Commit Graph

4439 Commits

Author SHA1 Message Date
Jiri Denemark
81e99f014b Fix error reporting when parsing CPU XML strings 2010-03-23 15:40:10 +01:00
Jiri Denemark
8d8815ea2a Use common XML parsing functions 2010-03-23 15:40:10 +01:00
Jiri Denemark
26be7a0a24 Introduce XML parsing utility functions 2010-03-23 15:40:04 +01:00
Jim Meyering
c390bcfec5 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.
2010-03-23 11:22:26 +01:00
Jim Meyering
67904847f0 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.
2010-03-23 11:22:26 +01:00
Jim Meyering
67ef701779 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.
2010-03-23 11:22:26 +01:00
Matthias Bolte
b9a3287e80 util: Add stubs for some functions on Windows
virSetCloseExec and virExecDaemonize were missing a body on Windows.
2010-03-23 02:14:20 +01:00
Matthias Bolte
7233dc170f 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.
2010-03-23 02:13:19 +01:00
Matthias Bolte
2f80b2a013 bootstrap: Enable copy-mode for MinGW builds
MSYS' ln doesn't work well in the way bootstrap uses it with relative paths.
2010-03-23 02:12:07 +01:00
Matthias Bolte
e77ee32357 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.
2010-03-23 02:11:21 +01:00
Matthias Bolte
17f7220891 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.
2010-03-23 02:10:14 +01:00
Matthias Bolte
0f7ba8c21c util: Make some conditional symbols unconditional
Add dummy bodies for HAVE_GETPWUID_R and HAVE_MNTENT_H dependent
functions for MinGW builds.
2010-03-23 02:09:29 +01:00
Matthias Bolte
3528d66641 Make sure virtTestCaptureProgramOutput has a body on Windows
Now the virsh tests compile at least.
2010-03-23 02:08:14 +01:00
Matthias Bolte
190aaa2627 Fix export of virConnectAuthPtrDefault for MinGW builds
Use the __declspec(dllexport/dllimport) stuff to export the symbol,
otherwise accessing virConnectAuthPtrDefault triggers a segfault.
2010-03-23 02:07:38 +01:00
Matthias Bolte
460e7b6a94 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.
2010-03-23 02:06:07 +01:00
Matthias Bolte
6d45d5855d Export conditional state driver symbols only when they are defined
This is necessary for MinGW builds.
2010-03-23 02:05:18 +01:00
Matthias Bolte
91da9a7689 Make sure uid_t and gid_t are available 2010-03-23 02:04:03 +01:00
Matthias Bolte
041a18be17 esx: Add esxVI_LookupVirtualMachineByName
Used in esxDomainLookupByName and to be used in esxDomainDefineXML later.
2010-03-23 01:28:08 +01:00
Matthias Bolte
bba36f7fc7 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.
2010-03-23 01:28:08 +01:00
Matthias Bolte
055d21d254 esx: Cleanup file header comments
Replace 'method' with 'function' and get the filename's suffix right.
2010-03-23 01:28:08 +01:00
Matthias Bolte
d304352b19 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.
2010-03-23 01:28:08 +01:00
Jim Fehlig
09fafa1e21 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.
2010-03-22 09:42:14 -06:00
Cole Robinson
65e97240e6 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.
2010-03-22 10:45:36 -04:00
Guido Günther
b7a7b33651 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
2010-03-22 10:43:45 +01:00
Jiri Denemark
5ee592208c Add migrate-setmaxdowntime command to virsh 2010-03-19 22:57:10 +01:00
Jiri Denemark
7f4f1dd416 Implement virDomainMigrateSetMaxDowntime in qemu driver 2010-03-19 22:47:45 +01:00
Jiri Denemark
0ab6423579 Implement virDomainMigrateSetMaxDowntime in remote driver 2010-03-19 22:45:55 +01:00
Jiri Denemark
20ffaf59dc Wire protocol and dispatcher for virDomainMigrateSetMaxDowntime 2010-03-19 22:42:25 +01:00
Jiri Denemark
68f63673da Public virDomainMigrateSetMaxDowntime API 2010-03-19 22:33:09 +01:00
Jiri Denemark
7f7849c996 Internal driver API for virDomainMigrateSetMaxDowntime 2010-03-19 22:20:42 +01:00
David Allan
3535092f3a Virsh support for vol wiping 2010-03-19 14:44:47 -04:00
David Allan
73adc0e5b7 Simplified version of volume wiping based on feedback from the list. 2010-03-19 14:43:40 -04:00
David Allan
3fdb9ba760 Implement remote bits for vol wiping 2010-03-19 14:43:02 -04:00
David Allan
d36b4e92ac Implement the public API for vol wiping 2010-03-19 14:37:51 -04:00
David Allan
b50ab42d41 Define the internal driver API for vol wiping
Also add vol wiping to ESX storage driver struct
2010-03-19 14:35:58 -04:00
David Allan
e10dc8666e Add public API for volume wiping 2010-03-19 14:31:48 -04:00
Laine Stump
598a0c00dc 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).
2010-03-19 16:58:14 +01:00
Matthias Bolte
caad0a8783 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.
2010-03-18 23:45:11 +01:00
Eric Blake
336fd879c0 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.
2010-03-18 21:37:32 +01:00
Eric Blake
fc148ca133 maint: enforce recent copyright style
* cfg.mk (sc_copyright_format): New rule.
2010-03-18 21:20:32 +01:00
Eric Blake
0a33633579 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.
2010-03-18 16:48:05 +01:00
Eric Blake
257d90f3fb maint: fix typo
* cfg.mk (sc_prohibit_gettext_noop): Fix typo
2010-03-18 16:26:06 +01:00
Eric Blake
bc3f582bb0 maint: enforce recent N_ usage
* cfg.mk (sc_prohibit_gettext_noop): New rule applied in "make syntax-check"
2010-03-18 14:05:44 +01:00
Daniel Veillard
e7d29e234c Fix logroate rpm build breakage
related to fix of bug https://bugzilla.redhat.com/show_bug.cgi?id=547514
2010-03-18 13:50:08 +01:00
Daniel Veillard
1216398da9 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
2010-03-18 13:30:16 +01:00
Matthias Bolte
b62cab6e09 docs: <pre> cannot be nested in <p>
xsltproc complained about this.
2010-03-17 22:37:45 +01:00
Philip Hahn
2ef091efcc 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
+
2010-03-17 12:34:04 -04:00
Cole Robinson
0ef58c3155 .gitignore: Ignore generated daemon/libvirtd.logrotate 2010-03-17 12:27:41 -04:00
Cole Robinson
89d8cdfc7e Fix make dist with XenAPI changes 2010-03-17 12:25:50 -04:00
Jiri Denemark
0c842417ef 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>
2010-03-17 14:38:46 +01:00