]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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>
14 years agoqemu: improve error if tun device is missing
Doug Goldstein [Thu, 5 Aug 2010 23:02:52 +0000 (17:02 -0600)]
qemu: improve error if tun device is missing

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 agobuild: rerun bootstrap if po/Makevars got nuked
Eric Blake [Wed, 4 Aug 2010 20:35:41 +0000 (14:35 -0600)]
build: rerun bootstrap if po/Makevars got nuked

There has been a frequent complaint of:

make[2]: Entering directory `/home/remote/eblake/libvirt/po'
make[2]: *** No rule to make target `/config.status', needed by `Makefile'.  Stop.

It happens after nuking and regenerating the po directory,
which is a common action after running anything like
'make dist' or 'make rpm' that dirties all the .po files.

Teach autogen.sh that it must regenerate po/Makevars to avoid
the missing variable declaration, and teach cfg.mk to recognize
that a nuked po directory is cause to rerun autogen.sh.

* cfg.mk (_update_required): Check for po/Makevars.
* autogen.sh (bootstrap): Run bootstrap if it got lost.
Diagnosed by Justin Clift.

14 years agoDo not use boot=on on IDE device
Daniel Veillard [Wed, 4 Aug 2010 16:31:44 +0000 (18:31 +0200)]
Do not use boot=on on IDE device

the followup on the boot=on problem, basically it's not needed to
specify it when booting out of IDE devices when using KVM
* src/qemu/qemu_conf.c: do not use boot=on for IDE devices
* tests/qemuxml2argvdata/qemuxml2argv*.args: this changes the output
  for 5 of the tests

14 years agoRelease of libvirt-0.8.3
Daniel Veillard [Wed, 4 Aug 2010 13:03:25 +0000 (15:03 +0200)]
Release of libvirt-0.8.3

