]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoCygwin's GCC doesn't like this .sa_handler initialization for some reason
Matthias Bolte [Sun, 25 Apr 2010 10:50:23 +0000 (12:50 +0200)]
Cygwin's GCC doesn't like this .sa_handler initialization for some reason

15 years agolinux/if.h header is not available on non-Linux platforms
Matthias Bolte [Sun, 25 Apr 2010 10:32:11 +0000 (12:32 +0200)]
linux/if.h header is not available on non-Linux platforms

15 years agonwfilter: enable hex number inputs in filter XML
Stefan Berger [Mon, 26 Apr 2010 17:50:40 +0000 (13:50 -0400)]
nwfilter: enable hex number inputs in filter XML

With this patch I want to enable hex number inputs in the filter XML. A
number that was entered as hex is also printed as hex unless a string
representing the meaning can be found.

I am also extending the schema and adding a test case. A problem with
the DSCP value is fixed on the way as well.

Changes from V1 to V2:

- using asHex boolean in all printf type of functions to select the
output format in hex or decimal format

15 years agoStarts dnsmasq from libvirtd with --dhcp-hostsfile option
Satoru SATOH [Mon, 26 Apr 2010 14:07:25 +0000 (16:07 +0200)]
Starts dnsmasq from libvirtd with --dhcp-hostsfile option

This patch makes libvirtd start the dnsmasq daemon with a
--dhcp-hostsfile option instead of --dhcp-host options for each
'//ip/dhcp/host' entries defined in network xml file.

the dnsmasq host file is stored into /var/lib/libvirt/network

* src/network/bridge_driver.c: define the directory for the hostfiles
  and save/delete them to be used by dnsmasq

15 years agoAdd build support for dnsmasq module
Satoru SATOH [Mon, 26 Apr 2010 13:56:03 +0000 (15:56 +0200)]
Add build support for dnsmasq module

* po/POTFILES.in: the new module contains translatable strings
* src/Makefile.am: include the files in the utils set
* src/libvirt_private.syms: exports the symbols internally

15 years agoAdd dnsmasq module files
Satoru SATOH [Mon, 26 Apr 2010 13:52:02 +0000 (15:52 +0200)]
Add dnsmasq module files

It implements an idea to save dhcp hosts' macaddr vs. ipaddr mappings to
static file and make dnsmasq loading it with "--dhcp-hostsfile" option,
originally suggested by Dan, and can address the problem that too
many "--dhcp-host" args hitting ARG_MAX limit

* src/util/dnsmasq.h src/util/dnsmasq.c: adds the 2 new files

15 years agoFix make dist missing ESX generated files
Daniel Veillard [Mon, 26 Apr 2010 14:59:50 +0000 (16:59 +0200)]
Fix make dist missing ESX generated files

new method generated files are missing from dist tarball.

15 years agoFix memory leak in virsh snapshot-list.
Chris Lalancette [Fri, 23 Apr 2010 15:59:39 +0000 (11:59 -0400)]
Fix memory leak in virsh snapshot-list.

We were forgetting to release the memory allocated by
virDomainSnapshotListNames.  Free the memory properly.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix printing of pathnames on error in qemuDomainSnapshotLoad.
Chris Lalancette [Fri, 23 Apr 2010 15:59:02 +0000 (11:59 -0400)]
Fix printing of pathnames on error in qemuDomainSnapshotLoad.

While doing some testing of the snapshot code I noticed that
if qemuDomainSnapshotLoad failed, it would print a NULL as
part of the error.  That's not desirable, so leave the
full_path variable around until after we are done printing
errors.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix virDomainSnapshotObjFree memory leak.
Chris Lalancette [Fri, 23 Apr 2010 15:58:41 +0000 (11:58 -0400)]
Fix virDomainSnapshotObjFree memory leak.

We were freeing the virDomainSnapshotDefPtr, but not
the virDomainSnapshotObjPtr in virDomainSnapshotObjFree.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake virDomainSnapshotObjListDeinit static.
Chris Lalancette [Fri, 23 Apr 2010 15:57:50 +0000 (11:57 -0400)]
Make virDomainSnapshotObjListDeinit static.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix a memory leak in the snapshot code in libvirtd.
Chris Lalancette [Fri, 23 Apr 2010 15:57:16 +0000 (11:57 -0400)]
Fix a memory leak in the snapshot code in libvirtd.

While running libvirtd under valgrind and doing some
snapshot testing I noticed that we would always leak a
connection reference.  The problem was actually that we
were leaking a domain reference in the libvirtd remote
snapshot code, which was in turn causing a leaked
connection reference.  Fix the situation by explicitly
taking and dropping a domain reference where we need it.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agocygwin: Check explicitly for getmntent_r
Matthias Bolte [Fri, 23 Apr 2010 09:34:17 +0000 (11:34 +0200)]
cygwin: Check explicitly for getmntent_r

Cygwin has mntent.h but lacks getmntent_r. Update preprocessor
checks to catch this combination.

15 years agoSome NWFilter symbols are conditional and have to be exported conditional
Matthias Bolte [Fri, 23 Apr 2010 16:39:08 +0000 (18:39 +0200)]
Some NWFilter symbols are conditional and have to be exported conditional

