]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/log
people/liuw/libxenctrl-split/libvirt.git
15 years agoIntroduce a new public API for domain events
Daniel P. Berrange [Thu, 18 Mar 2010 13:01:48 +0000 (13:01 +0000)]
Introduce a new public API for domain events

The current API for domain events has a number of problems

 - Only allows for domain lifecycle change events
 - Does not allow the same callback to be registered multiple times
 - Does not allow filtering of events to a specific domain

This introduces a new more general purpose domain events API

  typedef enum {
     VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0,       /* virConnectDomainEventCallback */
      ...more events later..
  }

  int virConnectDomainEventRegisterAny(virConnectPtr conn,
                                       virDomainPtr dom, /* Optional, to filter */
                                       int eventID,
                                       virConnectDomainEventGenericCallback cb,
                                       void *opaque,
                                       virFreeCallback freecb);

  int virConnectDomainEventDeregisterAny(virConnectPtr conn,
                                         int callbackID);

Since different event types can received different data in the callback,
the API is defined with a generic callback. Specific events will each
have a custom signature for their callback. Thus when registering an
event it is neccessary to cast the callback to the generic signature

eg

  int myDomainEventCallback(virConnectPtr conn,
                            virDomainPtr dom,
                            int event,
                            int detail,
                            void *opaque)
  {
    ...
  }

  virConnectDomainEventRegisterAny(conn, NULL,
                                   VIR_DOMAIN_EVENT_ID_LIFECYCLE,
                                   VIR_DOMAIN_EVENT_CALLBACK(myDomainEventCallback)
                                   NULL, NULL);

The VIR_DOMAIN_EVENT_CALLBACK() macro simply does a "bad" cast
to the generic signature

* include/libvirt/libvirt.h.in: Define new APIs for registering
  domain events
* src/driver.h: Internal driver entry points for new events APIs
* src/libvirt.c: Wire up public API to driver API for events APIs
* src/libvirt_public.syms: Export new APIs
* 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/qemu/qemu_driver.c, src/remote/remote_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 new API entries

15 years agomaint: update syntax-check rule to also catch test's -o operator
Eric Blake [Fri, 26 Mar 2010 07:41:05 +0000 (08:41 +0100)]
maint: update syntax-check rule to also catch test's -o operator

* cfg.mk (sc_prohibit_test_minus_a): Rename...
(sc_prohibit_test_minus_ao): ...and flag '-o', too.

15 years agotests: teach syntax-check that virDomainDefFree has free-like semantics
Jim Meyering [Thu, 25 Mar 2010 20:53:29 +0000 (21:53 +0100)]
tests: teach syntax-check that virDomainDefFree has free-like semantics

* cfg.mk (useless_free_options): Add virDomainDefFree to the list
of free-like functions.
* src/test/test_driver.c (testDomainCreateXML): Remove useless-if-
before-virDomainDefFree.
* src/conf/domain_conf.c (virDomainAssignDef): Likewise

15 years agoAdd entry point logging for cpu functions
Jiri Denemark [Tue, 23 Mar 2010 09:53:28 +0000 (10:53 +0100)]
Add entry point logging for cpu functions

15 years agobuild: don't use "test cond1 -o cond2": it's not portable
Eric Blake [Wed, 24 Mar 2010 21:31:31 +0000 (15:31 -0600)]
build: don't use "test cond1 -o cond2": it's not portable

* configure.ac: Use "test cond1 || test cond2" instead.
* m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Likewise.
* tests/test-lib.sh (verbose): Likewise.

15 years agoesx: Make the conf parser compare names case insensitive in VMX mode
Matthias Bolte [Wed, 24 Mar 2010 00:52:33 +0000 (01:52 +0100)]
esx: Make the conf parser compare names case insensitive in VMX mode

The keys of entries in a VMX file are case insensitive. Both scsi0:1.fileName
and scsi0:1.filename are valid. Therefore, make the conf parser compare names
case insensitive in VMX mode to accept every capitalization variation.

Also add test cases for this.

15 years agovbox: Fix segfault on empty device source
Matthias Bolte [Mon, 22 Mar 2010 20:01:41 +0000 (21:01 +0100)]
vbox: Fix segfault on empty device source

<source file=''/> results in def->disks[i]->src == NULL. But
vboxDomainDefineXML and vboxDomainAttachDevice didn't check
def->disks[i]->src for NULL and expected it to be a valid string.

Add checks for def->disks[i]->src != NULL to fix the segfault.

15 years agopython example: poll(-0.001) does not sleep forever
Philipp Hahn [Tue, 23 Mar 2010 15:07:57 +0000 (16:07 +0100)]
python example: poll(-0.001) does not sleep forever

The conversion from seconds to milliseconds should only be done for
actual delays >= 0, not for the magic -1 value used for infinite
timeouts.

Signed-off-by: Philipp Hahn <hahn@univention.de>
15 years agobuild: suppress distracting build output
Jim Meyering [Wed, 24 Mar 2010 08:39:54 +0000 (09:39 +0100)]
build: suppress distracting build output

