]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
12 years agolist: Implement listAllNetworks for network driver
Osier Yang [Tue, 4 Sep 2012 15:55:18 +0000 (23:55 +0800)]
list: Implement listAllNetworks for network driver

src/network/bridge_driver.c: Implement listAllNetworks.

12 years agolist: Add helpers to list network objects
Osier Yang [Tue, 4 Sep 2012 15:55:17 +0000 (23:55 +0800)]
list: Add helpers to list network objects

src/conf/network_conf.c: Add virNetworkMatch to filter the networks;
and virNetworkList to iterate over all the networks with the filter.

src/conf/network_conf.h: Declare virNetworkList and define the macros
for filters.

src/libvirt_private.syms: Export virNetworkList.

12 years agolist: Implement RPC calls for virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:16 +0000 (23:55 +0800)]
list: Implement RPC calls for virConnectListAllNetworks

The RPC generator doesn't support returning list of object, this patch
do the work manually.

* daemon/remote.c:
  Implemente the server side handler remoteDispatchConnectListAllNetworks.

* src/remote/remote_driver.c:
  Add remote driver handler remoteConnectListAllNetworks.

* src/remote/remote_protocol.x:
  New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS and
  structs to represent the args and ret for it.

* src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virConnectListAllNetworks
Osier Yang [Tue, 4 Sep 2012 15:55:15 +0000 (23:55 +0800)]
list: Define new API virConnectListAllNetworks

This is to list the network objects, supported filtering flags
are: active|inactive, persistent|transient, autostart|no-autostart.

include/libvirt/libvirt.h.in: Declare enum virConnectListAllNetworkFlags
                              and virConnectListAllNetworks.
python/generator.py: Skip auto-generating
src/driver.h: (virDrvConnectListAllNetworks)
src/libvirt.c: Implement the public API
src/libvirt_public.syms: Export the symbol to public

12 years agoFix unwanted closing of libvirt client connection
Christophe Fergeau [Mon, 10 Sep 2012 10:17:07 +0000 (12:17 +0200)]
Fix unwanted closing of libvirt client connection

