]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
15 years agoavoid link error in tests using libvirt_util; due to pthread_sigmask
Jim Meyering [Fri, 7 May 2010 14:23:44 +0000 (16:23 +0200)]
avoid link error in tests using libvirt_util; due to pthread_sigmask

* src/Makefile.am (libvirt_util_la_LDFLAGS): Add $(LIB_PTHREAD),
required, now that we're using gnulib's pthread module.

15 years agoRemove unused nwfilter field from struct remote_error
Matthew Booth [Fri, 7 May 2010 14:38:05 +0000 (16:38 +0200)]
Remove unused nwfilter field from struct remote_error

Change 965466c1 added a new field to struct remote_error, which broke
the RPC protocol. Fortunately the new field is unused, so this change
simply removes it again.

* src/remote/remote_protocol.(c|h|x): Remove remote_nwfilter from struct
  remote_error

15 years agoImplement SCSI disk unplugging
Wolfgang Mauerer [Wed, 5 May 2010 14:52:15 +0000 (16:52 +0200)]
Implement SCSI disk unplugging

With the introduction of the generic qemu device model, unplugging
SCSI disks works like a charm, so support it in libvirt.

* src/qemu/qemu_driver.c: Add qemudDomainDetachSCSIDiskDevice() to do the
  unplugging, extend qemudDomainDetachDeviceAdd().

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agoqemu: use better types
Eric Blake [Thu, 6 May 2010 21:32:56 +0000 (15:32 -0600)]
qemu: use better types

* src/qemu/qemu_driver.c (qemudFindDisk): Mark parameter const.
(qemudShrinkDisks): Mark parameter unsigned.

15 years agoRefactor disk unplugging
Wolfgang Mauerer [Wed, 5 May 2010 14:52:14 +0000 (16:52 +0200)]
Refactor disk unplugging

We can reuse some of the code for other purposes.

Signed-off-by: Wolfgang Mauerer <wolfgang.mauerer@siemens.com>
15 years agobuild: simplify checks for sched.h
Eric Blake [Tue, 4 May 2010 23:18:28 +0000 (17:18 -0600)]
build: simplify checks for sched.h

* configure.ac: Remove redundant checks.

15 years agobuild: update gnulib
Eric Blake [Mon, 3 May 2010 21:00:43 +0000 (15:00 -0600)]
build: update gnulib

81 patches to gnulib, picks up several new syntax checks.

* .gnulib: Update to latest.
* .x-sc_prohibit_always_true_header_tests: New file.
* bootstrap.conf (gnulib_modules): Add sched.
* src/util/processinfo.c (includes): <sched.h> is now guaranteed.
* src/network/bridge_driver.c (includes): Drop useless
<strings.h>.
* src/openvz/openvz_conf.c (includes): Likewise.
* src/openvz/openvz_driver.c (includes): Likewise.
* src/phyp/phyp_driver.c (includes): Likewise.
* src/qemu/qemu_driver.c (includes): Likewise.
* src/uml/uml_driver.c (includes): Likewise.

15 years agobuild: drop more redundant configure checks
Eric Blake [Thu, 29 Apr 2010 03:26:57 +0000 (21:26 -0600)]
build: drop more redundant configure checks

* configure.ac (AC_CHECK_FUNCS_ONCE, AC_SYS_LARGEFILE): Rely on
gnulib for strtok_r and large file support.
(AC_OBJEXT): Drop call now done by AC_PROG_CC.
(m4_foreach_w): Drop macro guaranteed by gnulib.
(AC_C_CONST): Drop call declared obsolete by autoconf.

Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agobuild: use gnulib's sys/wait.h
Eric Blake [Thu, 29 Apr 2010 03:31:16 +0000 (21:31 -0600)]
build: use gnulib's sys/wait.h

* configure.ac: Drop sys/wait.h check.
* src/libvirt.c (includes): Use header unconditionally.
* src/remote/remote_driver.c (includes): Likewise.
* src/storage/storage_backend.c (includes): Likewise.
* src/util/ebtables.c (includes): Likewise.
* src/util/hooks.c (includes): Likewise.
* src/util/iptables.c (includes): Likewise.
* src/util/util.c (includes): Likewise.

