Commit Graph

5414 Commits

Author SHA1 Message Date
Chris Lalancette
87d2e4ba56 Fix a qemuDomainPCIAddressSetFree memory leak
qemuDomainPCIAddressSetFree was freeing up the hash
table for the pci addresses, but not freeing up the addr
structure.  Looking over the callers of this function, it
seems like they expect it to also free up the structure,
so do that here.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-29 09:16:14 -04:00
Chris Lalancette
18b3096c40 Fix a memory leak in the node_device_udev code
We were over-writing a pointer without freeing it in
case of a disk device, leading to a memory leak.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-29 09:15:54 -04:00
Chris Lalancette
50250aba36 Fix build on Ubuntu.
When building on Ubuntu with make -j3 (or more), it would always
fail when trying to build virt-aa-helper.  I'm not an expert in
automake by any means, but I think the entry for virt-aa-helper
is mis-using LDADD; it shouldn't be putting direct paths to
libvirt_conf.la and libvirt_util.la, but instead referencing those
names.  With this patch in place, I'm able to successfully build
on Ubuntu 9.04 with make -j3.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-29 09:15:30 -04:00
Chris Lalancette
34b3c64a98 Report better error if qemuSnapshotIsAllowed failed.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-29 09:15:07 -04:00
Daniel P. Berrange
bdb844e996 Remove unused goto label from qemudDomainCreate
The previous commit changes a goto from 'endjob' to 'cleanup',
leaving the endjob label unused. Remove it to avoid compile
warning.

* src/qemu/qemu_driver.c: Remove 'endjob' label
2010-04-29 12:13:02 +01:00
Stefan Berger
f7366d84f4 nwfilter: python bindings for nwfilter
I have primarily followed the pattern of the 'secret' driver to provide
support for the missing python bindings for the network filter API.
2010-04-29 06:46:01 -04:00
Jim Meyering
ba1072f0ac qemuDomainSnapshotCreateXML: avoid NULL dereferences
* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): When setting
"vm" to NULL, jump over vm-dereferencing code to "cleanup".
(qemuDomainRevertToSnapshot): Likewise.
2010-04-29 11:16:04 +02:00
Jim Meyering
5eec84aaa3 qemudDomainCreate: correct a slightly misdirected goto
* src/qemu/qemu_driver.c (qemudDomainCreate): Goto cleanup,
not "endjob", since we know "vm" is already NULL.  No semantic change.
2010-04-29 11:16:03 +02:00
Matthias Bolte
98fb83ce25 cygwin/mingw: Fix version script handling
Let configure detect ld instead of hardcoding /usr/bin/ld, because
MinGW may have ld in /bin.

Only use a .def file to export symbols on MinGW. Cygwin's ld supports
the normal .syms file used on Linux.
2010-04-28 23:49:00 +02:00
Eric Blake
5fe816eccd build: fix autogen rule for VPATH build
* cfg.mk (gnulib_srcdir): Override maint.mk default.
(_update_required): Run in correct directory.
2010-04-28 08:15:12 -06:00
Daniel Veillard
4e041189f8 Move dnsmasq host file to a separate directory
use /var/lib/libvirt/dnsmasq since /var/lib/libvirt/network is
unreadable by the dnsmasq binary

* src/network/bridge_driver.c: update DNSMASQ_STATE_DIR
* src/Makefile.am: create it on make install
* libvirt.spec.in: take the new directory into account
2010-04-28 15:53:09 +02:00
Stefan Berger
42f8b25b66 nwfilter: allow to mix filterrefs and rules in the schema
So far the references to other filters needed to appear before filtering
rules. With the below patch they can now appear in any order.

Also I forgot to add a couple of 'rarp's.
2010-04-28 09:12:39 -04:00
Daniel P. Berrange
51cd0196e5 Fix handling of security driver restore failures in QEMU domain save
In cases where the security driver failed to restore a label after a
guest has saved, we mistakenly jumped to the error cleanup paths.
This is not good, because the operation has in fact completed and
cannot be rolled back completely. Label restore is non-critical, so
just log the problem instead. Also add a missing restore call in
the error cleanup path

* src/qemu/qemu_driver.c: Fix handling of security driver
  restore failures in QEMU domain save
2010-04-28 13:51:55 +01:00
Daniel P. Berrange
712048bd9a Fix QEMU domain save to block devices with cgroups enabled
When cgroups is enabled, access to block devices is likely to be
restricted to a whitelist. Prior to saving a guest to a block device,
it is necessary to add the block device to the whitelist. This is
not required upon restore, since QEMU reads from stdin

* src/qemu/qemu_driver.c: Add block device to cgroups whitelist
  if neccessary during domain save.