* src/Makefile.am (augeas-check): New target, just to give the existing
rule a name.  At the same time, prefix the commands with $(AM_V_GEN),
to avoid unexpected build output with V=0 which is the default.

15 years agomaint: add syntax-check rule to prohibit use of test's -a operator
Jim Meyering [Wed, 24 Mar 2010 08:32:43 +0000 (09:32 +0100)]
maint: add syntax-check rule to prohibit use of test's -a operator

* cfg.mk (sc_prohibit_test_minus_a): New rule.

15 years agobuild: don't use "test cond1 -a cond2" in configure: it's not portable
Jim Meyering [Wed, 24 Mar 2010 08:10:13 +0000 (09:10 +0100)]
build: don't use "test cond1 -a cond2" in configure: it's not portable

* configure.ac: Use "test cond1 && test cond2" instead.

15 years agotests: shell script portability and clean-up
Jim Meyering [Wed, 24 Mar 2010 08:05:27 +0000 (09:05 +0100)]
tests: shell script portability and clean-up

* tests/test-lib.sh: "echo -n" is not portable.  Use printf instead.
Remove unnecessary uses of "eval-in-subshell" (subshell is sufficient).
Remove uses of tests' -a operator; it is not portable.
Instead, use "test cond && test cond2".
* tests/schematestutils.sh: Replace use of test's -a.

15 years agotests: Don't add extra padding if counter mod 40 is 0
Matthias Bolte [Sat, 20 Mar 2010 17:08:00 +0000 (18:08 +0100)]
tests: Don't add extra padding if counter mod 40 is 0

This change only affects the output of tests that have an exact
multiple of 40 test cases. For example the domainschematest currently:

TEST: domainschematest
      ........................................ 40
      ........................................ 80
      ........................................ 120
      ........................................ 160
      ........................................                                         200 OK
PASS: domainschematest

It outputs additional 40 spaces on the last line.

The domainschematest output is fixed by the change in test-lib.sh. The
change in testutils.c fixes this for tests written in C. Currently no
C test has an exact multiple of 40 test cases, but I checked it and
the same problem exists there.

This patch stops that in both cases.

15 years agoFix error reporting when parsing CPU XML strings
Jiri Denemark [Wed, 24 Feb 2010 20:50:54 +0000 (21:50 +0100)]
Fix error reporting when parsing CPU XML strings

15 years agoUse common XML parsing functions
Jiri Denemark [Wed, 24 Feb 2010 20:53:16 +0000 (21:53 +0100)]
Use common XML parsing functions

15 years agoIntroduce XML parsing utility functions
Jiri Denemark [Wed, 24 Feb 2010 20:44:47 +0000 (21:44 +0100)]
Introduce XML parsing utility functions

15 years agovirDomainDiskDefAssignAddress: return int, not void
Jim Meyering [Mon, 15 Mar 2010 20:42:01 +0000 (21:42 +0100)]
virDomainDiskDefAssignAddress: return int, not void

Before, this function would blindly accept an invalid def->dst
and then abuse the idx=-1 it would get from virDiskNameToIndex,
when passing it invalid strings like "xvda:disk" and "sda1".
Now, this function returns -1 upon failure.
* src/conf/domain_conf.c (virDomainDiskDefAssignAddress): as above.
Update callers.
* src/conf/domain_conf.h: Update prototype.
* src/qemu/qemu_conf.c: Update callers.

15 years agotests: do not use the ":disk" suffix in sample xml input
Jim Meyering [Mon, 22 Mar 2010 19:21:18 +0000 (20:21 +0100)]
tests: do not use the ":disk" suffix in sample xml input

* tests/xml2sexprdata/xml2sexpr-curmem.xml: Remove ":disk" suffix from
"<target dev=" value.
* tests/xml2sexprdata/xml2sexpr-pv-localtime.xml: Likewise.
* tests/xml2sexprdata/xml2sexpr-curmem.sexpr: Update expected output
to match.
* tests/xml2sexprdata/xml2sexpr-pv-localtime.sexpr: Likewise.

15 years agovirDiskNameToIndex: ignore trailing digits
Jim Meyering [Fri, 19 Mar 2010 17:26:09 +0000 (18:26 +0100)]
virDiskNameToIndex: ignore trailing digits

* src/util/util.c (virDiskNameToIndex): Accept sda1, and map it to "sda".
I.e., accept and ignore any string of trailing digits.

15 years agoutil: Add stubs for some functions on Windows
Matthias Bolte [Sat, 20 Mar 2010 10:57:30 +0000 (11:57 +0100)]
util: Add stubs for some functions on Windows

virSetCloseExec and virExecDaemonize were missing a body on Windows.

15 years agoAdd HAVE_PTHREAD_H guard for pthread_sigmask
Matthias Bolte [Fri, 19 Mar 2010 20:09:30 +0000 (21:09 +0100)]
Add HAVE_PTHREAD_H guard for pthread_sigmask