15 years agobuild: use gnulib's uname
Eric Blake [Thu, 29 Apr 2010 03:06:46 +0000 (21:06 -0600)]
build: use gnulib's uname

* bootstrap.conf (gnulib_modules): Add uname.
* configure.ac: Drop uname and sys/utsname.h checks.
* src/nodeinfo.c (nodeGetInfo): Use uname unconditionally.

15 years agobuild: rely on gnulib's pthread module
Eric Blake [Thu, 29 Apr 2010 02:39:11 +0000 (20:39 -0600)]
build: rely on gnulib's pthread module

Gnulib can guarantee that pthread.h exists, but for now, it is a dummy
header with no support for most pthread_* functions.  Modify our
use of pthread to use function checks, rather than header checks,
to determine how much pthread support is present.

* bootstrap.conf (gnulib_modules): Add pthread.
* configure.ac: Drop all pthread.h checks.  Optimize function
checks.  Add check for pthread functions.
* src/Makefile.am (libvirt_lxc_LDADD): Ensure proper link.
* src/remote/remote_driver.c (remoteIOEventLoop): Depend on
pthread_sigmask, now that gnulib guarantees pthread.h.
* src/util/util.c (virFork): Likewise.
* src/util/threads.c (threads-pthread.c): Depend on
pthread_mutexattr_init, as a witness of full pthread support.
* src/util/threads.h (threads-pthread.h): Likewise.

15 years agobuild: silence a clang false positive
Eric Blake [Wed, 5 May 2010 17:14:54 +0000 (11:14 -0600)]
build: silence a clang false positive

* src/qemu/qemu_monitor.c (qemuMonitorIOWriteWithFD): Work around
recent clang shortcoming in analysis.

15 years agorpmbuild: add ebtables & ip(6)tables dependency for rpm
Stefan Berger [Wed, 5 May 2010 16:20:28 +0000 (12:20 -0400)]
rpmbuild: add ebtables & ip(6)tables dependency for rpm

Add ebtables,iptables & iptables-ipv6 dependency to rpm.

Changes from V1 to V2:
  -passing --without-libpcap to configure script, if libpcap is not to be used

15 years agoutil: fix va_start usage bug
Eric Blake [Tue, 4 May 2010 22:07:18 +0000 (16:07 -0600)]
util: fix va_start usage bug

Detected by clang.  POSIX requires that the second argument to
va_start be the name of the last variable; and in some implementations,
passing *path instead of path would dereference bogus memory instead
of pulling arguments off the stack.

* src/util/util.c (virBuildPathInternal): Use correct argument to
va_start.

15 years agoqemu: live migration with non-shared storage for kvm
Kenneth Nagin [Tue, 4 May 2010 21:36:42 +0000 (15:36 -0600)]
qemu: live migration with non-shared storage for kvm

Support for live migration between hosts that do not share storage was
added to qemu-kvm release 0.12.1.
It supports two flags:
-b migration without shared storage with full disk copy
-i migration without shared storage with incremental copy (same base image
shared between source and destination).

I tested the live migration without shared storage (both flags) for native
and p2p with and without tunnelling.  I also verified that the fix doesn't
affect normal migration with shared storage.

15 years agoconfigure.ac: Avoid uname, which breaks cross-compilation
Matthias Bolte [Mon, 3 May 2010 23:41:55 +0000 (01:41 +0200)]
configure.ac: Avoid uname, which breaks cross-compilation

When cross-compiling on Linux, configure will misdetect the target as
Linux because it uses uname instead of relying on the $host variable.
This results in including libvirt_linux.syms into libvirt.syms and
therefore trying to export undefined symbols.

Replace uname checks with $host checks to fix this.

15 years agoDon't wipe generated iface target in active domains
Jiri Denemark [Tue, 4 May 2010 13:16:29 +0000 (15:16 +0200)]
Don't wipe generated iface target in active domains

