]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
14 years agobuf: Fix possible infinite loop in EscapeString, VSnprintf
Cole Robinson [Wed, 1 Sep 2010 17:51:35 +0000 (13:51 -0400)]
buf: Fix possible infinite loop in EscapeString, VSnprintf

The current code will go into an infinite loop if the printf generated
string is >= 1000, AND exactly 1 character smaller than the amount of free
space in the buffer. When this happens, we are dropped into the loop body,
but nothing will actually change, because count == (buf->size - buf->use - 1),
and virBufferGrow returns unchanged if count < (buf->size - buf->use)

Fix this by removing the '- 1' bit from 'size'. The *nprintf functions handle
the NULL byte for us anyways, so we shouldn't need to manually accommodate
for it.

Here's a bug where we are actually hitting this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=602772

v2: Eric's improvements: while -> if (), remove extra va_list variable,
    make sure we report buffer error if snprintf fails

v3: Add tests/virbuftest which reproduces the infinite loop before this
    patch, works correctly after

14 years agoFix block statistics with newer versions of Xen
Guido Günther [Fri, 10 Sep 2010 13:57:35 +0000 (15:57 +0200)]
Fix block statistics with newer versions of Xen

Apparently the xen block device statistics moved from
"/sys/devices/xen-backend/vbd-%d-%d/statistics/%s"
to
"/sys/bus/xen-backend/devices/vbd-%d-%d/statistics/%s"

* src/xen/block_stats.c: try the extra path in case of failure to
  find the statistics in /sys

14 years agovirsh: Option for overriding disk type in attach-disk
Jiri Denemark [Fri, 10 Sep 2010 11:37:55 +0000 (13:37 +0200)]
virsh: Option for overriding disk type in attach-disk

Unless --driver tap|file option was given to attach-disk, virsh would
generate <disk type='block'> XML which might be fine for Xen but not for
other hypervisors. This patch introduces a new option --sourcetype which
can be used to explicitly set the type of disk source. The option
accepts either "file" or "block" types.

14 years agoFix dependancies for remote generated files
Daniel P. Berrange [Thu, 19 Aug 2010 13:33:39 +0000 (14:33 +0100)]
Fix dependancies for remote generated files

Very occasionally during a parallel make, dispatch.c would
be compiled before the generated remote headers had been
fully written. This would cause it to compile an empty
union, and result in really wierd runtime bugs that are
near impossible to diagnose.

* daemon/Makefile.am: Fix remote build deps

14 years agoEnsure remote daemon unions are always non-zero length
Daniel P. Berrange [Thu, 19 Aug 2010 13:32:10 +0000 (14:32 +0100)]
Ensure remote daemon unions are always non-zero length

If the remote daemon args/ret unions ever become zero length
(due to a build / Makefile bug) then bad stuff happens at
runtime. Add a compile time assertion to check for this kind
of problem

* daemon/remote.h: Ensure non-zero length unions

14 years agoFix off-by-1 in QEMU boot arg array handling
Daniel P. Berrange [Tue, 24 Aug 2010 11:00:41 +0000 (12:00 +0100)]
Fix off-by-1 in QEMU boot arg array handling

A QEMU guest can have upto VIR_DOMAIN_BOOT_LAST boot entries
defined. When building the QEMU arg, each entry takes a
single byte. This means the array must be declared to be
VIR_DOMAIN_BOOT_LAST+1 bytes in length to allow for the
trailing null

* src/qemu/qemu_conf.c: Fix off-by-1 boot arg array size

14 years agobridge: Fix static-only DHCP configuration
Jiri Denemark [Thu, 9 Sep 2010 14:00:08 +0000 (16:00 +0200)]
bridge: Fix static-only DHCP configuration

For static-only DHCP, i.e. with no <range> but at least one <host>
element within <dhcp> element, we have to add "--dhcp-range IP,static"
option to dnsmasq to actually enable the service. Without this option,
dnsmasq will not respond to DHCP requests.

14 years agoqemu: qemuMonitorJSONEjectMedia(): Fix arguments' type
Luiz Capitulino [Thu, 9 Sep 2010 21:05:04 +0000 (18:05 -0300)]
qemu: qemuMonitorJSONEjectMedia(): Fix arguments' type

QMP in QEMU 0.13 has been fixed to enforce type correctness,
this means that boolean types must be true or false, not
integers.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoqemu: qemuMonitorJSONMigrate(): Fix arguments' type
Luiz Capitulino [Thu, 9 Sep 2010 21:05:03 +0000 (18:05 -0300)]
qemu: qemuMonitorJSONMigrate(): Fix arguments' type

QMP in QEMU 0.13 has been fixed to enforce type correctness,
this means that boolean types must be true or false, not
integers.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
14 years agoAdd nwfilter support to UML driver
Soren Hansen [Tue, 7 Sep 2010 08:19:56 +0000 (10:19 +0200)]
Add nwfilter support to UML driver

Extend user-mode-linux driver to support nwfilter.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agotest: Don't overwrite storage volume target path and key
Matthias Bolte [Wed, 8 Sep 2010 19:46:15 +0000 (21:46 +0200)]
test: Don't overwrite storage volume target path and key