Correctly disable pthread related code if pthread is not avialable,
in order to get it compile with MinGW on Windows.

15 years agobootstrap: Enable copy-mode for MinGW builds
Matthias Bolte [Wed, 17 Mar 2010 18:22:50 +0000 (19:22 +0100)]
bootstrap: Enable copy-mode for MinGW builds

MSYS' ln doesn't work well in the way bootstrap uses it with relative paths.

15 years agoutil: Handle lack of (f)chmod and (f)chown on Windows
Matthias Bolte [Wed, 17 Mar 2010 15:36:08 +0000 (16:36 +0100)]
util: Handle lack of (f)chmod and (f)chown on Windows

Even if gnulib can provide stubs, it won't help that much. So just
replace affected util functions (virFileOperation and virDirCreate)
with stubs on Windows. Both functions aren't used on libvirt's
client side, so this is fine for MinGW builds.

15 years agobootstrap: Remove rsync from buildreq list
Matthias Bolte [Wed, 17 Mar 2010 15:13:45 +0000 (16:13 +0100)]
bootstrap: Remove rsync from buildreq list

rsync is used to download .po files, but SKIP_PO=true is set and
downloading .po files is skipped.

This also fixes a problem with MinGW builds, because rsync is not
available for MinGW.

15 years agoutil: Make some conditional symbols unconditional
Matthias Bolte [Wed, 17 Mar 2010 00:06:31 +0000 (01:06 +0100)]
util: Make some conditional symbols unconditional

Add dummy bodies for HAVE_GETPWUID_R and HAVE_MNTENT_H dependent
functions for MinGW builds.

15 years agoMake sure virtTestCaptureProgramOutput has a body on Windows
Matthias Bolte [Tue, 16 Mar 2010 23:36:07 +0000 (00:36 +0100)]
Make sure virtTestCaptureProgramOutput has a body on Windows

Now the virsh tests compile at least.

15 years agoFix export of virConnectAuthPtrDefault for MinGW builds
Matthias Bolte [Tue, 16 Mar 2010 22:54:22 +0000 (23:54 +0100)]
Fix export of virConnectAuthPtrDefault for MinGW builds

Use the __declspec(dllexport/dllimport) stuff to export the symbol,
otherwise accessing virConnectAuthPtrDefault triggers a segfault.

15 years agoRemove interfaceRegister from libvirt_private.syms
Matthias Bolte [Tue, 16 Mar 2010 22:38:01 +0000 (23:38 +0100)]
Remove interfaceRegister from libvirt_private.syms

This symbol is conditional, it would need to be exported conditional to
work properly with MinGW. So just remove it, as no other driver register
function is listed in the symbols files.

15 years agoExport conditional state driver symbols only when they are defined
Matthias Bolte [Mon, 15 Mar 2010 01:02:57 +0000 (02:02 +0100)]
Export conditional state driver symbols only when they are defined

This is necessary for MinGW builds.

15 years agoMake sure uid_t and gid_t are available
Matthias Bolte [Mon, 15 Mar 2010 01:02:10 +0000 (02:02 +0100)]
Make sure uid_t and gid_t are available

15 years agoesx: Add esxVI_LookupVirtualMachineByName
Matthias Bolte [Tue, 2 Mar 2010 23:57:57 +0000 (00:57 +0100)]
esx: Add esxVI_LookupVirtualMachineByName

Used in esxDomainLookupByName and to be used in esxDomainDefineXML later.

15 years agoesx: Fix potential memory leak in esxVI_BuildFullTraversalSpecItem
Matthias Bolte [Tue, 2 Mar 2010 22:15:00 +0000 (23:15 +0100)]
esx: Fix potential memory leak in esxVI_BuildFullTraversalSpecItem

If esxVI_String_DeepCopyValue or esxVI_SelectionSpec_AppendToList fail
then selectionSpec would leak. Add a free call in the failure path to
fix the leak.

15 years agoesx: Cleanup file header comments
Matthias Bolte [Tue, 2 Mar 2010 21:19:24 +0000 (22:19 +0100)]
esx: Cleanup file header comments

Replace 'method' with 'function' and get the filename's suffix right.

15 years agoesx: Generate method mappings via macros
Matthias Bolte [Tue, 23 Feb 2010 00:06:58 +0000 (01:06 +0100)]
esx: Generate method mappings via macros

This is actually a consequence of the reworked required parameter
checking: Unify the required parameter check into a Validate function
instead of doing it separately im the (de)serialization part.

The required parameter checking for the mapped methods parameter was
done in the (de)serialize functions before. Now it's explicitly done
in the mapped method itself.

15 years agoAvoid libvirtd crash when cgroups is not configured on host
Jim Fehlig [Mon, 22 Mar 2010 15:42:14 +0000 (09:42 -0600)]
Avoid libvirtd crash when cgroups is not configured on host

Invoking virDomainSetMemory() on lxc driver results in libvirtd
segfault when cgroups has not been configured on the host.