2010-04-28 13:51:55 +01:00
Daniel P. Berrange
93e0b3c8d6 Fix QEMU save/restore with block devices
The save process was relying on use of the shell >> append
operator to ensure the save data was placed after the libvirt
header + XML. This doesn't work for block devices though.
Replace this code with use of 'dd' and its 'seek' parameter.
This means that we need to pad the header + XML out to a
multiple of dd block size (in this case we choose 512).

The qemuMonitorMigateToCommand() monitor API is used for both
save/coredump, and migration via UNIX socket. We can't simply
switch this to use 'dd' since this causes problems with the
migration usage. Thus, create a dedicated qemuMonitorMigateToFile
which can accept an filename + offset, and remove the filename
from the current qemuMonitorMigateToCommand() API

* src/qemu/qemu_driver.c: Switch to qemuMonitorMigateToFile
  for save and core dump
* 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: Create
  a new qemuMonitorMigateToFile, separate from the existing
  qemuMonitorMigateToCommand to allow handling file offsets
2010-04-28 13:51:48 +01:00
Daniel P. Berrange
ae42979a74 Avoid create/unlink with block devs used for QEMU save
It is possible to use block devices with domain save/restore. Upon
failure QEMU unlinks the path being saved to. This isn't good when
it is a block device !

* src/qemu/qemu_driver.c: Don't unlink block devices if save fails
2010-04-28 13:47:49 +01:00
Daniel P. Berrange
d7e0fe6e9f Fix crash when cleaning up from failed save attempt
If a transient QEMU crashes during save attempt, then the virDomainPtr
object may be freed. If a persistent QEMU crashes during save, then
the 'priv->mon' field is no longer valid since it will be inactive.

* src/qemu/qemu_driver.c: Fix two crashes when QEMU exits
  during a save attempt
2010-04-28 13:45:34 +01:00
Stefan Berger
ed7813d28d nwfilter: let qemu's after-migration packet pass
Qemu currently sends an Ethernet packet with protocol id 0x835 once a VM
was successfully migrated. The content of the packet looks like a
gratuitous RARP, just with the wrong protocol ID, which should be
0x8035. I wrote some filters to let either one of the packets pass and
am adapting the clean-traffic sample filter to use it. I am also
doing some changes on the existing ARP filter which was lacking a
test for source MAC address.
2010-04-27 14:50:35 -04:00
Chris Lalancette
71f99af5a4 Fix up the error message if we can't parse the snapshot XML.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-27 14:11:36 -04:00
Klaus Ethgen
75d88455f5 The base used for conversion of USB values should be 16 not 10.
Signed-off-by: Guido Günther <agx@sigxcpu.org>
2010-04-27 19:47:54 +02:00
Chris Lalancette
b69bbebbba Fix up the locking in the snapshot code.
In particular I was forgetting to take the qemuMonitorPrivatePtr
lock (via qemuDomainObjBeginJob), which would cause problems
if two users tried to access the same domain at the same time.
This patch also fixes a problem where I was forgetting to remove
a transient domain from the list of domains.

Thanks to Stephen Shaw for pointing out the problem and testing
out the initial patch.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-27 10:40:36 -04:00
Daniel Veillard
0c4010a1d7 cleanup the download section of the documentation
Just removing reverences to the deprecated CVS server and the old git
on et.redhat.com
2010-04-27 14:20:51 +02:00
Stefan Berger
aea68ce906 nwfilter: add support for RAPR protocol
This patch adds support for the RARP protocol. This may be needed due to
qemu sending out a RARP packet (at least that's what it seems to want to
do even though the protocol id is wrong) when migration finishes and
we'd need a rule to let the packets pass.

Unfortunately my installation of ebtables does not understand -p RARP
and also seems to otherwise depend on strings in /etc/ethertype
translated to protocol identifiers. Therefore I need to pass -p 0x8035
for RARP. To generally get rid of the dependency of that file I switch
all so far supported protocols to use their protocol identifier in the
-p parameter rather than the string.

I am also extending the schema and added a test case.

changes from v1 to v2:
- added test case into patch
2010-04-27 07:26:12 -04:00
Jiri Denemark
35b6137696 Ignore qemu STOP event when stopping CPUs
With JSON qemu monitor, we get a STOP event from qemu whenever qemu
stops guests CPUs. The downside of it is that vm->state is changed to
PAUSED and a new generic paused event is send to applications. However,
when we ask qemu to stop the CPUs we are not really interested in qemu
event and we usually want to issue a more specific event.