Only generate target path and key when they are not defined
in the XML config.

14 years agoRemove hack to get static binaries in DV environment
Daniel Veillard [Thu, 9 Sep 2010 15:06:00 +0000 (17:06 +0200)]
Remove hack to get static binaries in DV environment

14 years agoMoved my name up to the primary list, as I have commit rights now.
Justin Clift [Wed, 8 Sep 2010 14:13:19 +0000 (00:13 +1000)]
Moved my name up to the primary list, as I have commit rights now.

As recommended by Eric. :)

14 years agoesx: Use SessionIsActive when available
Matthias Bolte [Sun, 5 Sep 2010 14:53:10 +0000 (16:53 +0200)]
esx: Use SessionIsActive when available

Before this commit SessionIsActive was not used because ESX(i)
doesn't implement it. vCenter supports SessionIsActive, so use
it here, but keep the fall back mechanism for ESX(i) and GSX.

14 years agoesx: Fall back to path as key when QueryVirtualDiskUuid isn't available
Matthias Bolte [Fri, 3 Sep 2010 23:30:04 +0000 (01:30 +0200)]
esx: Fall back to path as key when QueryVirtualDiskUuid isn't available

QueryVirtualDiskUuid is only available on an ESX(i) server. vCenter
returns an NotImplemented fault and a GSX server is missing the
VirtualDiskManager completely. Therefore only use QueryVirtualDiskUuid
with an ESX(i) server and fall back to path as storage volume key for
vCenter and GSX server.

14 years agomingw: match recent changes in spec file
Eric Blake [Fri, 3 Sep 2010 19:48:25 +0000 (13:48 -0600)]
mingw: match recent changes in spec file

* libvirt.spec.in (%file): List new installed files.
* configure.ac (with_init_script): Assume default of none when
cross-compiling.

14 years agobuild: Fix permissions of sysconfig files
Jiri Denemark [Thu, 2 Sep 2010 14:53:38 +0000 (16:53 +0200)]
build: Fix permissions of sysconfig files

14 years agoUpdate of localization files
Daniel Veillard [Sat, 4 Sep 2010 17:24:07 +0000 (19:24 +0200)]
Update of localization files

- Updated dutch, spanish and russian, regenerated the po/pot files

14 years agoesx: Use the VirtualDisk UUID as storage volume key
Matthias Bolte [Sun, 29 Aug 2010 17:33:49 +0000 (19:33 +0200)]
esx: Use the VirtualDisk UUID as storage volume key

VirtualDisks are .vmdk file based. Other files in a datastore
like .iso or .flp files don't have a UUID attached, fall back
to the path as key for them.

14 years agoesx: Add .vmdk storage volume creation
Matthias Bolte [Sat, 28 Aug 2010 19:49:07 +0000 (21:49 +0200)]
esx: Add .vmdk storage volume creation

14 years agoOpenVZ: add ethernet interface type support
Jean-Baptiste Rouault [Wed, 18 Aug 2010 15:05:02 +0000 (17:05 +0200)]
OpenVZ: add ethernet interface type support

This patch adds support for ethernet interface type to OpenVZ domains
as stated in this previous message: http://www.redhat.com/archives/libvir-
list/2010-July/msg00658.html

14 years agobuild: avoid uninitialized variable warning
Eric Blake [Fri, 3 Sep 2010 15:39:23 +0000 (09:39 -0600)]
build: avoid uninitialized variable warning

* src/vbox/vbox_tmpl.c (vboxAttachDrives): Capture return value.

14 years agoesx: Rework datastore path parsing and handling
Matthias Bolte [Wed, 25 Aug 2010 09:44:57 +0000 (11:44 +0200)]
esx: Rework datastore path parsing and handling

Instead of splitting the path part of a datastore path into
directory and file name, keep this in one piece. An example:

  "[datastore] directory/file"

was split into this before:

  datastoreName = "datastore"
  directoryName = "directory"
  fileName = "file"

Now it's split into this:

  datastoreName = "datastore"
  directoryName = "directory"
  directoryAndFileName = "directory/file"

This simplifies code using esxUtil_ParseDatastorePath, because
directoryAndFileName is used more often than fileName. Also the
old approach expected the datastore path to reference an actual
file, but this isn't always correct, especially when listing
volumes. In that case esxUtil_ParseDatastorePath is used to parse
a path that references a directory. This fails for a vpx://
connection because the vCenter returns directory paths with a
trailing '/'. The new approach is robust against this and the
actual decision if the datastore path should reference a file or
a directory is up to the caller of esxUtil_ParseDatastorePath.

Update the tests accordingly.

14 years agovbox: factor a large function
Eric Blake [Tue, 31 Aug 2010 18:01:45 +0000 (12:01 -0600)]
vbox: factor a large function

* src/vbox/vbox_tmpl.c (vboxDomainDefineXML): Split...
(vboxSetBootDeviceOrder, vboxAttachDrives, vboxAttachSound)
(vboxAttachNetwork, vboxAttachSerial, vboxAttachParallel)
(vboxAttachVideo, vboxAttachDisplay, vboxAttachUSB): ...into new
helper functions.