Ensure driver->cgroup is non-null before invoking
virCgroupForDomain().  To prevent similar segfaults in the future,
ensure driver parameter to virCgroupForDomain() is non-null before
dereferencing.

15 years agosecurity: selinux: Fix crash when releasing non-existent label
Cole Robinson [Mon, 22 Mar 2010 14:45:36 +0000 (10:45 -0400)]
security: selinux: Fix crash when releasing non-existent label

This can be triggered by the qemuStartVMDaemon cleanup path if a
VM references a non-existent USB device (by product) in the XML.

15 years agoDon't crash without a security driver
Guido Günther [Wed, 17 Mar 2010 20:04:11 +0000 (21:04 +0100)]
Don't crash without a security driver

"virsh dominfo <vm>" crashes if there's no primary security driver set
since we only intialize the secmodel.model and secmodel.doi if we have
one. Attached patch checks for securityPrimaryDriver instead of
securityDriver since the later is always set in qemudSecurityInit().

Closes: http://bugs.debian.org/574359
15 years agoAdd migrate-setmaxdowntime command to virsh
Jiri Denemark [Wed, 17 Mar 2010 16:18:36 +0000 (17:18 +0100)]
Add migrate-setmaxdowntime command to virsh

15 years agoImplement virDomainMigrateSetMaxDowntime in qemu driver
Jiri Denemark [Wed, 17 Mar 2010 15:53:14 +0000 (16:53 +0100)]
Implement virDomainMigrateSetMaxDowntime in qemu driver

15 years agoImplement virDomainMigrateSetMaxDowntime in remote driver
Jiri Denemark [Wed, 17 Mar 2010 15:49:38 +0000 (16:49 +0100)]
Implement virDomainMigrateSetMaxDowntime in remote driver

15 years agoWire protocol and dispatcher for virDomainMigrateSetMaxDowntime
Jiri Denemark [Fri, 12 Mar 2010 15:21:10 +0000 (16:21 +0100)]
Wire protocol and dispatcher for virDomainMigrateSetMaxDowntime

15 years agoPublic virDomainMigrateSetMaxDowntime API
Jiri Denemark [Fri, 12 Mar 2010 13:55:27 +0000 (14:55 +0100)]
Public virDomainMigrateSetMaxDowntime API

15 years agoInternal driver API for virDomainMigrateSetMaxDowntime
Jiri Denemark [Fri, 12 Mar 2010 13:55:08 +0000 (14:55 +0100)]
Internal driver API for virDomainMigrateSetMaxDowntime

15 years agoVirsh support for vol wiping
David Allan [Tue, 2 Mar 2010 03:10:40 +0000 (22:10 -0500)]
Virsh support for vol wiping

15 years agoSimplified version of volume wiping based on feedback from the list.
David Allan [Tue, 23 Feb 2010 03:13:18 +0000 (22:13 -0500)]
Simplified version of volume wiping based on feedback from the list.

15 years agoImplement remote bits for vol wiping
David Allan [Mon, 1 Mar 2010 20:32:35 +0000 (15:32 -0500)]
Implement remote bits for vol wiping

15 years agoImplement the public API for vol wiping
David Allan [Mon, 1 Mar 2010 20:27:27 +0000 (15:27 -0500)]
Implement the public API for vol wiping

15 years agoDefine the internal driver API for vol wiping
David Allan [Mon, 1 Mar 2010 20:15:16 +0000 (15:15 -0500)]
Define the internal driver API for vol wiping

Also add vol wiping to ESX storage driver struct

15 years agoAdd public API for volume wiping
David Allan [Mon, 1 Mar 2010 19:56:46 +0000 (14:56 -0500)]
Add public API for volume wiping

15 years agoSupport vhost-net mode at qemu startup for virtio network devices
Laine Stump [Fri, 19 Mar 2010 15:58:14 +0000 (16:58 +0100)]
Support vhost-net mode at qemu startup for virtio network devices

Attempt to turn on vhost-net mode for devices of type NETWORK, BRIDGE,
and DIRECT (macvtap).

* src/qemu/qemu_conf.h: add vhostfd to qemuBuildHostNetStr prototype
  add qemudOpenVhostNet prototype new flag to set when :,vhost=" found in
  qemu help
* src/qemu/qemu_conf.c: * set QEMUD_CMD_FLAG_VNET_HOST is ",vhost=" found
  in qemu help
   - qemudOpenVhostNet - opens /dev/vhost-net to pass to qemu if everything
     is in place to use it.
   - qemuBuildHostNetStr - add vhostfd to commandline if it's not empty
     (higher levels decide whether or not to fill it in)
   - qemudBuildCommandLine - if /dev/vhost-net is successfully opened, add
     its fd to tapfds array so it isn't closed on qemu exec, and populate
     vhostfd_name to be passed in to commandline builder.
* src/qemu/qemu_driver.c: add filler 0 for new arg to qemuBuildHostNetStr,
  along with a note that this must be implemented in order for hot-plug of
  vhost-net virtio devices to work properly (once qemu "netdev_add" monitor
  command is implemented).