Wipe generated interface target only when reading configuration of
inactive domains.

15 years agoVarious fixes for the spec file
Daniel Veillard [Tue, 4 May 2010 14:13:55 +0000 (16:13 +0200)]
Various fixes for the spec file

This includes various things:
 - fix the Requires: libvirt-client to use %{name} to allow easy
   renaming
 - when building ESX support one need libcurl-devel
 - remove Makefile[.in] from xml/nwfilter in the docs, as this breaks
   parallel install ation of i686 and x86_64 packages
 - don't include nwfilter config files if not building with the daemon
all relatively trivial which is why I packed them together
* libvirt.spec.in: fix various small bugs

15 years agodocs: hacking: explain why using curly braces well is important
Jim Meyering [Thu, 15 Apr 2010 17:31:04 +0000 (19:31 +0200)]
docs: hacking: explain why using curly braces well is important

* docs/hacking.html.in: Use the "curly braces" section from coreutils'
HACKING, adapting for libvirt's different formatting style.
* HACKING: Sync from the above, still mostly manually.

15 years agolxc: Check domain is active/inactive as required by operation
Jiri Denemark [Mon, 3 May 2010 12:04:44 +0000 (14:04 +0200)]
lxc: Check domain is active/inactive as required by operation

Report VIR_ERR_OPERATION_INVALID when operation which requires running
domain is called on inactive domain and vice versa.

15 years agolxc: Make SetMemory work for active domains only
Jiri Denemark [Mon, 3 May 2010 12:02:56 +0000 (14:02 +0200)]
lxc: Make SetMemory work for active domains only

15 years agolxc: Use virDomainFindByUUID for domain lookup
Jiri Denemark [Mon, 3 May 2010 11:59:03 +0000 (13:59 +0200)]
lxc: Use virDomainFindByUUID for domain lookup

Consistently use virDomainFindByUUID instead of virDomainFindByID and
virDomainFindByName and report VIR_ERR_NO_DOMAIN when domain cannot be
found.

15 years agomingw: Fix two undefined symbols
Matthias Bolte [Mon, 3 May 2010 23:05:44 +0000 (01:05 +0200)]
mingw: Fix two undefined symbols

Add an empty body for virCondWaitUntil and move virPipeReadUntilEOF
out of the '#ifndef WIN32' block, because it compiles fine with MinGW
in combination with gnulib.

15 years agobuild: avoid compiler warning
Eric Blake [Thu, 29 Apr 2010 03:36:03 +0000 (21:36 -0600)]
build: avoid compiler warning

Necessary on cygwin, where uid_t and gid_t are 4-byte long rather
than int, causing gcc -Wformat warnings.

* src/util/util.c (virFileOperationNoFork, virDirCreateNoFork)
(virFileOperation, virDirCreate, virGetUserEnt): Cast uid_t and
gid_t before passing to printf.
* .gitignore: Ignore Windows executables.

15 years agonwfilter: skip some interfaces on filter update
Stefan Berger [Mon, 3 May 2010 22:14:58 +0000 (18:14 -0400)]
nwfilter: skip some interfaces on filter update

When a filter is updated, only those interfaces must have their old
rules cleared that either reference the filter directly or indirectly
through another filter. Remember between the different steps of the
instantiation of the filters which interfaces must be skipped. I am
using a hash map to remember the names of the interfaces and store a
bogus pointer to ~0 into it that need not be freed.

15 years agopass info where request stems from to have rules applied
Stefan Berger [Mon, 3 May 2010 22:11:48 +0000 (18:11 -0400)]
pass info where request stems from to have rules applied

For the decision on whether to instantiate the rules, the check for a
pending IP address learn request is not sufficient since then only the
thread could instantiate the rules. So, a boolean needs to be passed
when the thread instantiates the filter rules late and the IP address
learn request is still pending in order to override the check for the
pending learn request. If the rules are to be updated while the thread
is active, this will not be done immediately but the thread will do that
later on.