15 years agoxen: Fix inside_daemon beeing unused when libvirtd is disabled
Matthias Bolte [Fri, 23 Apr 2010 16:12:09 +0000 (18:12 +0200)]
xen: Fix inside_daemon beeing unused when libvirtd is disabled

The defined __sun is there, because inside_daemon is used in xenUnifiedOpen
if __sun is defined.

15 years agoDisable stateful OpenNebula driver if libvirtd is disabled
Matthias Bolte [Fri, 23 Apr 2010 16:00:19 +0000 (18:00 +0200)]
Disable stateful OpenNebula driver if libvirtd is disabled

Also move the equivalent checks for LXC and UML before their header
checks. This way configure doesn't check for the headers when the driver
gets disabled anyway.

15 years agoImprove configure error message about missing Linux headers
Matthias Bolte [Fri, 23 Apr 2010 09:40:13 +0000 (11:40 +0200)]
Improve configure error message about missing Linux headers

15 years agobuild: fix typo in previous commit
Eric Blake [Fri, 23 Apr 2010 17:24:52 +0000 (11:24 -0600)]
build: fix typo in previous commit

* configure.ac: Avoid syntax error.

15 years agobuild: don't include winsock2.h on cygwin
Eric Blake [Fri, 23 Apr 2010 16:29:35 +0000 (10:29 -0600)]
build: don't include winsock2.h on cygwin

Under cygwin, winsock2.h is intentionally incompatible with,
<sys/socket.h>, and checking for existence is wrong.

Under mingw, HAVE_WINSOCK2_H is defined on our behalf by
gnulib, in a way that does not interfere with cygwin.

* configure.ac: Drop unnecessary header check.
Reported by Matthias Bolte.

15 years agoQEmu JSON drop timestamp from command object
Luiz Capitulino [Fri, 23 Apr 2010 16:06:18 +0000 (18:06 +0200)]
QEmu JSON drop timestamp from command object

It's not needed and is currently ignored, but this is a bug.

It will get fixed soon and QMP will return an error for keys
it doesn't know about, this will break libvirt.

* src/qemu/qemu_monitor_json.c: remove qemuMonitorJSONCommandAddTimestamp()
  and the place where it's invoked in qemuMonitorJSONMakeCommand()

15 years agonwfilter: extend schema + add testcase w/ connlimit-above
Stefan Berger [Fri, 23 Apr 2010 15:42:39 +0000 (11:42 -0400)]
nwfilter: extend schema + add testcase w/ connlimit-above

I am extending the schema with the recently added connlimit-above
attribute and adding a test case for it to the test suite.

15 years agomaint: update AUTHORS
Marco Bozzolan [Fri, 23 Apr 2010 13:48:10 +0000 (07:48 -0600)]
maint: update AUTHORS

* AUTHORS: Use preferred name.

Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agoFix crash in nwfilter driver check
Daniel P. Berrange [Mon, 19 Apr 2010 13:16:46 +0000 (14:16 +0100)]
Fix crash in nwfilter driver check

The nwfilterDriverActive() could de-reference a NULL pointer
if it hadn't be started at the point it was called. It was
also not thread safe, since it lacked locking around data
accesses.

* src/nwfilter/nwfilter_driver.c: Fix locking & NULL checks
  in nwfilterDriverActive()

15 years agoaddrToString: give better error message
Eric Blake [Tue, 20 Apr 2010 16:08:56 +0000 (10:08 -0600)]
addrToString: give better error message

The user probably doesn't care what the gai error numbers are, as
much as what the failed conversion IP address was.

* src/remote/remote_driver.c (addrToString): Mention which address
could not be converted.
* daemon/remote.c (addrToString): Likewise.

15 years agomaint: update AUTHORS with recent contributors
Eric Blake [Thu, 22 Apr 2010 20:13:03 +0000 (14:13 -0600)]
maint: update AUTHORS with recent contributors

git shortlog $(git log -1 --format=%H AUTHORS).. | grep -v "^ "

then add missing entries to AUTHORS.

* AUTHORS: Update.

15 years agoqemu: fix security context references in DAC code
Spencer Shimko [Wed, 21 Apr 2010 17:44:43 +0000 (13:44 -0400)]
qemu: fix security context references in DAC code

* The error messages coming from qemu's DAC support contain strings
  from the original SELinux security driver code.  This just removes
  references to "security context" and other SELinux-isms from the DAC
  code.

Signed-off-by: Spencer Shimko <sshimko@tresys.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agoChanges from V1 to V2:
Stefan Berger [Thu, 22 Apr 2010 18:58:57 +0000 (14:58 -0400)]
Changes from V1 to V2:
 - using INT_BUFSIZE_BOUND() to determine the length of the buffersize
for printing and integer into

 - not explicitly initializing static var threadsTerminate to false
anymore, since that's done automatically

Changes after V2:
  - removed while looks in case of OOM error
  - removed on ifaceDown() call
  - preceding one ifaceDown() call with an ifaceCheck() call

Since the name of an interface can be the same between stops and starts
of different VMs I have to switch the IP address learning thread to use
the index of the interface to determine whether an interface is still
available or not - in the case of macvtap the thread needs to listen for
traffic on the physical interface, thus having to time out periodically
to check whether the VM's macvtap device is still there as an indication
that the VM is still alive. Previously the following sequence of 2 VMs
with macvtap device