15 years agoqemu: Fix FD leak in qemudStartVMDaemon
Matthias Bolte [Wed, 17 Mar 2010 21:21:03 +0000 (22:21 +0100)]
qemu: Fix FD leak in qemudStartVMDaemon

The logfile FD is dup2'ed in __virExec in the child. The FD needs to
be closed in the parent, otherwise it leaks.

15 years agoutil: ensure virMutexInit is not recursive
Eric Blake [Thu, 18 Mar 2010 17:32:16 +0000 (11:32 -0600)]
util: ensure virMutexInit is not recursive

POSIX states that creation of a mutex with default attributes
is unspecified whether the mutex is recursive or non-recursive.
We specifically want non-recursive (deadlock is desirable in
flushing out coding bugs that used our mutex incorrectly).

* src/util/threads-pthread.c (virMutexInit): Specifically request
non-recursive mutex, rather than relying on unspecified default.

15 years agomaint: enforce recent copyright style
Eric Blake [Thu, 18 Mar 2010 17:25:01 +0000 (11:25 -0600)]
maint: enforce recent copyright style

* cfg.mk (sc_copyright_format): New rule.

15 years agomaint: make Red Hat copyright notices consistent
Eric Blake [Fri, 12 Mar 2010 17:47:26 +0000 (10:47 -0700)]
maint: make Red Hat copyright notices consistent

Spell out 'Red Hat, Inc.':
 git grep -i 'Copyright.*Red Hat' | grep -v Inc

Include (C) consistently:
 git grep -i 'Copyright [^(].*Red Hat'

* src/lxc/lxc_container.c: Update copyright formatting.
* src/node_device/node_device_udev.c: Likewise.
* src/node_device/node_device_udev.h: Likewise.
* src/xen/xend_internal.h: Likewise.
* src/xen/xm_internal.c: Likewise.
* src/xen/xm_internal.h: Likewise.
* tests/xmconfigtest.c: Likewise.
* tests/object-locking.ml: Likewise.
* tools/virt-pki-validate.in: Likewise.
* tools/virt-xml-validate.in: Likewise.

15 years agomaint: fix typo
Eric Blake [Thu, 18 Mar 2010 14:39:59 +0000 (08:39 -0600)]
maint: fix typo

* cfg.mk (sc_prohibit_gettext_noop): Fix typo

15 years agomaint: enforce recent N_ usage
Eric Blake [Thu, 18 Mar 2010 13:05:44 +0000 (14:05 +0100)]
maint: enforce recent N_ usage

* cfg.mk (sc_prohibit_gettext_noop): New rule applied in "make syntax-check"

15 years agoFix logroate rpm build breakage
Daniel Veillard [Thu, 18 Mar 2010 12:50:08 +0000 (13:50 +0100)]
Fix logroate rpm build breakage

related to fix of bug https://bugzilla.redhat.com/show_bug.cgi?id=547514

15 years agoFix LSB compliance of init script
Daniel Veillard [Wed, 3 Mar 2010 10:55:06 +0000 (11:55 +0100)]
Fix LSB compliance of init script

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

* daemon/libvirtd.init.in: daemon/libvirtd.init.in were not mentionned
  in the usage message and if a missing or wrong argument is given it
  should return 2, not 1

15 years agodocs: <pre> cannot be nested in <p>
Matthias Bolte [Sat, 13 Mar 2010 14:04:34 +0000 (15:04 +0100)]
docs: <pre> cannot be nested in <p>

xsltproc complained about this.

15 years agopython: Fix networkLookupByUUID
Philip Hahn [Wed, 17 Mar 2010 16:34:04 +0000 (12:34 -0400)]
python: Fix networkLookupByUUID

According to:

http://libvirt.org/html/libvirt-libvirt.html#virNetworkLookupByUUID

virNetworkLookupByUUID() expects a virConnectPtr as its first argument,
thus making it a method of the virConnect Python class.

Currently it's a method of libvirt.virNetwork.

@@ -805,13 +805,6 @@ class virNetwork:
         if ret == -1: raise libvirtError ('virNetworkGetAutostart() failed', net=self)
         return ret

-    def networkLookupByUUID(self, uuid):
-        """Try to lookup a network on the given hypervisor based on its UUID. """
-        ret = libvirtmod.virNetworkLookupByUUID(self._o, uuid)
-        if ret is None:raise libvirtError('virNetworkLookupByUUID() failed', net=self)
-        __tmp = virNetwork(self, _obj=ret)
-        return __tmp
-
 class virInterface:
     def __init__(self, conn, _obj=None):
         self._conn = conn
@@ -1689,6 +1682,13 @@ class virConnect:
         __tmp = virDomain(self,_obj=ret)
         return __tmp

+    def networkLookupByUUID(self, uuid):
+        """Try to lookup a network on the given hypervisor based on its UUID. """
+        ret = libvirtmod.virNetworkLookupByUUID(self._o, uuid)
+        if ret is None:raise libvirtError('virNetworkLookupByUUID() failed', conn=self)
+        __tmp = virNetwork(self, _obj=ret)
+        return __tmp
+

