]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agostorage backend: Add RBD (RADOS Block Device) support
Wido den Hollander [Mon, 14 May 2012 09:06:42 +0000 (11:06 +0200)]
storage backend: Add RBD (RADOS Block Device) support

This patch adds support for a new storage backend with RBD support.

RBD is the RADOS Block Device and is part of the Ceph distributed storage
system.

It comes in two flavours: Qemu-RBD and Kernel RBD, this storage backend only
supports Qemu-RBD, thus limiting the use of this storage driver to Qemu only.

To function this backend relies on librbd and librados being present on the
local system.

The backend also supports Cephx authentication for safe authentication with
the Ceph cluster.

For storing credentials it uses the built-in secret mechanism of libvirt.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
12 years agobuild: fix unused variable after last patch
Eric Blake [Mon, 21 May 2012 18:36:50 +0000 (12:36 -0600)]
build: fix unused variable after last patch

The previous commit (2cb0899) left a dead variable behind.

* src/libxl/libxl_driver.c (libxlClose): Drop dead variable.

12 years agoFix potential events deadlock when unref'ing virConnectPtr
Daniel P. Berrange [Mon, 21 May 2012 11:10:53 +0000 (12:10 +0100)]
Fix potential events deadlock when unref'ing virConnectPtr

When the last reference to a virConnectPtr is released by
libvirtd, it was possible for a deadlock to occur in the
virDomainEventState functions. The virDomainEventStatePtr
holds a reference on virConnectPtr for each registered
callback. When removing a callback, the virUnrefConnect
function is run. If this causes the last reference on the
virConnectPtr to be released, then virReleaseConnect can
be run, which in turns calls qemudClose. This function has
a call to virDomainEventStateDeregisterConn which is intended
to remove all callbacks associated with the virConnectPtr
instance. This will try to grab a lock on virDomainEventState
but this lock is already held. Deadlock ensues

Thread 1 (Thread 0x7fcbb526a840 (LWP 23185)):

Since each callback associated with a virConnectPtr holds a
reference on virConnectPtr, it is impossible for the qemudClose
method to be invoked while any callbacks are still registered.
Thus the call to virDomainEventStateDeregisterConn must in fact
be a no-op. Thus it is possible to just remove all trace of
virDomainEventStateDeregisterConn and avoid the deadlock.

* src/conf/domain_event.c, src/conf/domain_event.h,
  src/libvirt_private.syms: Delete virDomainEventStateDeregisterConn
* src/libxl/libxl_driver.c, src/lxc/lxc_driver.c,
  src/qemu/qemu_driver.c, src/uml/uml_driver.c: Remove
  calls to virDomainEventStateDeregisterConn

12 years agoFix build when configuring with polkit0
Jim Fehlig [Mon, 21 May 2012 15:23:41 +0000 (09:23 -0600)]
Fix build when configuring with polkit0

Commit 2223ea98 removed the only use of 'server' param in
remoteDispatchAuthPolkit().  Mark the parameter with ATTRIBUTE_UNUSED
to fix the build when configuring with polkit0.

12 years agonwfilter: Add support for ipset
Stefan Berger [Mon, 21 May 2012 10:26:34 +0000 (06:26 -0400)]
nwfilter: Add support for ipset

This patch adds support for the recent ipset iptables extension
to libvirt's nwfilter subsystem. Ipset allows to maintain 'sets'
of IP addresses, ports and other packet parameters and allows for
faster lookup (in the order of O(1) vs. O(n)) and rule evaluation
to achieve higher throughput than what can be achieved with
individual iptables rules.

On the command line iptables supports ipset using

iptables ... -m set --match-set <ipset name> <flags> -j ...

where 'ipset name' is the name of a previously created ipset and
flags is a comma-separated list of up to 6 flags. Flags use 'src' and 'dst'
for selecting IP addresses, ports etc. from the source or
destination part of a packet. So a concrete example may look like this:

iptables -A INPUT -m set --match-set test src,src -j ACCEPT

Since ipset management is quite complex, the idea was to leave ipset
management outside of libvirt but still allow users to reference an ipset.
The user would have to make sure the ipset is available once the VM is
started so that the iptables rule(s) referencing the ipset can be created.

Using XML to describe an ipset in an nwfilter rule would then look as
follows:

  <rule action='accept' direction='in'>
    <all ipset='test' ipsetflags='src,src'/>
  </rule>

The two parameters on the command line are also the two distinct XML attributes
'ipset' and 'ipsetflags'.

FYI: Here is the man page for ipset:

https://ipset.netfilter.org/ipset.man.html

Regards,
    Stefan

12 years agobuild: fix virnetlink on glibc 2.11
Eric Blake [Fri, 18 May 2012 15:42:25 +0000 (09:42 -0600)]
build: fix virnetlink on glibc 2.11

We were being lazy - virnetlink.c was getting uint32_t as a
side-effect from glibc 2.14's <unistd.h>, but older glibc 2.11
does not provide uint32_t from <unistd.h>.  In fact, POSIX states
that <unistd.h> need only provide intptr_t, not all of <stdint.h>,
so the bug really is ours.  Reported by Jonathan Alescio.

* src/util/virnetlink.h: Include <stdint.h>.

12 years agoAdds support to param 'vcpu_time' in qemu_driver.
Hu Tao [Wed, 9 May 2012 08:41:38 +0000 (16:41 +0800)]
Adds support to param 'vcpu_time' in qemu_driver.

This involves setting the cpuacct cgroup to a per-vcpu granularity,
as well as summing the each vcpu accounting into a common array.
Now that we are reading more than one cgroup file, we double-check
that cpus weren't hot-plugged between reads to invalidate our
summing.

Signed-off-by: Eric Blake <eblake@redhat.com>
12 years agoAdd a new param 'vcpu_time' to virDomainGetCPUStats
Hu Tao [Wed, 9 May 2012 08:41:37 +0000 (16:41 +0800)]
Add a new param 'vcpu_time' to virDomainGetCPUStats

Currently virDomainGetCPUStats gets total cpu usage, which consists
of:

  1. vcpu usage: the physical cpu time consumed by virtual cpu(s) of
     domain
  2. hypervisor: `total cpu usage' - `vcpu usage'

The param 'vcpu_time' is for getting vcpu usages.

12 years agotests: add ich6 codec type test to qemuxml2argv-sound-device
Marc-André Lureau [Tue, 15 May 2012 22:55:11 +0000 (00:55 +0200)]
tests: add ich6 codec type test to qemuxml2argv-sound-device

Test new codec type element.

12 years agoqemu: honour sound <codec> sub-elements
Marc-André Lureau [Tue, 15 May 2012 22:55:10 +0000 (00:55 +0200)]
qemu: honour sound <codec> sub-elements

With ICH6 audio device, allow to specify codecs.
By default, for compatibility reasons, if no codec is specified,
"hda-duplex" will be used.

12 years agodomain: add <codec> sound sub-element
Marc-André Lureau [Tue, 15 May 2012 22:55:09 +0000 (00:55 +0200)]
domain: add <codec> sound sub-element