e5a1bee07 introduced a regression in Boxes: when Boxes is left idle
(it's still doing some libvirt calls in the background), the
libvirt connection gets closed after a few minutes. What happens is
that this code in virNetClientIOHandleOutput gets triggered:

if (!thecall)
    return -1; /* Shouldn't happen, but you never know... */

and after the changes in e5a1bee07, this causes the libvirt connection
to be closed.

Upon further investigation, what happens is that
virNetClientIOHandleOutput is called from gvir_event_handle_dispatch
in libvirt-glib, which is triggered because the client fd became
writable. However, between the times gvir_event_handle_dispatch
is called, and the time the client lock is grabbed and
virNetClientIOHandleOutput is called, another thread runs and
completes the current call. 'thecall' is then NULL when the first
thread gets to run virNetClientIOHandleOutput.

After describing this situation on IRC, danpb suggested this:

11:37 < danpb> In that case I think the correct thing would be to change
               'return -1' above to 'return 0' since that's not actually an
               error - its a rare, but expected event

which is what this patch is doing. I've tested it against master
libvirt, and I didn't get disconnected in ~10 minutes while this
happens in less than 5 minutes without this patch.

12 years agolist: Expose virStoragePoolListAllVolumes to Python binding
Osier Yang [Tue, 4 Sep 2012 15:32:58 +0000 (23:32 +0800)]
list: Expose virStoragePoolListAllVolumes to Python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document

python/libvirt-override-virStoragePool.py:
  * New file, includes implementation of listAllVolumes.

python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virStoragePoolListAllVolumes in virsh
Osier Yang [Tue, 4 Sep 2012 15:32:57 +0000 (23:32 +0800)]
list: Use virStoragePoolListAllVolumes in virsh

tools/virsh-volume.c:
  * vshStorageVolSorter to sort storage vols by name

  * vshStorageVolumeListFree to free the volume objects list

  * vshStorageVolumeListCollect to collect the volume objects, trying
    to use new API first, fall back to older APIs if it's not supported.

12 years agolist: Implement virStoragePoolListAllVolumes for test driver
Osier Yang [Tue, 4 Sep 2012 15:32:56 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for test driver

src/test/test_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement virStoragePoolListAllVolumes for storage driver
Osier Yang [Tue, 4 Sep 2012 15:32:55 +0000 (23:32 +0800)]
list: Implement virStoragePoolListAllVolumes for storage driver

src/storage/storage_driver.c: Implement poolListAllVolumes.

12 years agolist: Implement RPC calls for virStoragePoolListAllVolumes
Osier Yang [Tue, 4 Sep 2012 15:32:54 +0000 (23:32 +0800)]
list: Implement RPC calls for virStoragePoolListAllVolumes

The RPC generator doesn't returning support list of object, this
patch do the work manually.

  * daemon/remote.c:
    Implemente the server side handler remoteDispatchStoragePoolListAllVolumes

  * src/remote/remote_driver.c:
    Add remote driver handler remoteStoragePoolListAllVolumes

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Define new API virStoragePoolListAllVolumes
Osier Yang [Tue, 4 Sep 2012 15:32:53 +0000 (23:32 +0800)]
list: Define new API virStoragePoolListAllVolumes

Simply returns the storage volume objects. No supported filter
flags.

include/libvirt/libvirt.h.in: Declare the API
python/generator.py: Skip the function for generating. virStoragePool.py
                     will be added in later patch.
src/driver.h: virDrvStoragePoolListVolumesFlags
src/libvirt.c: Implementation for the API.
src/libvirt_public.syms: Export the symbol to public

12 years agoesx: Remove unused variable from esxDomainGetAutostart
Matthias Bolte [Sun, 9 Sep 2012 10:44:20 +0000 (12:44 +0200)]
esx: Remove unused variable from esxDomainGetAutostart

12 years agodocs: point out git send-email location, be more stern about make check
Laine Stump [Thu, 6 Sep 2012 17:21:21 +0000 (13:21 -0400)]
docs: point out git send-email location, be more stern about make check

An email came to libvir-list wondering why the git send-email command
was missing in spite of having git installed; this is due to the
send-email command being in a sub-package of the main git package.

While touching the hacking file, I thought it would be useful to 1)
indicate the location of the source (docs/hacking.html.in) in the
message at the top of HACKING, and also to make the note about running
"make check" and "make syntax-check" a bit more stern.

12 years agobuild: fix build on older gcc
Eric Blake [Fri, 7 Sep 2012 17:42:10 +0000 (11:42 -0600)]
build: fix build on older gcc

On RHEL 6.2, gcc 4.4.6 complains:
cc1: warning: command line option "-Wenum-compare" is valid for C++/ObjC++ but not for C
which in turn breaks a -Werror build.

Meanwhile, in Fedora 17, gcc 4.7.0, -Wenum-compare has been enhanced
to also work on C, but at the same time, it is documented that -Wall
now implicitly includes -Wenum-compare.

Therefore, it is sufficient to remove explicit checks for this option,
avoiding the warning from older gcc while still getting the
compile-time safety from newer gcc.

* m4/virt-compile-warnings.m4 (-Wenum-compare): Omit explicit check.

12 years agoFix RPM spec conditional when %{rhel} is not defined
Daniel P. Berrange [Fri, 7 Sep 2012 15:45:50 +0000 (16:45 +0100)]
Fix RPM spec conditional when %{rhel} is not defined

12 years agoevents: Fix domain event race on client disconnect
Christophe Fergeau [Thu, 6 Sep 2012 06:16:46 +0000 (08:16 +0200)]
events: Fix domain event race on client disconnect

GNOME Boxes sometimes stops getting domain events from libvirtd, even
after restarting it. Further investigation in libvirtd shows that
events are properly queued with virDomainEventStateQueue, but the
timer virDomainEventTimer which flushes the events and sends them to
the clients never gets called. Looking at the event queue in gdb
shows that it's non-empty and that its size increases with each new
events.

virDomainEventTimer is set up in virDomainEventStateRegister[ID]
when going from 0 client connecte to 1 client connected, but is
initially disabled. The timer is removed in
virDomainEventStateRegister[ID] when the last client is disconnected
(going from 1 client connected to 0).

This timer (which handles sending the events to the clients) is
enabled in virDomainEventStateQueue when queueing an event on an
empty queue (queue containing 0 events). It's disabled in
virDomainEventStateFlush after flushing the queue (ie removing all
the elements from it). This way, no extra work is done when the queue
is empty, and when the next event comes up, the timer will get
reenabled because the queue will go from 0 event to 1 event, which
triggers enabling the timer.

However, with this Boxes bug, we have a client connected (Boxes), a
non-empty queue (there are events waiting to be sent), but a disabled
timer, so something went wrong.

When Boxes connects (it's the only client connecting to the libvirtd
instance I used for debugging), the event timer is not set as expected
(state->timer == -1 when virDomainEventStateRegisterID is called),
but at the same time the event queue is not empty. In other words,
we had no clients connected, but pending events. This also explains
why the timer never gets enabled as this is only done when an event
is queued on an empty queue.

I think this can happen if an event gets queued using
virDomainEventStateQueue and the client disconnection happens before
the event timer virDomainEventTimer gets a chance to run and flush
the event. In this situation, virDomainEventStateDeregister[ID] will
get called with a non-empty event queue, the timer will be destroyed
if this was the only client connected. Then, when other clients connect
at a later time, they will never get notified about domain events as
the event timer will never get enabled because the timer is only
enabled if the event queue is empty when virDomainEventStateRegister[ID]
gets called, which will is no longer the case.

To avoid this issue, this commit makes sure to remove all events from
the event queue when the last client in unregistered. As there is
no longer anyone interested in receiving these events, these events
are stale so there is no need to keep them around. A client connecting
later will have no interest in getting events that happened before it
got connected.

12 years agoFix location of SELinux mount during RPM builds
Daniel P. Berrange [Thu, 6 Sep 2012 14:22:27 +0000 (15:22 +0100)]
Fix location of SELinux mount during RPM builds

When building RPMs the host kernel cannot be assumed to match
the target OS kernel. Thus auto-detecting /selinux vs
/sys/fs/selinux based on the host kernel can result in the
wrong choice (eg F18 builds on a RHEL6 host kernel)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't assume use of /sys/fs/cgroup
Daniel P. Berrange [Thu, 6 Sep 2012 14:19:32 +0000 (15:19 +0100)]
Don't assume use of /sys/fs/cgroup

The introduction of /sys/fs/cgroup came in fairly recent kernels.
Prior to that time distros would pick a custom directory like
/cgroup or /dev/cgroup. We need to auto-detect where this is,
rather than hardcoding it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce a test suite for the JSON monitor
Daniel P. Berrange [Mon, 20 Aug 2012 12:31:29 +0000 (13:31 +0100)]
Introduce a test suite for the JSON monitor

Take advantage of the previously added monitor helpers to
create a test suite for the QEMU JSON monitor impl. As a
proof of concept, this tests the 'qemuMonitorGetStatus'
implementation

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd helper library for testing the qemu monitor code
Daniel P. Berrange [Mon, 20 Aug 2012 13:06:21 +0000 (14:06 +0100)]
Add helper library for testing the qemu monitor code

To be able to test the QEMU monitor code, we need to have a fake
QEMU monitor server. This introduces a simple (dumb) framework
that can do this. The test case registers a series of items to
be sent back as replies to commands that will be executed. A
thread runs the event loop looking for incoming replies and
sending back this pre-registered data. This allows testing all
QEMU monitor code that deals with parsing responses and errors
from QEMU, without needing QEMU around

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd non-null annotations to qemuMonitorOpen
Daniel P. Berrange [Mon, 20 Aug 2012 12:39:47 +0000 (13:39 +0100)]
Add non-null annotations to qemuMonitorOpen

Add some non-null annotations to qemuMonitorOpen and also
check that the error callback is set, since it is mandatory

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoexamples: Fix event detail printing in python test
Jiri Denemark [Thu, 6 Sep 2012 15:02:47 +0000 (17:02 +0200)]
examples: Fix event detail printing in python test

If there is only one detail string for a particular event, we need to pu
comma after the string otherwise the string itself will be taken as a
list and only its first character will be printed out. For example,

    myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown F

instead of the desired

    myDomainEventCallback1 EVENT: Domain fedora17(12) Shutdown Finished

12 years agoAdd PMSUSPENDED life cycle event
Jiri Denemark [Thu, 6 Sep 2012 15:00:43 +0000 (17:00 +0200)]
Add PMSUSPENDED life cycle event

While PMSUSPENDED state was added a long time ago, we didn't have
corresponding life cycle event.

12 years agoFix PMSuspend and PMWakeup events
Jiri Denemark [Thu, 6 Sep 2012 14:56:08 +0000 (16:56 +0200)]
Fix PMSuspend and PMWakeup events

The unused reason parameter of PM{Suspend,Wakeup} event callbacks was
completely ignored in lot of places and those events were not actually
working at all.

12 years agovirsh: Update only changed scheduler tunables
Peter Krempa [Wed, 5 Sep 2012 12:41:25 +0000 (14:41 +0200)]
virsh: Update only changed scheduler tunables

When setting the cpu tunables in virsh you are able to update only a
subset of them. Virsh while doing the update updated all of the
tunables, changed ones with new values and unchanged with old ones.
This is unfortunate as it:
a) might overwrite some other change by a race condition (unprobable)
b) fails with range checking as some of the old values saved might be
   out of range