15 years ago.gitignore: Ignore generated daemon/libvirtd.logrotate
Cole Robinson [Wed, 17 Mar 2010 16:27:41 +0000 (12:27 -0400)]
.gitignore: Ignore generated daemon/libvirtd.logrotate

15 years agoFix make dist with XenAPI changes
Cole Robinson [Wed, 17 Mar 2010 16:25:50 +0000 (12:25 -0400)]
Fix make dist with XenAPI changes

15 years agoAllow suspend during live migration
Jiri Denemark [Mon, 15 Mar 2010 13:19:00 +0000 (14:19 +0100)]
Allow suspend during live migration

Currently no command can be sent to a qemu process while another job is
active. This patch adds support for signaling long-running jobs (such as
migration) so that other threads may request predefined operations to be
done during such jobs. Two signals are defined so far:
    - QEMU_JOB_SIGNAL_CANCEL
    - QEMU_JOB_SIGNAL_SUSPEND

The first one is used by qemuDomainAbortJob.

The second one is used by qemudDomainSuspend for suspending a domain
during migration, which allows for changing live migration into offline
migration. However, there is a small issue in the way qemudDomainSuspend
is currently implemented for migrating domains. The API calls returns
immediately after signaling migration job which means it is asynchronous
in this specific case.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agodo not require two ./autogen.sh runs to permit "make"
Jim Meyering [Tue, 16 Mar 2010 20:08:31 +0000 (21:08 +0100)]
do not require two ./autogen.sh runs to permit "make"

* autogen.sh (bootstrap_hash): New function.
Running bootstrap may update the gnulib SHA1, yet we were computing
t=$(git submodule status ...) *prior* to running bootstrap, and
then recording that sometimes-stale value in the stamp file upon
a successful bootstrap run.  That would require two (lengthy!)
bootstrap runs to update the stamp file.

15 years agophyp: Use virRequestUsername and virRequestPassword
Matthias Bolte [Sun, 14 Mar 2010 20:46:32 +0000 (21:46 +0100)]
phyp: Use virRequestUsername and virRequestPassword

15 years agoxenapi: Don't leak url and caps in case of error
Matthias Bolte [Sun, 14 Mar 2010 20:31:14 +0000 (21:31 +0100)]
xenapi: Don't leak url and caps in case of error

15 years agoxenapi: Check for NULL before accessing the scheme
Matthias Bolte [Sun, 14 Mar 2010 20:29:06 +0000 (21:29 +0100)]
xenapi: Check for NULL before accessing the scheme

15 years agoxenapi: Request a username if there is non in the URI
Matthias Bolte [Sun, 14 Mar 2010 20:00:43 +0000 (21:00 +0100)]
xenapi: Request a username if there is non in the URI

Use virRequestUsername and virRequestPassword.

15 years agoxenapi: Check for valid private data in xenapiSessionErrorHandle
Matthias Bolte [Sun, 14 Mar 2010 20:53:01 +0000 (21:53 +0100)]
xenapi: Check for valid private data in xenapiSessionErrorHandle

15 years agoesx: Move username and password helper functions to authhelper.c
Matthias Bolte [Sun, 14 Mar 2010 19:50:14 +0000 (20:50 +0100)]
esx: Move username and password helper functions to authhelper.c

15 years agofix two "make syntax check" failures
Jim Meyering [Tue, 16 Mar 2010 18:32:05 +0000 (19:32 +0100)]
fix two "make syntax check" failures

* src/xenapi/xenapi_driver.c (xenapiOpen): Remove useless-if-before-free.
* po/POTFILES.in: Add src/xenapi/xenapi_utils.c.

15 years agoUse WARN_CFLAGS when compiling virsh.c
Jiri Denemark [Tue, 16 Mar 2010 10:51:36 +0000 (11:51 +0100)]
Use WARN_CFLAGS when compiling virsh.c

15 years agoUse fsync() at the end of file allocation instead of O_DSYNC
Jiri Denemark [Tue, 16 Mar 2010 15:03:59 +0000 (16:03 +0100)]
Use fsync() at the end of file allocation instead of O_DSYNC

Instead of opening storage file with O_DSYNC, make sure data are written
to a disk only before we claim allocation has finished.

15 years agoRevert f5a6ce44ce8368d4183b69a31b77f67688d9af43
Jim Meyering [Mon, 15 Mar 2010 15:43:23 +0000 (16:43 +0100)]
Revert f5a6ce44ce8368d4183b69a31b77f67688d9af43

* src/qemu/qemu_driver.c (qemudDomainAttachSCSIDisk): The ".controller"
member is an index, and *may* be 0.  As such, the commit that we're
reverting broke SCSI disk hot-plug on controller 0.
Reported by Wolfgang Mauerer.

15 years agosecurity: Set permissions for kernel/initrd
Cole Robinson [Fri, 12 Mar 2010 18:38:39 +0000 (13:38 -0500)]
security: Set permissions for kernel/initrd