15 years agobuild: prefer WIN32 over __MINGW32__ checks
Eric Blake [Mon, 3 May 2010 20:44:12 +0000 (14:44 -0600)]
build: prefer WIN32 over __MINGW32__ checks

WIN32 is always defined when __MINGW32__ is defined, but the
converse is not true.  WIN32 is more generic, if someone were
to ever attempt porting to a microsoft compiler.  This does
not affect Cygwin, which intentionally does not define WIN32.

* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Use more
generic flag macro.
* src/storage/storage_backend.c
(virStorageBackendUpdateVolTargetInfoFD)
(virStorageBackendRunProgRegex): Likewise.
* tools/console.h (vshRunConsole): Likewise.

15 years agocgroup: Fix possible memory leak in virCgroupMakeGroup
Ryota Ozaki [Mon, 3 May 2010 19:04:51 +0000 (04:04 +0900)]
cgroup: Fix possible memory leak in virCgroupMakeGroup

* src/util/cgroup.c: free temporal path string before breaking loop

15 years agodnsmasqReload: avoid mingw link failure
Eric Blake [Mon, 3 May 2010 18:23:50 +0000 (12:23 -0600)]
dnsmasqReload: avoid mingw link failure

* src/util/dnsmasq.c (dnsmasqReload): Mingw lacks kill, but is not
running a dnsmasq daemon either.

15 years agomingw: Fix symbol export
Matthias Bolte [Mon, 3 May 2010 10:21:58 +0000 (12:21 +0200)]
mingw: Fix symbol export

In commit 98fb83ce25f46e0236706fa6e0943032d921935f I changed the
version script handling. But it seems that I didn't test this properly
and broke it. The .def file is passed to the compiler directly, but it
should get passed to the linker instead.

Set VERSION_SCRIPT_FLAGS to -Wl, to pass the .def file correctly to
the linker.

This fixes the undefined symbol errors while linking virsh.

15 years agodnsmasq.c: Fix OOM error reporting
Matthias Bolte [Mon, 3 May 2010 10:26:42 +0000 (12:26 +0200)]
dnsmasq.c: Fix OOM error reporting

Also do some indentation clean up.

15 years agoFix memory leaks in cmdInterfaceEdit and cmdNWFilterEdit.
Laine Stump [Sat, 1 May 2010 04:16:52 +0000 (00:16 -0400)]
Fix memory leaks in cmdInterfaceEdit and cmdNWFilterEdit.

This applies a fix to thos functions similar to that made to cmdEdit
in 270895063d1cf86ab42fa220a8d090c24d58dbc0, thus fnixing a memory
leak - if tmp is unlinked and NULLed early in the function, the memory
used by tmp is never freed. Since we will always unlink tmp prior to
freeing its memory at the end of the function, just remove the earlier
code and let cleanup: do the cleanup.

15 years agolxc: Fix failure on starting a domain with multiple interfaces
Ryota Ozaki [Mon, 3 May 2010 09:13:26 +0000 (11:13 +0200)]
lxc: Fix failure on starting a domain with multiple interfaces

[Error message]
error: Failed to start domain lxc_test1
error: internal error Failed to create veth device pair: 512

The reason of the failure is that lxc driver unexpectedly re-uses
an auto-assigned veth name and tries to create the created veth
again. The failure will happen when a domain has multiple network
interfaces and the names of those are not specified in XML.

The patch fixes the problem by resetting buffers of veth names
in every iteration of creating veth.

* src/lxc/lxc_driver.c: prevent re-using auto-assigned veth name
  Reported by Kumar L Srikanth-B22348.

15 years agoautobuild.sh: provide default prefix
Eric Blake [Fri, 30 Apr 2010 16:57:10 +0000 (10:57 -0600)]
autobuild.sh: provide default prefix

Without this patch and with a clean environment, ./autobuild.sh
tried to use ./configure --prefix=/, and fails.

* autobuild.sh (AUTOBUILD_INSTALL_ROOT): Provide sensible
default.  Suggested by Daniel P. Berrange.