This patch changes the update procedure so that only the changed value
is updated on the host.

This patch also fixes a very unprobable memory leak if the daemon would
return a string tunable parameter, as the typed parameter array was not
cleared.

12 years agoutil: Add helper to assign typed params from string
Peter Krempa [Thu, 6 Sep 2012 12:47:40 +0000 (14:47 +0200)]
util: Add helper to assign typed params from string

This patch adds a helper to deal with assigning values to
virTypedParameter structures from strings. The helper parses the value
from the string and assigns it to the corresponding union value.

12 years agoqemu: Add range checking for scheduler tunables when changed by API
Peter Krempa [Tue, 4 Sep 2012 13:17:07 +0000 (15:17 +0200)]
qemu: Add range checking for scheduler tunables when changed by API

The quota and period tunables for cpu scheduler accept only a certain
range of values. When changing the live configuration invalid values get
rejected. This check is not performed when changing persistent config.

This patch adds a separate range check, that improves error messages
when changing live config and adds the check for persistent config.
This check is done only when using the API. It is still possible to
specify invalid values in the XML.

12 years agoqemu: clean up qemuSetSchedulerParametersFlags()
Peter Krempa [Tue, 4 Sep 2012 12:26:38 +0000 (14:26 +0200)]
qemu: clean up qemuSetSchedulerParametersFlags()

This patch tries to clean the code up a little bit and shorten very long
lines.

The apparent semantic change from moving the condition before calling
the setter function is a non-issue here as the setter function is a
no-op when called with both arguments zero.

12 years agovirsh: Improve the document for pool-list
Osier Yang [Thu, 6 Sep 2012 16:01:24 +0000 (00:01 +0800)]
virsh: Improve the document for pool-list

Which is lost by commit 93a346d353.

12 years agonwfilter: drop use of awk
Eric Blake [Fri, 31 Aug 2012 22:54:48 +0000 (15:54 -0700)]
nwfilter: drop use of awk

Commit 2a41bc9 dropped a dependency on gawk, but we can go one step
further and avoid awk altogether.

* src/nwfilter/nwfilter_ebiptables_driver.c
(iptablesLinkIPTablesBaseChain): Simplify command.
(ebiptablesDriverInit, ebiptablesDriverShutdown): Drop awk probe.

12 years agoremove dnsmasq command line parameter "--filterwin2k"
Gene Czarcinski [Thu, 6 Sep 2012 16:08:22 +0000 (12:08 -0400)]
remove dnsmasq command line parameter "--filterwin2k"

This patch removed the "--filterwin2k" dnsmasq command line
parameter which was unnecessary for domain specification,
possibly blocked some usage, and was command line clutter.

Gene Czarcinski <gene@czarc.net>

12 years agobuild: improved handling of <execinfo.h>, BSD <net/if.h>
Eric Blake [Wed, 5 Sep 2012 22:27:42 +0000 (16:27 -0600)]
build: improved handling of <execinfo.h>, BSD <net/if.h>

FreeBSD and OpenBSD have a <net/if.h> that is not self-contained;
and mingw lacks the header altogether.  But gnulib has just taken
care of that for us, so we might as well simplify our code.  In
the process, I got a syntax-check failure if we don't also take
the gnulib execinfo module.

* .gnulib: Update to latest, for execinfo and net_if.
* bootstrap.conf (gnulib_modules): Add execinfo and net_if modules.
* configure.ac: Let gnulib check for headers.  Simplify check for
'struct ifreq', while also including enough prereq headers.
* src/internal.h (IF_NAMESIZE): Drop, now that gnulib guarantees it.
* src/nwfilter/nwfilter_learnipaddr.h: Use correct header for
IF_NAMESIZE.
* src/util/virnetdev.c (includes): Assume <net/if.h> exists.
* src/util/virnetdevbridge.c (includes): Likewise.
* src/util/virnetdevtap.c (includes): Likewise.
* src/util/logging.c (includes): Assume <execinfo.h> exists.
(virLogStackTraceToFd): Handle gnulib's fallback implementation.

12 years agobuild: avoid tabs that failed syntax-check
Eric Blake [Thu, 6 Sep 2012 15:42:35 +0000 (09:42 -0600)]
build: avoid tabs that failed syntax-check

Introduced in commit f299ddd6.

* src/check-symfile.pl: Fix whitespace.
* .dir-locals.el (perl-mode): Prevent future occurrences.

12 years agolist: fix typo in virsh patch
Eric Blake [Thu, 6 Sep 2012 15:35:00 +0000 (09:35 -0600)]
list: fix typo in virsh patch

A last minute rename in commit fc122e1a to virsh.h was not properly
reflected when rebasing virsh-pool.c in commit 93a346d.

* tools/virsh-pool.c (vshStoragePoolListCollect): Use VSH_MATCH,
not MATCH.

12 years agoRemove duplicate symbols and add test case
Daniel P. Berrange [Thu, 6 Sep 2012 14:45:57 +0000 (15:45 +0100)]
Remove duplicate symbols and add test case

When the event symbols were added to the public API, not all
of them were removed from the private exports list. Solaris
gets unhappy when there are duplicated symbols. Extend the
symfile check to test for this scenario

12 years agopython: Expose virStorageListAllStoragePools to python binding
Osier Yang [Tue, 4 Sep 2012 15:16:33 +0000 (23:16 +0800)]
python: Expose virStorageListAllStoragePools to python binding

The implementation is done manually as the generator does not support
wrapping lists of C pointers into Python objects.

python/libvirt-override-api.xml: Document
python/libvirt-override-virConnect.py: Add listAllStoragePools
python/libvirt-override.c: Implementation for the wrapper.

12 years agolist: Use virConnectListAllStoragePools in virsh
Osier Yang [Wed, 5 Sep 2012 06:36:33 +0000 (14:36 +0800)]
list: Use virConnectListAllStoragePools in virsh