14 years agolxc: avoid large stacks with veth creation
Eric Blake [Tue, 31 Aug 2010 22:04:46 +0000 (16:04 -0600)]
lxc: avoid large stacks with veth creation

* src/lxc/veth.h (vethCreate): Change prototype.
* src/lxc/veth.c (vethCreate): Always malloc veth2, and allocate
veth1 if needed.
(getFreeVethName): Adjust signature, and use virAsprintf.
* src/lxc/lxc_driver.c (lxcSetupInterfaces): Adjust caller.

14 years agoesx: Fix generator for string return values
Matthias Bolte [Sun, 29 Aug 2010 17:17:10 +0000 (19:17 +0200)]
esx: Fix generator for string return values

Distinguish between strings as parameters (const char *)
and strings as return values (char **).

14 years agoopenvz: use virAsprintf to avoid large stacks
Eric Blake [Tue, 31 Aug 2010 22:56:22 +0000 (16:56 -0600)]
openvz: use virAsprintf to avoid large stacks

* src/openvz/openvz_conf.c (openvzLocateConfFile): Alter
signature.
(openvzGetVPSUUID, openvzSetDefinedUUID)
(openvzWriteVPSConfigParam, openvzReadVPSConfigParam)
(openvzCopyDefaultConfig): Adjust callers.

14 years agoopenvz: formatting cleanups
Eric Blake [Tue, 31 Aug 2010 22:43:18 +0000 (16:43 -0600)]
openvz: formatting cleanups

* src/openvz/openvz_conf.c: Whitespace fixes.
* src/openvz/openvz_driver.c: Likewise.

14 years agonetwork: use virAsprintf when appropriate
Eric Blake [Tue, 31 Aug 2010 20:25:49 +0000 (14:25 -0600)]
network: use virAsprintf when appropriate

* src/conf/network_conf.c (virNetworkAllocateBridge): Avoid
limited buffer from snprintf.

14 years agobuild: add some modules
Eric Blake [Tue, 31 Aug 2010 22:27:24 +0000 (16:27 -0600)]
build: add some modules

snprintf is currently implicitly picked up by getaddrinfo, but we
might as well make it explicit so that mingw doesn't break if
getaddrinfo changes to drop the dependency.

func doesn't matter for gcc compilation, but may help other compilers
cope with our use of __func__.

* bootstrap.conf (gnulib_modules): Add snprintf and func.

14 years agovirsh: remove driver check from attach-disk command
Ryan Harper [Tue, 24 Aug 2010 16:09:00 +0000 (11:09 -0500)]
virsh: remove driver check from attach-disk command

Virsh shouldn't check for driver support but rather let the backend handled this.
After removing the check, I can successfully attach file-based images to a qemu
VM with attach-disk.

% virsh attach-disk vm2 /images/test02.img vdc --driver qemu --type disk --subdriver raw
Disk attached successfully

This command generates the following XML:

<disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/images/test02.img'/>
      <target dev='vdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
14 years agoUse global directory as UML's monitorDir for privileged connections
Soren Hansen [Tue, 31 Aug 2010 11:44:16 +0000 (13:44 +0200)]
Use global directory as UML's monitorDir for privileged connections

