]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
14 years agoFix tunnelled migration with qemu running as qemu:qemu.
Chris Lalancette [Thu, 12 Aug 2010 14:01:31 +0000 (10:01 -0400)]
Fix tunnelled migration with qemu running as qemu:qemu.

The problem is that on the source of the migration, libvirtd
is responsible for creating the unix socket over which the data
will flow.  Since libvirtd is running as root, this file will
be created as root.  When the qemu process running as qemu:qemu
goes to access the unix file to write data to it, it will get
permission denied and fail.  Make sure to change the owner
of the unix file to qemu:qemu.

Thanks to Justin Clift for testing this patch out for me.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix valgrind complaints when using kill -SIGHUP on libvirtd
Stefan Berger [Thu, 12 Aug 2010 20:30:11 +0000 (16:30 -0400)]
Fix valgrind complaints when using kill -SIGHUP on libvirtd

This patch fixes a couple of complaints from valgrind when tickling libvirtd with SIGHUP.

The first two files contain fixes for memory leaks. The 3rd one initializes an uninitialized variable. The 4th one is another memory leak.

14 years agoqemu: avoid calling the balloon info command if disabled
Daniel Veillard [Thu, 12 Aug 2010 16:32:16 +0000 (18:32 +0200)]
qemu: avoid calling the balloon info command if disabled

 Basically a followup of the previous patch about balloon desactivation
if desactivated, to not ask for balloon information to qemu as we will
just get an error back.
 This can make a huge difference in the time needed for domain
information or list when a machine is loaded, and balloon has been
desactivated in the guests.

* src/qemu/qemu_driver.c: do not get the balloon info if the balloon
  suppor is disabled

14 years agobridge: Add --dhcp-no-override option to dnsmasq
Jiri Denemark [Wed, 11 Aug 2010 18:25:09 +0000 (20:25 +0200)]
bridge: Add --dhcp-no-override option to dnsmasq

--dhcp-no-override description from dnsmasq man page:

      Disable  re-use  of  the  DHCP servername and filename fields as
      extra option space. If it can, dnsmasq moves the boot server and
      filename  information  (from  dhcp-boot)  out of their dedicated
      fields into DHCP options. This make extra space available in the
      DHCP  packet  for options but can, rarely, confuse old or broken
      clients. This flag forces "simple and safe" behaviour  to  avoid
      problems in such a case.

It seems some virtual network card ROMs are this old/buggy so let's add
--dhcp-no-override as a workaround for them. We don't use extra DHCP
options so this should be safe. The option was added in dnsmasq-2.41,
which becomes the minimum required version.

14 years agoesx: Improve VMX file name parsing and formatting
Matthias Bolte [Sat, 7 Aug 2010 17:58:29 +0000 (19:58 +0200)]
esx: Improve VMX file name parsing and formatting

For parsing try to match by datastore mount path first, if that
fails fallback to /vmfs/volumes/<datastore>/<path> parsing. This
also fixes problems with GSX on Windows. Because GSX on Windows
doesn't use /vmfs/volumes/ style file names.

For formatting use the datastore mount path too, instead of using
/vmfs/volumes/<datastore>/<path> as fixed format.

14 years agobridge: Fix potential segfault when preparing dnsmasq arguments
Jiri Denemark [Wed, 11 Aug 2010 15:47:18 +0000 (17:47 +0200)]
bridge: Fix potential segfault when preparing dnsmasq arguments

We add --dhcp-lease-max=xxx argument when network->def->nranges > 0 but
we only allocate space for in the opposite case :-) I guess we are lucky
enough to miscount somewhere else so that we actually allocate more
space than we need since no-one has hit this bug so far.

14 years agoesx: Split VMX code into a general and an ESX specific part
Matthias Bolte [Thu, 5 Aug 2010 15:43:19 +0000 (17:43 +0200)]
esx: Split VMX code into a general and an ESX specific part