tools/virsh-pool.c:
  * vshStoragePoolSorter to sort the pool list by pool name.

  * struct vshStoragePoolList to present the pool list, pool info
    is collected by list->poolinfo if 'details' is specified by
    user.

  * vshStoragePoolListFree to free the pool list

  * vshStoragePoolListCollect to collect the pool list, new API
    virStorageListAllPools is tried first, if it's not supported,
    fall back to older APIs.

  * New options --persistent, --transient, --autostart, --no-autostart
    and --type for pool-list. --persistent or --transient is to filter
    the returned pool list by whether the pool is persistent or not.
    --autostart or --no-autostart is to filter the returned pool list
    by whether the pool is autostarting or not. --type is to filter
    the pools by pool types. E.g.

    % virsh pool-list --all --persistent --type dir,disk

tools/virsh.pod:
   * Add documentations for the new options.

12 years agolist: Change MATCH for common use in virsh
Osier Yang [Tue, 4 Sep 2012 15:16:31 +0000 (23:16 +0800)]
list: Change MATCH for common use in virsh

Move definition of MATCH from virsh-domain-monitor.c into
virsh.h, and rename it as VSH_MATCH for further use.

* tools/virsh-domain-monitor.c: Change MATCH into VSH_MATCH
* tools/virsh.h: Define VSH_MATCH

12 years agovirsh: Fix the wrong doc for pool-list
Osier Yang [Tue, 4 Sep 2012 15:16:30 +0000 (23:16 +0800)]
virsh: Fix the wrong doc for pool-list

The storage pool's management doesn't relate with a domain, it
probably was an intention, but not achieved yet. And the fact
is only active pools are listed by default.

12 years agolist: Add helper to convert strings separated by ', ' to array
Osier Yang [Tue, 4 Sep 2012 15:16:29 +0000 (23:16 +0800)]
list: Add helper to convert strings separated by ', ' to array

tools/virsh.c: New helper function vshStringToArray.
tools/virsh.h: Declare vshStringToArray.
tools/virsh-domain.c: use the helper in cmdUndefine.

12 years agolist: Implement listAllStoragePools for test driver
Osier Yang [Tue, 4 Sep 2012 15:16:28 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for test driver

src/test/test_driver.c: Implement listAllStoragePools

12 years agolist: Implement listAllStoragePools for storage driver
Osier Yang [Tue, 4 Sep 2012 15:16:27 +0000 (23:16 +0800)]
list: Implement listAllStoragePools for storage driver

src/storage/storage_driver.c: Implement listAllStoragePools.

12 years agolist: Implement the RPC calls for virConnectListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:26 +0000 (23:16 +0800)]
list: Implement the RPC calls for virConnectListAllStoragePools

The RPC generator doesn't support returning list of object, this patch does
the work manually.

  * daemon/remote.c:
    Implement the server side handler remoteDispatchConnectListAllStoragePools

  * src/remote/remote_driver.c:
    Add remote driver handler remoteConnectListAllStoragePools.

  * src/remote/remote_protocol.x:
    New RPC procedure REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS and
    structs to represent the args and ret for it.

  * src/remote_protocol-structs: Likewise.

12 years agolist: Add helpers for listing storage pool objects
Osier Yang [Tue, 4 Sep 2012 15:16:25 +0000 (23:16 +0800)]
list: Add helpers for listing storage pool objects

src/conf/storage_conf.c: Add virStoragePoolMatch to filter the
pools; Add virStoragePoolList to iterate over the pool objects
with filter.

src/conf/storage_conf.h: Declare virStoragePoolMatch,
virStoragePoolList, and the macros for filters.

src/libvirt_private.syms: Export helper virStoragePoolList.

12 years agolist: Define new API virStorageListAllStoragePools
Osier Yang [Tue, 4 Sep 2012 15:16:24 +0000 (23:16 +0800)]
list: Define new API virStorageListAllStoragePools

This introduces a new API to list the storage pool objects,
4 groups of flags are provided to filter the returned pools:

  * Active or not

  * Autostarting or not

  * Persistent or not

  * And the pool type.

include/libvirt/libvirt.h.in: New enum virConnectListAllStoragePoolFlags;
                              Declare the API.
python/generator.py: Skip the generating
src/driver.h: (virDrvConnectListAllStoragePools)
src/libvirt.c: Implementation for the API.
src/libvirt_public.syms: Export the symbol.

12 years agoesx: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:24:40 +0000 (14:24 +0200)]
esx: Add implementation for virConnectListAllDomains()

ESX doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently defined filtering flags, but as with
other drivers some combinations yield a empty result list.

12 years agohyperv: Add implementation for virConnectListAllDomains()
Peter Krempa [Tue, 5 Jun 2012 12:20:58 +0000 (14:20 +0200)]
hyperv: Add implementation for virConnectListAllDomains()

Hyperv doesn't use the common virDomainObj implementation so this patch
adds a separate implementation.

This driver supports all currently added flags for filtering although
some of those don't make sense with this driver (no support yet) and
thus produce no output when used.

12 years agoDefine DYNLIB_NAME on OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:48:51 +0000 (16:48 +0200)]
Define DYNLIB_NAME on OpenBSD.

12 years agobuild: avoid test failure when sasl was not compiled in
Eric Blake [Wed, 5 Sep 2012 21:02:01 +0000 (15:02 -0600)]
build: avoid test failure when sasl was not compiled in

On systems without cyrus-sasl-devel available (I happened to be
in that situation on my FreeBSD testing), this test fails rather
miserably:

TEST: libvirtdconftest
      .....!!!!!!...!!!!!!!!!!!!!!!!!!!!!!!!!  39  FAIL
FAIL: libvirtdconftest

with verbose output showing things like:

39) Test corruption                                          ... libvir: Config File error : unsupporeted configuration: remoteReadConfigFile: /usr/home/dummy/libvirt/tests/../daemon/libvirtd.conf: auth_tcp: unsupported auth sasl

* tests/libvirtdconftest.c (testCorrupt): Avoid failure when sasl
is missing.

12 years agobuild: avoid check-symfile on non-Linux
Eric Blake [Wed, 5 Sep 2012 19:10:18 +0000 (13:10 -0600)]
build: avoid check-symfile on non-Linux

I tested both OpenBSD and cygwin; both failed 'make check' with:

  GEN    check-symfile
Can't return outside a subroutine at ./check-symfile.pl line 13.