Fixes URL installs when running virt-install as root on Fedora.

15 years agoqemu: Fix USB by product with security enabled
Cole Robinson [Fri, 12 Mar 2010 17:37:52 +0000 (12:37 -0500)]
qemu: Fix USB by product with security enabled

We need to call PrepareHostdevs to determine the USB device path before
any security calls. PrepareHostUSBDevices was also incorrectly skipping
all USB devices.

15 years agoqemu: Add some debugging at domain startup
Cole Robinson [Fri, 12 Mar 2010 17:36:56 +0000 (12:36 -0500)]
qemu: Add some debugging at domain startup

15 years agoqemu: pass the information when disks are read-only
Daniel Veillard [Thu, 11 Mar 2010 16:53:49 +0000 (17:53 +0100)]
qemu: pass the information when disks are read-only

* src/qemu/qemu_conf.c: add the ",readonly=on" for read-only disks
  and also parse it back in qemuParseCommandLineDisk()
* tests/qemuxml2argvtest.c
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.args
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-readonly-disk.xml:
  add a specific regression test

15 years agoFix syntax-check errors
Jiri Denemark [Mon, 15 Mar 2010 13:14:06 +0000 (14:14 +0100)]
Fix syntax-check errors

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoFix error messages in qemu text monitor
Jiri Denemark [Mon, 15 Mar 2010 13:01:20 +0000 (14:01 +0100)]
Fix error messages in qemu text monitor

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
15 years agoxenapi: Initial commit of the new driver
Sharadha Prabhakar [Sun, 14 Mar 2010 11:11:51 +0000 (12:11 +0100)]
xenapi: Initial commit of the new driver

15 years agoesx: Improve documentation about remote URIs
Matthias Bolte [Fri, 12 Mar 2010 21:09:11 +0000 (22:09 +0100)]
esx: Improve documentation about remote URIs

15 years agomacvtap: Only export symbols if support is enabled
Matthias Bolte [Fri, 12 Mar 2010 21:09:50 +0000 (22:09 +0100)]
macvtap: Only export symbols if support is enabled

15 years agoOnly use the numa functions when they are available.
Chris Lalancette [Fri, 12 Mar 2010 15:41:49 +0000 (10:41 -0500)]
Only use the numa functions when they are available.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake nodeGetInfo report the correct number of NUMA nodes.
Chris Lalancette [Thu, 11 Mar 2010 20:45:11 +0000 (15:45 -0500)]
Make nodeGetInfo report the correct number of NUMA nodes.

The nodeGetInfo code was always assuming that machine had a
single NUMA node, which is not correct.  The good news is that
libnuma gives us this information pretty easily, so let's
properly report it.

NOTE: With recent hardware starting to support CPU hot-add
and hot-remove, both this code and the nodeCapsInitNUMA()
code are quickly going to become obsolete.  We'll have to
think of a more dynamic solution for dealing with NUMA
nodes and CPUs that can come and go at will.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix crash in virsh after bogus command
Chris Lalancette [Fri, 12 Mar 2010 11:00:46 +0000 (12:00 +0100)]
Fix crash in virsh after bogus command

If you ran virsh in interactive mode and ran a command
that virsh could not parse, it would then SEGV
on subsequent commands.  The problem is that we are
freeing the vshCmd structure in the syntaxError label
at the end of vshCommandParse, but forgetting to
set ctl->cmd to NULL.  This means that on the next command,
we would try to free the same structure again, leading
to badness.

* tools/virsh.c: Make sure to set ctl->cmd to NULL after
  freeing it in vshCommandParse()

15 years agoFix virsh command 'cd'
Chris Lalancette [Fri, 12 Mar 2010 10:49:16 +0000 (11:49 +0100)]
Fix virsh command 'cd'

* tools/virsh.c: cmdCd was returning a 0 on success and -1 on error,
  when the rest of the code expected a TRUE on success and a
  FALSE on error.

15 years agoFix compiler warnings in virsh.c
Laine Stump [Fri, 12 Mar 2010 10:39:24 +0000 (11:39 +0100)]
Fix compiler warnings in virsh.c

No functional change. These all generated compiler warnings which, for
some reason weren't converted to errors by
--enable-compiler-warnings=error.

* tools/virsh.c:
  - change return type from int to void on two functions that don't
    return a value.
  - remove unused variables/labels from two functions
  - eliminate non-literal format strings
  - typecast char* into xmlChar* when calling
  - xmlParseBalancedChunkMemory

15 years agoSilence compiler complaints about non-literal format strings
Laine Stump [Fri, 12 Mar 2010 10:36:05 +0000 (11:36 +0100)]
Silence compiler complaints about non-literal format strings

* src/util/macvtap.c: replace _("....") with "%s", _("...") in two places

15 years agoUpdate commiters list
Daniel Veillard [Fri, 12 Mar 2010 10:30:07 +0000 (11:30 +0100)]
Update commiters list