Introduce esxVMX_Context containing functions pointers to
glue both parts together in a generic way.

Move the ESX specific part to esx_driver.c.

This is a step towards making the VMX code reusable in a
potential VMware Workstation and VMware Player driver.

14 years agoallow memballoon type of none to desactivate it
Daniel Veillard [Wed, 11 Aug 2010 09:28:17 +0000 (11:28 +0200)]
allow memballoon type of none to desactivate it

  The balloon device is automatically added to qemu guests if supported,
but it may be useful to desactivate it. The simplest to not change the
existing behaviour is to allow
  <memballoon type="none"/>
as an extra option to desactivate it (it is automatically added if the
memballoon construct is missing for the domain).
The following simple patch just adds the extra option and does not
change the default behaviour but avoid creating a balloon device if
type="none" is used.

* docs/schemas/domain.rng: add the extra type attribute value
* src/conf/domain_conf.c src/conf/domain_conf.h: add the extra enum
  value
* src/qemu/qemu_conf.c: if enum is NONE, don't activate the device,
  i.e. don't pass the args to qemu/kvm

14 years agoAvoid unnecessary bootstrap runs in VPATH builds
Jiri Denemark [Tue, 10 Aug 2010 14:58:16 +0000 (16:58 +0200)]
Avoid unnecessary bootstrap runs in VPATH builds

14 years agoAdd a detailed message when tap device add fails
Doug Goldstein [Tue, 10 Aug 2010 21:43:37 +0000 (16:43 -0500)]
Add a detailed message when tap device add fails

Added a more detailed error message when adding a tap devices fails and
the kernel is missing tun support.

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
14 years agoFix return value usage
Doug Goldstein [Tue, 10 Aug 2010 21:43:29 +0000 (16:43 -0500)]
Fix return value usage

Fix the error checking to use the return value from brAddTap() instead
of checking the current errno value which might have been changed by
clean up calls inside of brAddTap().

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>
14 years agonodeinfo: skip offline CPUs
Eric Blake [Tue, 10 Aug 2010 21:33:37 +0000 (15:33 -0600)]
nodeinfo: skip offline CPUs

https://bugzilla.redhat.com/622515 - When hot-unplugging CPUs,
libvirt failed to start a guest that had been pinned to CPUs that
were still online.

Tested on a dual-core laptop, where I also discovered that, per
http://www.cyberciti.biz/files/linux-kernel/Documentation/cpu-hotplug.txt,
/sys/devices/system/cpu/cpu0/online does not exist on systems where it
cannot be hot-unplugged.

* src/nodeinfo.c (linuxNodeInfoCPUPopulate): Ignore CPUs that are
currently offline.  Detect readdir failure.
(parse_socket): Move guts...
(get_cpu_value): ...to new function, shared with...
(cpu_online): New function.

14 years agoqemu: Hack around asynchronous device_del
Jiri Denemark [Mon, 9 Aug 2010 12:14:34 +0000 (14:14 +0200)]
qemu: Hack around asynchronous device_del

device_del command is not synchronous for PCI devices, it merely asks
the guest to release the device and returns. If the host wants to use
that device before the guest actually releases it, we are in big
trouble. To avoid this, we already added a loop which waits up to 10
seconds until the device is actually released before we do anything else
with that device. But we only added this loop for managed PCI devices
before we try reattach them back to the host.