By setting vm->status to PAUSED before actually sending the request to
qemu (and resetting it back if the request fails) we can ignore the
event since the event handler does nothing when the guest is already
paused. This solution is quite hacky but unfortunately it's the best
solution which I was able to come up with and it doesn't introduce a
race condition.
2010-04-27 12:14:47 +02:00
Jiri Denemark
29bca037aa Fix build with DEBUG_RAW_IO=1 2010-04-27 12:09:35 +02:00
David Allan
1b9347b5f1 Fix indentation for storage conf XML
* virStorageEncryptionFormat is called from both
  virDomainDiskDefFormat and virStorageVolTargetDefFormat.  The proper
  indentation in the generated XML depends on the caller.  My earlier
  patch to fix the incorrect indentation for the domain XML broke the
  indentation for the storage XML.  This patch adopts Laine's
  suggestion of requring the caller of virStorageEncryptionFormat to
  provide an unsigned int with the number of spaces the output should
  be indented.  The patch modifies both callers to provide the
  additional argument.

* Add a regression test for the domain XML

* src/conf/domain_conf.c src/conf/storage_conf.c
  src/conf/storage_encryption_conf.c src/conf/storage_encryption_conf.h:
  change the indentation code
* tests/qemuxml2xmltest.c
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.args
  tests/qemuxml2argvdata/qemuxml2argv-encrypted-disk.xml: add a regression test
2010-04-27 12:01:32 +02:00
Daniel Veillard
6b3ce82d98 Don't try to build qemu and lxc on non-Linux platforms
as their drivers requires linux only headers
2010-04-27 10:11:21 +02:00
Matthias Bolte
d707c86633 cygwin: Handle differences in the XDR implementation
Cygwin's XDR implementation defines xdr_u_int64_t instead of
xdr_uint64_t and lacks IXDR_PUT_INT32/IXDR_GET_INT32.

Alter the IXDR_GET_LONG regex in rpcgen_fix.pl so it doesn't destroy
the #define IXDR_GET_INT32 IXDR_GET_LONG in remote_protocol.x.

Also fix the remote_protocol.h regex in rpcgen_fix.pl.
2010-04-27 09:31:28 +02:00
Matthias Bolte
56c33caaec Cygwin's GCC doesn't like this .sa_handler initialization for some reason 2010-04-26 21:13:47 +02:00
Matthias Bolte
fe4ff24af8 linux/if.h header is not available on non-Linux platforms 2010-04-26 21:07:11 +02:00
Stefan Berger
5c7c755f50 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
2010-04-26 13:50:40 -04:00
Satoru SATOH
8fa9c22142 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
2010-04-26 17:20:02 +02:00
Satoru SATOH
51d203c676 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
2010-04-26 17:20:02 +02:00
Satoru SATOH
4ad65ab86a 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
2010-04-26 17:20:02 +02:00
Daniel Veillard
4ce54ef5c7 Fix make dist missing ESX generated files
new method generated files are missing from dist tarball.
2010-04-26 16:59:50 +02:00
Chris Lalancette
52ae076a94 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>
2010-04-23 14:23:27 -04:00
Chris Lalancette
21c6cfc213 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>
2010-04-23 14:22:48 -04:00
Chris Lalancette
5993321dc5 Fix virDomainSnapshotObjFree memory leak.
We were freeing the virDomainSnapshotDefPtr, but not
the virDomainSnapshotObjPtr in virDomainSnapshotObjFree.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:21:34 -04:00
Chris Lalancette
e129a63775 Make virDomainSnapshotObjListDeinit static.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
2010-04-23 14:20:56 -04:00
Chris Lalancette
4aa36a68a6 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>
2010-04-23 14:20:11 -04:00
Matthias Bolte
40648b156b cygwin: Check explicitly for getmntent_r
Cygwin has mntent.h but lacks getmntent_r. Update preprocessor
checks to catch this combination.
2010-04-23 20:15:53 +02:00
Matthias Bolte
d1be0aefa9 Some NWFilter symbols are conditional and have to be exported conditional 2010-04-23 19:51:00 +02:00
Matthias Bolte
87506c2bcf 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.
2010-04-23 19:51:00 +02:00
Matthias Bolte
258923f2eb 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.
2010-04-23 19:51:00 +02:00
Matthias Bolte
8d319a2f2d Improve configure error message about missing Linux headers 2010-04-23 19:51:00 +02:00
Eric Blake
d6daeb124b build: fix typo in previous commit
* configure.ac: Avoid syntax error.
2010-04-23 11:24:52 -06:00
Eric Blake
004aee6346 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.
2010-04-23 11:06:33 -06:00
Luiz Capitulino
eb9b653243 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()
2010-04-23 18:06:18 +02:00
Stefan Berger
9db01465e5 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.
2010-04-23 11:42:39 -04:00
Marco Bozzolan
2aed290ee9 maint: update AUTHORS
* AUTHORS: Use preferred name.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-04-23 07:48:10 -06:00