virsh start testvm1; virsh destroy testvm1 ; virsh start testvm2

would not terminate the thread upon testvm1's destroy since the name of
the interface on the host could be the same (i.e, macvtap0) on testvm1
and testvm2, thus it was easily race-able. The thread would then
determine the IP address parameter for testvm2 but apply the rule set
for testvm1. :-(
I am also introducing a lock for the interface (by name) that the thread
must hold while it listens for the traffic and releases when it
terminates upon VM termination or 0.5 second thereafter. Thus, the new
thread for a newly started VM with the same interface name will not
start while the old one still holds the lock. The only other code that I
see that also needs to grab the lock to serialize operation is the one
that tears down the firewall that were established on behalf of an
interface.

I am moving the code applying the 'basic' firewall rules during the IP
address learning phase inside the thread but won't start the thread
unless it is ensured that the firewall driver has the ability to apply
the 'basic' firewall rules.

15 years agoProperly indent encryption tags
David Allan [Thu, 22 Apr 2010 16:55:17 +0000 (12:55 -0400)]
Properly indent encryption tags

* Fix for the bug reported at:

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

15 years agoFix locking in qemudDomainCoreDump
Jiri Denemark [Thu, 22 Apr 2010 14:43:08 +0000 (16:43 +0200)]
Fix locking in qemudDomainCoreDump

The hang fix in d376b7d63ec1ef24ba4c812d58b9a414ddb561f8 was incomplete
since it left quite a few {Enter,Exit}Monitor calls which require driver
to be unlocked. Since the driver is locked throughout the whole
function, {Enter,Exit}MonitorWithDriver need to be used instead to
ensure driver is not locked when issuing monitor commands.

15 years agoPoll for migration end every 50ms instead of 50us
Jiri Denemark [Thu, 22 Apr 2010 14:22:31 +0000 (16:22 +0200)]
Poll for migration end every 50ms instead of 50us

The comment in qemuDomainWaitForMigrationComplete says we are polling
every 50ms but the code sleeps only for 50us. This was already discussed
during review but apparently forgotten when the series was pushed.

15 years agoconfigure.ac SELinux fixes
Spencer Shimko [Wed, 21 Apr 2010 17:44:29 +0000 (13:44 -0400)]
configure.ac SELinux fixes

* Fix a logic error in configure.ac that prevented --with-selinux=no
  from being used with --with-secdriver-selinux=no.

* Fix some strings to clarify the difference between --with-selinux
  and --with-secdriver-selinux.

Signed-off-by: Spencer Shimko <sshimko@tresys.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agoFix QEMU text monitor command error checking
Daniel P. Berrange [Thu, 22 Apr 2010 15:47:33 +0000 (16:47 +0100)]
Fix QEMU text monitor command error checking

The text monitor code was checking for a '\n' prefix on several
places. Previously this would work, but since the monitor code
re-write the '\n' is already stripped off, so mustn't be checked
for.

* src/qemu/qemu_monitor_text.c: Fix monitor error checking

15 years agoFix CPU hotplug command names
Daniel P. Berrange [Thu, 22 Apr 2010 15:39:10 +0000 (16:39 +0100)]
Fix CPU hotplug command names

Probably as a result of a merge error, the CPU hotplug command
names were completely wrong.

* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_text.c: Fix
  the CPU hotplug command names

15 years agoFix printing of event detail in python events demo program
Daniel P. Berrange [Thu, 22 Apr 2010 15:31:05 +0000 (16:31 +0100)]
Fix printing of event detail in python events demo program

The events demo program is slightly misleading printing

  myDomainEventCallback1 EVENT: Domain f14i686(-1) Added

which is not distinguishing Add vs Update events. It should have
been doing

  myDomainEventCallback1 EVENT: Domain f14i686(-1) Defined Updated

* examples/domain-events/events-python/event-test.py: Fully print
  event detail info string

15 years agoportability fixes to tools/virt-pki-validate.in
Dustin Kirkland [Wed, 21 Apr 2010 21:52:10 +0000 (16:52 -0500)]
portability fixes to tools/virt-pki-validate.in

A few fixes will help make tools/virt-pki-validate.in useful on Debian
and Ubuntu.  And one fix should be useful to everyone (see #3).

 1) note our gnutls-bin package (in addition to your gnutls-utils
package) in the no-certtool error text

 2) fix a bashism, == should be = in the case where /bin/sh is a symlink
to dash

 3) $(SYSCONFDIR) cannot evaluate; set a single shell SYSCONFDIR
variable to the autoconf @SYSCONFDIR@ value, and use $SYSCONFDIR
everywhere

Bug report:
 * https://bugs.edge.launchpad.net/ubuntu/+source/libvirt/+bug/562266

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agomaint: enforce whitespace on shell scripts
Eric Blake [Wed, 21 Apr 2010 23:21:06 +0000 (17:21 -0600)]
maint: enforce whitespace on shell scripts

Noticed because virt-pki-validate was very inconsistent on
using tabs vs. 8 spaces, sometimes mixing both paradigms on
a single line.

'git diff -b' shows significant changes only in cfg.mk.

* cfg.mk (sc_TAB_in_indentation): Add a few files.
* daemon/libvirtd.init.in: Avoid tabs.
* tools/virt-pki-validate.in: Likewise.