However, we need to wait even for non-managed devices. We don't reattach
them automatically, but we still want to prevent the host from using it.
This was revealed thanks to sVirt: when we relabel sysfs files
corresponding to the PCI device before the guest finished releasing the
device, qemu is no longer allowed to access those files and if it wants
(as a result of guest's request) to write anything to them, it just
exits, which kills the guest.

This is not a proper fix and needs some further work both on libvirt and
qemu side in the future.

14 years agomaint: update an email address preference
Eric Blake [Tue, 10 Aug 2010 14:13:22 +0000 (08:13 -0600)]
maint: update an email address preference

* AUTHORS (Soren Hansen): Update address.
* .mailmap: Alias other addresses to new preference.

14 years agobuild-sys: only build the test programs during the check phase.
Diego Elio Pettenò [Tue, 10 Aug 2010 12:38:57 +0000 (14:38 +0200)]
build-sys: only build the test programs during the check phase.

This avoids building the tests when testing libvirt is not the aim.

14 years agoAdd "ubd" to the list of disk prefixes
Soren Hansen [Tue, 10 Aug 2010 11:46:46 +0000 (13:46 +0200)]
Add "ubd" to the list of disk prefixes

virDiskNameToIndex has a list of disk name prefixes that it uses in the
process of finding the disk's index. This list is missing "ubd" which
is the disk prefix used for UML domains.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
14 years agoExtend virSocketParseAddr() to allow a NULL result pointer
Daniel Veillard [Tue, 10 Aug 2010 13:00:15 +0000 (15:00 +0200)]
Extend virSocketParseAddr() to allow a NULL result pointer

That way it can be used to verify a numeric address without storing
the details
* src/util/network.c: change virSocketParseAddr to allow a null @addr
  parameter

14 years agobootloader_args is named bootargs in xen-xm
Philipp Hahn [Thu, 5 Aug 2010 15:07:18 +0000 (17:07 +0200)]
bootloader_args is named bootargs in xen-xm

According to <xen-3.4.3/tools/python/xen/xm/create.py:158>
gopts.var('bootargs', val='NAME',
  fn=set_value, default=None,
  use="Arguments to pass to boot loader")
the "bootloader_args" parameter needs to be translated into "bootargs"
when using "virsh domxml-to-native xen-xm".
The reverse direction (domxml-from-native) is already okay.

This patch fixes domxml-to-native and adds two test files to catch this
problem.

Signed-off-by: Philipp Hahn <hahn@univention.de>
14 years agophyp: refactor phypListDomainsGeneric to eliminate buffer overflow
Eduardo Otubo [Thu, 15 Jul 2010 22:37:48 +0000 (19:37 -0300)]
phyp: refactor phypListDomainsGeneric to eliminate buffer overflow

src/phyp/phyp_driver.c:phypListDomainsGeneric was crashing due to a buffer
overflow if any line returned from virRun wasn't <=10 characters.

Since virStrToLong_i recognizes any non-numeric as a terminator (not
just NULL), there actually is no need to copy the number into a
separate string anyway, so this patch eliminates that copy, the fixed
length buffer, and therefore the potential to overflow.

This change also provided the oppurtunity to eliminate the character
counting loop, instead using the return from virStrToLong_i to point
past the end of the number, then simply skip the \n to get to the
next.

14 years agodocs: fix an incorrect keyword in updated hooks page
Justin Clift [Fri, 6 Aug 2010 13:33:05 +0000 (23:33 +1000)]
docs: fix an incorrect keyword in updated hooks page

14 years agobuild-sys: fix build when daemon is disabled by not installing libvirtd.8
Diego Elio Pettenò [Fri, 6 Aug 2010 01:17:37 +0000 (03:17 +0200)]
build-sys: fix build when daemon is disabled by not installing libvirtd.8

Since the rule to build libvirtd.8 is within the WITH_LIBVIRTD conditional,
so declare the man page in there as well. Without this change, build
without daemon will fail.

14 years agodocs: significant expansion of custom hook script information
Justin Clift [Fri, 6 Aug 2010 10:20:07 +0000 (20:20 +1000)]
docs: significant expansion of custom hook script information

14 years agoFix return value usage
Doug Goldstein [Thu, 5 Aug 2010 19:12:52 +0000 (14:12 -0500)]
Fix return value usage

Fix the error checking to use the return value from brAddTap() instead
of checking the current errno value which might have been changed by
clean up calls inside of brAddTap().

Signed-off-by: Doug Goldstein <cardoe@gentoo.org>