15 years agoRelease of libvirt-0.8.1
Daniel Veillard [Fri, 30 Apr 2010 16:55:08 +0000 (18:55 +0200)]
Release of libvirt-0.8.1

* configure.ac docs/news.html.in libvirt.spec.in: updates for release
* po/*.po*: updated localizations and regenerated

15 years agodomain: Fix PCI address decimal parsing regression
Cole Robinson [Fri, 30 Apr 2010 16:14:35 +0000 (18:14 +0200)]
domain: Fix PCI address decimal parsing regression

<hostdev> address parsing previously attempted to detect the number
base: currently it is hardcoded to base 16, which can break PCI
assignment via virt-manager. Revert to the previous behavior.

* src/conf/domain_conf.c: virDomainDevicePCIAddressParseXML, switch to
  virStrToLong_ui(bus, NULL, 0, ...) to autodetect base

15 years agoAdd support for another explicit IO error event
Daniel P. Berrange [Thu, 18 Mar 2010 19:37:44 +0000 (19:37 +0000)]
Add support for another explicit IO error event

This introduces a new event type

   VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON

This event is the same as the previous VIR_DOMAIN_ID_IO_ERROR
event, but also includes a string describing the cause of
the event.

Thus there is a new callback definition for this event type

typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn,
                                                           virDomainPtr dom,
                                                           const char *srcPath,
                                                           const char *devAlias,
                                                           int action,
                                                           const char *reason,
                                                           void *opaque);

This is currently wired up to the QEMU block IO error events

* daemon/remote.c: Dispatch IO error events to client
* examples/domain-events/events-c/event-test.c: Watch for
  IO error events
* include/libvirt/libvirt.h.in: Define new IO error event ID
  and callback signature
* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Extend API to handle IO error events
* src/qemu/qemu_driver.c: Connect to the QEMU monitor event
  for block IO errors and emit a libvirt IO error event
* src/remote/remote_driver.c: Receive and dispatch IO error
  events to application
* src/remote/remote_protocol.x: Wire protocol definition for
  IO error events
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
  src/qemu/qemu_monitor_json.c: Watch for BLOCK_IO_ERROR event
  from QEMU monitor

15 years agoReport all errors in SELinuxRestoreSecurityFileLabel
Jiri Denemark [Fri, 30 Apr 2010 11:35:15 +0000 (13:35 +0200)]
Report all errors in SELinuxRestoreSecurityFileLabel

15 years agoPrevent updates while IP address learn thread is running
Stefan Berger [Fri, 30 Apr 2010 12:12:26 +0000 (08:12 -0400)]
Prevent updates while IP address learn thread is running

Prevent updating and tearing down of filter while the IP
address learning thread is running and has its own filtering
rules applied.

15 years agoSyncronize the teardown of rules with the thread
Stefan Berger [Fri, 30 Apr 2010 12:10:12 +0000 (08:10 -0400)]
Syncronize the teardown of rules with the thread

Introduce a function to notify the IP address learning
thread to terminate and thus release the lock on the interface.
Notify the thread before grabbing the lock on the interface
and tearing down the rules. This prevents a 'virsh destroy' to
tear down the rules that the IP address learning thread has
applied.

15 years agoClean all tables before applying 'basic' rules
Stefan Berger [Fri, 30 Apr 2010 12:06:18 +0000 (08:06 -0400)]
Clean all tables before applying 'basic' rules

The functions invoked by the IP address learning thread
that apply some basic filtering rules did not clean up
any previous filtering rules that may still be there
(due to a libvirt restart for example). With the
patch below all the rules are cleaned up first.

Also, I am introducing a function to drop all traffic
in case the IP address learning thread could not apply
the rules.

15 years agoMAke virFileHasSuffix case insensitive
Daniel Veillard [Fri, 30 Apr 2010 12:03:41 +0000 (14:03 +0200)]
MAke virFileHasSuffix case insensitive

* src/util/util.c: as it's used for checking things like .iso suffixes

15 years agonwfilter: Also pick IP address from a DHCP ACK message
Stefan Berger [Fri, 30 Apr 2010 11:51:47 +0000 (07:51 -0400)]
nwfilter: Also pick IP address from a DHCP ACK message

The local DHCP server on virtbr0 sends DHCP ACK messages when a VM is
started and requests an IP address while the initial DHCP lease on the
VM's MAC address hasn't expired. So, also pick the IP address of the VM
if that type of message is seen.
Thanks to Gerhard Stenzel for providing a test case for this.

Changes from V1 to V2:
- cleanup: replacing DHCP option numbers through constants

15 years agoFix virt-pki-validate's determination of CN
Dustin Kirkland [Thu, 29 Apr 2010 21:20:50 +0000 (16:20 -0500)]
Fix virt-pki-validate's determination of CN

Ubuntu's gntls package generates an Issuer line that looks like this:
        Issuer: C=US,ST=NY,L=Rochester,O=example.com,CN=example.com CA,EMAIL=hostmaster@example.com

While Red Hat's looks like this
Issuer: CN=Red Hat Emerging Technologies

Note the leading whitespace, and the additional fields in the former.

This patch updates the regular expression to:
 * trim leading characters before "Issuer:"
 * trim anything between Issuer: and CN=
 * trim anything after the next ,

I've tested this against the certool output of both RH and Ubuntu
generated certs.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
15 years agoqemudDomainSaveFlag: remove dead store
Jim Meyering [Thu, 29 Apr 2010 15:56:01 +0000 (17:56 +0200)]
qemudDomainSaveFlag: remove dead store

* src/qemu/qemu_driver.c (qemudDomainSaveFlag): Remove dead store to "rc".

15 years agoFix detection of disk in IO events
Daniel P. Berrange [Wed, 28 Apr 2010 14:14:47 +0000 (15:14 +0100)]
Fix detection of disk in IO events

When using -device syntax, the IO event will have a different
prefix, 'drive-' that needs to be skipped over before matching
against the libvirt disk alias

* src/qemu/qemu_driver.c: Skip QEMU_DRIVE_HOST_PREFIX in IO event

15 years agoImplement python binding for virDomainGetBlockInfo
Daniel P. Berrange [Wed, 28 Apr 2010 12:42:13 +0000 (13:42 +0100)]
Implement python binding for virDomainGetBlockInfo

This binds the virDomainGetBlockInfo API to python's blockInfo
method on the domain object

>>> c = libvirt.openReadOnly('qemu:///session')
>>> d = c.lookupByName('demo')
>>> f = d.blockInfo("/dev/loop0", 0)
>>> print f
[1048576000L, 104857600L, 104857600L]

* python/libvirt-override-api.xml: Define override signature
* python/generator.py: Skip C impl generator for virDomainGetBlockInfo
* python/libvirt-override.c: Manual impl of virDomainGetBlockInfo

15 years agoAdd new domblkinfo command to virsh
Daniel P. Berrange [Tue, 27 Apr 2010 19:31:58 +0000 (20:31 +0100)]
Add new domblkinfo command to virsh

  virsh # domblkinfo demoguest /dev/hda2
  Capacity:       1048576000
  Allocation:     104857600
  Physical:       104857600

* tools/virsh.c: Implement domblkinfo command mapping to the
  new virDomainGetBlockInfo API

15 years agoImplement virDomainGetBlockInfo in QEMU driver
Daniel P. Berrange [Tue, 27 Apr 2010 19:31:09 +0000 (20:31 +0100)]
Implement virDomainGetBlockInfo in QEMU driver

* src/qemu/qemu_driver.c: Implementation of virDomainGetBlockInfo
* src/util/storage_file.h: Add DEV_BSIZE
* src/storage/storage_backend.c: Remove DEV_BSIZE

15 years agoRemote protocol impl for virDomainGetBlockInfo
Daniel P. Berrange [Tue, 27 Apr 2010 19:29:15 +0000 (20:29 +0100)]
Remote protocol impl for virDomainGetBlockInfo

* daemon/remote.c: Server side dispatcher
* daemon/remote_dispatch_args.h, daemon/remote_dispatch_prototypes.h,
  daemon/remote_dispatch_ret.h, daemon/remote_dispatch_table.h: Update
  with new API
* src/remote/remote_driver.c: Client side dispatcher
* src/remote/remote_protocol.c, src/remote/remote_protocol.h: Update
* src/remote/remote_protocol.x: Define new wire protocol

15 years agoInternal driver API infrastructure for virDomainGetBlockInfo
Daniel P. Berrange [Tue, 27 Apr 2010 19:27:34 +0000 (20:27 +0100)]
Internal driver API infrastructure for virDomainGetBlockInfo

This defines the internal driver API and stubs out each driver

* src/driver.h: Define virDrvDomainGetBlockInfo signature
* src/libvirt.c, src/libvirt_public.syms: Glue public API to drivers
* src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c,
  src/openvz/openvz_driver.c, src/phyp/phyp_driver.c,
  src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c,
  src/xen/xen_driver.c, src/xenapi/xenapi_driver.c: Stub out driver

15 years agoAdd virDomainGetBlockInfo API to query disk sizing
Daniel P. Berrange [Tue, 27 Apr 2010 19:24:30 +0000 (20:24 +0100)]
Add virDomainGetBlockInfo API to query disk sizing

Some applications need to be able to query a guest's disk info,
even for paths not managed by the storage pool APIs. This adds
a very simple API to get this information, modelled on the
virStorageVolGetInfo API, but with an extra field 'physical'.
Normally 'physical' and 'allocation' will be identical, but
in the case of a qcow2-like file stored inside a block device
'physical' will give the block device size, while 'allocation'
will give the qcow2 image size

* include/libvirt/libvirt.h.in: Define virDomainGetBlockInfo

15 years agoFix a virsh edit memory leak
Chris Lalancette [Wed, 28 Apr 2010 19:50:06 +0000 (15:50 -0400)]
Fix a virsh edit memory leak

When running virsh edit, we are unlinking and setting
the tmp variable to NULL before going to the end of the
function, meaning that we never free tmp.  Since the
exit to the function will always unlink and free tmp,
just remove this bit of code and let it get done at the
end.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix a qemuDomainPCIAddressSetFree memory leak
Chris Lalancette [Wed, 28 Apr 2010 19:49:41 +0000 (15:49 -0400)]
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>
15 years agoFix a memory leak in the node_device_udev code
Chris Lalancette [Wed, 28 Apr 2010 19:49:10 +0000 (15:49 -0400)]
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>
15 years agoFix build on Ubuntu.
Chris Lalancette [Mon, 26 Apr 2010 13:41:07 +0000 (09:41 -0400)]
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>
15 years agoReport better error if qemuSnapshotIsAllowed failed.
Chris Lalancette [Fri, 23 Apr 2010 15:59:23 +0000 (11:59 -0400)]
Report better error if qemuSnapshotIsAllowed failed.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove unused goto label from qemudDomainCreate
Daniel P. Berrange [Thu, 29 Apr 2010 11:13:02 +0000 (12:13 +0100)]
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

15 years agonwfilter: python bindings for nwfilter
Stefan Berger [Thu, 29 Apr 2010 10:46:01 +0000 (06:46 -0400)]
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.

15 years agoqemuDomainSnapshotCreateXML: avoid NULL dereferences
Jim Meyering [Tue, 27 Apr 2010 20:35:32 +0000 (22:35 +0200)]
qemuDomainSnapshotCreateXML: avoid NULL dereferences

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): When setting
"vm" to NULL, jump over vm-dereferencing code to "cleanup".
(qemuDomainRevertToSnapshot): Likewise.

15 years agoqemudDomainCreate: correct a slightly misdirected goto
Jim Meyering [Tue, 27 Apr 2010 20:16:02 +0000 (22:16 +0200)]
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.

15 years agocygwin/mingw: Fix version script handling
Matthias Bolte [Tue, 27 Apr 2010 07:43:55 +0000 (09:43 +0200)]
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.

15 years agobuild: fix autogen rule for VPATH build
Eric Blake [Tue, 27 Apr 2010 20:39:40 +0000 (14:39 -0600)]
build: fix autogen rule for VPATH build

* cfg.mk (gnulib_srcdir): Override maint.mk default.
(_update_required): Run in correct directory.

15 years agoMove dnsmasq host file to a separate directory
Daniel Veillard [Wed, 28 Apr 2010 13:38:47 +0000 (15:38 +0200)]
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

15 years agonwfilter: allow to mix filterrefs and rules in the schema
Stefan Berger [Wed, 28 Apr 2010 13:12:39 +0000 (09:12 -0400)]
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.

15 years agoFix handling of security driver restore failures in QEMU domain save
Daniel P. Berrange [Thu, 22 Apr 2010 16:16:47 +0000 (17:16 +0100)]
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

15 years agoFix QEMU domain save to block devices with cgroups enabled
Daniel P. Berrange [Wed, 21 Apr 2010 15:44:40 +0000 (16:44 +0100)]
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.

15 years agoFix QEMU save/restore with block devices
Daniel P. Berrange [Wed, 21 Apr 2010 13:06:37 +0000 (14:06 +0100)]
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

15 years agoAvoid create/unlink with block devs used for QEMU save
Daniel P. Berrange [Wed, 21 Apr 2010 10:42:50 +0000 (11:42 +0100)]
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

15 years agoFix crash when cleaning up from failed save attempt
Daniel P. Berrange [Mon, 19 Apr 2010 14:41:48 +0000 (15:41 +0100)]
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

15 years agonwfilter: let qemu's after-migration packet pass
Stefan Berger [Tue, 27 Apr 2010 18:50:35 +0000 (14:50 -0400)]
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.

15 years agoFix up the error message if we can't parse the snapshot XML.
Chris Lalancette [Fri, 23 Apr 2010 15:58:14 +0000 (11:58 -0400)]
Fix up the error message if we can't parse the snapshot XML.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoThe base used for conversion of USB values should be 16 not 10.
Klaus Ethgen [Tue, 27 Apr 2010 07:20:47 +0000 (09:20 +0200)]
The base used for conversion of USB values should be 16 not 10.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
15 years agoFix up the locking in the snapshot code.
Chris Lalancette [Thu, 22 Apr 2010 16:01:56 +0000 (12:01 -0400)]
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>
15 years agocleanup the download section of the documentation
Daniel Veillard [Tue, 27 Apr 2010 12:20:51 +0000 (14:20 +0200)]
cleanup the download section of the documentation

Just removing reverences to the deprecated CVS server and the old git
on et.redhat.com

15 years agonwfilter: add support for RAPR protocol
Stefan Berger [Tue, 27 Apr 2010 11:26:12 +0000 (07:26 -0400)]
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

15 years agoIgnore qemu STOP event when stopping CPUs
Jiri Denemark [Tue, 27 Apr 2010 08:10:31 +0000 (10:10 +0200)]
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.

15 years agoFix build with DEBUG_RAW_IO=1
Jiri Denemark [Tue, 27 Apr 2010 08:11:46 +0000 (10:11 +0200)]
Fix build with DEBUG_RAW_IO=1

15 years agoFix indentation for storage conf XML
David Allan [Tue, 27 Apr 2010 10:01:32 +0000 (12:01 +0200)]
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

15 years agoDon't try to build qemu and lxc on non-Linux platforms
Daniel Veillard [Tue, 27 Apr 2010 08:11:21 +0000 (10:11 +0200)]
Don't try to build qemu and lxc on non-Linux platforms

as their drivers requires linux only headers

15 years agocygwin: Handle differences in the XDR implementation
Matthias Bolte [Sun, 25 Apr 2010 11:31:31 +0000 (13:31 +0200)]
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.

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.