15 years agoFix hang in qemudDomainCoreDump.
Chris Lalancette [Wed, 10 Mar 2010 21:50:13 +0000 (16:50 -0500)]
Fix hang in qemudDomainCoreDump.

Currently if you dump the core of a qemu guest with
qemudDomainCoreDump, subsequent commands will hang
up libvirtd.  This is because qemudDomainCoreDump
uses qemuDomainWaitForMigrationComplete, which expects
the qemuDriverLock to be held when it's called.  This
patch does the simple thing and moves the qemuDriveUnlock
to the end of the qemudDomainCoreDump so that the driver
lock is held for the entirety of the call (as it is done
in qemudDomainSave).  We will probably want to make the
lock more fine-grained than that in the future, but
we can fix both qemudDomainCoreDump and qemudDomainSave
at the same time.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoMake sure qemudDomainSetVcpus doesn't hang.
Chris Lalancette [Wed, 10 Mar 2010 20:52:39 +0000 (15:52 -0500)]
Make sure qemudDomainSetVcpus doesn't hang.

The code to add job support into libvirtd caused a problem
in qemudDomainSetVcpus.  In particular, a qemuDomainObjEndJob()
call was added at the end of the function, but a
corresponding qemuDomainObjBeginJob() was not.  Additionally,
a call to qemuDomainObj{Enter,Exit}Monitor() was also missed
in qemudDomainHotplugVcpus().  These missing calls conspired to
cause a hang in the libvirtd process after the command was
finished.  Fix this by adding the missing calls.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoRemove qemudDomainSetMaxMemory.
Chris Lalancette [Wed, 10 Mar 2010 19:14:53 +0000 (14:14 -0500)]
Remove qemudDomainSetMaxMemory.

As previously discussed[1], this patch removes the
qemudDomainSetMaxMemory() function, since it doesn't
work.  This means that instead of getting somewhat
cryptic errors, you will now get:

error: Unable to change MaxMemorySize
error: this function is not supported by the hypervisor: virDomainSetMaxMemory

Which describes the situation perfectly.

[1] https://www.redhat.com/archives/libvir-list/2010-February/msg00928.html

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoFix a JSON CPU information bug.
Chris Lalancette [Wed, 10 Mar 2010 18:22:02 +0000 (13:22 -0500)]
Fix a JSON CPU information bug.

When using the JSON monitor, qemuMonitorJSONExtractCPUInfo
was returning 0 on success.  Unfortunately, higher levels of
the cpuinfo code expect that it returns the number of CPUs
it found on success.  This one-line patch fixes it so that
it returns the correct number.  This makes "virsh vcpuinfo <domain>"
work when using the JSON monitor.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
15 years agoAllow devices without a parent
Ed Swierk [Wed, 10 Mar 2010 18:48:49 +0000 (13:48 -0500)]
Allow devices without a parent

* Allow devices without parent links to be created and set their parent to the root "computer" node

15 years agobuild: change to gnulib module list should rerun bootstrap
Eric Blake [Wed, 10 Mar 2010 17:03:29 +0000 (10:03 -0700)]
build: change to gnulib module list should rerun bootstrap

* autogen.sh (curr_status): Also include hash of bootstrap.conf
when checking for changes that require bootstrap rerun.
* cfg.mk (_update_required): Likewise.

15 years agobuild: enforce preprocessor indentation
Eric Blake [Tue, 9 Mar 2010 21:22:14 +0000 (14:22 -0700)]
build: enforce preprocessor indentation

Since cppi is not part of Fedora Core 12, the check is conditional:
without cppi, running 'make syntax-check' merely warns:

$ make sc_preprocessor_indentation
preprocessor_indentation
maint.mk: skipping test sc_preprocessor_indentation: cppi not installed

* cfg.mk (sc_preprocessor_indentation): New syntax-check rule.
(preprocessor_exempt): New macro, with first exemption.

15 years agobuild: update gnulib submodule to newer (but not latest)
Jim Meyering [Wed, 10 Mar 2010 16:26:40 +0000 (17:26 +0100)]
build: update gnulib submodule to newer (but not latest)

This is a stop-gap measure to make autogen.sh rerun ./bootstrap,
(required due to recent bootstrap.conf addition) while we prepare
the fix to automatically detect the case of an updated modules list.

15 years agoFree resources on error in udev startup
David Allan [Thu, 4 Mar 2010 18:17:24 +0000 (13:17 -0500)]
Free resources on error in udev startup

* The udev driver didn't properly free resources that it allocates when setting up the 'computer' device in the error case.

15 years agoMake virsh reconnect when losing connection
Daniel Veillard [Fri, 5 Mar 2010 09:59:52 +0000 (10:59 +0100)]
Make virsh reconnect when losing connection

When the daemon libvirtd restarts, a connected virsh gets a SIGPIPE
and dies. This change the behaviour to try to reconnect if the
signal was received or command error indicated a connection or RPC
failure. Note that the failing command is not restarted.

* tools/virsh.c: catch SIGPIPE signals as well as connection related
  failures, add some automatic reconnection code and appropriate error
  messages.