15 years agotestutilsqemu: avoid uninitialized variable
Eric Blake [Thu, 22 Apr 2010 15:00:30 +0000 (09:00 -0600)]
testutilsqemu: avoid uninitialized variable

* tests/testutilsqemu.c (testQemuCapsInit): Initialize variables.

15 years agoFake host CPU for qemu tests
Jiri Denemark [Fri, 16 Apr 2010 06:01:59 +0000 (08:01 +0200)]
Fake host CPU for qemu tests

15 years agoUse configured CPU model if possible
Jiri Denemark [Thu, 15 Apr 2010 10:06:13 +0000 (12:06 +0200)]
Use configured CPU model if possible

Adds ability to provide a preferred CPU model for CPUID data decoding.
Such model would be considered as the best possible model (if it's
supported by hypervisor) regardless on number of features which have to
be added or removed for describing required CPU.

15 years agoSupport removing features when converting data to CPU
Jiri Denemark [Wed, 14 Apr 2010 15:41:32 +0000 (17:41 +0200)]
Support removing features when converting data to CPU

So far, when CPUID data were converted into CPU model and features, the
features can only be added to the model. As a result, when a guest asked
for something like "qemu64,-svm" it would get a qemu32 plus a bunch of
additional features instead.

This patch adds support for removing feature from the base model.
Selection algorithm remains the same: the best CPU model is the model
which requires lowest number of features to be added/removed from it.

15 years agoMove MIN macro to util.h so that others can use it
Jiri Denemark [Wed, 14 Apr 2010 15:40:14 +0000 (17:40 +0200)]
Move MIN macro to util.h so that others can use it

15 years agoDeal with CPU models in []
Jiri Denemark [Tue, 13 Apr 2010 16:59:14 +0000 (18:59 +0200)]
Deal with CPU models in []

Qemu committed a patch which list some CPU names in [] when asked for
supported CPUs (qemu -cpu ?). Yet, it needs such CPUs to be passed
without those square braces. When probing for supported CPU models, we
can just strip the square braces and pretend we have never seen them.

15 years agoFix initial VCPU pinning in qemu driver
Jiri Denemark [Wed, 21 Apr 2010 07:39:49 +0000 (09:39 +0200)]
Fix initial VCPU pinning in qemu driver

First, inital VCPU pinning is set correctly but then it is reset by
assigning qemu process to a new cgroup (which contains all CPUs). It's
easily fixed by swapping these two actions.

15 years agomaint: ignore 'make syntax-check' failure files
Eric Blake [Wed, 21 Apr 2010 15:55:03 +0000 (09:55 -0600)]
maint: ignore 'make syntax-check' failure files

* .gitignore: Add exemption.
* cfg.mk (local-checks-to-skip): Ignore a test to silence a skip
warning.

15 years agoMake avahi startup more robust.
Chris Lalancette [Tue, 23 Mar 2010 13:01:37 +0000 (09:01 -0400)]
Make avahi startup more robust.

If the hostname of the current virtualization machine
could not be resolved, then libvirtd would fail to
start.  However, for disconnected operation (on a laptop,
for instance) the hostname may very legitimately not
be resolvable.  This patch makes it so that if we can't
resolve the hostname, avahi doesn't fail, it just uses
a less useful MDNS string.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoIgnore empty type attribute in driver element of virtual disks
Guido Günther [Mon, 19 Apr 2010 16:08:19 +0000 (18:08 +0200)]
Ignore empty type attribute in driver element of virtual disks

Fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=578347

15 years agobuild: fix preprocessor indentation
Eric Blake [Wed, 21 Apr 2010 15:54:10 +0000 (09:54 -0600)]
build: fix preprocessor indentation

* src/esx/esx_vi.h: Placate cppi.

15 years agoesx: Don't treat an empty root snapshot list as error
Chris Wong [Wed, 21 Apr 2010 09:47:15 +0000 (11:47 +0200)]
esx: Don't treat an empty root snapshot list as error

An empty root snapshot list was considered as error condition. Creating a
new snapshot would fail if the domain didn't have snapshots yet, because
the snapshot-create function tries to lookup the list of existing snapshots
in order to verify that the snapshot name is unique. This fails if the
domain doesn't have snapshots yet.

Removing the NULL check from esxVI_LookupRootSnapshotTreeList fixes this.

15 years agoesx: Gather some XML generation macros in esx_vi.h
Matthias Bolte [Sun, 18 Apr 2010 17:58:58 +0000 (19:58 +0200)]
esx: Gather some XML generation macros in esx_vi.h

15 years agoesx: Fix FindByIp response handling
Matthias Bolte [Sun, 18 Apr 2010 16:07:13 +0000 (18:07 +0200)]
esx: Fix FindByIp response handling

FindByIp may return nothing if there is no host or virtual machine
with the given IP address. Handle that case properly.

15 years agoesx: Fix virtualHW.version generation
Matthias Bolte [Sun, 18 Apr 2010 16:04:24 +0000 (18:04 +0200)]
esx: Fix virtualHW.version generation

The supported virtualHW.version doesn't depend on the API version,
but on the product version.

15 years agonwfilter: add support for connlimit match
Stefan Berger [Tue, 20 Apr 2010 21:14:38 +0000 (17:14 -0400)]
nwfilter: add support for connlimit match