Perl requires 'exit 77' instead of 'return 77' in that context,
but even with that tweak, the build still fails, since the exit
code of 77 is only special to explicit TESTS=foo listings, and
not to make-only dependency rules where we are not going through
automake's test framework.

* src/check-symfile.pl: Kill bogus platform check...
* src/Makefile.am (check-symfile): ...and replace with an automake
conditional.

12 years agonetwork: prevent infinite hang if ovs-vswitchd isn't running
Laine Stump [Tue, 4 Sep 2012 19:26:29 +0000 (15:26 -0400)]
network: prevent infinite hang if ovs-vswitchd isn't running

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=852984

If a network or interface is configured to use Open vSwitch, but
ovs-vswitchd (the Open vSwitch database service) isn't running, the
ovs-vsctl add-port/del-port commands will hang indefinitely rather
than returning an error. There is a --nowait option, but that appears
to have no effect on add-port and del-port commands, so instead we add
a --timeout=5 to the commands - they will retry for up to 5 seconds,
then fail if there is no response.

12 years agobuild: require netcf-0.2.2 when installing on Fedora18+
Laine Stump [Tue, 4 Sep 2012 17:05:54 +0000 (13:05 -0400)]
build: require netcf-0.2.2 when installing on Fedora18+

A previous patch forced libnl-3 and netcf-0.2.2 (which itself requires
libnl-3) when *building* for Fedora 18+ (and RHEL 7+), but the
install-time Requires: for netcf has always been implicit due to
libvirtd linking with libnetcf.so. However, the since the API of netcf
didn't change when it was rebuilt to use libnl-3, the internal library
version didn't change either, making it possible (from rpm's point of
view) to upgrade libvirt without upgrading netcf (in reality, that
leads to a segfault - see
https://bugzilla.redhat.com/show_bug.cgi?id=853381).

The solution is to put an explicit Requires: line in libvirt's
specfile for fedora >= 18 and rhel >= 7.

12 years agobuild: don't fail when xsltproc is missing
Eric Blake [Wed, 5 Sep 2012 17:55:42 +0000 (11:55 -0600)]
build: don't fail when xsltproc is missing

On a machine without xsltproc, the build failed with:

Scripting search.php
/usr/local/bin/bash: line 1: search.php.tmp: No such file or directory
rm: ./search.php: No such file or directory

Regression introduced in commit 28183590.

* docs/Makefile.am (%.php): Skip in the same conditions when the
.tmp file is skipped.

12 years agobuild: avoid warnings from gcc 4.2.1
Eric Blake [Wed, 5 Sep 2012 17:40:31 +0000 (11:40 -0600)]
build: avoid warnings from gcc 4.2.1

OpenBSD ships with gcc 4.2.1, which annoyingly treats all format
strings as though they were also attribute((nonnull)).  The two
concepts are orthogonal, though, as evidenced by the number of
spurious warnings it generates on uses where we know that
virReportError specifically handles NULL instead of a format
string; worse, since we now force -Werror on git builds, it
prevents development builds on OpenBSD.

I hate to do this, as it disables ALL format checking on older
gcc, and therefore misses out on some useful checks (code that
happened to compile on Linux may still have type mismatches
when compiled on other platforms, as evidenced by the number
of times I have fixed formatting mismatches for uid_t as found
by warnings on Cygwin), but I don't see any other way to keep
-Werror alive and still compile on OpenBSD.

A more invasive change would be to make virReportError() mark
its format attribute as nonnull, and fix (a lot of) fallout;
we may end up doing that anyways as part of danpb's error
refactoring improvements, but not today.

* src/internal.h (ATTRIBUTE_FMT_PRINTF): Use preferred spellings.
* m4/virt-compile-warnings.m4 (-Wformat): Disable on older gcc.

12 years agoqemu: don't pin all the cpus
Martin Kletzander [Tue, 4 Sep 2012 13:26:46 +0000 (15:26 +0200)]
qemu: don't pin all the cpus

This is another fix for the emulator-pin series. When going through
the cputune pinning settings, the current code is trying to pin all
the CPUs, even when not all of them are specified. This causes error
in the subsequent function which, of course, cannot find the cpu to
pin. Since it's enough to pass the correct VCPU ID to the function,
the fix is trivial.

12 years agomaint: avoid doubled name in syntax check failures
Eric Blake [Tue, 4 Sep 2012 23:40:04 +0000 (17:40 -0600)]
maint: avoid doubled name in syntax check failures

Based on the similar gnulib commit 96ad9077.  The use of
$(_sc_search_regexp) already injects $(ME) into any output
messages, so a failure of these rules would look like this,
pre-patch:

maint.mk: maint.mk: use virStrToLong_*, not strtol variants

* cfg.mk (sc_prohibit_strncmp, sc_prohibit_strtol)
(sc_libvirt_unmarked_diagnostics): Drop redundant $(ME).

12 years agobuild: use re-entrant functions in virsh
Eric Blake [Tue, 4 Sep 2012 23:35:27 +0000 (17:35 -0600)]
build: use re-entrant functions in virsh

Yesterday's commit 15d2c9f pointed out that virsh was still using
localtime(), which is not thread-safe, even though virsh is
definitely multi-threaded.  Even if we only ever triggered it from
one thread, it's better safe than sorry for maintenance purposes.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_nonreentrant):
Tighten the rule.
* tools/virsh.c (vshOutputLogFile): Avoid localtime.
(vshEditWriteToTempFile, vshEditReadBackFile, cmdCd, cmdPwd)
(vshCloseLogFile): Avoid strerror.
* tools/console.c (vshMakeStdinRaw): Likewise.
* tools/virsh-domain.c (vshGenFileName): Fix spacing in previous
patch.

12 years agoRemove explicit dependency on ceph RPM
Daniel P. Berrange [Wed, 5 Sep 2012 07:58:50 +0000 (08:58 +0100)]
Remove explicit dependency on ceph RPM

The libvirt storage driver uses librbd.so for its functionality.
RPM will automatically add a dependency on the library, so there
is no need to have an explicit dependency on the ceph RPM itself.
This allows newer Fedora distros to avoid pulling in the huge
ceph RPM, in favour of just having the libraries installed

12 years agoqemu: Do not require auth scheme in graphics events
Jiri Denemark [Tue, 4 Sep 2012 14:52:47 +0000 (16:52 +0200)]
qemu: Do not require auth scheme in graphics events

Only VNC_{{DIS,}CONNECTED,INITIALIZED} and SPICE_INITIALIZED events are
documented to support server/auth field and even there it is marked as
optional. Emit "" auth scheme in case QEMU didn't send it.

12 years agoconf: describe security_driver behavior
Martin Kletzander [Tue, 4 Sep 2012 14:09:43 +0000 (16:09 +0200)]
conf: describe security_driver behavior

As a request was raised for this, I added few lines in the "Notes"
part of the "security_driver" comments about allowed values.

12 years agodocs: correct dompmwakeup description
Martin Kletzander [Tue, 4 Sep 2012 10:01:41 +0000 (12:01 +0200)]
docs: correct dompmwakeup description

12 years agoPass a correct pointer type to localtime_r(3).
Paul Eggert [Tue, 4 Sep 2012 17:03:41 +0000 (10:03 -0700)]
Pass a correct pointer type to localtime_r(3).

On 09/04/2012 08:20 AM, Eric Blake wrote:
> tv_sec is required by POSIX to be
> of type time_t; so this is a bug in the OpenBSD header
> [for declaring it as long]

Most likely this problem arose because of the patch I pushed
in gnulib commit e07d7c40f3ca5ec410cf5aa6fa03cfe51e712039.
Previously, gnulib required timeval's tv_sec to be
the same size as time_t.  But now, it requires only that
tv_sec be big enough to hold a time_t.

This patch was needed for Emacs.  Without the patch, gnulib
replaced struct timeval on OpenBSD, and this messed up
utimens.c, and Emacs wouldn't build.

Alternatively, gnulib could substitute its own struct timeval
for the system's, wrapping every struct timeval-using function
(gettimeofday, futimesat, futimes, lutimes, etc.  That'd be
more work, though.  And it would introduce some performance
issues with gettimeofday, which is supposed to be fast.

I've been trying to get away from using struct timeval,
and to use the higher-resolution struct timespec instead,
so messing with these obsolescent interfaces has been
lower priority for me.  But if someone wants to take the
more-ambitious approach that'd be fine, I expect.

For this particular case, though, how about if we avoid
the problem entirely?  libvirt doesn't need to use struct
timeval here at all.  It makes libvirt smaller and probably
faster, and it ports to OpenBSD without messing with gnulib.

12 years agobuild: use correct libraries for clock_gettime
Eric Blake [Tue, 4 Sep 2012 16:57:25 +0000 (10:57 -0600)]
build: use correct libraries for clock_gettime

On OpenBSD, clock_gettime() exists in libc rather than librt, and
blindly linking with -lrt made the build fail.  Gnulib already
did the work for determining which libraries to use, so we should
reuse that work rather than doing it ourselves.

* bootstrap.conf (gnulib_modules): Pull in clock-time.
* configure.ac (RT_LIBS): Drop.
* src/Makefile.am (libvirt_util_la_LIBADD): Use gnulib variable
instead.
* src/util/virtime.c (includes): Simplify.

12 years agoInclude an extra header needed for OpenBSD.
Jasper Lievisse Adriaanse [Tue, 4 Sep 2012 14:57:09 +0000 (16:57 +0200)]
Include an extra header needed for OpenBSD.

12 years agoRename iolimit to blockio.
Viktor Mihajlovski [Tue, 4 Sep 2012 14:30:55 +0000 (16:30 +0200)]
Rename iolimit to blockio.

After discussion with DB we decided to rename the new iolimit
element as it creates the impression it would be there to
limit (i.e. throttle) I/O instead of specifying immutable
characteristics of a block device.
This is also backed by the fact that the term I/O Limits has
vanished from newer storage admin documentation.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Fix reboot with guest agent
Jiri Denemark [Tue, 4 Sep 2012 10:01:43 +0000 (12:01 +0200)]
qemu: Fix reboot with guest agent

When reboot using qemu guest agent was requested, qemu driver kept
waiting for SHUTDOWN event from qemu. However, such event is never
emitted during guest reboot and qemu driver would keep waiting forever.

12 years agoFix mingw64 build by using intptr_t for int->void* casts
Daniel P. Berrange [Tue, 4 Sep 2012 10:16:55 +0000 (11:16 +0100)]
Fix mingw64 build by using intptr_t for int->void* casts

The viratomictest.c was casting from an int to a void* via a
long. This works on Linux or Mingw32, but fails on Mingw64
due to a pointer/integer size mis-match. Replacing 'long'
with 'intptr_t' ensures matching type sizes

12 years agoqemu: Don't update graphic definitions on password change failure
Peter Krempa [Mon, 3 Sep 2012 14:52:27 +0000 (16:52 +0200)]
qemu: Don't update graphic definitions on password change failure

When the password change failed we updated the graphic definition
anyways, which is not desired.

12 years agotests: Add tests for qemu S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:18:16 +0000 (12:18 +0200)]
tests: Add tests for qemu S3/S4 state configuration

Few tests were added which are checking whether the parsing of the xml
and command-line arguments is working and compatible with each other.

12 years agoqemu: Add support for S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:14:39 +0000 (12:14 +0200)]
qemu: Add support for S3/S4 state configuration