For privileged UML connections (uml:///system), we shouldn't use root's
home dir, but rather somewhere in /var/run/libvirt/uml-guest.

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

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoExplicitly pass uml_dir argument to user-mode-linux
Soren Hansen [Wed, 25 Aug 2010 09:03:42 +0000 (11:03 +0200)]
Explicitly pass uml_dir argument to user-mode-linux

uml_dir overrides user-mode-linux's default of ~/.uml. This is needed
for a couple of different reasons:

libvirt expects this to default to virGetUserDirectory(geteuid()) +
'/.uml'. However, user-mode-linux actually uses the HOME environment
variable to determine where to look for the uml sockets, but if running
libvirtd under sudo (which I routinely do during development), $HOME is
pointing at my user's homedir, while my euid is 0, so libvirt looks in
/root.

Also (and this was my actual motivation for this patch), if HOME isn't
set at all, user-mode-linux utterly fails. Looking at the code, it seems
it's meant to emit a warning, but alas, it doesn't for some reason.
If running libvirtd from upstart, HOME is not set, so any system using
upstart will need this change.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agomaint: track moved file
Eric Blake [Tue, 31 Aug 2010 16:00:31 +0000 (10:00 -0600)]
maint: track moved file

* daemon/.gitignore: Move libvirt-guests.init...
* tools/.gitignore: ...to its new location.

14 years agoAdd tests for Xen's blktap2 implementation
Jim Fehlig [Tue, 24 Aug 2010 21:49:00 +0000 (15:49 -0600)]
Add tests for Xen's blktap2 implementation

xml2sexpr and sexpr2xml tests for blktap2

14 years agoAdd blktap2 support to xend driver
Jim Fehlig [Tue, 24 Aug 2010 17:31:14 +0000 (11:31 -0600)]
Add blktap2 support to xend driver

Xen4.0 includes a new blktap2 implementation, which is specified
with 'tap2' prefix.  AFAICT it's configuration syntax is identical
to blktap, with exception of 'tap2' vs 'tap' prefix.  This patch
takes the simple approach of accepting and generating sexp
containing 'tap2' prefix.

14 years agoesx: Map the .vmx annotation to the domain XML description
Matthias Bolte [Fri, 27 Aug 2010 15:23:49 +0000 (17:23 +0200)]
esx: Map the .vmx annotation to the domain XML description

Take care of escaping '"' and '|' (the escape character).

Add tests for this.

14 years agoMove hextobin as virHexToBin to util.c
Matthias Bolte [Fri, 27 Aug 2010 21:13:45 +0000 (23:13 +0200)]
Move hextobin as virHexToBin to util.c

virHexToBin will be used in the .vmx handling code.

14 years agoPHYP: Bad comparison when checking for existing domain name
Eduardo Otubo [Tue, 17 Aug 2010 19:04:49 +0000 (16:04 -0300)]
PHYP: Bad comparison when checking for existing domain name

When creating a new domain from XML, the check for an existing
domain name should compare the return of the function to a valid
LPAR ID (!= -1) and not to error (== -1).

14 years agoesx: Fix esxVI_BuildSelectSet's invalid argument check
Matthias Bolte [Thu, 26 Aug 2010 22:07:23 +0000 (00:07 +0200)]
esx: Fix esxVI_BuildSelectSet's invalid argument check

The check was altered in 8c48743b9737ad4d246ab6043fd299316f9a2091
and got too strict, I've no clue how that snuck in. This check
makes every try to open a connection using the ESX driver fail
with an invalid argument error.

Revert the change to the check and add a comment to prevent future
mistakes with this check.

14 years agoesx: Add read-only storage volume access
Matthias Bolte [Sat, 7 Aug 2010 22:24:29 +0000 (00:24 +0200)]
esx: Add read-only storage volume access

This allows to list existing volumes and to retrieve information
about them.

14 years agoMove libvirt-guests init script and config to tools
Jiri Denemark [Wed, 25 Aug 2010 12:07:26 +0000 (14:07 +0200)]
Move libvirt-guests init script and config to tools

Since libvirt-guests init script and its configuration do not require
libvirtd to be running/installed, it was a bad idea to put them into
daemon directory. libvirt.spec even includes these files in
libvirt-client subpackage, which may result in build failure for
client-only builds when the whole daemon directory is just skipped.

14 years agospec: Fix undefined with_libnl
Jiri Denemark [Wed, 25 Aug 2010 10:28:02 +0000 (12:28 +0200)]
spec: Fix undefined with_libnl

When building libvirt RPM without macvtap, with_libnl would be
undefined.

14 years agoSupport virDomainAttachDevice and virDomainDetachDevice for disks in UML
Soren Hansen [Mon, 23 Aug 2010 09:31:27 +0000 (11:31 +0200)]
Support virDomainAttachDevice and virDomainDetachDevice for disks in UML

UML supports hot plugging and unplugging of various devices. This patch
exposes this functionality for disks.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoRename qemudShrinkDisks to virDomainDiskRemove and move to domain_conf.c
Soren Hansen [Mon, 23 Aug 2010 09:31:26 +0000 (11:31 +0200)]
Rename qemudShrinkDisks to virDomainDiskRemove and move to domain_conf.c

Other drivers will need this same functionality, so move it to up to
conf/domain_conf.c and give it a more general name.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agodocs: fix lxc examples
Serge Hallyn [Tue, 15 Jun 2010 22:46:21 +0000 (16:46 -0600)]
docs: fix lxc examples

* docs/drvlxc.html.in: Use correct VM name, and mention that
libvirt_lxc might be in an alternate location.

14 years agoFix handling of sparse NUMA topologies
Daniel P. Berrange [Tue, 17 Aug 2010 15:09:28 +0000 (11:09 -0400)]
Fix handling of sparse NUMA topologies

When finding a sparse NUMA topology, libnuma will return ENOENT
the first time it is invoked. On subsequent invocations it
will return success, but with an all-1's CPU mask. Check for
this, to avoid polluting the capabilities XML with 4096 bogus
CPUs

* src/nodeinfo.c: Check for all-1s CPU mask

14 years agoLog return value for virConnectGetCapabilities
Daniel P. Berrange [Tue, 17 Aug 2010 15:08:19 +0000 (11:08 -0400)]
Log return value for virConnectGetCapabilities

Enabling debug doesn't show the capabilities XML for a connection.
Add an extra debug statement for the return value

* src/libvirt.c: Enable debug logging of capabilities XML

14 years agoTry harder to send RPC error message back to client
Daniel P. Berrange [Tue, 17 Aug 2010 14:31:51 +0000 (10:31 -0400)]
Try harder to send RPC error message back to client

When failing to serialize the normal RPC reply, try harder to
send a error message back to the client, instead of immediately
closing the connection.

* daemon/dispatch.c: Improve error messages when RPC reply
  can not be sent

14 years agoAdd explicit warning messages when failing to serialize to XDR
Daniel P. Berrange [Tue, 17 Aug 2010 14:23:27 +0000 (10:23 -0400)]
Add explicit warning messages when failing to serialize to XDR

When libvirtd fails to serialize a message to XDR the client
connection is terminated immediately. To enable this to be
diagnosed, log the message which caused the problem on the
server

* daemon/dispatch.c: Log XDR serialization failures

14 years agoAllow chardev of type 'file' for UML domains.
Soren Hansen [Mon, 23 Aug 2010 11:25:50 +0000 (13:25 +0200)]
Allow chardev of type 'file' for UML domains.

Like the comment suggested, we just open the file and pass the file
descriptor to uml. The input "stream" is set to "null", since I couldn't
find any useful way to actually use a file for input for a chardev and
this also mimics what e.g. QEmu does internally.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoesx: Improve object-by-type lookup performance
Matthias Bolte [Sat, 21 Aug 2010 16:49:18 +0000 (18:49 +0200)]
esx: Improve object-by-type lookup performance

Instead of using one big traversal spec for lookup use a set of
more fine grained traversal specs that are selected based on the
actual needs of the lookup.

This gives up to 20% speedup for certain operations like domain
listing due to less HTTP(S) traffic.

14 years agoxen tests: Fix PV-VFB tests with RHEL-5 API
Jiri Denemark [Mon, 23 Aug 2010 13:43:51 +0000 (15:43 +0200)]
xen tests: Fix PV-VFB tests with RHEL-5 API

RHEL-5 Xen doesn't support the old style vnc configuration. In sexpr, we
can't really check it with rhel5-api turned on. However, for XM
configuration files it's sufficient to use cfg version 1 instead of 2.

14 years agoxml2sexprtest: Remove graphics from unrelated tests
Jiri Denemark [Mon, 23 Aug 2010 13:42:12 +0000 (15:42 +0200)]
xml2sexprtest: Remove graphics from unrelated tests

This caused unnecessary make check failures when libvirt is configured
--with-rhel5-api

14 years agoxen tests: Fix missing "type ioemu" with rhel5-api
Jiri Denemark [Mon, 23 Aug 2010 12:58:08 +0000 (14:58 +0200)]
xen tests: Fix missing "type ioemu" with rhel5-api

The most common cause of errors with rhel5-api turn on was missing
"(type ioemu)" in sexpr or its equivalent in XM configuration file. This
happens because the presence of that part in sexpr (or cfg) depends on
xen version the host is running. Let's avoid it by explicitly specifying
interface model which ensures "type ioemu" will always be emitted.

This patch adds

    <model type='e1000'/>

withing the interface element in all affected xml files. And

    (model 'e1000')

to all corresponding sexpr files with similar fix to cfg files. Such
configuration works regardless on Xen version.

14 years agonodeinfotest: Print libvirt error on failure
Jiri Denemark [Mon, 23 Aug 2010 14:48:33 +0000 (16:48 +0200)]
nodeinfotest: Print libvirt error on failure

If linuxNodeInfoCPUPopulate() fails, the test would just print "FAILED"
which is not very informative. It's better to print the real error.

14 years agoxenapi: support xenapi 5.6.0 headers
Eric Blake [Fri, 20 Aug 2010 23:35:54 +0000 (17:35 -0600)]
xenapi: support xenapi 5.6.0 headers

* src/xenapi/xenapi_driver.c (xenapiDomainGetInfo): Avoid using
XEN_VM_POWER_STATE_UNKNOWN, which disappeared in newer xenapi.
* src/xenapi/xenapi_utils.c (mapPowerState): Likewise.

14 years agoAdd support for -enable-kqemu flag
Daniel P. Berrange [Fri, 23 Jul 2010 11:05:32 +0000 (12:05 +0100)]
Add support for -enable-kqemu flag

Previously QEMU enabled KQEMU by default and had -no-kqemu.
0.11.x switched to requiring -enable-kqemu. 0.12.x dropped
kqemu entirely. This patch adds support for -enable-kqemu
so 0.11.x works. It replaces a huge set of if() with a
switch() to make the code a bit more readable.

* src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Support
  -enable-kqemu

14 years agoesx: Use MD5 sum of mount path as storage pool UUID
Matthias Bolte [Sun, 8 Aug 2010 18:45:12 +0000 (20:45 +0200)]
esx: Use MD5 sum of mount path as storage pool UUID

With the previous storage pool UUID source not all storage pools
had a proper UUID, especially GSX storage pools. The mount path
is unique per host and cannot change during the lifetime of the
datastore. Therefore, it's MD5 sum can be used as UUID.

Use gnulib's crypto/md5 module to generate the MD5 sum.

14 years agoesx: Make sure dumpxml outputs proper ID for active domains
Matthias Bolte [Fri, 20 Aug 2010 18:42:45 +0000 (20:42 +0200)]
esx: Make sure dumpxml outputs proper ID for active domains

14 years agoxenapi: Fix compile error in previous commit
Matthias Bolte [Fri, 20 Aug 2010 21:28:28 +0000 (23:28 +0200)]
xenapi: Fix compile error in previous commit

14 years agoAdd actions to virDomainLifecycle enum
Jim Fehlig [Thu, 12 Aug 2010 17:15:44 +0000 (11:15 -0600)]
Add actions to virDomainLifecycle enum

Xen supports on_crash actions coredump-{destroy,restart}.  libvirt
cannot parse config returned by xend that contains either of these
actions

xen52 # xm li -l test | grep on_crash
    (on_crash coredump-restart)
xen52 # virsh dumpxml test
error: internal error unknown lifecycle type coredump-restart

This patch adds a new virDomainLifecycleCrash enum and appends
the new options to existing destroy, restart, preserve, and
rename-restart options.

14 years agoqemu: Remove code duplication
Jiri Denemark [Fri, 20 Aug 2010 11:57:35 +0000 (13:57 +0200)]
qemu: Remove code duplication

We already filled the PCI address structure when we checked whether it's
free or not, so let's just use the structure here instead of filling it
again.

14 years agoqemu: Check for errors when converting PCI address to string
Jiri Denemark [Fri, 20 Aug 2010 11:53:54 +0000 (13:53 +0200)]
qemu: Check for errors when converting PCI address to string

14 years agoqemu: Fix JSON migrate_set_downtime command
Jiri Denemark [Thu, 19 Aug 2010 13:59:25 +0000 (15:59 +0200)]
qemu: Fix JSON migrate_set_downtime command

14 years agovbox: factor a large function
Eric Blake [Wed, 18 Aug 2010 23:20:07 +0000 (17:20 -0600)]
vbox: factor a large function

* src/vbox/vbox_tmpl.c (vboxDomainCreateWithFlags): Split...
(vboxStartMachine): ...into new helper.

14 years agovbox: add location used in rpmfusion release
Eric Blake [Wed, 18 Aug 2010 22:59:20 +0000 (16:59 -0600)]
vbox: add location used in rpmfusion release

* configure.ac (vbox_xpcomc_dir): Add another potential dir.

14 years agoxenapi: avoid sprintf
Eric Blake [Wed, 18 Aug 2010 22:57:00 +0000 (16:57 -0600)]
xenapi: avoid sprintf

* src/xenapi/xenapi_utils.h (createVifNetwork): Delete prototype.
* src/xenapi/xenapi_utils.c (createVifNetwork): Change signature,
and use virAsprintf.  Detect allocation failure.
(createVMRecordFromXml): Adjust caller.

14 years agostorage: avoid s[n]printf
Eric Blake [Wed, 18 Aug 2010 21:54:11 +0000 (15:54 -0600)]
storage: avoid s[n]printf

* src/storage/storage_backend.c (virStorageBackendCreateQemuImg)
(virStorageBackendCreateQcowCreate): Use virAsprintf instead.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskCreateVol, virStorageBackendDiskPartFormat):
Likewise.