Allow specifying sound device codecs. See formatdomain.html for
more details.

12 years agoqemu: test CAPS_HDA_MICRO
Marc-André Lureau [Tue, 15 May 2012 22:55:08 +0000 (00:55 +0200)]
qemu: test CAPS_HDA_MICRO

12 years agoqemu: Don't delete USB device on failed qemuPrepareHostdevUSBDevices
Michal Privoznik [Thu, 17 May 2012 11:40:52 +0000 (13:40 +0200)]
qemu: Don't delete USB device on failed qemuPrepareHostdevUSBDevices

If qemuPrepareHostdevUSBDevices fail it will roll back devices added
to the driver list of used devices. However, if it may fail because
the device is being used already. But then again - with roll back.
Therefore don't try to remove a usb device manually if the function
fail. Although, we want to remove the device if any operation
performed afterwards fail.

12 years agonodeinfo: test more details
Eric Blake [Mon, 14 May 2012 23:11:47 +0000 (17:11 -0600)]
nodeinfo: test more details

Make it obvious why we need Osier's patch in commit 10d9038b
to fix NUMA parsing of an AMD machine with two cores sharing
a socket id.

* tests/nodeinfotest.c (linuxTestCompareFiles): Enhance the test.
* tests/nodeinfodata/linux-nodeinfo-sysfs-test-*-output.txt: Update.

12 years agoAdd a virLogMessage alternative taking va_list args
Daniel P. Berrange [Mon, 23 Jan 2012 14:57:16 +0000 (14:57 +0000)]
Add a virLogMessage alternative taking va_list args

Allow the logging APIs to be called with a va_list for format
args, instead of requiring var-args usage.

* src/util/logging.h, src/util/logging.c: Add virLogVMessage

12 years agobuild: fix recent syntax-check breakage
Eric Blake [Wed, 16 May 2012 15:52:44 +0000 (09:52 -0600)]
build: fix recent syntax-check breakage

The use of readlink() in lxc_container.c is intentional; we don't
want an absolute pathname there.

* src/util/cgroup.h (VIR_CGROUP_SYSFS_MOUNT): Indent properly.
* cfg.mk (exclude_file_name_regexp--sc_prohibit_readlink): Add
exemption.

12 years agoqemu: Rollback on used USB devices
Michal Privoznik [Wed, 16 May 2012 14:42:02 +0000 (16:42 +0200)]
qemu: Rollback on used USB devices

One of our latest USB device handling patches
05abd1507d66aabb6cad12eeafeb4c4d1911c585 introduced a regression.
That is, we first create a temporary list of all USB devices that
are to be used by domain just starting up. Then we iterate over and
check if a device from the list is in the global list of currently
assigned devices (activeUsbHostdevs). If not, we add it there and
continue with next iteration then. But if a device from temporary
list is either taken already or adding to the activeUsbHostdevs fails,
we remove all devices in temp list from the activeUsbHostdevs list.
Therefore, if a device is already taken we remove it from
activeUsbHostdevs even if we should not. Thus, next time we allow
the device to be assigned to another domain.

12 years agoFix build compat with older libselinux for LXC
Daniel P. Berrange [Wed, 16 May 2012 13:18:25 +0000 (14:18 +0100)]
Fix build compat with older libselinux for LXC

Most versions of libselinux do not contain the function
selinux_lxc_contexts_path() that the security driver
recently started using for LXC. We must add a conditional
check for it in configure and then disable the LXC security
driver for builds where libselinux lacks this function.

* configure.ac: Check for selinux_lxc_contexts_path
* src/security/security_selinux.c: Disable LXC security
  if selinux_lxc_contexts_path() is missing

12 years agoReject any non-option command line arguments
Daniel P. Berrange [Wed, 16 May 2012 11:03:02 +0000 (12:03 +0100)]
Reject any non-option command line arguments

Due to a bug in editing /etc/sysconfig/libvirtd, VDSM was causing
libvirt processes to run with the following command line args

   /usr/sbin/libvirtd --listen '#' 'by vdsm'

While it correctly rejects any invalid option flags, libvirtd
was not rejecting any non-option command line arguments

* daemon/libvirtd.c: Reject non-option argv

12 years agoRemount cgroups controllers after setting up new /sys in LXC
Daniel P. Berrange [Fri, 11 May 2012 16:26:48 +0000 (17:26 +0100)]
Remount cgroups controllers after setting up new /sys in LXC

Normal practice is for cgroups controllers to be mounted at
/sys/fs/cgroup. When setting up a container, /sys is mounted
with a new sysfs instance, thus we must re-mount all the
cgroups controllers. The complexity is that we must mount
them in the same layout as the host OS. ie if 'cpu' and 'cpuacct'
were mounted at the same location in the host we must preserve
this in the container. Also if any controllers are co-located
we must setup symlinks from the individual controller name to
the co-located mount-point

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoTrim /proc & /sys subtrees before mounting new instances
Daniel P. Berrange [Fri, 11 May 2012 10:35:28 +0000 (11:35 +0100)]
Trim /proc & /sys subtrees before mounting new instances

Both /proc and /sys may have sub-mounts in them from the host
OS. We must explicitly unmount them all before mounting the
new instance over that location. If we don't then /proc/mounts
will show the sub-mounts as existing, even though nothing will
be able to access them, due to the over-mount.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAvoid LXC pivot root in the root source is still /
Daniel P. Berrange [Fri, 11 May 2012 14:09:27 +0000 (15:09 +0100)]
Avoid LXC pivot root in the root source is still /

If the LXC config has a filesystem

  <filesystem>
     <source dir='/'/>
     <target dir='/'/>
  </filesystem>

then there is no need to go down the pivot root codepath.
We can simply use the existing root as needed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMount fresh instance of sysfs/selinux in LXC
Daniel P. Berrange [Thu, 10 May 2012 16:16:11 +0000 (17:16 +0100)]
Mount fresh instance of sysfs/selinux in LXC

Currently to make sysfs readonly, we remount the existing
instance and then bind it readonly. Unfortunately this means
sysfs is still showing device objects wrt the host OS namespace.
We need it to reflect the container namespace, so we must mount
a completely new instance of it. Do the same for selinuxfs since
there is no benefit to bind mounting & this lets us simplify
the code.

* src/lxc/lxc_container.c: Mount fresh sysfs instance

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert the LXC driver to use the security driver API for mount options
Daniel Walsh [Fri, 11 May 2012 10:02:50 +0000 (11:02 +0100)]
Convert the LXC driver to use the security driver API for mount options

Instead of hardcoding use of SELinux contexts in the LXC driver,
switch over to using the official security driver API.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd security driver APIs for getting mount options
Daniel Walsh [Tue, 1 May 2012 14:16:04 +0000 (15:16 +0100)]
Add security driver APIs for getting mount options

Some security drivers require special options to be passed to
the mount system call. Add a security driver API for handling
this data.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd support for LXC specific SELinux configuration
Daniel Walsh [Fri, 11 May 2012 09:54:31 +0000 (10:54 +0100)]
Add support for LXC specific SELinux configuration