This patch adds support for the connlimit match in iptables that is used
to limit the number of outgoing directions.

15 years agoExtend fwall-drv interface and call functions via interface
Stefan Berger [Tue, 20 Apr 2010 21:07:15 +0000 (17:07 -0400)]
Extend fwall-drv interface and call functions via interface

I am moving some of the eb/iptables related functions into the interface
of the firewall driver and am making them only accessible via the driver's
interface. Otherwise exsiting code is adapted where needed. I am adding one
new function to the interface that checks whether the 'basic' rules can be
applied,  which will then be used by a subsequent patch.

15 years agobuild: avoid compiler warning
Eric Blake [Tue, 20 Apr 2010 19:44:31 +0000 (13:44 -0600)]
build: avoid compiler warning

According to GCC, ATTRIBUTE_UNUSED means that an attribute _might_
be unused, not _must_ be unused.  Therefore, it is easier to
blindly mark a variable, than to try and do preprocessor limiting
of when we know it is unused.

* src/remote/remote_driver.c (remoteAuthenticate): Mark attribute
as potentially unused.
Reported by Gustovo Morozowski.

15 years agoExplicitly set virStoragePoolTypeInfo FS and NETFS defaults
Matthias Bolte [Sun, 18 Apr 2010 12:00:38 +0000 (14:00 +0200)]
Explicitly set virStoragePoolTypeInfo FS and NETFS defaults

No semantic change, the now explicitly set default are all zero and
that's what GCC sets unspecified struct members to.

15 years agoesx: Add support for the VMXNET 2 (Enhanced) NIC model
Matthias Bolte [Sat, 17 Apr 2010 09:43:01 +0000 (11:43 +0200)]
esx: Add support for the VMXNET 2 (Enhanced) NIC model

Add a test case and document it.

15 years agoMark in_open parameter of remoteAuthenticate as unused when it's unused
Matthias Bolte [Tue, 20 Apr 2010 18:28:00 +0000 (20:28 +0200)]
Mark in_open parameter of remoteAuthenticate as unused when it's unused

Otherwise compiling with -Werror will fail.

15 years agoInstall nwfilter xml files from source directory.
Philipp Hahn [Thu, 15 Apr 2010 09:21:18 +0000 (11:21 +0200)]
Install nwfilter xml files from source directory.

During an out-of-tree build, the current working directory is the build
directory. Since the FILTERS are static and not modified or
auto-generated during the build process, they need to be explicitly
fetched from the source directory during install.

Prefix the files with $(srcdir), which gets expanded to the absolute or
relative path to the source directory, even when duing out-of-tree
builds.

Signed-off-by: Philipp Hahn <hahn@univention.de>
15 years agoDon't ship generated python/libvirt.? files.
Philipp Hahn [Thu, 15 Apr 2010 10:49:33 +0000 (12:49 +0200)]
Don't ship generated python/libvirt.? files.

libvirt.c and libvirt.h are auto-generated files. Mentioning their names
in *_SOURCES includes them in the distribution. During an out-of-tree
build these shipped files are included instead of the auto-generated
version, potentially breaking the build (as it happend in 0.8.0, because
the shipped libvirt.h was missing the declaration for
'libvirt_virDomainUpdateDeviceFlags')

Use the nodist_*_SOURCES automake variable instead.

Signed-off-by: Philipp Hahn <hahn@univention.de>
15 years agoFixup python binding for virDomainSnapshot APIs
Daniel P. Berrange [Tue, 20 Apr 2010 09:49:27 +0000 (11:49 +0200)]
Fixup python binding for virDomainSnapshot APIs

The generator code was totally wrong for the virDomainSnapshot
APIs, not generating the wrapper class, and giving methods the
wrong names

* generator.py: Set metadata for virDomainSnapshot type & APIs
* libvirt-override-api.xml, libvirt-override.c: Hand-code the
  virDomainSnapshotListNames glue layer

15 years agoFix network hotplug to use device_add in QEMU
Daniel P. Berrange [Fri, 16 Apr 2010 10:46:38 +0000 (11:46 +0100)]
Fix network hotplug to use device_add in QEMU

The initial boot of VMs uses -device for NICs where available. The
corresponding monitor command is device_add, but the network hotplug
code was still using device_del by mistake.

* src/qemu/qemu_driver.c: Use device_add for NIC hotplug where
  available

15 years agoFix error reporting for getfd + host_net_add in QEMU
Daniel P. Berrange [Thu, 15 Apr 2010 15:40:54 +0000 (16:40 +0100)]
Fix error reporting for getfd + host_net_add in QEMU

If either of the getfd or host_net_add monitor commands return
any text, this indicates an error condition. Don't ignore this!

* src/qemu/qemu_monitor_text.c: Report errors for getfd and
  host_net_add

15 years agoFix device_del in JSON mode for QEMU
Daniel P. Berrange [Thu, 15 Apr 2010 11:17:29 +0000 (12:17 +0100)]
Fix device_del in JSON mode for QEMU

The 'device_del' command expects a parameter called 'id' but we
were passing 'config'.

* src/qemu/qemu_monitor_json.c: Fix device_del command parameter

15 years agonwfilter: Free nwfilter hash of virConnectPtr
Matthias Bolte [Sat, 17 Apr 2010 16:20:15 +0000 (18:20 +0200)]
nwfilter: Free nwfilter hash of virConnectPtr