14 years agomaint: whitespace cleanups
Eric Blake [Wed, 18 Aug 2010 20:54:48 +0000 (14:54 -0600)]
maint: whitespace cleanups

* src/storage/storage_backend_disk.c
(virStorageBackendDiskPartFormat): Fix spacing.

14 years agobuild: delete dead comments
Eric Blake [Wed, 18 Aug 2010 19:54:11 +0000 (13:54 -0600)]
build: delete dead comments

* src/qemu/qemu_driver.c (qemudGetProcessInfo): Clean up.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/xen/sexpr.c (_string2sexpr): Likewise.

14 years agostorage: add support for Vendor and Model in XML
Patrick Dignan [Tue, 17 Aug 2010 17:44:27 +0000 (12:44 -0500)]
storage: add support for Vendor and Model in XML

I wrote a patch to add support for listing the Vendor and Model of a
storage pool in the storage pool XML.  This would allow vendor
extensions of specific devices.  The patch includes a test for the new
attributes as well.

Patrick Dignan

14 years agouml: fix logic bug in checking reply length
Eric Blake [Mon, 16 Aug 2010 21:21:38 +0000 (15:21 -0600)]
uml: fix logic bug in checking reply length

* src/uml/uml_driver.c (umlMonitorCommand): Validate that enough
bytes were read to dereference both res.length, and that many
bytes from res.data.
Reported by Soren Hansen.