The SELinux policy for LXC uses a different configuration file
than the traditional svirt one. Thus we need to load
/etc/selinux/targeted/contexts/lxc_contexts which contains
something like this:

 process = "system_u:system_r:svirt_lxc_net_t:s0"
 file = "system_u:object_r:svirt_lxc_file_t:s0"
 content = "system_u:object_r:virt_var_lib_t:s0"

cleverly designed to be parsable by virConfPtr

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse private data struct in SELinux driver
Daniel Walsh [Fri, 11 May 2012 09:43:30 +0000 (10:43 +0100)]
Use private data struct in SELinux driver

Currently the SELinux driver stores its state in a set of global
variables. This switches it to use a private data struct instead.
This will enable different instances to have their own data.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't enable the AppArmour security driver with LXC
Daniel Walsh [Fri, 11 May 2012 09:34:49 +0000 (10:34 +0100)]
Don't enable the AppArmour security driver with LXC

The AppArmour driver does not currently have support for LXC
so ensure that when probing, it claims to be disabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoPass the virt driver name into security drivers
Daniel Walsh [Thu, 10 May 2012 16:49:29 +0000 (17:49 +0100)]
Pass the virt driver name into security drivers

To allow the security drivers to apply different configuration
information per hypervisor, pass the virtualization driver name
into the security manager constructor.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove bogus udev.target dep from libvirtd unit
Daniel P. Berrange [Tue, 15 May 2012 16:33:00 +0000 (17:33 +0100)]
Remove bogus udev.target dep from libvirtd unit

There is no 'udev.target' unit in systemd (only 'udev.service')
yet libvirtd's unit file had a dep on one. There's no compelling
reason for a dep on udev, so remove it altogether.

Reported-by: Avi Kivity <avi@redhat.com>
12 years agoqemu: Add support for -no-user-config
Jiri Denemark [Thu, 26 Apr 2012 10:11:49 +0000 (12:11 +0200)]
qemu: Add support for -no-user-config

Thanks to this new option we are now able to use modern CPU models (such
as Westmere) defined in external configuration file.

The qemu-1.1{,-device} data files for qemuhelptest are filled in with
qemu-1.1-rc2 output for now. I will update those files with real
qemu-1.1 output once it is released.

12 years agoSet a sensible default master start port for ehci companion controllers
Daniel P. Berrange [Mon, 14 May 2012 12:22:58 +0000 (13:22 +0100)]
Set a sensible default master start port for ehci companion controllers

The uhci1, uhci2, uhci3 companion controllers for ehci1 must
have a master start port set. Since this value is predictable
we should set it automatically if the app does not supply it

12 years agoFix logic for assigning PCI addresses to USB2 companion controllers
Daniel P. Berrange [Mon, 14 May 2012 10:16:22 +0000 (11:16 +0100)]
Fix logic for assigning PCI addresses to USB2 companion controllers

Currently each USB2 companion controller gets put on a separate
PCI slot. Not only is this wasteful of PCI slots, but it is not
in compliance with the spec for USB2 controllers. The master
echi1 and all companion controllers should be in the same slot,
with echi1 in function 7, and uhci1-3 in functions 0-2 respectively.

* src/qemu/qemu_command.c: Special case handling of USB2 controllers
  to apply correct pci slot assignment
* tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.args,
  tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml: Expand
  test to cover automatic slot assignment

12 years agoFix virDomainDeviceInfoIsSet() to check all struct fields
Daniel P. Berrange [Tue, 15 May 2012 15:16:49 +0000 (16:16 +0100)]
Fix virDomainDeviceInfoIsSet() to check all struct fields

The virDomainDeviceInfoIsSet API was only checking if an
address or alias was set in the struct. Thus if only a
rom bar setting / filename, boot index, or USB master
value was set, they could be accidentally dropped when
formatting XML

12 years agoRemove redundant trailing slash in user dir paths
Daniel P. Berrange [Tue, 15 May 2012 15:49:26 +0000 (16:49 +0100)]
Remove redundant trailing slash in user dir paths

Callers of virGetUser{Config,Runtime,Cache}Directory all
append further path component. We should not be
adding a trailing slash in the return path otherwise we
get paths containing '//'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAllow stack traces to be included with log messages
Daniel P. Berrange [Wed, 9 May 2012 14:18:56 +0000 (15:18 +0100)]
Allow stack traces to be included with log messages

Sometimes it is useful to see the callpath for log messages.
This change enhances the log filter syntax so that stack traces
can be show by setting '1:+NAME' instead of '1:NAME'.

This results in output like:

2012-05-09 14:18:45.136+0000: 13314: debug : virInitialize:414 : register drivers
/home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xd6)[0x7f89188ebe86]
/home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
/home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]

2012-05-09 14:18:45.136+0000: 13314: debug : virRegisterDriver:775 : driver=0x7f8918d02760 name=Test
/home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virRegisterDriver+0x6b)[0x7f89188ec717]
/home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(+0x11b3ad)[0x7f891891e3ad]
/home/berrange/src/virt/libvirt/src/.libs/libvirt.so.0(virInitialize+0xf3)[0x7f89188ebea3]
/home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x431921]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x3a21e21735]
/home/berrange/src/virt/libvirt/tools/.libs/lt-virsh[0x40a279]

* docs/logging.html.in: Document new syntax
* configure.ac: Check for execinfo.h
* src/util/logging.c, src/util/logging.h: Add support for
  stack traces
* tests/testutils.c: Adapt to API change

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove user libvirtd socket out of abstract namespace
Daniel P. Berrange [Thu, 3 May 2012 12:40:32 +0000 (13:40 +0100)]
Move user libvirtd socket out of abstract namespace

The current unprivileged user libvirtd sockets are in the abstract
namespace. This has a number of problems

 - You can't connect to them remotely using the nc/ssh tunnel
 - This is not portable for OS-X, BSD & probably others
 - Parent directory permissions don't apply

12 years agoAdd openvz_util.c to POTFILES
Daniel P. Berrange [Tue, 15 May 2012 15:27:08 +0000 (16:27 +0100)]
Add openvz_util.c to POTFILES

12 years agoAdd bundled(gnulib) to RPM specfile
Daniel P. Berrange [Tue, 15 May 2012 15:03:14 +0000 (16:03 +0100)]
Add bundled(gnulib) to RPM specfile

According to Fedora guidelines, because we bundle gnulib we
need to add a virtual Provides: bundled(gnulib).

https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries#Requirement_if_you_bundle

12 years agoopenvz: determine kb/pages only once
Guido Günther [Mon, 7 May 2012 21:00:28 +0000 (23:00 +0200)]
openvz: determine kb/pages only once

to save some syscalls (as suggested by Eric Blake)

12 years agolibvirt-guests: Remove LISTFILE if it's empty when stopping service
Osier Yang [Tue, 15 May 2012 08:22:28 +0000 (16:22 +0800)]
libvirt-guests: Remove LISTFILE if it's empty when stopping service

$LISTFILE is created even no domain is running, and the empty
$LISTFILE could cause improper service status.

    stopped ,with saved guests

Which is not right, as there is no domain was saved.