And close the driver on connection close.

15 years agoReplace printf with logging macros
Matthias Bolte [Fri, 2 Apr 2010 19:43:17 +0000 (21:43 +0200)]
Replace printf with logging macros

15 years agoMark internal.h for translation
Jiri Denemark [Fri, 16 Apr 2010 17:21:10 +0000 (19:21 +0200)]
Mark internal.h for translation

15 years agoUse virCheckFlags for APIs added in 0.8.0
Jiri Denemark [Fri, 16 Apr 2010 12:04:31 +0000 (14:04 +0200)]
Use virCheckFlags for APIs added in 0.8.0

15 years agoIntroduce virCheckFlags for consistent flags checking
Jiri Denemark [Tue, 13 Apr 2010 13:48:04 +0000 (15:48 +0200)]
Introduce virCheckFlags for consistent flags checking

The idea is that every API implementation in driver which has flags
parameter should first call virCheckFlags() macro to check the function
was called with supported flags:

    virCheckFlags(VIR_SUPPORTED_FLAG_1 |
                  VIR_SUPPORTED_FLAG_2 |
                  VIR_ANOTHER_SUPPORTED_FLAG, -1);

The error massage which is printed when unsupported flags are passed
looks like:

    invalid argument in virFooBar: unsupported flags (0x2)

Where the unsupported flags part only prints those flags which were
passed but are not supported rather than all flags passed.

15 years agonwfilter: Clear all state tracking from a drop rule
Stefan Berger [Fri, 16 Apr 2010 11:34:36 +0000 (07:34 -0400)]
nwfilter: Clear all state tracking from a drop rule

Don't use state-matching in a drop rule.

15 years agoesx: Replace scanf with STRSKIP and strtok_r
Matthias Bolte [Tue, 13 Apr 2010 22:03:12 +0000 (00:03 +0200)]
esx: Replace scanf with STRSKIP and strtok_r

This also fixes a portability problem with the %a format modifier.
%a is not portable and made esxDomainDumpXML fail at runtime in
MinGW builds.

15 years agoUpdate to latest gnulib to get strtok_r relaxed to LGPLv2+
Matthias Bolte [Thu, 15 Apr 2010 00:03:05 +0000 (02:03 +0200)]
Update to latest gnulib to get strtok_r relaxed to LGPLv2+

strtok_r will be used in the ESX driver to replace scanf-based code.

MinGW lacks strtok_r, so we need gnulib to provide it, but until now
strtok_r was licensed LGPL3.

15 years agoesx: Add nwfilter driver stub
Matthias Bolte [Wed, 14 Apr 2010 23:38:50 +0000 (01:38 +0200)]
esx: Add nwfilter driver stub

This stops libvirt trying to connect to a non-existing libvirtd on the
ESX server in order to find a nwfilter driver.

15 years agoremote: react to failures on wakeupFD
Eric Blake [Tue, 9 Mar 2010 22:17:21 +0000 (15:17 -0700)]
remote: react to failures on wakeupFD

* src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Report
failures on pipe used for wakeup.
Reported by Chris Lalancette.

15 years agoutil: ensure safe{read,write,zero} return is checked
Eric Blake [Tue, 2 Mar 2010 16:35:01 +0000 (09:35 -0700)]
util: ensure safe{read,write,zero} return is checked

Based on a warning from coverity.  The safe* functions
guarantee complete transactions on success, but don't guarantee
freedom from failure.

* src/util/util.h (saferead, safewrite, safezero): Add
ATTRIBUTE_RETURN_CHECK.
* src/remote/remote_driver.c (remoteIO, remoteIOEventLoop): Ignore
some failures.
(remoteIOReadBuffer): Adjust error messages on read failure.
* daemon/event.c (virEventHandleWakeup): Ignore read failure.

15 years agomaint: another preprocessor fix
Eric Blake [Thu, 15 Apr 2010 17:37:25 +0000 (11:37 -0600)]
maint: another preprocessor fix

Regression introduced in commit 62170b995.

* src/util/memory.h: Placate cppi, and fit 80 columns.

15 years agoFix CDROM media change for QEMU when using -device syntax
Daniel P. Berrange [Thu, 15 Apr 2010 10:35:07 +0000 (11:35 +0100)]
Fix CDROM media change for QEMU when using -device syntax

Disk devices in QEMU have two parts, the guest device and the host
backend driver. Historically these two parts have had the same
"unique" name. With the switch to using -device though, they now
have separate names. Thus when changing CDROM media, for guests
using -device syntax, we need to prepend the QEMU_DRIVE_HOST_PREFIX
constant

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Add helper function
  qemuDeviceDriveHostAlias() for building a host backend alias
* src/qemu/qemu_driver.c: Use qemuDeviceDriveHostAlias() to determine
  the host backend alias for performing eject/change commands in the
  monitor

15 years agoUpdate QEMU device_add command in JSON mode
Daniel P. Berrange [Wed, 14 Apr 2010 15:02:37 +0000 (16:02 +0100)]
Update QEMU device_add command in JSON mode

The device_add command was added in JSON mode in a way I didn't
expect. Instead of passing the normal device string to the JSON
command:

    { "execute": "device_add", "arguments": { "device": "ne2k_pci,id=nic.1,netdev=net.1" } }