This patch adds support for running qemu guests with the required
parameters to forcefully enable or disable BIOS advertising of S3 and
S4 states.  The support for this is added to capabilities and there is
also a qemu command parameter parsing implemented.

12 years agoAdd per-guest S3/S4 state configuration
Martin Kletzander [Thu, 2 Aug 2012 10:12:50 +0000 (12:12 +0200)]
Add per-guest S3/S4 state configuration

There is a new <pm/> element implemented that can control what ACPI
sleeping states will be advertised by BIOS and allowed to be switched
to by libvirt. The default keeps defaults on hypervisor, otherwise
forces chosen setting.
The documentation of the pm element is added as well.

12 years agopython: don't mask libvirt errors
Eric Blake [Fri, 31 Aug 2012 17:07:19 +0000 (10:07 -0700)]
python: don't mask libvirt errors

A user reported this crash when using python bindings:

  File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 134, in trigger
    hook.trigger(event)
  File "/home/nox/workspace/NOX/src/NOX/hooks.py", line 33, in trigger
    self.handlers[event]()
  File "/home/nox/workspace/NOX/hooks/volatility.py", line 81, in memory_dump
    for block in Memory(self.ctx):
  File "/home/see/workspace/NOX/src/NOX/lib/libtools.py", line 179, in next
    libvirt.VIR_MEMORY_PHYSICAL)
  File "/usr/lib/python2.7/dist-packages/libvirt.py", line 1759, in memoryPeek
    ret = libvirtmod.virDomainMemoryPeek(self._o, start, size, flags)
SystemError: error return without exception set