12 years agonodeinfo: Get the correct CPU number on AMD Magny Cours platform
Osier Yang [Mon, 14 May 2012 13:12:53 +0000 (21:12 +0800)]
nodeinfo: Get the correct CPU number on AMD Magny Cours platform

"Instead of developing one CPU with 12 cores, the Magny Cours is
actually two 6 core “Bulldozer” CPUs combined in to one package"

I.e, each package has two NUMA nodes, and the two numa nodes share
the same core ID set (0-6), which means parsing the cores number
from sysfs doesn't work in this case.

And the wrong CPU number could cause three problems for libvirt:

1) performance lost

  A domain without "cpuset" or "placement='auto'" (to drive numad)
specified will be only pinned to part of the CPUs.

2) domain can be started

  If a domain uses numad, and the advisory nodeset returned from
numad contains node which exceeds the range of wrong total CPU
number. The domain will fail to start, as the bitmask passed to
sched_setaffinity could be fully filled with zero.

3) wrong CPU number affects lots of stuffs.

  E.g. for command "virsh vcpuinfo", "virsh vcpupin", it will always
output with the truncated CPU list.

For more details:

https://www.redhat.com/archives/libvir-list/2012-May/msg00607.html

This patch is to fix the problem by parsing /proc/cpuinfo to get
the value of field "cpu cores", and use it as nodeinfo->cores if
it's greater than the cores number from sysfs.

12 years agoqemu: Set memory policy using cgroup if placement is auto
Osier Yang [Sat, 12 May 2012 12:53:15 +0000 (20:53 +0800)]
qemu: Set memory policy using cgroup if placement is auto

Like for 'static' placement, when the memory policy mode is
'strict', set the memory policy by writing the advisory nodeset
returned from numad to cgroup file cpuset.mems,

12 years agoqemu: Use the CPU index in capabilities to map NUMA node to cpu list.
Osier Yang [Sat, 12 May 2012 12:52:45 +0000 (20:52 +0800)]
qemu: Use the CPU index in capabilities to map NUMA node to cpu list.

On some of the NUMA platforms, the CPU index in each NUMA node
grows non-consecutive. While on other platforms, it can be inconsecutive,
E.g.

% numactl --hardware
available: 4 nodes (0-3)
node 0 cpus: 0 4 8 12 16 20 24 28
node 0 size: 131058 MB
node 0 free: 86531 MB
node 1 cpus: 1 5 9 13 17 21 25 29
node 1 size: 131072 MB
node 1 free: 127070 MB
node 2 cpus: 2 6 10 14 18 22 26 30
node 2 size: 131072 MB
node 2 free: 127758 MB
node 3 cpus: 3 7 11 15 19 23 27 31
node 3 size: 131072 MB
node 3 free: 127226 MB
node distances:
node   0   1   2   3
  0:  10  20  20  20
  1:  20  10  20  20
  2:  20  20  10  20
  3:  20  20  20  10

This patch is to fix the problem by using the CPU index in
caps->host.numaCell[i]->cpus[i] to set the bitmask instead of
assuming the CPU index of the NUMA nodes are always sequential.

12 years agoAssign spapr-vio bus address to ibmvscsi controller
Li Zhang [Mon, 14 May 2012 06:16:37 +0000 (14:16 +0800)]
Assign spapr-vio bus address to ibmvscsi controller

For pseries guest, the default controller model is
ibmvscsi controller, this controller only can work
on spapr-vio address.

This patch is to assign spapr-vio address type to
ibmvscsi controller and correct vscsi test case.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
12 years agosanlock: fix locking for readonly devices
David Weber [Mon, 14 May 2012 09:53:02 +0000 (09:53 +0000)]
sanlock: fix locking for readonly devices

Add ignore param for readonly and shared disk in sanlock

12 years agonodeinfo: add some more tests
Eric Blake [Fri, 11 May 2012 20:30:05 +0000 (14:30 -0600)]
nodeinfo: add some more tests

Test 2 data grabbed from a 2-core 1-node laptop.
Test 3 data grabbed from a 48-cpu AMD Magny Cours box.

* tests/nodeinfodata/linux-nodeinfo-sysfs-test-2*: New test data.
* tests/nodeinfodata/linux-nodeinfo-sysfs-test-3*: Likewise.
* tests/nodeinfotest.c (mymain): Run them.
* cfg.mk
(exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF): Exempt
new test files.

12 years agonodeinfo: avoid probing host filesystem during test
Eric Blake [Fri, 11 May 2012 19:59:59 +0000 (13:59 -0600)]
nodeinfo: avoid probing host filesystem during test

We had previously weakened our nodeinfotest in order to ignore parsed
node values, because the parse function was mistakenly relying on
host files.  A better fix is to avoid using the numactl library, but
to instead parse the same files that numactl would read, all while
allowing the files to be relative to our choice of directory.

* src/nodeinfo.c (CPU_SYS_PATH, NODE_SYS_PATH): Replace with...
(SYSFS_SYSTEM_PATH): ...parent directory.
(linuxNodeInfoCPUPopulate): Check NUMA nodes from requested
directory (by inlining numactl code).
(nodeGetCPUmap, nodeGetMemoryStats): Adjust macro use.
* tests/nodeinfotest.c (linuxTestCompareFiles, linuxTestNodeInfo):
Update test to match.

12 years agonodeinfo: drop static variable
Eric Blake [Fri, 11 May 2012 18:50:08 +0000 (12:50 -0600)]
nodeinfo: drop static variable

We were wasting time to malloc a copy of a constant string, then
copy it into static storage, for every call to nodeGetInfo.  At
least we were lucky that it was a constant source, and thus not
subject to even worse issues with one thread clobbering the static
storage while another was using it.  This gets rid of the waste,
by passing the string through the stack instead, as well as renaming
internal functions to better match our conventions.

* src/nodeinfo.c (sysfs_path): Delete.
(get_cpu_value, count_thread_siblings, parse_socket): Add
parameter, and rename...
(virNodeGetCpuValue, virNodeCountThreadSiblings)
(virNodeParseSocket): ... into a common namespace.
(cpu_online, parse_core): Inline into callers.
(linuxNodeInfoCPUPopulate): Update caller.
(nodeGetInfo): Drop a useless malloc.

12 years agobuild: really silence the 32-bit warning
Eric Blake [Sat, 12 May 2012 13:24:08 +0000 (07:24 -0600)]
build: really silence the 32-bit warning

Commit cdce2f42d tried to silence a compiler warning on 32-bit builds,
but the gcc shipped with RHEL 5 is old enough that the type conversion
via multiplication by 1 was insufficient for the task.

* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Previous attempt
didn't get past all gcc versions.

12 years agomaint: fix AUTHORS
Eric Blake [Mon, 14 May 2012 15:14:19 +0000 (09:14 -0600)]
maint: fix AUTHORS

Use the address specified in the actual commit, to placate
'make syntax-check'.

12 years agoUse XDG Base Directories instead of storing in home directory
William Jon McCann [Thu, 3 May 2012 16:36:27 +0000 (12:36 -0400)]
Use XDG Base Directories instead of storing in home directory