We need to split up the device string into a full JSON object

    { "execute": "device_add", "arguments": { "driver": "ne2k_pci", "id": "nic.1", "netdev": "net.1" } }

* src/qemu/qemu_conf.h, src/qemu/qemu_conf.c: Rename the
  qemuCommandLineParseKeywords method to qemuParseKeywords
  and export it to monitor
* src/qemu/qemu_monitor_json.c: Split up device string into
  a JSON object for device_add command

15 years agoRename parameter in qemuMonitorDeviceDel
Daniel P. Berrange [Wed, 14 Apr 2010 14:36:42 +0000 (15:36 +0100)]
Rename parameter in qemuMonitorDeviceDel

The parameter for the qemuMonitorDeviceDel() is a device alias,
not a device config string. Rename the parameter reflect this
and avoid confusion to readers.

* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h,
  src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
  Rename devicestr to devalias in qemuMonitorDeviceDel()

15 years agoRemove code from JSON monitor for commands that won't be ported
Daniel P. Berrange [Wed, 14 Apr 2010 14:23:38 +0000 (15:23 +0100)]
Remove code from JSON monitor for commands that won't be ported

The QEMU developers have stated that they will not be porting
the commands 'pci_add', 'pci_del', 'usb_add', 'usb_del' to the
JSON mode monitor, since they're obsoleted by 'device_add'
and 'device_del'. libvirt has (untested) code that would have
supported those commands in theory, but since we already use
device_add/del where available, there's no need to keep the
legacy stuff anymore.

The text mode monitor keeps support for all commands for sake
of historical compatability.

* src/qemu/qemu_monitor_json.c: Remove 'pci_add', 'pci_del',
  'usb_add', 'usb_del' commands

15 years agoRun test suite as part of RPM build process
Daniel P. Berrange [Mon, 12 Apr 2010 18:39:00 +0000 (19:39 +0100)]
Run test suite as part of RPM build process

To ensure that patches in the RPM don't break any functionality
it is neccessary to run the test suites during build. It currently
has 3 tests disabled

 - daemon-conf: this is totally broken, since it relies on
   being able to resolve the 'libvirt' group & being able to
   resolve hostnames at daemon startup. This isn't possible
   in a mock build root
 - seclabeltest: fails to initialize selinux in the mock
   build root. Possibly fixable
 - nodeinfotest: broken on s390 + ppc - this is a real bug

* libvirt.spec.in: Add a %check section, with 3 tests
   temporarily disabled

15 years agoFix QEMU memory stats JSON mode
Daniel P. Berrange [Mon, 12 Apr 2010 11:31:15 +0000 (12:31 +0100)]
Fix QEMU memory stats JSON mode

The QEMU driver is mistakenly calling directly into the text
mode monitor for the domain memory stats query.

* src/qemu/qemu_driver.c: Replace qemuMonitorTextGetMemoryStats with
  qemuMonitorGetMemoryStats
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add the new
  wrapper for qemuMonitorGetMemoryStats
* src/qemu/qemu_monitor_json.c, src/qemu/qemu_monitor_json.h: Add
  qemuMonitorJSONGetMemoryStats implementation

15 years agoFix QEMU command building errors to reflect unsupported configuration
Daniel P. Berrange [Mon, 12 Apr 2010 17:20:31 +0000 (18:20 +0100)]
Fix QEMU command building errors to reflect unsupported configuration

Instead of reporting VIR_ERR_INTERNAL_ERROR use the more specific
VIR_ERR_CONFIG_UNSUPPORTED

* src/qemu/qemu_conf.c: Report VIR_ERR_CONFIG_UNSUPPORTED for
  unsupported video adapters

15 years agonwfilter: fix tear down order and consolidate functions
Stefan Berger [Thu, 15 Apr 2010 14:49:24 +0000 (10:49 -0400)]
nwfilter: fix tear down order and consolidate functions

To avoid race-conditions, the tear down of a filter has to happen before
the tap interface disappears and another tap interface with the same
name can re-appear. This patch tries to fix this. In one place, where
communication with the qemu monitor may fail, I am only tearing the
filters down after knowing that the function did not fail.

I am also moving the tear down functions into an include file for other
drivers to reuse.

15 years agoTrivial fix: Add braces to for statement to avoid crashes
Stefan Berger [Thu, 15 Apr 2010 01:24:21 +0000 (21:24 -0400)]
Trivial fix: Add braces to for statement to avoid crashes

I am adding braces around the for statement that are now needed to due the
new sa_assert immediately following the for statement.

15 years agoFix close_used_without_including_unistd_h error
Matthias Bolte [Wed, 14 Apr 2010 22:59:11 +0000 (00:59 +0200)]
Fix close_used_without_including_unistd_h error

Triggered by gnulib when compiling with MinGW.

15 years agoFix apibuild.py warnings about missing ':'
Matthias Bolte [Wed, 14 Apr 2010 22:58:01 +0000 (00:58 +0200)]
Fix apibuild.py warnings about missing ':'

15 years agoImplement variable length structure allocator
David Allan [Mon, 5 Apr 2010 17:11:34 +0000 (13:11 -0400)]
Implement variable length structure allocator