14 years agonwfilter: use consistent OOM reporting
Eric Blake [Wed, 18 Aug 2010 18:10:08 +0000 (12:10 -0600)]
nwfilter: use consistent OOM reporting

* src/nwfilter/nwfilter_driver.c (nwfilterLog): Delete.
(nwfilterDriverStartup): Use virReportOOMError instead.

14 years agobuild: fix compiler warning
Eric Blake [Wed, 18 Aug 2010 19:43:26 +0000 (13:43 -0600)]
build: fix compiler warning

node_device/node_device_driver.c: In function 'nodeDeviceVportCreateDelete':
node_device/node_device_driver.c:423: error: implicit declaration of function 'stat' [-Wimplicit-function-declaration]

* src/node_device/node_device_driver.c (includes): Add <sys/stat.h>.

14 years agoxen: Fix scheduler setting problems
Daniel Veillard [Tue, 17 Aug 2010 16:30:17 +0000 (18:30 +0200)]
xen: Fix scheduler setting problems

Doing `virsh schedinfo rhel5u3 --cap 65535' the hypervisor does the
call, but does not change the value nor raise an error. Best is just to
consider it's not in the allowed values. The problem is that the error
won't be output since the xend driver will then be called and raise an
error

    error: this function is not supported by the hypervisor: unsupported
    in xendConfigVersion < 4

which will override the useful information from
xenUnifiedDomainSetSchedulerParameters(). So best is to also invert the
order in which the xen sub-drivers are called.

* src/xen/xen_hypervisor.c: mark 65535 cap value as out of bound
* src/xen/xen_hypervisor.c: reverse the order of the calls to the xen
  sub drivers to get the error message if needed

14 years agonodedev: Free the right pointers when getting WWNs fails
Jiri Denemark [Tue, 17 Aug 2010 15:49:12 +0000 (17:49 +0200)]
nodedev: Free the right pointers when getting WWNs fails

14 years agonodedev: Fix sysfs paths for vport operations
Dave Allan [Tue, 17 Aug 2010 15:21:16 +0000 (17:21 +0200)]
nodedev: Fix sysfs paths for vport operations

Some kernels, such as the one used in RHEL-5, have vport_create and
vport_delete operation files in /sys/class/scsi_host/hostN directory
instead of /sys/class/fc_host/hostN. Let's check both paths for
compatibility reasons.

This also removes unnecessary '/' characters from sysfs paths containing
LINUX_SYSFS_FC_HOST_PREFIX.

14 years agoxen: Fix device count on detach
Daniel Berrange [Tue, 17 Aug 2010 14:14:28 +0000 (16:14 +0200)]
xen: Fix device count on detach

14 years agoremote: Fix incorrect use of private data field
Daniel Berrange [Mon, 9 Aug 2010 12:16:04 +0000 (14:16 +0200)]
remote: Fix incorrect use of private data field

NodeDeviceCreateXML and NodeDeviceDestroy methods added for NPIV were
using the wrong privateData field for the remote driver. This doesn't
impact KVM, since the remote driver handles everything, thus
privateData == devMonPrivateData. It does impact Xen though, because
the remote driver only handles a subset of methods and thus
privateData != devMonPrivateData.

14 years agoesx: Fix memory leak when looking up an non-existing domain by name
Matthias Bolte [Sun, 8 Aug 2010 19:32:29 +0000 (21:32 +0200)]
esx: Fix memory leak when looking up an non-existing domain by name

In case an optional object cannot be found the lookup function is
left early and the cleanup code is not executed.

This pattern occurs in some other functions too.

14 years agoFix up qemu domain save/managed save locking.
Chris Lalancette [Fri, 13 Aug 2010 13:23:11 +0000 (09:23 -0400)]
Fix up qemu domain save/managed save locking.

The current version of the qemu managed save implementation
is subject to a race where the domain shuts down between
the time that we start the command and the time that we
actually try to do the save.  Close this race by making
qemuDomainSaveFlags() expect both the driver and the passed-in
vm object to be locked before executing.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agodocs: mention domain <clock> improvements
Eric Blake [Thu, 13 May 2010 22:00:14 +0000 (16:00 -0600)]
docs: mention domain <clock> improvements

Add documentation for features added a while ago.

* docs/formatdomain.html.in (Time keeping): Update documentation
of <clock> element to match 0.8.0 addition.

14 years agocygwin: build fix
Stefan Berger [Tue, 17 Aug 2010 10:37:27 +0000 (06:37 -0400)]
cygwin: build fix

Fixing a problem in the build on cygwin due to missing #define's.

14 years agoqemu: Fix copy&paste error in warning message
Jiri Denemark [Fri, 13 Aug 2010 14:44:27 +0000 (16:44 +0200)]
qemu: Fix copy&paste error in warning message

This also makes the message consistent with the message used in error
path of qemudDomainAttachHostPciDevice.

14 years agoqemu: Release PCI slot when detaching disk and net devices
Jiri Denemark [Fri, 13 Aug 2010 14:42:15 +0000 (16:42 +0200)]
qemu: Release PCI slot when detaching disk and net devices

14 years agoqemu: Re-reserve all PCI addresses on libvirtd restart
Jiri Denemark [Fri, 13 Aug 2010 14:16:19 +0000 (16:16 +0200)]
qemu: Re-reserve all PCI addresses on libvirtd restart

When reconnecting to existing VMs, we re-reserved only those PCI
addresses which were explicitly mentioned in domain XML. Since some
addresses are always reserved (e.g., 0:0:0 and 0:0:1), we need to handle
those too.

Also all this should only be done if device flag is supported by qemu.

14 years agobuild: fix AppArmor compilation
Jamie Strandboge [Fri, 13 Aug 2010 22:00:31 +0000 (17:00 -0500)]
build: fix AppArmor compilation

* src/security/virt-aa-helper.c: Add missing include.

14 years agonwfilter: extend nwfilter reload support
Stefan Berger [Mon, 16 Aug 2010 16:59:54 +0000 (12:59 -0400)]
nwfilter: extend nwfilter reload support

In this patch I am extending and fixing the nwfilter module's reload support to stop all ongoing threads (for learning IP addresses of interfaces) and rebuild the filtering rules of all interfaces of all VMs when libvirt is started. Now libvirtd rebuilds the filters upon the SIGHUP signal and libvirtd restart.

About the patch: The nwfilter functions require a virConnectPtr. Therefore I am opening a connection in qemudStartup, which later on needs to be closed outside where the driver lock is held since otherwise it ends up in a deadlock due to virConnectClose() trying to lock the driver as well.

I have tested this now for a while with several machines running and needing the IP address learner thread(s). The rebuilding of the firewall rules seems to work fine following libvirtd restart or a SIGHUP. Also the termination of libvirtd worked fine.

14 years agobuild: allow mingw VPATH build
Eric Blake [Sat, 14 Aug 2010 17:23:59 +0000 (11:23 -0600)]
build: allow mingw VPATH build

* .gnulib: Update to latest.
Reported by Matthias Bolte.

14 years agoesx: Explicitly disable unused floppy devices
Matthias Bolte [Fri, 6 Aug 2010 00:02:03 +0000 (02:02 +0200)]
esx: Explicitly disable unused floppy devices

floppy0.present defaults to true. Therefore, it needs to be
explicitly set to false when the XML config doesn't specify the
corresponding floppy device.

Also update tests accordingly.

14 years agoGenerate libvirt_qemu.def from libvirt_qemu.syms for MinGW builds
Matthias Bolte [Thu, 12 Aug 2010 21:43:16 +0000 (23:43 +0200)]
Generate libvirt_qemu.def from libvirt_qemu.syms for MinGW builds

14 years agoPHYP: Add rudimentary network driver
Eduardo Otubo [Thu, 12 Aug 2010 14:33:12 +0000 (11:33 -0300)]
PHYP: Add rudimentary network driver

I changed virStorage[Open|Close] to virVIOSDriver[Open|Close] so
the network driver can use it - since the network driver deals
with Open/Close in the same way.

14 years agoMake umlConnectTapDevice ask brAddTap for a persistent tap device.
Soren Hansen [Thu, 12 Aug 2010 13:06:34 +0000 (15:06 +0200)]
Make umlConnectTapDevice ask brAddTap for a persistent tap device.

This patch does two things:

 * It makes umlConnectTapDevice ask brAddTap for a persistent tap by
   passing it a NULL tapfd argument.
 * Stops umlConnectTapDevice from immediately dismantling the bridge
   it just set up.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoClose fd's of persistent tap devices
Soren Hansen [Wed, 11 Aug 2010 21:51:41 +0000 (23:51 +0200)]
Close fd's of persistent tap devices

When passing a NULL tapfd argument to brAddTap, we need to close the fd
of the tap device. If we don't, libvirt will keep the fd open
indefinitely and renders the the guest unable to configure its side of
the tap device.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoMake sure all command line arguments get passed to UML
Soren Hansen [Thu, 12 Aug 2010 13:42:34 +0000 (15:42 +0200)]
Make sure all command line arguments get passed to UML

If umlBuildCommandLineChr fails (e.g. due to an unsupported chardev
type), it returns NULL. umlBuildCommandLine does not check for this and
sets this as an argument on the comand line, effectively ending the
argument list. This patch checks for this case and sets the chardev to
"none".

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agonwfilter: Discard class D,E IP addresses when sniffing pkts
Stefan Berger [Fri, 13 Aug 2010 20:41:39 +0000 (16:41 -0400)]
nwfilter: Discard class D,E IP addresses when sniffing pkts

When sniffing the network traffic, discard class D and E IP addresses when sniffing traffic. This was a reason why filters were not correctly rebuilt on VMs on the local 192.* network when libvirt was restarted and those VMs did not use a DHCP request to get its IP address.

14 years agonwfilter: serialize execution of scripts with ebtables cmds
Stefan Berger [Fri, 13 Aug 2010 19:47:10 +0000 (15:47 -0400)]
nwfilter: serialize execution of scripts with ebtables cmds

While testing the SIGHUP handling and reloading of the nwfilter driver, I found that when the filters are rebuilt and mutlipe threads handled the individual interfaces, concurrently running multiple external bash scripts causes strange failures even though the executed ebtables commands are working on different tables for different interfaces. I cannot say for sure where the concurrency problems are caused, but introducing this lock definitely helps.

14 years agoOnly require XDR when building libvirtd or the remote driver
Matthias Bolte [Thu, 12 Aug 2010 21:45:20 +0000 (23:45 +0200)]
Only require XDR when building libvirtd or the remote driver

14 years agoMove the tunnelled migration unix socket to /var/lib/libvirt/qemu
Chris Lalancette [Thu, 12 Aug 2010 16:51:31 +0000 (12:51 -0400)]
Move the tunnelled migration unix socket to /var/lib/libvirt/qemu

Since the qemu process is running as qemu:qemu, it can't actually
look at the unix socket in /var/run/libvirt/qemu which is owned by
root and has permission 700.  Move the unix socket to
/var/lib/libvirt/qemu, which is already owned by qemu:qemu.

Thanks to Justin Clift for test this out for me.

Signed-off-by: Chris Lalancette <clalance@redhat.com>