As defined in:
http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

This offers a number of advantages:
 * Allows sharing a home directory between different machines, or
sessions (eg. using NFS)
 * Cleanly separates cache, runtime (eg. sockets), or app data from
user settings
 * Supports performing smart or selective migration of settings
between different OS versions
 * Supports reseting settings without breaking things
 * Makes it possible to clear cache data to make room when the disk
is filling up
 * Allows us to write a robust and efficient backup solution
 * Allows an admin flexibility to change where data and settings are stored
 * Dramatically reduces the complexity and incoherence of the
system for administrators

12 years agoRelease of libvirt-0.9.12
Daniel Veillard [Mon, 14 May 2012 02:52:04 +0000 (10:52 +0800)]
Release of libvirt-0.9.12

* configure.ac docs/news.html.in libvirt.spec.in: updates for the release
* po/*.po: pushed new sources and synchronized new languages translations

12 years agoesx: Fix memory leaks in error paths related to transferred ownership
Matthias Bolte [Sun, 6 May 2012 17:33:59 +0000 (19:33 +0200)]
esx: Fix memory leaks in error paths related to transferred ownership

Appending an item to a list transfers ownership of that item to the
list owner. But an error can occur in between item allocation and
appending it to the list. In this case the item has to be freed
explicitly. This was not done in some special cases resulting in
possible memory leaks.

Reported by Coverity.

12 years agoqemu: Don't skip detection of virtual cpu's on non KVM targets
Peter Krempa [Mon, 7 May 2012 11:58:22 +0000 (13:58 +0200)]
qemu: Don't skip detection of virtual cpu's on non KVM targets

This patch lifts the limit of calling thread detection code only on KVM
guests. With upstream qemu the thread mappings are reported also on
non-KVM machines.

QEMU adopted the thread_id information from the kvm branch.

To remain compatible with older upstream versions of qemu the check is
attempted but the failure to detect threads (or even run the monitor
command - on older versions without SMP support) is treated non-fatal
and the code reports one vCPU with pid of the hypervisor (in same
fashion this was done on non-KVM guests).

12 years agoqemu: Re-detect virtual cpu threads after cpu hot (un)plug.
Peter Krempa [Mon, 7 May 2012 11:56:17 +0000 (13:56 +0200)]
qemu: Re-detect virtual cpu threads after cpu hot (un)plug.

After a cpu hotplug the qemu driver did not refresh information about
virtual processors used by qemu and their corresponding threads. This
patch forces a re-detection as is done on start of QEMU.

This ensures that correct information is reported by the
virDomainGetVcpus API and "virsh vcpuinfo".

A failure to obtain the thread<->vcpu mapping is treated non-fatal and
the mapping is not updated in a case of failure as not all versions of
QEMU report this in the info cpus command.

12 years agoqemu: Refactor qemuDomainSetVcpusFlags
Peter Krempa [Mon, 7 May 2012 11:53:20 +0000 (13:53 +0200)]
qemu: Refactor qemuDomainSetVcpusFlags

This patch changes a switch statement into ifs when handling live vs.
configuration modifications getting rid of redundant code in case when
both live and persistent configuration gets changed.

12 years agobuild: fix stamp file name
Eric Blake [Fri, 11 May 2012 14:20:34 +0000 (08:20 -0600)]
build: fix stamp file name

Ever since commit c964b6a, make was trying to find the timestamp
of '""./apibuild.py".stamp"', but only touching 'apibuild.py.stamp',
and thus always rebuilding.  Reported by Daniel P. Berrange.

* docs/Makefile.am (APIBUILD, APIBUILD_STAMP): Omit bogus quotes.

12 years agousb: fix crash when failing to attach a second usb device
Guannan Ren [Fri, 11 May 2012 06:29:15 +0000 (14:29 +0800)]
usb: fix crash when failing to attach a second usb device

when failing to attach another usb device to a domain for some reason
which has one use device attached before, the libvirtd crashed.
The crash is caused by null-pointer dereference error in invoking
usbDeviceListSteal passed in NULL value usb variable.
commit 05abd1507d66aabb6cad12eeafeb4c4d1911c585 introduces the bug.

12 years agodocs: mention migration issue of which credentials are used
Eric Blake [Mon, 30 Apr 2012 20:51:07 +0000 (14:51 -0600)]
docs: mention migration issue of which credentials are used

Based on a report by Seth Vidal.  Just because _you_ can use virsh
to connect to both source and destinations does not mean that libvirtd
on the source (aka _root_) can likewise connect to the destination;
this matters when setting up a peer-to-peer migration instead of a
native one.

* docs/migration.html.in: Mention that in peer-to-peer, the owner
of the source libvirtd (usually root) must be able to connect to
the destination.

12 years agobuild: Fix the typo in configure.ac
Osier Yang [Thu, 10 May 2012 02:25:22 +0000 (10:25 +0800)]
build: Fix the typo in configure.ac

s/nuamd/numad/,

12 years agoconf: Fix memory leaks in virStoragePoolDefParseSource
Alex Jia [Wed, 9 May 2012 10:48:46 +0000 (18:48 +0800)]
conf: Fix memory leaks in virStoragePoolDefParseSource

Detected by valgrind. Leaks are introduced in commit 122fa379.

src/conf/storage_conf.c: fix memory leaks.

How to reproduce?
$ make && make -C tests check TESTS=storagepoolxml2xmltest
$ cd tests && valgrind -v --leak-check=full ./storagepoolxml2xmltest

actual result:
==28571== LEAK SUMMARY:
==28571==    definitely lost: 40 bytes in 5 blocks
==28571==    indirectly lost: 0 bytes in 0 blocks
==28571==      possibly lost: 0 bytes in 0 blocks
==28571==    still reachable: 1,054 bytes in 21 blocks
==28571==         suppressed: 0 bytes in 0 blocks

Signed-off-by: Alex Jia <ajia@redhat.com>
12 years agoqemu: fix build when !HAVE_NUMACTL
Eric Blake [Wed, 9 May 2012 23:55:31 +0000 (17:55 -0600)]
qemu: fix build when !HAVE_NUMACTL

Commit 97010eb1f forgot to change the other side of an #ifdef.

* src/qemu/qemu_process.c (qemuProcessInitNumaMemoryPolicy): Add
argument.

13 years agoReport error when parsing character device target type
Jim Fehlig [Wed, 9 May 2012 17:12:38 +0000 (11:12 -0600)]
Report error when parsing character device target type

No useful error was being reported when an invalid character device
target type is specified in the domainXML. E.g.

    ...
    <console type="pty">
      <source path="/dev/pts/2"/>
      <target type="kvm" port="0"/>
    </console>
    ...

resulted in

error: Failed to define domain from x.xml
error: An error occurred, but the cause is unknown

With this small patch, the error is more helpful

error: Failed to define domain from x.xml
error: XML error: unknown target type 'kvm' specified for character device

13 years agonetlink: Fix build with libnl-3
Jiri Denemark [Wed, 9 May 2012 09:57:44 +0000 (11:57 +0200)]
netlink: Fix build with libnl-3

Commit 642973135c54b93242c4548ef27d591b52b0994c added three direct
references to nl_handle_* instead of using our aliases which hide
differences between libnl-3 and libnl-1.

13 years agonumad: Update comments in libvirt.spec.in
Osier Yang [Wed, 9 May 2012 04:26:36 +0000 (12:26 +0800)]
numad: Update comments in libvirt.spec.in

Not only support CPU placement now.

13 years agonumad: Check numactl-devel if compiled with numad support
Osier Yang [Wed, 9 May 2012 04:22:58 +0000 (12:22 +0800)]
numad: Check numactl-devel if compiled with numad support

Since now we pre-set memory policy using libnuma to fully
drive numad, it needs to check numactl-devel if "with_numad"
is "yes".

configure with groups "--with-numad=yes --with-numactl=yes",
"--with-numad=no --with-numactl=yes", "--with-numad=yes
--with-numactl=yes" works fine after the change.

13 years agonumad: Divide cur_balloon by 1024 before passing it to numad
Osier Yang [Tue, 8 May 2012 16:04:37 +0000 (00:04 +0800)]
numad: Divide cur_balloon by 1024 before passing it to numad

Numad expects MB by default.

13 years agonumad: Always output 'placement' of <vcpu>
Osier Yang [Tue, 8 May 2012 16:04:36 +0000 (00:04 +0800)]
numad: Always output 'placement' of <vcpu>

<vcpu> is not an optional node. The value for its 'placement'
actually always defaults to 'static' in the underlying codes.
(Even no 'cpuset' and 'placement' is specified, the domain
process will be pinned to all the available pCPUs).

13 years agonumad: Copy 'placement' of <numatune> to <vcpu> by default
Osier Yang [Tue, 8 May 2012 16:04:35 +0000 (00:04 +0800)]
numad: Copy 'placement' of <numatune> to <vcpu> by default

With this patch, one can also fully drive numad by:

  <vcpu>2</vcpu>
  <numatune>
    <memory placement='auto'/>
  </numatune>

New tests are added.

13 years agonumad: Set memory policy from numad advisory nodeset
Osier Yang [Tue, 8 May 2012 16:04:34 +0000 (00:04 +0800)]
numad: Set memory policy from numad advisory nodeset

Though numad will manage the memory allocation of task dynamically,
it wants management application (libvirt) to pre-set the memory
policy according to the advisory nodeset returned from querying numad,
(just like pre-bind CPU nodeset for domain process), and thus the
performance could benefit much more from it.

This patch introduces new XML tag 'placement', value 'auto' indicates
whether to set the memory policy with the advisory nodeset from numad,
and its value defaults to the value of <vcpu> placement, or 'static'
if 'nodeset' is specified. Example of the new XML tag's usage:

  <numatune>
    <memory placement='auto' mode='interleave'/>
  </numatune>

Just like what current "numatune" does, the 'auto' numa memory policy
setting uses libnuma's API too.

If <vcpu> "placement" is "auto", and <numatune> is not specified
explicitly, a default <numatume> will be added with "placement"
set as "auto", and "mode" set as "strict".

The following XML can now fully drive numad:

1) <vcpu> placement is 'auto', no <numatune> is specified.

   <vcpu placement='auto'>10</vcpu>

2) <vcpu> placement is 'auto', no 'placement' is specified for
   <numatune>.

   <vcpu placement='auto'>10</vcpu>
   <numatune>
     <memory mode='interleave'/>
   </numatune>

And it's also able to control the CPU placement and memory policy
independently. e.g.

1) <vcpu> placement is 'auto', and <numatune> placement is 'static'

   <vcpu placement='auto'>10</vcpu>
   <numatune>
     <memory mode='strict' nodeset='0-10,^7'/>
   </numatune>

2) <vcpu> placement is 'static', and <numatune> placement is 'auto'

   <vcpu placement='static' cpuset='0-24,^12'>10</vcpu>
   <numatune>
     <memory mode='interleave' placement='auto'/>
   </numatume>

A follow up patch will change the XML formatting codes to always output
'placement' for <vcpu>, even it's 'static'.

13 years agosnapshot: allow block devices past cgroup
Eric Blake [Mon, 7 May 2012 22:56:08 +0000 (16:56 -0600)]
snapshot: allow block devices past cgroup

It turns out that when cgroups are enabled, the use of a block device
for a snapshot target was failing with EPERM due to libvirt failing
to add the block device to the cgroup whitelist.  See also
https://bugzilla.redhat.com/show_bug.cgi?id=810200

* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive)
(qemuDomainSnapshotUndoSingleDiskActive): Account for cgroup.
(qemuDomainSnapshotCreateDiskActive): Update caller.

13 years agotests: add some self-documentation to tests
Alon Levy [Tue, 8 May 2012 17:46:45 +0000 (20:46 +0300)]
tests: add some self-documentation to tests

Alon tried './qemuxml2argvtest --help' to figure out a test failure,
but it didn't help.  The information is in HACKING, but it doesn't
hurt to make the tests also provide their own help.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agodomain_conf: add "default" to list of valid spice channels
Alon Levy [Tue, 8 May 2012 17:42:44 +0000 (20:42 +0300)]
domain_conf: add "default" to list of valid spice channels

qemu's behavior in this case is to change the spice server behavior to
require secure connection to any channel not otherwise specified as
being in plaintext mode. libvirt doesn't currently allow requesting this
(via plaintext-channel=<channel name>).

RHBZ: 819499

Signed-off-by: Alon Levy <alevy@redhat.com>
13 years agodomain_conf: add "usbredir" to list of valid spice channels
Alon Levy [Tue, 8 May 2012 13:00:28 +0000 (16:00 +0300)]
domain_conf: add "usbredir" to list of valid spice channels

Add "usbredir" channel to list of recognized spice channels.

RHBZ: 819498

Signed-off-by: Alon Levy <alevy@redhat.com>
13 years agobuild: avoid link failure on Windows
Eric Blake [Wed, 2 May 2012 18:53:04 +0000 (12:53 -0600)]
build: avoid link failure on Windows

We only know -lpthread exists on platforms where we build
threads-pthread.c; but when we build threads-win32.c, LIB_PTHREAD
is empty.

* tests/Makefile.am (shunloadtest_LDADD): Use correct library.

13 years agovirsh: avoid heap corruption leading to virsh abort
Jim Meyering [Mon, 7 May 2012 19:22:09 +0000 (21:22 +0200)]
virsh: avoid heap corruption leading to virsh abort

* tools/virsh.c (vshParseSnapshotDiskspec): Fix off-by-3 memmove
that would corrupt heap when parsing escaped --diskspec comma.
Bug introduced via commit v0.9.4-260-g35d52b5.

13 years agoutil: set src_pid for virNetlinkCommand when appropriate
Laine Stump [Fri, 4 May 2012 17:48:20 +0000 (13:48 -0400)]
util: set src_pid for virNetlinkCommand when appropriate

Until now, the nl_pid of the source address of every message sent by
virNetlinkCommand has been set to the value of getpid(). Most of the
time this doesn't matter, and in the one case where it does
(communication with lldpad), it previously was the proper thing to do,
because the netlink event service (which listens on a netlink socket
for unsolicited messages from lldpad) coincidentally always happened
to bind with a local nl_pid == getpid().

With the fix for:

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

that particular nl_pid is now effectively a reserved value, so the
netlink event service will always bind to something else
(coincidentally "getpid() + (1 << 22)", but it really could be
anything). The result is that communication between lldpad and
libvirtd is broken (lldpad gets a "disconnected" error when it tries
to send a directed message).

The solution to this problem caused by a solution, is to query the
netlink event service's nlhandle for its "local_port", and send that
as the source nl_pid (but only when sending to lldpad, of course - in
other cases we maintain the old behavior of sending getpid()).

There are two cases where a message is being directed at lldpad - one
in virNetDevLinkDump, and one in virNetDevVPortProfileOpSetLink.

The case of virNetDevVPortProfileOpSetLink is simplest to explain -
only if !nltarget_kernel, i.e. the message isn't targetted for the
kernel, is the dst_pid set (by calling
virNetDevVPortProfileGetLldpadPid()), so only in that case do we call
virNetlinkEventServiceLocalPid() to set src_pid.

For virNetDevLinkDump, it's a bit more complicated. The call to
virNetDevVPortProfileGetLldpadPid() was effectively up one level (in
virNetDevVPortProfileOpCommon), although obscured by an unnecessary
passing of a function pointer. This patch removes the function
pointer, and calls virNetDevVPortProfileGetLldpadPid() directly in
virNetDevVPortProfileOpCommon - if it's doing this, it knows that it
should also call virNetlinkEventServiceLocalPid() to set src_pid too;
then it just passes src_pid and dst_pid down to
virNetDevLinkDump. Since (src_pid == 0 && dst_pid == 0) implies that
the kernel is the destination, there is no longer any need to send
nltarget_kernel as an arg to virNetDevLinkDump, so it's been removed.

The disparity between src_pid being int and dst_pid being uint32_t may
be a bit disconcerting to some, but I didn't want to complicate
virNetlinkEventServiceLocalPid() by having status returned separately
from the value.

13 years agoutil: function to get local nl_pid used by netlink event socket
Laine Stump [Fri, 4 May 2012 17:19:51 +0000 (13:19 -0400)]
util: function to get local nl_pid used by netlink event socket

This value will be needed to set the src_pid when sending netlink
messages to lldpad. It is part of the solution to:

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

Note that libnl's port generation algorithm guarantees that the
nl_socket_get_local_port() will always be > 0 (since it is "getpid() +
(n << 22>" where n is always < 1024), so it is okay to cast the
uint32_t to int (thus allowing us to use -1 as an error sentinel).

13 years agoutil: allow specifying both src and dst pid in virNetlinkCommand
Laine Stump [Fri, 4 May 2012 16:58:36 +0000 (12:58 -0400)]
util: allow specifying both src and dst pid in virNetlinkCommand

Until now, virNetlinkCommand has assumed that the nl_pid in the source
address of outgoing netlink messages should always be the return value
of getpid(). In most cases it actually doesn't matter, but in the case
of communication with lldpad, lldpad saves this info and later uses it
to send netlink messages back to libvirt. A recent patch to fix Bug
816465 changed the order of the universe such that the netlink event
service socket is no longer bound with nl_pid == getpid(), so lldpad
could no longer send unsolicited messages to libvirtd. Adding src_pid
as an argument to virNetlinkCommand() is the first step in notifying
lldpad of the proper address of the netlink event service socket.

13 years agoutil: fix libvirtd startup failure due to netlink error
Laine Stump [Thu, 3 May 2012 14:39:04 +0000 (10:39 -0400)]
util: fix libvirtd startup failure due to netlink error

This is part of the solution to the problem detailed in:

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

and further detailed in

  https://www.redhat.com/archives/libvir-list/2012-May/msg00202.htm

A short explanation is included in the comments of the patch itself.

Note that this patch by itself breaks communication between lldpad and
libvirtd, so the other 3 patches in the series must be applied at the
same time as this patch.

13 years agoopenvz: simplify openvzDomainDefineCmd by using virCommandPtr
Guido Günther [Sat, 5 May 2012 06:47:05 +0000 (08:47 +0200)]
openvz: simplify openvzDomainDefineCmd by using virCommandPtr

13 years agoqemu: call usb search function for hostdev initialization and hotplug
Guannan Ren [Sun, 6 May 2012 14:45:05 +0000 (22:45 +0800)]
qemu: call usb search function for hostdev initialization and hotplug

src/qemu/qemu_hostdev.c:
refactor qemuPrepareHostdevUSBDevices function, make it focus on
adding usb device to activeUsbHostdevs after check. After that,
the usb hotplug function qemuDomainAttachHostDevice also could use
it.
expand qemuPrepareHostUSBDevices to perform the usb search,
rollback on failure.

src/qemu/qemu_hotplug.c:
If there are multiple usb devices available with same vendorID and productID,
but with different value of "bus, device", we give an error to let user
use <address> to specify the desired one.

13 years agousb: create functions to search usb device accurately
Guannan Ren [Fri, 4 May 2012 07:49:58 +0000 (15:49 +0800)]
usb: create functions to search usb device accurately

usbFindDevice():get usb device according to
                idVendor, idProduct, bus, device
                it is the exact match of the four parameters

usbFindDeviceByBus():get usb device according to bus, device
                  it returns only one usb device same as usbFindDevice

usbFindDeviceByVendor():get usb device according to idVendor,idProduct
                     it probably returns multiple usb devices.

usbDeviceSearch(): a helper function to do the actual search

13 years agorpm: Handle different source URLs for maint releases
Cole Robinson [Sun, 6 May 2012 18:09:22 +0000 (14:09 -0400)]
rpm: Handle different source URLs for maint releases

13 years agodocs: Add 'maintenance releases' link in 'News' sidebar
Cole Robinson [Sun, 6 May 2012 17:50:22 +0000 (13:50 -0400)]
docs: Add 'maintenance releases' link in 'News' sidebar

13 years agoqemu: Emit compatible XML when migrating a domain
Jiri Denemark [Fri, 4 May 2012 19:23:17 +0000 (21:23 +0200)]
qemu: Emit compatible XML when migrating a domain

When we added the default USB controller into domain XML, we efficiently
broke migration to older versions of libvirt that didn't support USB
controllers at all (0.9.4 and earlier) even for domains that don't use
anything that the older libvirt can't provide. We still want to present
the default USB controller in any XML seen by a user/app but we can
safely remove it from the domain XML used during migration. If we are
migrating to a new enough libvirt, it will add the controller XML back,
while older libvirt won't be confused with it although it will still
tell qemu to create the controller.

Similar approach can be used in the future whenever we find out we
always enabled some kind of device without properly advertising it in
domain XML.

13 years agoqemu: Don't use virDomainDefFormat* directly
Jiri Denemark [Fri, 4 May 2012 19:00:13 +0000 (21:00 +0200)]
qemu: Don't use virDomainDefFormat* directly

Always use appropriate qemuDomain{,Def}Format wrapper since it may do
some additional magic based on the flags.

13 years agoqemu: reject blockiotune if qemu too old
Eric Blake [Fri, 4 May 2012 16:24:17 +0000 (10:24 -0600)]
qemu: reject blockiotune if qemu too old

Commit 4c82f09e added a capability check for qemu per-device io
throttling, but only applied it to domain startup.  As mentioned
in the previous commit (98cec05), the user can still get an 'internal
error' message during a hotplug attempt, when the monitor command
doesn't exist.  It is confusing to allow tuning on inactive domains
only to then be rejected when starting the domain.

* src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Reject
offline tuning if online can't match it.

13 years agoqemu: don't modify domain on failed blockiotune
Eric Blake [Fri, 4 May 2012 15:43:23 +0000 (09:43 -0600)]
qemu: don't modify domain on failed blockiotune

If you have a qemu build that lacks the blockio tune monitor command,
then this command:

$ virsh blkdeviotune rhel6u2 hda --total_bytes_sec 1000
error: Unable to change block I/O throttle
error: internal error Unexpected error

fails as expected (well, the error message is lousy), but the next
dumpxml shows that the domain was modified anyway.  Worse, that means
if you save the domain then restore it, the restore will likely fail
due to throttling being unsupported, even though no throttling should
even be active because the monitor command failed in the first place.

* src/qemu/qemu_driver.c (qemuDomainSetBlockIoTune): Check for
error before making modification permanent.

13 years agoutil: remove error log from stubs of virNetlinkEventServiceStart|Stop
Laine Stump [Thu, 3 May 2012 15:52:17 +0000 (11:52 -0400)]
util: remove error log from stubs of virNetlinkEventServiceStart|Stop

These two functions are called from main() on all platforms, and
always return success on platforms that don't support libnl. They
still log an error message, though, which doesn't make sense - they
should just be NOPs on those platforms. (Per a suggestion during
review, I've turned the logs into debug messages rather than removing
them completely).

13 years agonode_device: fix possible non-terminated string
Stefan Berger [Fri, 4 May 2012 17:22:22 +0000 (13:22 -0400)]
node_device: fix possible non-terminated string

Error: STRING_NULL:
/libvirt/src/node_device/node_device_linux_sysfs.c:80:
string_null_argument: Function "saferead" does not terminate string "*buf".
/libvirt/src/util/util.c:101:
string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
/libvirt/src/node_device/node_device_linux_sysfs.c:87:
string_null: Passing unterminated string "buf" to a function expecting a null-terminated string.

13 years agouuid: fix possible non-terminated string
Stefan Berger [Fri, 4 May 2012 17:22:22 +0000 (13:22 -0400)]
uuid: fix possible non-terminated string

Error: STRING_NULL:
/libvirt/src/util/uuid.c:273:
string_null_argument: Function "getDMISystemUUID" does not terminate string "*dmiuuid".
/libvirt/src/util/uuid.c:241:
string_null_argument: Function "saferead" fills array "*uuid" with a non-terminated string.
/libvirt/src/util/util.c:101:
string_null_argument: Function "read" fills array "*buf" with a non-terminated string.
/libvirt/src/util/uuid.c:274:
string_null: Passing unterminated string "dmiuuid" to a function expecting a null-terminated string.
/libvirt/src/util/uuid.c:138:
var_assign_parm: Assigning: "cur" = "uuidstr". They now point to the same thing.
/libvirt/src/util/uuid.c:164:
string_null_sink_loop: Searching for null termination in an unterminated array "cur".

13 years agotests: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)]
tests: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/tests/qemuxml2argvtest.c:47:
alloc_arg: Calling allocation function "virAlloc" on "ret".
/libvirt/src/util/memory.c:101:
alloc_fn: Storage is returned from allocation function "calloc".
/libvirt/src/util/memory.c:101:
var_assign: Assigning: "*((void **)ptrptr)" = "calloc(1UL, size)".
/libvirt/tests/qemuxml2argvtest.c:54:
leaked_storage: Variable "ret" going out of scope leaks the storage it points to.

13 years agoqemu: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)]
qemu: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/src/qemu/qemu_driver.c:6968:
alloc_fn: Calling allocation function "calloc".
/libvirt/src/qemu/qemu_driver.c:6968:
var_assign: Assigning: "nodeset" =  storage returned from "calloc(1UL, 1UL)".
/libvirt/src/qemu/qemu_driver.c:6977:
noescape: Variable "nodeset" is not freed or pointed-to in function "virTypedParameterAssign".
/libvirt/src/qemu/qemu_driver.c:6997:
leaked_storage: Variable "nodeset" going out of scope leaks the storage it points to.

13 years agovmx: fix resource leak
Stefan Berger [Fri, 4 May 2012 14:42:09 +0000 (10:42 -0400)]
vmx: fix resource leak

Error: RESOURCE_LEAK:
/libvirt/src/vmx/vmx.c:2431:
alloc_fn: Calling allocation function "calloc".
/libvirt/src/vmx/vmx.c:2431:
var_assign: Assigning: "networkName" =  storage returned from "calloc(1UL, 1UL)".
/libvirt/src/vmx/vmx.c:2495:
leaked_storage: Variable "networkName" going out of scope leaks the storage it points to.

13 years agoopenvz: read vmguarpages/privvmpages to set memory tunables
Guido Günther [Wed, 25 Apr 2012 19:18:16 +0000 (21:18 +0200)]
openvz: read vmguarpages/privvmpages to set memory tunables

13 years agoCoverity: Fix resource leak in virnetlink.c
Osier Yang [Wed, 2 May 2012 14:51:38 +0000 (22:51 +0800)]
Coverity: Fix resource leak in virnetlink.c

13 years agoCoverity: Fix resource leak in nodeinfo.c
Osier Yang [Wed, 2 May 2012 15:18:03 +0000 (23:18 +0800)]
Coverity: Fix resource leak in nodeinfo.c

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: alloc_fn: Calling allocation function "fopen".
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
/builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:638: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.

13 years agoCoverity: Fix resource leak in test driver
Osier Yang [Wed, 2 May 2012 14:51:36 +0000 (22:51 +0800)]
Coverity: Fix resource leak in test driver

Error: RESOURCE_LEAK:
/builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1041: alloc_arg: Calling allocation function "virXPathNodeSet" on "devs".
/builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:621: alloc_arg: "virAllocN" allocates memory that is stored into "*list".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: alloc_fn: Storage is returned from allocation function "calloc".
/builddir/build/BUILD/libvirt-0.9.10/src/util/memory.c:129: var_assign: Assigning: "*((void **)ptrptr)" = "calloc(count, size)".
/builddir/build/BUILD/libvirt-0.9.10/src/util/xml.c:625: noescape: Variable "*list" is not freed or pointed-to in function "memcpy".
/builddir/build/BUILD/libvirt-0.9.10/src/test/test_driver.c:1098: leaked_storage: Variable "devs" going out of scope leaks the storage it points to.