* This patch implements a memory allocator to obtain memory for
  structures whose last member is a variable length array.  C99 refers
  to these variable length objects as structs containing flexible
  array members.
* Fixed macro parentheses per Eric Blake

15 years agoqemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang
Jim Meyering [Wed, 7 Apr 2010 18:54:50 +0000 (20:54 +0200)]
qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang

* src/util/conf.c (virConfParseValue): Add an sa_assert.

15 years agoxend_internal.c: assure clang that we do not dereference NULL
Jim Meyering [Tue, 2 Mar 2010 15:07:30 +0000 (16:07 +0100)]
xend_internal.c: assure clang that we do not dereference NULL

* src/xen/xend_internal.c (xend_parse_sexp_desc_char): Add three
uses of sa_assert, each preceding a strchr(value,... to assure
clang that "value" is non-NULL.

15 years agoqemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang
Jim Meyering [Wed, 7 Apr 2010 15:27:50 +0000 (17:27 +0200)]
qemudDomainAttachSCSIDisk: avoid FP NULL-ptr-deref from clang

* src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk):
Initialize "cont" to NULL, so clang knows it's set.
Add an sa_assert so it knows it's non-NULL when dereferenced.

15 years agovirGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang
Jim Meyering [Wed, 7 Apr 2010 15:23:24 +0000 (17:23 +0200)]
virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang

* src/util/util.c (virGetHostnameLocalhost): Add an sa_assert
to tell clang it's ok to dereference "info" after a non-failing
getaddrinfo call.

15 years agonwfilter_ebiptables_driver.c: avoid NULL dereference
Jim Meyering [Mon, 29 Mar 2010 16:27:26 +0000 (18:27 +0200)]
nwfilter_ebiptables_driver.c: avoid NULL dereference

* src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesApplyNewRules):
Don't dereference a NULL or uninitialized pointer when given
an empty list of rules.  Add an sa_assert(inst) in each loop to
tell clang that the uses of "inst[i]" are valid.

15 years agobuild: set STATIC_ANALYSIS when running via clang or coverity
Jim Meyering [Wed, 7 Apr 2010 15:02:25 +0000 (17:02 +0200)]
build: set STATIC_ANALYSIS when running via clang or coverity

* configure.ac (STATIC_ANALYSIS): Define when run via clang's
scan-build or coverity-prevent's cov-build.
Use the CLANG_CC and COVERITY_BUILD_COMMAND envvars as witnesses.

15 years agosa_assert: assert-like macro, enabled only for use with static analyzers
Jim Meyering [Wed, 7 Apr 2010 14:13:17 +0000 (16:13 +0200)]
sa_assert: assert-like macro, enabled only for use with static analyzers

Among some here, there is a strong aversion to the use of "assert", yet
some others think it is essential (when applied judiciously) even --
perhaps "especially" -- at the heart of libraries and core hypervisor-
related code.
Here is a compromise that lets us make assertions about the code (e.g.,
to tell static analyzers about invariants) without even a hint of risk
of an abort.
* src/internal.h [STATIC_ANALYSIS]: Include <assert.h>.
(sa_assert): Define.  A no-op most of the time, but equivalent
to classical assert when STATIC_ANALYSIS is nonzero.

15 years agobuild: fix recent 'make syntax-check' failure
Eric Blake [Wed, 14 Apr 2010 17:23:09 +0000 (11:23 -0600)]
build: fix recent 'make syntax-check' failure

* src/esx/esx_vi_methods.h: Placate cppi.

15 years agovirt-aa-helper-test: avoid non-portable echo -n
Eric Blake [Wed, 14 Apr 2010 15:51:45 +0000 (09:51 -0600)]
virt-aa-helper-test: avoid non-portable echo -n

* tests/virt-aa-helper-test (testme): Use printf instead.

15 years agoschematestutils.sh: improve shell portability: avoid "echo -e"
Jim Meyering [Wed, 14 Apr 2010 11:25:46 +0000 (13:25 +0200)]
schematestutils.sh: improve shell portability: avoid "echo -e"

* tests/schematestutils.sh: Use printf rather than echo -e.

15 years agovirStorageBackendFileSystemMount: prefer strdup over virAsprintf
Jim Meyering [Wed, 14 Apr 2010 08:03:03 +0000 (10:03 +0200)]
virStorageBackendFileSystemMount: prefer strdup over virAsprintf

* src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
Use virAsprintf only when needed.  In this case, strdup works fine.

15 years agovirStorageBackendFileSystemMount: placate clang
Jim Meyering [Wed, 14 Apr 2010 08:00:53 +0000 (10:00 +0200)]
virStorageBackendFileSystemMount: placate clang

* src/storage/storage_backend_fs.c (virStorageBackendFileSystemMount):
Clang was not smart enough, and mistakenly reported that "options"
could be used uninitialized.  Initialize it.

15 years agoImplement forgotten backend of virInterfaceIsActive()
Laine Stump [Tue, 13 Apr 2010 17:22:56 +0000 (13:22 -0400)]
Implement forgotten backend of virInterfaceIsActive()

Somehow the backend of this function was never implemented in
libvirt's netcf driver, and nobody noticed until now. (The required
netcf function was already in place, so nothing needs to change
there.)
* src/interface/netcf_driver.c: add in the backend function, and point
                                to it from the table of driver functions.