* configure.ac docs/news.html.in libvirt.spec.in: updates
* po/*.po*: update and regenerated

14 years agoqemu: Fix PCI address allocation
Jiri Denemark [Wed, 4 Aug 2010 12:46:06 +0000 (14:46 +0200)]
qemu: Fix PCI address allocation

Patch version revamped by Eric Blake <eblake@redhat.com> of Jiri
Denemark <jdenemar@redhat.com> original patch

When attaching a PCI device which doesn't explicitly set its PCI
address, libvirt allocates the address automatically. The problem is
that when checking which PCI address is unused, we only check for those
with slot number higher than the highest slot number ever used.

Thus attaching/detaching such device several times in a row (31 is the
theoretical limit, less then 30 tries are enough in practise) makes any
further device attachment fail. Furthermore, attaching a device with
predefined PCI address to 0:0:31 immediately forbids attachment of any
PCI device without explicit address.

This patch changes the logic so that we always check all PCI addresses
before we say there is no PCI address available.

Modifications from v1: revert back to remembering the last slot
reserved, but allow wraparound to not be limited by the end.
In this way, slots are still assigned in the same order as
before the patch, rather than filling in the gaps closest to
0 and risking making windows guests mad.

* src/qemu/qemu_conf.c: fix pci reservation code to do a round-robbin
  check of all available PCI splot availability before failing.

14 years agoOpenVZ: implement suspend/resume driver APIs
Jean-Baptiste Rouault [Wed, 4 Aug 2010 12:00:07 +0000 (14:00 +0200)]
OpenVZ: implement suspend/resume driver APIs

* src/openvz/openvz_driver.c: implements openvzDomainSuspend and
  openvzDomainResume

14 years agoDon't leak delay string when freeing virInterfaceBridgeDefs
Laine Stump [Tue, 3 Aug 2010 14:31:59 +0000 (10:31 -0400)]
Don't leak delay string when freeing virInterfaceBridgeDefs

14 years agoFix build error in virsh.c
Laine Stump [Tue, 3 Aug 2010 14:35:01 +0000 (10:35 -0400)]
Fix build error in virsh.c

Another gettext string with no format args sent to printf as a format string.

14 years agoesx: Set storage pool target path to host.mountInfo.path
Matthias Bolte [Sun, 1 Aug 2010 20:11:38 +0000 (22:11 +0200)]
esx: Set storage pool target path to host.mountInfo.path

Now all storage pool types expose the target path.

14 years agoesx: Make storage pool lookup by name and UUID more robust
Matthias Bolte [Sun, 1 Aug 2010 17:53:00 +0000 (19:53 +0200)]
esx: Make storage pool lookup by name and UUID more robust

Don't rely on summary.url anymore, because its value is different
between an esx:// and vpx:// connection. Use host.mountInfo.path
instead.

Don't fallback to lookup by UUID (actually lookup by absolute path)
in esxVI_LookupDatastoreByName when lookup by name fails. Add a
seperate function for this: esxVI_LookupDatastoreByAbsolutePath

14 years agoesx: Restrict vpx:// to handle a single host in a vCenter
Matthias Bolte [Sat, 31 Jul 2010 21:57:42 +0000 (23:57 +0200)]
esx: Restrict vpx:// to handle a single host in a vCenter

Now a vpx:// connection has an explicitly specified host. This
allows to enabled several functions for a vpx:// connection
again, like host UUID, hostname, general node info, max vCPU
count, free memory, migration and defining new domains.

Lookup datacenter, compute resource, resource pool and host
system once and cache them. This simplifies the rest of the
code and reduces overall HTTP(S) traffic a bit.

esx:// and vpx:// can be mixed freely for a migration.

Ensure that migration source and destination refer to the
same vCenter. Also directly encode the resource pool and
host system object IDs into the migration URI in the prepare
function. Then directly build managed object references in
the perform function instead of re-looking up already known
information.

14 years agoesx: Map some managed object types
Matthias Bolte [Sat, 31 Jul 2010 20:27:32 +0000 (22:27 +0200)]
esx: Map some managed object types

Datacenter, ComputeResource and HostSystem will be used for
simplified handling and caching.

14 years agoesx: Parse the path of the URI
Matthias Bolte [Fri, 30 Jul 2010 20:08:35 +0000 (22:08 +0200)]
esx: Parse the path of the URI

The path will be used to specify the datacenter, compute resource
and host system to be used with a vpx:// connection.

14 years agoqemu: don't lose error on setting monitor capabilities
Eric Blake [Fri, 30 Jul 2010 15:47:28 +0000 (09:47 -0600)]
qemu: don't lose error on setting monitor capabilities

Spotted by clang.  Regression introduced in commit e72cc3c11d.

* src/qemu/qemu_driver.c (qemuConnectMonitor): Don't lose error status.

14 years agobuild: avoid compiler warning, for real this time
Eric Blake [Mon, 2 Aug 2010 20:00:54 +0000 (14:00 -0600)]
build: avoid compiler warning, for real this time

* tools/virsh.c (vshParseArgv): Drop spurious argument to printf.

14 years agoFix virsh error message when -d arg is not numeric
Eric Blake [Mon, 2 Aug 2010 20:03:13 +0000 (22:03 +0200)]
Fix virsh error message when -d arg is not numeric

14 years agoAdd Aurelien to AUTHORS
Daniel Veillard [Mon, 2 Aug 2010 19:55:33 +0000 (21:55 +0200)]
Add Aurelien to AUTHORS

14 years agoFix a couple of typo in iSCSI backend
Aurelien ROUGEMONT [Mon, 2 Aug 2010 19:52:02 +0000 (21:52 +0200)]
Fix a couple of typo in iSCSI backend

- a pure typo error and a wrong command referenced in an error message.

14 years agoMake virsh -d check its input
Daniel Veillard [Mon, 2 Aug 2010 19:20:26 +0000 (21:20 +0200)]
Make virsh -d check its input

it was using atoi direct without checking leading to confusion
in case of flag error for example with -c

* tools/virsh.c: vshParseArgv() use virStrToLong_i and remove the
  unchecked atoi used to parse teh parameter

14 years agoAdd iptables rule to fixup DHCP response checksum.
Laine Stump [Tue, 13 Jul 2010 02:59:58 +0000 (22:59 -0400)]
Add iptables rule to fixup DHCP response checksum.

This patch attempts to take advantage of a newly added netfilter
module to correct for a problem with some guest DHCP client
implementations when used in conjunction with a DHCP server run on the
host systems with packet checksum offloading enabled.

The problem is that, when the guest uses a RAW socket to read the DHCP
response packets, the checksum hasn't yet been fixed by the IP stack,
so it is incorrect.

The fix implemented here is to add a rule to the POSTROUTING chain of
the mangle table in iptables that fixes up the checksum for packets on
the virtual network's bridge that are destined for the bootpc port (ie
"dhcpc", ie port 68) port on the guest.

Only very new versions of iptables will have this support (it will be
in the next upstream release), so a failure to add this rule only
results in a warning message. The iptables patch is here:

  http://patchwork.ozlabs.org/patch/58525/

A corresponding kernel module patch is also required (the backend of
the iptables patch) and that will be in the next release of the
kernel.

14 years agoFix the ACS checking in the PCI code.
Chris Lalancette [Wed, 28 Jul 2010 20:53:00 +0000 (16:53 -0400)]
Fix the ACS checking in the PCI code.

When trying to assign a PCI device to a guest, we have
to check that all bridges upstream of that device support
ACS.  That means that we have to find the parent bridge of
the current device, check for ACS, then find the parent bridge
of that device, check for ACS, etc.  As it currently stands,
the code to do this iterates through all PCI devices on the
system, looking for a device that has a range of busses that
included the current device's bus.

That check is not restrictive enough, though.  Depending on
how we iterated through the list of PCI devices, we could first
find the *topmost* bridge in the system; since it necessarily had
a range of busses including the current device's bus, we
would only ever check the topmost bridge, and not check
any of the intermediate bridges.

Note that this also caused a fairly serious bug in the
secondary bus reset code, where we could erroneously
find and reset the topmost bus instead of the inner bus.

This patch changes pciGetParentDevice() so that it first
checks if a bridge device's secondary bus exactly matches
the bus of the device we are looking for.  If it does, we've
found the correct parent bridge and we are done.  If it does not,
then we check to see if this bridge device's busses *include* the
bus of the device we care about.  If so, we mark this bridge device
as best, and go on.  If we later find another bridge device whose
busses include this device, but is more restrictive, then we
free up the previous best and mark the new one as best.  This
algorithm ensures that in the normal case we find the direct
parent, but in the case that the parent bridge secondary bus
is not exactly the same as the device, we still find the
correct bridge.

This patch was tested by me on a 4-port NIC with a
bridge without ACS (where assignment failed), a 4-port
NIC with a bridge with ACS (where assignment succeeded),
and a 2-port NIC with no bridges (where assignment
succeeded).

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFree up memballoon def.
Chris Lalancette [Fri, 30 Jul 2010 15:40:59 +0000 (11:40 -0400)]
Free up memballoon def.

Forgetting to do this was causing a memory leak.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoDon't put a semicolon on the end of a VIR_ENUM_IMPL.
Chris Lalancette [Fri, 30 Jul 2010 15:40:42 +0000 (11:40 -0400)]
Don't put a semicolon on the end of a VIR_ENUM_IMPL.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoFix a bogus warning when parsing <hostdev>
Chris Lalancette [Fri, 30 Jul 2010 15:28:55 +0000 (11:28 -0400)]
Fix a bogus warning when parsing <hostdev>

When parsing hostdev, the following message would be emitted:

10:17:19.052: error : virDomainHostdevDefParseXML:3748 : internal error unknown node alias

However, alias is appropriately parsed in
virDomainDeviceInfoParseXML anyway.  Disable the error message
in the initial XML parsing loop.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoRemove duplicate </p> from downloads.html.in
Matthias Bolte [Sat, 31 Jul 2010 23:54:40 +0000 (01:54 +0200)]
Remove duplicate </p> from downloads.html.in

14 years agoUpdate ID after stopping a domain
Matthias Bolte [Fri, 30 Jul 2010 17:50:12 +0000 (19:50 +0200)]
Update ID after stopping a domain

14 years agoopenvzDomainCreateWithFlags: set domain id to the correct value
Jean-Baptiste Rouault [Fri, 30 Jul 2010 08:36:06 +0000 (10:36 +0200)]
openvzDomainCreateWithFlags: set domain id to the correct value

When an openvz domain is defined with virDomainDefineXML,
domain id is set to -1. A call to virDomainGetInfo after
starting the domain would then fail because this invalid
id is passed to openvzGetProcessInfo.

14 years agostorage: kill dead stores
Eric Blake [Fri, 30 Jul 2010 16:24:17 +0000 (10:24 -0600)]
storage: kill dead stores

Found by clang.  Clang complained that virStorageBackendProbeTarget
could dereference NULL if backingStoreFormat was NULL, but since all
callers passed a valid pointer, I added attributes instead of null
checks.

* src/storage/storage_backend.c
(virStorageBackendQEMUImgBackingFormat): Kill dead store.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Likewise.  Skip null checks, by adding attributes.

14 years agoqemu: kill some dead stores
Eric Blake [Fri, 30 Jul 2010 17:33:26 +0000 (11:33 -0600)]
qemu: kill some dead stores

Spotted by clang.

* src/qemu/qemu_monitor.c (qemuMonitorClose): Kill dead store.
* src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Likewise.

14 years agonetwork: kill dead store
Eric Blake [Fri, 30 Jul 2010 15:59:17 +0000 (09:59 -0600)]
network: kill dead store

* src/network/bridge_driver.c (networkDefine): Kill dead store.

14 years agoxenapi: Update ID after starting a domain
Matthias Bolte [Fri, 30 Jul 2010 15:13:38 +0000 (17:13 +0200)]
xenapi: Update ID after starting a domain

14 years agoesx: Update ID after starting a domain
Matthias Bolte [Fri, 30 Jul 2010 15:06:20 +0000 (17:06 +0200)]
esx: Update ID after starting a domain

14 years agoFix DMI uuid parsing.
Chris Lalancette [Fri, 30 Jul 2010 14:19:51 +0000 (10:19 -0400)]
Fix DMI uuid parsing.

valgrind was complaining that virUUIDParse was depending on
an uninitialized value.  Indeed it was; virSetHostUUIDStr()
didn't initialize the dmiuuid buffer to 0's, meaning that
anything after the string read from /sys was uninitialized.
Clear out the dmiuuid buffer before use, and make sure to
always leave a \0 at the end.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoDo not activate boot=on on devices when not using KVM
Daniel Veillard [Fri, 30 Jul 2010 14:38:48 +0000 (16:38 +0200)]
Do not activate boot=on on devices when not using KVM

  Basically the 'boot=on' boot selection device is something present in
KVM but not in upstream QEmu, as a result if we boot a QEmu domain
without KVM acceleration we must disable boot=on ... even if the front
end kvm binary expose that capability in the help page.

* src/qemu/qemu_conf.c: in qemudBuildCommandLine if -no-kvm
  is passed, then deactivate QEMUD_CMD_FLAG_DRIVE_BOOT

14 years agoFix a memory leak in the qemudBuildCommandLine.
Chris Lalancette [Fri, 30 Jul 2010 13:39:48 +0000 (09:39 -0400)]
Fix a memory leak in the qemudBuildCommandLine.

ADD_ARG_LIT should only be used for literal arguments,
since it duplicates the memory.  Since virBufferContentAndReset
is already allocating memory, we should only use ADD_ARG.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoesx: Fix freeing of heterogeneous lists
Matthias Bolte [Wed, 28 Jul 2010 13:42:10 +0000 (15:42 +0200)]
esx: Fix freeing of heterogeneous lists

Always call the free function of the base type. The base type
function then dynamically dispatches the call to the free function
for the actual type.

14 years agoesx: Switch from name to number checks in the subdrivers
Matthias Bolte [Sun, 25 Jul 2010 17:04:22 +0000 (19:04 +0200)]
esx: Switch from name to number checks in the subdrivers

14 years agoesx: Improve blocked task detection and fix race condition
Matthias Bolte [Sun, 25 Jul 2010 15:45:19 +0000 (17:45 +0200)]
esx: Improve blocked task detection and fix race condition

esxVI_WaitForTaskCompletion can take a UUID to lookup the
corresponding domain and check if the current task for it
is blocked by a question. It calls another function to do
this: esxVI_LookupAndHandleVirtualMachineQuestion looks up
the VirtualMachine and checks for a question. If there is
a question it calls esxVI_HandleVirtualMachineQuestion to
handle it.

If there was no question or it has been answered the call
to esxVI_LookupAndHandleVirtualMachineQuestion returns 0.
If any error occurred during the lookup and answering
process -1 is returned. The problem with this is, that -1
is also returned when there was no error but the question
could not be answered. So esxVI_WaitForTaskCompletion cannot
distinguish between this two situations and reports that a
question is blocking the task even when there was actually
another problem.

This inherent problem didn't surface until vSphere 4.1 when
you try to define a new domain. The driver tries to lookup
the domain that is just in the process of being registered.
There seems to be some kind of race condition and the driver
manages to issue a lookup command before the ESX server was
able to register the domain. This used to work before.

Due to the return value problem described above the driver
reported a false error message in that case.

To solve this esxVI_WaitForTaskCompletion now takes an
additional occurrence parameter that describes whether or
not to expect the domain to be existent. Also add a new
parameter to esxVI_LookupAndHandleVirtualMachineQuestion
that allows to distinguish if the call returned -1 because
of an actual error or because the question could not be
answered.

14 years agoesx: silence spurious compiler warning
Eric Blake [Wed, 28 Jul 2010 23:28:44 +0000 (17:28 -0600)]
esx: silence spurious compiler warning

* src/esx/esx_vi_types.c (_DESERIALIZE_NUMBER)
(ESX_VI__TEMPLATE__DESERIALIZE_NUMBER): Add range check to shut up
gcc 4.5.0 regarding long long.

14 years agobuild: distribute libvirt_qemu.syms
Eric Blake [Thu, 29 Jul 2010 20:19:40 +0000 (14:19 -0600)]
build: distribute libvirt_qemu.syms

* src/Makefile.am (EXTRA_DIST): Ensure 'make distcheck' and
'rpmbuild' can reproduce a build.
* daemon/Makefile.am (DAEMON_SOURCES): Likewise.

14 years agobuild: restore operation of bit-rotted 'make cov'
Eric Blake [Wed, 9 Jun 2010 18:35:49 +0000 (12:35 -0600)]
build: restore operation of bit-rotted 'make cov'

'./autobuild.sh' with lcov installed discovered that our
coverage support has been bit-rotting for a while.  This
restores it back to a successful state, although I have
not yet spent any time looking through the resulting files to
look for low-hanging fruit in the unit test coverage front.

* configure.ac: Clear COMPILER_FLAGS at right place.
* Makefile.am (cov): Newer genhtml no longer likes plain -s.
* m4/compiler-flags.m4 (gl_COMPILER_FLAGS): Don't AC_SUBST
COMPILER_FLAGS; it is a shell variable for use in configure only.
* src/Makefile.am (AM_CFLAGS, AM_LDFLAGS): New variables, to make
it easier to provide global flag additions.  Use throughout, to
uniformly apply coverage flags.
* .gitignore: Globally ignore gcov output.
* daemon/.gitignore: Simplify.
* src/.gitignore: Likewise.
* tests/.gitignore: Likewise.

14 years agoxen: fix logic bug
Eric Blake [Wed, 28 Jul 2010 23:12:16 +0000 (17:12 -0600)]
xen: fix logic bug

The recent switch to enable -Wlogical-op paid off again.
gcc 4.5.0 (rawhide) is smarter than 4.4.4 (Fedora 13).

* src/xen/xend_internal.c (xenDaemonAttachDeviceFlags)
(xenDaemonUpdateDeviceFlags, xenDaemonDetachDeviceFlags): Use
correct operator.

Signed-off-by: Eric Blake <eblake@redhat.com>
14 years agobuild: fix 'make syntax-check' failure
Eric Blake [Thu, 29 Jul 2010 19:27:58 +0000 (13:27 -0600)]
build: fix 'make syntax-check' failure

src/lxc/veth.c:150:        VIR_DEBUG(_("Failed to delete '%s' (%d)"),
src/lxc/veth.c:188:            VIR_DEBUG(_("Failed to disable '%s' (%d)"),
maint.mk: do not mark these strings for translation

* src/lxc/veth.c (vethDelete, vethInterfaceUpOrDown): Don't
translate VIR_DEBUG.

14 years agolxc: Fix return values of veth.c functions
Ryota Ozaki [Fri, 23 Jul 2010 17:25:56 +0000 (02:25 +0900)]
lxc: Fix return values of veth.c functions

Previously, the functions in src/lxc/veth.c could sometimes return
positive values on failure rather than -1. This made accurate error
reporting difficult, and led to one failure to catch an error in a
calling function.

This patch makes all the functions in veth.c consistently return 0 on
success, and -1 on failure. It also fixes up the callers to the veth.c
functions where necessary.

Note that this patch may be related to the bug:

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

It will not fix the bug, but should unveil what happens.

* po/POTFILES.in - add veth.c, which previously had no translatable strings
* src/lxc/lxc_controller.c
* src/lxc/lxc_container.c
* src/lxc/lxc_driver.c    - fixup callers to veth.c, and remove error logs,
                            as they are now done in veth.c
* src/lxc/veth.c - make all functions consistently return -1 on error.
* src/lxc/veth.h - use ATTRIBUTE_NONNULL to protect against NULL args.

14 years agoEliminate memory leak in xenUnifiedDomainInfoListFree
Laine Stump [Thu, 29 Jul 2010 13:41:33 +0000 (09:41 -0400)]
Eliminate memory leak in xenUnifiedDomainInfoListFree

This fixes a leak described in

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

xenUnifiedDomainInfoList has a pointer to a list of pointers to
xenUnifiedDomain. We were freeing up all the domains, but neglecting
to free the list.

This was found by Paolo Bonzini <pbonzini@redhat.com>.

14 years agolxc: Fix 'autostart' doesn't take effect actually
Ryota Ozaki [Thu, 29 Jul 2010 14:21:17 +0000 (23:21 +0900)]
lxc: Fix 'autostart' doesn't take effect actually

lxcStartup forgot to call lxcAutostartConfigs. Fix it.

This patch should fix https://bugzilla.redhat.com/show_bug.cgi?id=589863 .

14 years agoFix --with-xen-proxy related compile error
Matthias Bolte [Thu, 29 Jul 2010 14:03:48 +0000 (16:03 +0200)]
Fix --with-xen-proxy related compile error

Move virDomainChrTargetTypeToString out of the #ifndef PROXY
block, because it's used outside of it.

14 years agoFix a potential race in pciInitDevice.
Chris Lalancette [Wed, 28 Jul 2010 18:07:08 +0000 (14:07 -0400)]
Fix a potential race in pciInitDevice.

If detecting the FLR flag of a pci device fails, then we
could run into the situation of trying to close a file
descriptor twice, once in pciInitDevice() and once in pciFreeDevice().
Fix that by removing the pciCloseConfig() in pciInitDevice() and
just letting pciFreeDevice() handle it.

Thanks to Chris Wright for pointing out this problem.

While we are at it, fix an error check.  While it would actually
work as-is (since success returns 0), it's still more clear to
check for < 0 (as the rest of the code does).

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agoqemu: virtio console support
Cole Robinson [Wed, 14 Jul 2010 17:02:04 +0000 (13:02 -0400)]
qemu: virtio console support

Enable specifying a virtio console device with:

<console type='pty'>
  <target type='virtio'/>
</console>

14 years agodomain conf: Track <console> target type
Cole Robinson [Thu, 22 Jul 2010 17:56:21 +0000 (13:56 -0400)]
domain conf: Track <console> target type

All <console> devices now export a <target> type attribute. QEMU defaults
to 'serial', UML defaults to 'uml, xen can be either 'serial' or 'xen'
depending on fullvirt. Understandably there is lots of test fallout.

This will be used to differentiate between a serial vs. virtio console for
QEMU.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agodomain conf: char: Add an explicit targetType field
Cole Robinson [Tue, 13 Jul 2010 20:06:38 +0000 (16:06 -0400)]
domain conf: char: Add an explicit targetType field

targetType only tracks the actual <target> format we are parsing. Currently
we only fill abide this value for channel devices.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agodomain conf: Rename character prop targetType -> deviceType
Cole Robinson [Tue, 13 Jul 2010 19:05:34 +0000 (15:05 -0400)]
domain conf: Rename character prop targetType -> deviceType

There is actually a difference between the character device type (serial,
parallel, channel, ...) and the target type (virtio, guestfwd). Currently
they are awkwardly conflated.

Start to pull them apart by renaming targetType -> deviceType. This is
an entirely mechanical change.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agodocs: domain: Document virtio <channel>
Cole Robinson [Wed, 14 Jul 2010 19:07:59 +0000 (15:07 -0400)]
docs: domain: Document virtio <channel>

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agotests: Test qemuxml2xml when expected xml changes
Cole Robinson [Sat, 24 Jul 2010 22:18:18 +0000 (18:18 -0400)]
tests: Test qemuxml2xml when expected xml changes

Add tests for auto memballon, implicit IDE, SCSI, virtio channel
controllers, and console/serial back compat.

Additionally, an explicit qemuxml2argvtest for scsi disks is added.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
14 years agofix handling of PORT_PROFILE_RESPONSE_INPROGRESS netlink message
Gerhard Stenzel [Wed, 28 Jul 2010 14:17:21 +0000 (16:17 +0200)]
fix handling of PORT_PROFILE_RESPONSE_INPROGRESS netlink message

During function test of the 802.1Qbg implementation in lldpad we came
across a small problem in the handling of the netlink message
corresponding to PORT_PROFILE_RESPONSE_INPROGRESS. This should not
result in returning the default rc=1.

- src/util/macvtap.c: fix getPortProfileStatus() to return 0 in that
  case and also fix an indentation problem

14 years agomaint: fix comment typos
Eric Blake [Wed, 28 Jul 2010 14:05:55 +0000 (08:05 -0600)]
maint: fix comment typos

* src/network/bridge_driver.c
(networkAddMasqueradingIptablesRules): Fix spelling and grammar.

14 years agoFix up confusing indentation in qemudDomainAttachHostPciDevice.
Chris Lalancette [Tue, 27 Jul 2010 16:58:48 +0000 (12:58 -0400)]
Fix up confusing indentation in qemudDomainAttachHostPciDevice.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
14 years agomaint: turn on gcc logical-op checking
Eric Blake [Fri, 23 Jul 2010 20:28:31 +0000 (14:28 -0600)]
maint: turn on gcc logical-op checking

This would have detected the bug in commit 38ad33931 (Aug 09), which
we missed until commit f828ca35 (Jul 10); over 11 months later.

However, on Fedora 13, it also triggers LOTS of warnings from
the libcurl-devel header for two files:

esx/esx_vi.c: In function 'esxVI_CURL_Perform':
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
esx/esx_vi.c:232: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...
xenapi/xenapi_driver.c: In function 'call_func':
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
xenapi/xenapi_driver.c:1872: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]
...

libcurl allows to disable the type-checking code that triggers those
warnings, along with the reduction in type-safety of calls to some
libcurl functions. I figure this is worth the improved compiler
checking throughout the rest of libvirt.

* acinclude.m4 (--enable-compile-warnings=error): Add -Wlogical-op.
* configure.ac: Add -DCURL_DISABLE_TYPECHECK to LIBCURL_CFLAGS to
avoid compilation warning.

Suggested by Daniel P. Berrange.
Tweaked by Matthias Bolte.

14 years agolibvirt-guests: add reload, condrestart
Eric Blake [Tue, 27 Jul 2010 18:21:31 +0000 (12:21 -0600)]
libvirt-guests: add reload, condrestart

Optional per LSB, but required by Fedora:
https://fedoraproject.org/wiki/Packaging/SysVInitScript

* daemon/libvirt-guests.init.in (main): Add more required
commands.

14 years agolibvirt-guests: enhance status
Eric Blake [Tue, 27 Jul 2010 19:50:35 +0000 (13:50 -0600)]
libvirt-guests: enhance status

LSB and https://fedoraproject.org/wiki/Packaging/SysVInitScript
require status to output something useful, rather than just use
the exit code.

* daemon/libvirt-guests.init.in (rh_status): Break into new routine,
and provide output.
(usage): Document status.

14 years agolibvirt-guests: detect invalid arguments
Eric Blake [Tue, 27 Jul 2010 18:05:27 +0000 (12:05 -0600)]
libvirt-guests: detect invalid arguments

Reject extra arguments.
Return the correct status for unknown arguments, as mandated by
https://fedoraproject.org/wiki/Packaging/SysVInitScript
Add --help, as a permitted extension.

* daemon/libvirt-guests.init.in (usage): New function.  Use it in
more places, and return correct value.

14 years agoInvert logic for checking for QEMU disk cache options
Daniel P. Berrange [Tue, 27 Jul 2010 10:21:10 +0000 (11:21 +0100)]
Invert logic for checking for QEMU disk cache options

QEMU has had two different syntax for disk cache options

 Old: on|off
 New: writeback|writethrough|none

QEMU recently added another 'unsafe' option which broke the
libvirt check. We can avoid this & future breakage, if we
do a negative check for the old syntax, instead of a positive
check for the new syntax

* src/qemu/qemu_conf.c: Invert cache option check

14 years agoqemu: Allow setting boot menu on/off
Cole Robinson [Mon, 26 Jul 2010 14:28:58 +0000 (10:28 -0400)]
qemu: Allow setting boot menu on/off

Add a new element to the <os> block:

  <bootmenu enable="yes|no"/>

Which maps to -boot,menu=on|off on the QEMU command line.

I decided to use an explicit 'enable' attribute rather than just make the
bootmenu element boolean. This allows us to treat lack of a bootmenu element
as 'use hypervisor default'.

14 years agodocs: Link wiki FAQ to main page
Cole Robinson [Mon, 26 Jul 2010 14:32:42 +0000 (10:32 -0400)]
docs: Link wiki FAQ to main page

Since DV recommended keeping the build instructions distributed with the
source, move them from the old FAQ to the downloads page.

14 years agoqemu: Error on unsupported graphics config
Cole Robinson [Mon, 26 Jul 2010 14:30:01 +0000 (10:30 -0400)]
qemu: Error on unsupported graphics config

Throw an explicit error if multiple graphics devices are specified, or
an unsupported type is specified (rdp).

14 years agolibvirt-guests: Don't throw errors if libvirtd is not installed
Jiri Denemark [Tue, 27 Jul 2010 12:21:51 +0000 (14:21 +0200)]
libvirt-guests: Don't throw errors if libvirtd is not installed

When only client parts of libvirt are installed (i.e., no libvirtd
daemon), libvirt-guests init script in its default configuration would
throw seriously looking errors during host shutdown:

Running guests on default URI: error: unable to connect to
'/var/run/libvirt/libvirt-sock', libvirtd may need to be started: No
such file or directory
error: failed to connect to the hypervisor

This patch changes the script to print rather harmless message in that
situation:

Running guests on default URI: libvirtd not installed; skipping this
URI.