In the python bindings, returning NULL makes python think an
exception was thrown, while returning the None object lets the
wrappers know that a libvirt error exists.

Reported by Nox DaFox, fix suggested by Dan Berrange.

* python/libvirt-override.c (libvirt_virDomainBlockPeek)
(libvirt_virDomainMemoryPeek): Return python's None object, so
wrapper knows to check libvirt error.

12 years agoqemu: Support for Block Device IO Limits.
Viktor Mihajlovski [Wed, 29 Aug 2012 15:48:31 +0000 (17:48 +0200)]
qemu: Support for Block Device IO Limits.

Implementation of iolimits for the qemu driver with
capability probing for block size attribute and
command line generation for block sizes.
Including testcase for qemuxml2argvtest.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoconf: Support for Block Device IO Limits
Viktor Mihajlovski [Wed, 29 Aug 2012 15:48:30 +0000 (17:48 +0200)]
conf: Support for Block Device IO Limits

Introducing a new iolimits element allowing to override certain
properties of a guest block device like the physical and logical
block size.
This can be useful for platforms with 'non-standard' disk formats
like S390 DASD with its 4K block size.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agocommand: shell-quote when logging commands
Eric Blake [Tue, 28 Aug 2012 18:11:45 +0000 (11:11 -0700)]
command: shell-quote when logging commands

Without this patch, logged command executions can be ambiguous if
the command contained any shell metacharacters.  This has caused
more than one person to attempt to patch clients to add unnecessary
quoting, without realizing that the command itself was run with
correct args, and only the logged output was ambiguous.

* src/util/command.c (virCommandToString): Add shell escapes.
* tests/commandtest.c (test16): Test new behavior.
* tests/commanddata/test16.log: Update expected output.
* tests/qemuxml2argvdata/qemuxml2argv-*.args: Likewise.
* tests/networkxml2argvdata/*.argv: Likewise.

12 years agovirsh: remove unneeded usage of vshConnectionUsability()
Peter Krempa [Fri, 24 Aug 2012 11:57:01 +0000 (13:57 +0200)]
virsh: remove unneeded usage of vshConnectionUsability()

Now that vshCommandRun() checks for the connection automaticaly, remove
all of the redundant checks in the code.

vshConnectionUsability() no longer needs to be exported and this patch
marks it static.

12 years agovirsh: Improve checking for connection when running commands
Peter Krempa [Fri, 24 Aug 2012 10:39:53 +0000 (12:39 +0200)]
virsh: Improve checking for connection when running commands

Almost each virsh command uses the function vshConnectionUsability
before doing anything, to check if the connection is "alive".  Commands
that don't need an conection are already conveniently marked with
VSH_CMD_FLAG_NOCONNECT. We can automaticaly check for the connection
before calling any remote command so we don't forget to do so.

This patch also upgrades the connection check to use virConnectIsAlive
along with the current approach.

12 years agoqemu: fix remote port searching
Martin Kletzander [Fri, 31 Aug 2012 13:33:26 +0000 (15:33 +0200)]
qemu: fix remote port searching

After fixing the last review comments on remote port searching (commit
a14b4aea512d6c3a42af56207a65ef10ac4a12a1), the commit right after that
wasn't modified accordingly, therefore two values weren't changed as
they should and the configurable ports don't work as expected.

This simple commit changes last two values missed and fixes the issue.

12 years agoschemas: Fix wwn pattern
Osier Yang [Wed, 29 Aug 2012 16:28:40 +0000 (00:28 +0800)]
schemas: Fix wwn pattern

It should be [] instead of ().

12 years agoutil: Update the inconsistent and outdated comments
Osier Yang [Fri, 31 Aug 2012 13:44:21 +0000 (21:44 +0800)]
util: Update the inconsistent and outdated comments

The codes were updated to allow to reset the device as long as
there is no devices/functions behind the same bus. However, the
comments were kept without touched.

12 years agoRelease of libvirt-0.10.1
Daniel Veillard [Fri, 31 Aug 2012 12:39:36 +0000 (20:39 +0800)]
Release of libvirt-0.10.1

* configure.ac docs/news.html.in libvirt.spec.in: update for release
* po/*.po*: pulled localization updates for sp,ja,mr,pa,uk,zh_CN,zh_TW
  and regenerated

12 years agoconf: Avoid formatting auto-generated DAC labels
Marcelo Cerri [Fri, 31 Aug 2012 11:40:41 +0000 (13:40 +0200)]
conf: Avoid formatting auto-generated DAC labels

To avoid backward compatibility issues, this patch suppresses
auto-generated DAC labels from XML. This change affects commands such as
dumpxml and save.

Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
12 years agoconf: Fix parsing of seclabels without model
Marcelo Cerri [Fri, 31 Aug 2012 11:40:40 +0000 (13:40 +0200)]
conf: Fix parsing of seclabels without model

With this patch libvirt tries to assign a model to a single seclabel
when model is missing. Libvirt will look up at host's capabilities and
assign the first model to seclabel.

This patch fixes:

1. The problem with existing guests that have a seclabel defined in its XML.
2. A XML parse error when a guest is restored.

Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
12 years agovirsh: fixed incorrect timing report
Viktor Mihajlovski [Fri, 31 Aug 2012 11:32:45 +0000 (13:32 +0200)]
virsh: fixed incorrect timing report

When executing virsh -t <command> the reported timing was off
by 3 orders of magnitude if the command took more than one
second.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agovirsh: Document subdriver option of attach-disk
Jiri Denemark [Thu, 30 Aug 2012 15:51:35 +0000 (17:51 +0200)]
virsh: Document subdriver option of attach-disk

12 years agoqemu: Don't ignore CPU tuning config if required cgroups are missing
Jiri Denemark [Wed, 29 Aug 2012 14:08:59 +0000 (16:08 +0200)]
qemu: Don't ignore CPU tuning config if required cgroups are missing

When domain XML contains any of the elements for setting up CPU
scheduling parameters (period, quota, emulator_period, or
emulator_quota) we need cpu cgroup to enforce the configuration.
However, the existing code would just ignore silently such settings if
either cgroups were not available at all cpu cgroup was not available.
Moreover, APIs for manipulating CPU scheduler parameters were already
failing if cpu cgroup was not available. This patch makes cpu cgroup
mandatory for all domains that use CPU scheduling elements in their XML.

12 years agodoc: update option force to subcommand change-media
Guannan Ren [Fri, 31 Aug 2012 09:58:44 +0000 (17:58 +0800)]
doc: update option force to subcommand change-media

BZ: https://bugzilla.redhat.com/show_bug.cgi?id=837761

12 years agocgroup: fix libvirtd crash caused by messed memory
Guannan Ren [Fri, 31 Aug 2012 08:45:02 +0000 (16:45 +0800)]
cgroup: fix libvirtd crash caused by messed memory

The variable max_id is initialized again in the step of
getting cpu mapping variable map2. But in the next for loop
we still expect original value of max_id, the bug will
crash libvirtd when using on NUMA machine with big number
of cpus.

12 years agocgroup: fix a typo on extracting data from vcpu cgroup
Guannan Ren [Fri, 31 Aug 2012 08:40:10 +0000 (16:40 +0800)]
cgroup: fix a typo on extracting data from vcpu cgroup

12 years agocgroup: read more data from cgroup cpuacct.usage_percpu
Guannan Ren [Fri, 31 Aug 2012 08:31:30 +0000 (16:31 +0800)]
cgroup: read more data from cgroup cpuacct.usage_percpu

On NUMA machine, the length of string got from file
cpuacct.usage_percpu is quite large, so expand the
limit of 1024 bytes.

errors like:
Failed to read file \
'/cgroup/cpuacct/libvirt/qemu/rhel6q/cpuacct.usage_percpu': \
Value too large for defined data type

12 years agodocs: Fix typo in CPU tuning
Jiri Denemark [Fri, 31 Aug 2012 06:22:57 +0000 (08:22 +0200)]
docs: Fix typo in CPU tuning

12 years agodoc: Fix emulator pinning example in formatdomain.html
Peter Krempa [Fri, 31 Aug 2012 07:59:34 +0000 (09:59 +0200)]
doc: Fix emulator pinning example in formatdomain.html

Add correct closing tags.

12 years agonwfilter: adapt IP learning for broadcasted DHCP replies
Stefan Berger [Thu, 30 Aug 2012 18:29:51 +0000 (14:29 -0400)]
nwfilter: adapt IP learning for broadcasted DHCP replies

Adapt the IP learning code to also accept broadcasted DHCP replies

12 years agonwfilter: accept broadcasted DHCP replies in DHCP snooping code
Stefan Berger [Thu, 30 Aug 2012 18:29:50 +0000 (14:29 -0400)]
nwfilter: accept broadcasted DHCP replies in DHCP snooping code

Some DHCP servers send their DHCP replies to the broadcast MAC address
rather than to the MAC address of the VM. The existing DHCP snooping
code assumes that the reply always goes to the MAC address of the VM
thus filtering the traffic of some DHCP servers' replies.

The below patch adapts the code to

1) filter DHCP replies by comparing the MAC address in the reply against
   the MAC address of the VM (held in the snoop request)

2) adapts the pcap filter for traffic towards the VM to accept DHCP replies
   sent to any MAC address; for further filtering we rely on 1)

3) creates initial rules that are active while waiting for DHCP replies;
   these rules now accept DHCP replies to the VM's MAC address or to the
   MAC broadcast address

12 years agoImplement virMacAddrIsBroadcastRaw
Stefan Berger [Thu, 30 Aug 2012 18:29:49 +0000 (14:29 -0400)]
Implement virMacAddrIsBroadcastRaw

Add function for testing for Ethernet broadcast address

12 years agoFix adding ports to OVS bridges without VLAN tags
Kyle Mestery [Thu, 30 Aug 2012 20:38:06 +0000 (16:38 -0400)]
Fix adding ports to OVS bridges without VLAN tags

The introduction of the new VLAN code, along with the fix
from 5e465df6be8bcb00f0b4bff831e91f4042fae272, caused the
addition of OVS ports to fail with the following message:

ovs-vsctl: 00002|vsctl|ERR|: missing column name

This fix takes into account the VLAN arguments are optional,
and correctly sets up the command line to run the "ovs-vsctl"
command to add ports to the OVS bridge.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
CC: Eric Blake <eblake@redhat.com>
12 years agoFix xen driver following changes to make it stateful
Jim Fehlig [Thu, 30 Aug 2012 18:53:02 +0000 (12:53 -0600)]
Fix xen driver following changes to make it stateful

Recent work to improve support for loadable driver modules introduced
a regression in the xen driver.  The legacy xen driver is now a
stateful, libvirtd driver but was not being registered when building
without driver modules.

A slight behavior change was also noted in the xen drivers when
built as driver modules.  Previously, explicitly specifying a
connection URI was not necessary, but now

Compiled against library: libvirt 0.10.0
Using library: libvirt 0.10.0
Using API: QEMU 0.10.0
error: failed to get the hypervisor version
error: internal error Cannot find suitable emulator for x86_64

The xen drivers need to be registered before the qemu driver since
the qemu driver will return success with a null connection URI.
This ordering is safe since the xen drivers will decline when not
running the xen kernel.

12 years agoFix issue of PF brought down if VF is 8021.Qbh and pci passthrough
Nishank Trivedi [Thu, 30 Aug 2012 19:27:27 +0000 (15:27 -0400)]
Fix issue of PF brought down if VF is 8021.Qbh and pci passthrough

If a 8021.Qbh network device supports SRIOV and its VF is being used
in pci passthrough mode, when the guest is shutdown or destroyed, the
PF inteface is also brought down. qemuDomainHostdevNetConfigRestore()
finds out the PF for provided hostdev (which is VF) and passes it to
virNetDevPortProfileDisassociate() as linkdev. Later, linkdev gets passed
to virNetDevSetOnline() where the interface is brought down by clearing
IFF_UP flag.

Bringing down a PF, when only VF is being brought down is not expected
behavior. This patch adds a check so that virNetDevSetOnline() is called
only for PF and not if device is a VF.

Signed-off-by: Nishank Trivedi <nistrive@cisco.com>
12 years agonwfilter: loop generated too many rules
Stefan Berger [Thu, 30 Aug 2012 17:51:27 +0000 (13:51 -0400)]
nwfilter: loop generated too many rules

The loop processing the trusted DHCP server generated one too
many rules and added one final rules that accepted responses
from all DHCP servers. Below patch fixes this.

12 years agosecurity: Re-apply commit ce53382ba28179d3a504b29b4f888b6e130d53f0
Peter Krempa [Thu, 30 Aug 2012 14:05:53 +0000 (16:05 +0200)]
security: Re-apply commit ce53382ba28179d3a504b29b4f888b6e130d53f0

Recent changes in the security driver discarded changes that fixed
labeling un-confined guests.