]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agostorage: list more file types
Eric Blake [Fri, 28 Sep 2012 17:11:07 +0000 (11:11 -0600)]
storage: list more file types

When an image has no backing file, using VIR_STORAGE_FILE_AUTO
for its type is a bit confusing.  Additionally, a future patch
would like to reserve a default value for the case of no file
type specified in the XML, but different from the current use
of -1 to imply probing, since probing is not always safe.

Also, a couple of file types were missing compared to supported
code: libxl supports 'vhd', and qemu supports 'fat' for directories
passed through as a file system.

* src/util/storage_file.h (virStorageFileFormat): Add
VIR_STORAGE_FILE_NONE, VIR_STORAGE_FILE_FAT, VIR_STORAGE_FILE_VHD.
* src/util/storage_file.c (virStorageFileMatchesVersion): Match
documentation when version probing not supported.
(cowGetBackingStore, qcowXGetBackingStore, qcow1GetBackingStore)
(qcow2GetBackingStoreFormat, qedGetBackingStore)
(virStorageFileGetMetadataFromBuf)
(virStorageFileGetMetadataFromFD): Take NONE into account.
* src/conf/domain_conf.c (virDomainDiskDefForeachPath): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetBlockInfo): Likewise.
* src/conf/storage_conf.c (virStorageVolumeFormatFromString): New
function.
(poolTypeInfo): Use it.

12 years agoAutogenerate AUTHORS
Cole Robinson [Fri, 12 Oct 2012 23:50:19 +0000 (19:50 -0400)]
Autogenerate AUTHORS

AUTHORS.in tracks the maintainers, as well as some folks who were
previously in AUTHORS but don't have a git commit with proper
attribution.

Generated output is sorted alphabetically and lacks pretty spacing, so
tweak AUTHORS.in to follow the same format.

Additionally, drop the syntax-check rule that previously validated
AUTHORS against git log.

12 years agoselinux: relabel tapfd in qemuPhysIfaceConnect
Guannan Ren [Fri, 19 Oct 2012 08:44:30 +0000 (16:44 +0800)]
selinux: relabel tapfd in qemuPhysIfaceConnect

Relabeling tapfd right after the tap device is created.
qemuPhysIfaceConnect is common function called both for static
netdevs and for hotplug netdevs.

12 years agoqemu: Do not require hostuuid in migration cookie
Jiri Denemark [Fri, 19 Oct 2012 13:08:29 +0000 (15:08 +0200)]
qemu: Do not require hostuuid in migration cookie

Having hostuuid in migration cookie is a nice bonus since it provides an
easy way of detecting migration to the same host. However, requiring it
breaks backward compatibility with older libvirt releases.

12 years agoqemu: Allow migration with host USB devices
Jiri Denemark [Fri, 19 Oct 2012 11:36:33 +0000 (13:36 +0200)]
qemu: Allow migration with host USB devices

Recently, patches were added support for (managed)saving, restoring, and
migrating domains with host USB devices. However, qemu driver would
still forbid migration of such domains because qemuMigrationIsAllowed
was not updated.

12 years agoqemu: Set arch to i686 if qemu-system-i386 is found
Guido Günther [Thu, 18 Oct 2012 23:14:15 +0000 (01:14 +0200)]
qemu: Set arch to i686 if qemu-system-i386 is found

If we can't probe the architecture from QMP we parse the architecture
from the qemu binaries name. This results in the architecture being i386
instead of i686 which then results in QEMU_CAPS_PCI_MULTIBUS being unset
which gives a broken qemu command line.

This probably didn't show up earlier since most of the time there's also
a /usr/bin/qemu around which results in i686 capabilities.

12 years agoqemu: Don't fail without emulatorpin or cpumask
Guido Günther [Thu, 18 Oct 2012 22:29:17 +0000 (00:29 +0200)]
qemu: Don't fail without emulatorpin or cpumask

This unbreaks qemu:///session that got broken by
ba63d8f7d843461f77a8206c1ef9da38388713e5.

12 years agonetwork: Set to NULL after virNetworkDefFree()
Michal Privoznik [Thu, 18 Oct 2012 14:28:35 +0000 (16:28 +0200)]
network: Set to NULL after virNetworkDefFree()

which frees all allocated memory but doesn't set the passed pointer to
NULL.  Therefore, we must do it ourselves. This is causing actual
libvirtd crash: Basically, when doing 'virsh net-edit' the newDef should
be dropped.  And the memory is freed, indeed. However, the pointer is
not set to NULL but kept instead. And the next duo of calls 'virsh
net-start' and 'virsh net-destroy' starts the disaster. The latter one
does the same as 'virsh destroy'; it sees that newDef is nonNULL so it
replaces def with newDef (which has been freed already as said a few
lines above). Therefore any subsequent call accessing def will hit the ground.

12 years agodist: added cpu/cpu_ppc_data.h to Makefile.am
Viktor Mihajlovski [Thu, 18 Oct 2012 14:28:04 +0000 (16:28 +0200)]
dist: added cpu/cpu_ppc_data.h to Makefile.am

Missing entry for cpu_ppc_data.h added to fix RPM build.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Always format CPU topology
Jiri Denemark [Tue, 16 Oct 2012 19:11:29 +0000 (21:11 +0200)]
qemu: Always format CPU topology

When libvirt cannot find a suitable CPU model for host CPU (easily
reproducible by running libvirt in a guest), it would not provide CPU
topology in capabilities XML either. Even though CPU topology is known
and can be queried by virNodeGetInfo. With this patch, CPU topology will
always be provided in capabilities XML regardless on the presence of CPU
model.

12 years agospec: Fix dependency for lock-sanlock subpackage
Jiri Denemark [Thu, 18 Oct 2012 11:03:26 +0000 (13:03 +0200)]
spec: Fix dependency for lock-sanlock subpackage

This should not make a big difference in real world since libvirt-daemon,
which is already required by libvirt-lock-sanlock, requires
libvirt-client and thus libvirt-lock-sanlock gets this dependency
transitively. However, since libvirt-lock-sanlock contains
sanlock_helper binary linked to libvirt.so, we should start requiring
libvirt-client directly.

12 years agoqemu: Add support for HyperV Enlightenment feature "relaxed"
Peter Krempa [Wed, 17 Oct 2012 12:55:18 +0000 (14:55 +0200)]
qemu: Add support for HyperV Enlightenment feature "relaxed"

This patch adds QEMU support for the "relaxed" feature implemented by
previous patch.

12 years agoconf: Add support for HyperV Enlightenment features
Peter Krempa [Tue, 16 Oct 2012 16:25:56 +0000 (18:25 +0200)]
conf: Add support for HyperV Enlightenment features

Hypervisors are starting to support HyperV Enlightenment features that
improve behavior of guests running Microsoft Windows operating systems.

This patch adds support for the "relaxed" feature that improves timer
behavior and also establishes a framework to add these features in
future.

12 years agoconf: Make tri-state feature options more universal
Peter Krempa [Tue, 16 Oct 2012 14:28:22 +0000 (16:28 +0200)]
conf: Make tri-state feature options more universal

The apic-eoi feature enum and implementation can be made more universal
to allow re-use of the enum for other features.

12 years agoqemu: Correctly wait for spice to migrate
Michal Privoznik [Thu, 18 Oct 2012 07:38:41 +0000 (09:38 +0200)]
qemu: Correctly wait for spice to migrate

Currently we query-spice after the main migration has completed
before moving to next state. Qemu reports this as boolean (not
enclosed within quotes). Therefore it is not correct to use
virJSONValueObjectGetString but virJSONValueObjectGetBoolean instead.

12 years agoqemu: Fixed default machine detection in qemuCapsParseMachineTypesStr
Viktor Mihajlovski [Wed, 17 Oct 2012 14:48:42 +0000 (16:48 +0200)]
qemu: Fixed default machine detection in qemuCapsParseMachineTypesStr

The machine in the last output line of <qemu-binary> -M ?
was always reported as default machine even if this wasn't the
actual default. Trivial fix.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agoqemu: Pin the emulator when only cpuset is specified
Martin Kletzander [Wed, 17 Oct 2012 14:39:31 +0000 (16:39 +0200)]
qemu: Pin the emulator when only cpuset is specified

According to our recent changes (clarifications), we should be pinning
qemu's emulator processes using the <vcpu> 'cpuset' attribute in case
there is no <emulatorpin> specified.  This however doesn't work
entirely as expected and this patch should resolve all the remaining
issues.

12 years agoqemu: Clear async job when p2p migration fails early
Jiri Denemark [Wed, 17 Oct 2012 12:08:17 +0000 (14:08 +0200)]
qemu: Clear async job when p2p migration fails early

When p2p migration fails early because qemuMigrationIsAllowed or
qemuMigrationIsSafe say migration should be cancelled, we fail to clear
the migration-out async job. As a result of that, further APIs called
for the same domain may fail with Timed out during operation: cannot
acquire state change lock.

Reported by Guido Winkelmann.

12 years agointerface: add virInterfaceGetXMLDesc() in udev
Doug Goldstein [Sun, 14 Oct 2012 22:02:33 +0000 (17:02 -0500)]
interface: add virInterfaceGetXMLDesc() in udev

Added support for retrieving the XML defining a specific interface via
the udev based backend to virInterface. Implement the following APIs
for the udev based backend:
* virInterfaceGetXMLDesc()

Note: Does not support bond devices.

12 years agoAUTHORS: Remove double entry
Michal Privoznik [Wed, 17 Oct 2012 09:53:13 +0000 (11:53 +0200)]
AUTHORS: Remove double entry

I've accidentally added Li Zhang <zhlcindy@linux.vnet.ibm.com> to
AUTHORS, even if he already was there.

12 years agoDoc-fix for PowerPC CPU model driver
Li Zhang [Mon, 15 Oct 2012 09:07:51 +0000 (17:07 +0800)]
Doc-fix for PowerPC CPU model driver

There are some descriptions not right in PowerPC CPU model driver.
This patch is to fix them.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
12 years agoImplement CPU model driver for PowerPC
Li Zhang [Mon, 15 Oct 2012 09:07:50 +0000 (17:07 +0800)]
Implement CPU model driver for PowerPC

Currently, the CPU model driver is not implemented for PowerPC.
Host's CPU information is needed to exposed to guests' XML file some
time.

This patch is to implement the callback functions of CPU model driver.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
12 years agoAdd one file cpu_ppc_data.h to define CPU data for PPC
Li Zhang [Mon, 15 Oct 2012 09:07:49 +0000 (17:07 +0800)]
Add one file cpu_ppc_data.h to define CPU data for PPC

CPU version can be got by PVR on PowerPC. So this PVR is defined in
the CPU data in cpuData structure.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Acked-by: Michal Privoznik <mprivozn@redhat.com>
12 years agoselinux: remove unused variables in socket labelling
Guannan Ren [Wed, 17 Oct 2012 03:28:28 +0000 (11:28 +0800)]
selinux: remove unused variables in socket labelling

12 years agoselinux: fix wrong tapfd relablling
Guannan Ren [Wed, 17 Oct 2012 03:23:19 +0000 (11:23 +0800)]
selinux: fix wrong tapfd relablling

It should relabel tapfd of virtual network of type VIR_DOMAIN_NET_TYPE_DIRECT
rather than VIR_DOMAIN_NET_TYPE_NETWORK and VIR_DOMAIN_NET_TYPE_BRIDGE
(commit ae368ebfcc4923d0b32e83d4ca96a6f599625785 introduced this bug)

Caution: The context of the two hunks is identical other than indentation.
Please be extremely cautious of where the patch gets applied.

12 years agostorage: lvm: lvcreate fails with allocation=0, don't do that
Cole Robinson [Wed, 17 Oct 2012 00:30:23 +0000 (20:30 -0400)]
storage: lvm: lvcreate fails with allocation=0, don't do that

On F17 at least, this command fails:

$ sudo /usr/sbin/lvcreate --name sparsetest -L 0K --virtualsize 16384K vgvirt
  Unable to create new logical volume with no extents

Which is unfortunate since allocation=0 is what virt-manager tries to use
by default.

Rather than telling the user 'don't do that', let's just give them the
smallest allocation possible if alloc=0 is requested.

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

12 years agostorage: lvm: Don't overwrite lvcreate errors
Cole Robinson [Wed, 17 Oct 2012 00:25:41 +0000 (20:25 -0400)]
storage: lvm: Don't overwrite lvcreate errors

Before:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvchange -aln vgvirt/sparsetest) unexpected exit status 5:   One or more specified logical volume(s) not found.

After:
$ sudo virsh vol-create-as --pool vgvirt sparsetest --capacity 16M --allocation 0
error: Failed to create vol sparsetest
error: internal error Child process (/usr/sbin/lvcreate --name sparsetest -L 0K --virtualsize 16384K vgvirt) unexpected exit status 5:   Unable to create new logical volume with no extents

12 years agospec: Require newer sanlock on recent distros 2
Jiri Denemark [Tue, 16 Oct 2012 21:54:18 +0000 (23:54 +0200)]
spec: Require newer sanlock on recent distros 2

The previous commit was incomplete. We need to also add explicit
Requires for the newer version since RPM's automatic dependencies won't
work with sanlock.

12 years agospec: Add runtime requirement for libssh2
Peter Krempa [Tue, 16 Oct 2012 12:34:35 +0000 (14:34 +0200)]
spec: Add runtime requirement for libssh2

libssh2 unfortunately doesn't support symbol versioning so RPM can't
figure out what version is needed for the currently installed libvirt
package. This patch adds a runtime requirement, so that the correct
version of libssh2 can be installed along with libvirt.

12 years agospec: Require newer sanlock on recent distros
Jiri Denemark [Tue, 16 Oct 2012 10:45:27 +0000 (12:45 +0200)]
spec: Require newer sanlock on recent distros

Make sure libvirt is build with sanlock >= 2.4 on distros that are new
enough to provide it.

12 years agolocking: Fix build with sanlock < 2.4
Jiri Denemark [Tue, 16 Oct 2012 10:41:20 +0000 (12:41 +0200)]
locking: Fix build with sanlock < 2.4

libvirt started using sanlock_killpath to implement on_lockfailure
action. Since sanlock_killpath was introduced in sanlock 2.4, libvirt
fails to build with older sanlock.

12 years agoFix typo in previous commit s/lik/like/
Daniel P. Berrange [Tue, 16 Oct 2012 15:37:26 +0000 (16:37 +0100)]
Fix typo in previous commit s/lik/like/

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake virInitialize thread safe
Daniel P. Berrange [Wed, 10 Oct 2012 15:11:43 +0000 (16:11 +0100)]
Make virInitialize thread safe

Currently there is a restriction that multi-threaded applications
must manually call virInitialize, before threads start using
libvirt, because it is not thread-safe. By switching it to use
a virOnceControl initializer we gain thread safety, and thus
applications no longer need to manually call it. They can rely
on virConnectOpen invoking it for them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix virProcessKillPainfully on Win32
Daniel P. Berrange [Tue, 16 Oct 2012 14:46:12 +0000 (15:46 +0100)]
Fix virProcessKillPainfully on Win32

Win32 platforms don't have SIGKILL defined, but they do have
SIGABRT. Since our virProcess wrapper treats anything which
isn't SIGTERM/SIGINT as equivalent to SIGKILL, just use
SIGABRT on Win32.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd JSON serialization of virNetServerPtr objects for process re-exec()
Daniel P. Berrange [Thu, 9 Aug 2012 11:54:54 +0000 (12:54 +0100)]
Add JSON serialization of virNetServerPtr objects for process re-exec()

Add two new APIs virNetServerNewPostExecRestart and
virNetServerPreExecRestart which allow a virNetServerPtr
object to be created from a JSON object and saved to a
JSON object, for the purpose of re-exec'ing a process.

This includes serialization of all registered services
and clients

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd JSON serialization of virNetServerClientPtr objects for process re-exec()
Daniel P. Berrange [Thu, 9 Aug 2012 11:54:54 +0000 (12:54 +0100)]
Add JSON serialization of virNetServerClientPtr objects for process re-exec()

Add two new APIs virNetServerClientNewPostExecRestart and
virNetServerClientPreExecRestart which allow a virNetServerClientPtr
object to be created from a JSON object and saved to a
JSON object, for the purpose of re-exec'ing a process.

This includes serialization of the connected socket associated
with the client

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd JSON serialization of virNetServerServicePtr objects for process re-exec()
Daniel P. Berrange [Thu, 9 Aug 2012 11:54:54 +0000 (12:54 +0100)]
Add JSON serialization of virNetServerServicePtr objects for process re-exec()

Add two new APIs virNetServerServiceNewPostExecRestart and
virNetServerServicePreExecRestart which allow a virNetServerServicePtr
object to be created from a JSON object and saved to a
JSON object, for the purpose of re-exec'ing a process.

This includes serialization of the listening sockets associated
with the service

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd JSON serialization of virNetSocketPtr objects for process re-exec()
Daniel P. Berrange [Thu, 9 Aug 2012 11:54:54 +0000 (12:54 +0100)]
Add JSON serialization of virNetSocketPtr objects for process re-exec()

Add two new APIs virNetSocketNewPostExecRestart and
virNetSocketPreExecRestart which allow a virNetSocketPtr
object to be created from a JSON object and saved to a
JSON object, for the purpose of re-exec'ing a process.

As well as saving the state in JSON format, the second
method will disable the O_CLOEXEC flag so that the open
file descriptors are preserved across the process re-exec()

Since it is not possible to serialize SASL or TLS encryption
state, an error will be raised if attempting to perform
serialization on non-raw sockets

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd JSON serialization of virLockSpacePtr objects for process re-exec()
Daniel P. Berrange [Thu, 9 Aug 2012 10:54:37 +0000 (11:54 +0100)]
Add JSON serialization of virLockSpacePtr objects for process re-exec()

Add two new APIs virLockSpaceNewPostExecRestart and
virLockSpacePreExecRestart which allow a virLockSpacePtr
object to be created from a JSON object and saved to a
JSON object, for the purposes of re-exec'ing a process.

As well as saving the state in JSON format, the second
method will disable the O_CLOEXEC flag so that the open
file descriptors are preserved across the process re-exec()

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIntroduce an internal API for handling file based lockspaces
Daniel P. Berrange [Thu, 2 Aug 2012 16:02:40 +0000 (17:02 +0100)]
Introduce an internal API for handling file based lockspaces

The previously introduced virFile{Lock,Unlock} APIs provide a
way to acquire/release fcntl() locks on individual files. For
unknown reason though, the POSIX spec says that fcntl() locks
are released when *any* file handle referring to the same path
is closed. In the following sequence

  threadA: fd1 = open("foo")
  threadB: fd2 = open("foo")
  threadA: virFileLock(fd1)
  threadB: virFileLock(fd2)
  threadB: close(fd2)

you'd expect threadA to come out holding a lock on 'foo', and
indeed it does hold a lock for a very short time. Unfortunately
when threadB does close(fd2) this releases the lock associated
with fd1. For the current libvirt use case for virFileLock -
pidfiles - this doesn't matter since the lock is acquired
at startup while single threaded an never released until
exit.

To provide a more generally useful API though, it is necessary
to introduce a slightly higher level abstraction, which is to
be referred to as a "lockspace".  This is to be provided by
a virLockSpacePtr object in src/util/virlockspace.{c,h}. The
core idea is that the lockspace keeps track of what files are
already open+locked. This means that when a 2nd thread comes
along and tries to acquire a lock, it doesn't end up opening
and closing a new FD. The lockspace just checks the current
list of held locks and immediately returns VIR_ERR_RESOURCE_BUSY.

NB, the API as it stands is designed on the basis that the
files being locked are not being otherwise opened and used
by the application code. One approach to using this API is to
acquire locks based on a hash of the filepath.

eg to lock /var/lib/libvirt/images/foo.img the application
might do

   virLockSpacePtr lockspace = virLockSpaceNew("/var/lib/libvirt/imagelocks");
   lockname = md5sum("/var/lib/libvirt/images/foo.img");
   virLockSpaceAcquireLock(lockspace, lockname);

NB, in this example, the caller should ensure that the path
is canonicalized before calculating the checksum.

It is also possible to do locks directly on resources by
using a NULL lockspace directory and then using the file
path as the lock name eg

   virLockSpacePtr lockspace = virLockSpaceNew(NULL);
   virLockSpaceAcquireLock(lockspace, "/var/lib/libvirt/images/foo.img");

This is only safe to do though if no other part of the process
will be opening the files. This will be the case when this
code is used inside the soon-to-be-reposted virlockd daemon

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agotests: Fix domain-events python test
Martin Kletzander [Tue, 16 Oct 2012 14:24:41 +0000 (16:24 +0200)]
tests: Fix domain-events python test

There was a missing method in python implementation of domain-events
test and this patch adds that.

12 years agomaint: prepare for next release number
Eric Blake [Mon, 15 Oct 2012 21:17:34 +0000 (15:17 -0600)]
maint: prepare for next release number

Given Daniel's announcement[1], code targetting the next release will
be in 1.0.0, not 0.10.3.  Changed mechanically with:

for f in $(git grep -l '0\(.\)10\13\b') ; do
   sed -i -e 's/0\(.\)10\13/1\10\10/g' $f
done

[1]https://www.redhat.com/archives/libvir-list/2012-October/msg00403.html

* docs/formatdomain.html.in: Use 1.0.0 for next release.
* src/interface/interface_backend_udev.c: Likewise.

12 years agomaint: fix license on polkit script
Eric Blake [Mon, 15 Oct 2012 20:09:05 +0000 (14:09 -0600)]
maint: fix license on polkit script

As approved here:
https://www.redhat.com/archives/libvir-list/2012-October/msg00701.html

* daemon/libvirtd.policy.in: Use LGPLv2+ license.

12 years agoconf: add test for boot dev and order
Martin Kletzander [Tue, 16 Oct 2012 10:25:32 +0000 (12:25 +0200)]
conf: add test for boot dev and order

Add test for 280b8c9e7c94db1decdca08d169c88554c09fa19.

12 years agoconf: Fix crash with cleanup
Martin Kletzander [Tue, 16 Oct 2012 09:15:04 +0000 (11:15 +0200)]
conf: Fix crash with cleanup

There was a crash possible when both <boot dev... and <boot
order... were specified due to virDomainDefParseBootXML() erroring out
before setting *tmp (which was free'd in cleanup).  As a fix, I
created this cleanup that uses one pointer for all the temporary
stored XPath strings and values, plus this pointer is correctly
initialized to NULL.

12 years agoselinux: Use raw contexts 2
Martin Kletzander [Mon, 15 Oct 2012 12:04:36 +0000 (14:04 +0200)]
selinux: Use raw contexts 2

In commit 9674f2c637114fa6ac0680fe5658a41a62bb34a8, I forgot to change
selabel_lookup with the other functions, so this one-liner does exactly
that.

12 years agomaint: drop spurious semicolons
Eric Blake [Mon, 15 Oct 2012 15:08:19 +0000 (09:08 -0600)]
maint: drop spurious semicolons

Detected with:
git grep ';;$' -- '**/*.[ch]'

* src/network/bridge_driver.c (networkRadvdConfContents): Fix
harmless typo.
* src/phyp/phyp_driver.c (phypUUIDTable_Pull): Likewise.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONDriveDel):
Likewise.

12 years agoselinux: add security selinux function to label tapfd
Guannan Ren [Mon, 15 Oct 2012 09:03:49 +0000 (17:03 +0800)]
selinux: add security selinux function to label tapfd

BZ:https://bugzilla.redhat.com/show_bug.cgi?id=851981
When using macvtap, a character device gets first created by
kernel with name /dev/tapN, its selinux context is:
system_u:object_r:device_t:s0

Shortly, when udev gets notification when new file is created
in /dev, it will then jump in and relabel this file back to the
expected default context:
system_u:object_r:tun_tap_device_t:s0

There is a time gap happened.
Sometimes, it will have migration failed, AVC error message:
type=AVC msg=audit(1349858424.233:42507): avc:  denied  { read write } for
pid=19926 comm="qemu-kvm" path="/dev/tap33" dev=devtmpfs ino=131524
scontext=unconfined_u:system_r:svirt_t:s0:c598,c908
tcontext=system_u:object_r:device_t:s0 tclass=chr_file

This patch will label the tapfd device before qemu process starts:
system_u:object_r:tun_tap_device_t:MCS(MCS from seclabel->label)

12 years agoAdd support for SUSPEND_DISK event
Martin Kletzander [Fri, 12 Oct 2012 19:13:39 +0000 (21:13 +0200)]
Add support for SUSPEND_DISK event

This patch adds support for SUSPEND_DISK event; both lifecycle and
separated.  The support is added for QEMU, machines are changed to
PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes
to shut-off.  This and much more needs to be done in order for libvirt
to work with transient devices, wake-ups etc.  This patch is not
aiming for that functionality.

12 years agoutil: switch virLogEatParams to virLogSource
Ján Tomko [Mon, 15 Oct 2012 07:14:26 +0000 (09:14 +0200)]
util: switch virLogEatParams to virLogSource

Commit e8fd8757c89abbd38571092bbb987650b7658aec changed 'const char *'
category to virLogSource enum. This changes it in virLogEatParams as
well, thus fixing the build with --disable-debug.
--
Hopefully moving the enum declarations is less ugly than using int.

12 years agonode_memory: Add new parameter field to tune the new sysfs knob
Osier Yang [Fri, 12 Oct 2012 08:25:42 +0000 (16:25 +0800)]
node_memory: Add new parameter field to tune the new sysfs knob

Upstream kernel introduced new sysfs knob "merge_across_nodes" to
specify if pages from different numa nodes can be merged. When set
to 0, only pages which physically reside in the memory area of
same NUMA node can be merged. When set to 1, pages from all nodes
can be merged.

This patch supports the tuning by adding new param field
"shm_merge_across_nodes".

12 years agoqemu: reorganize qemuDomainChangeNet and qemuDomainChangeNetBridge
Laine Stump [Wed, 10 Oct 2012 19:38:00 +0000 (15:38 -0400)]
qemu: reorganize qemuDomainChangeNet and qemuDomainChangeNetBridge

This patch resolves:

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

to the extent that it can be resolved with current qemu functionality.
It attempts to detect as many situations as possible when the simple
operation of disconnecting an existing tap device from one bridge and
attaching it to another will satisfy the change requested in
virDomainUpdateDeviceFlags() for a network device. Before this patch,
that situation could only be detected if the pre-change interface
*and* the post-change interface definition were both "type='bridge'".
After this patch, it can also be detected if the before or after
interfaces are any combination of type='bridge' and type='network'
(the networks can be <forward mode='nat|route|bridge'>, as long as
they use a Linux host bridge and not macvtap connections).

This extra effort is especially useful since the recent discovery that
a netdev_del+netdev_add combo (to reconnect the network device with
completely different hostside configuration) doesn't work properly
with current qemu (1.2) unless it is accompanied by the matching
device_del+device_add - see this mailing list message for details:

  http://lists.nongnu.org/archive/html/qemu-devel/2012-10/msg02355.html

(A slight modification of the patch referenced there has been prepared
to apply on top of this patch, but won't be pushed until qemu can be
made to work with it.)

* qemuDomainChangeNet needs access to the virDomainDeviceDef that
holds the new netdef (so that it can clear out the virDomainDeviceDef
if it ends up using the NetDef to replace the original), so the
virDomainNetDefPtr arg is replaced with a virDomainDeviceDefPtr.

* qemuDomainChangeNet previously checked for *some* changes to the
interface config, but this check was by no means complete. It was also
a bit disorganized.

This refactoring of the code is (I believe) complete in its check of
all NetDef attributes that might be changed, and either returns a
failure (for changes that are simply impossible), or sets one of three
flags:

  needLinkStateChange - if the device link state needs to go up/down
  needBridgeChange    - if everything else is the same, but it needs
                        to be connected to a difference linux host
                        bridge
  needReconnect       - if the entire host side of the device needs
                        to be torn down and reconstructed (currently
                        non-working, as mentioned above)

Note that this function will refuse to make any change that requires
the *guest* side of the device to be detached (e.g. changing the PCI
address or mac address). Those would be disruptive enough to the guest
that it's reasonable to require an explicit detach/attach sequence
from the management application.

* As mentioned above, qemuDomainChangeNet also does its best to
understand when a simple change in attached bridge for the existing
tap device will work vs. the need to completely tear down/reconstruct
the host side of the device (including tap device).

This patch *does not* implement the "reconnect" code anyway - there is
a placeholder that turns that into an error. Rather, the purpose of
this patch is to replicate existing behavior with code that is ready
to have that functionality plugged in in a later patch.

* The expanded uses for qemuDomainChangeNetBridge meant that it needed
to be enhanced as well - it no longer replaces the original brname
string in olddev with the new brname; instead, it relies on the
caller to replace the *entire* olddev with newdev (since we've gone
to great lengths to assure they are functionally identical other
than the name of the bridge, this is now not only safe, but more
correct). Additionally, qemuDomainNetChangeBridge can now set the
bridge for type='network' interfaces as well as plain type='bridge'
interfaces. (Note that I had to make this change simultaneous to the
reorganization of qemuDomainChangeNet because the two are too
closely intertwined to separate).

12 years agoAvoid straying </cpuset>
Guido Günther [Mon, 15 Oct 2012 07:58:28 +0000 (09:58 +0200)]
Avoid straying </cpuset>

by using the same condition as for the <cpuset>.

Fixes "make check" found by
    http://honk.sigxcpu.org:8001/job/libvirt-check/160/

12 years agoconf: virDomainDeviceInfoCopy utility function
Laine Stump [Thu, 11 Oct 2012 05:09:00 +0000 (01:09 -0400)]
conf: virDomainDeviceInfoCopy utility function

This does a shallow copy of all the bits, then strdups the two items
that are actually allocated separately.

12 years agoconf: fix virDevicePCIAddressEqual args
Laine Stump [Thu, 11 Oct 2012 16:34:14 +0000 (12:34 -0400)]
conf: fix virDevicePCIAddressEqual args

This function really should have been taking virDevicePCIAddress*
instead of the inefficient virDevicePCIAddress (results in copying two
entire structs onto the stack rather than just two pointers), and
returning a bool true/false (not matching is not necessarily a
"failure", as a -1 return would imply, and also using "if
(!virDevicePCIAddressEqual(x, y))" to mean "if x == y" is just a bit
counterintuitive).

12 years agoFix tab vs space
Guido Günther [Mon, 15 Oct 2012 07:15:14 +0000 (09:15 +0200)]
Fix tab vs space

that broke "make syntax-check"

found by http://honk.sigxcpu.org:8001/job/libvirt-syntax-check/157/

Pushed under the build breaker rule.

12 years agoqemu: Ignore def->cpumask if emulatorpin is specified
Osier Yang [Fri, 12 Oct 2012 09:50:49 +0000 (17:50 +0800)]
qemu: Ignore def->cpumask if emulatorpin is specified

If the vcpu placement is "static", it's just fine to ignore the
def->cpumask if emulatorpin is specified.

12 years agoconf: Ignore emulatorpin if vcpu placement is auto
Osier Yang [Fri, 12 Oct 2012 14:44:35 +0000 (22:44 +0800)]
conf: Ignore emulatorpin if vcpu placement is auto

When vcpu placement is "auto", the domain process will be pinned
to advisory nodeset from querying numad, While emulatorpin will
override the pinning. That means both of them are to set the
pinning policy for domain process, but conflicts with each other.

This patch ingore emulatorpin if vcpu placement is "auto", because
<vcpu> placement can't be simply ignored for <numatune> placement
could default to it.

12 years agoqemu: Initialize cpuset for hotplugged vcpu as def->cpuset
Osier Yang [Fri, 12 Oct 2012 09:50:47 +0000 (17:50 +0800)]
qemu: Initialize cpuset for hotplugged vcpu as def->cpuset

The onlined vcpu pinning policy should inherit def->cpuset if
it's not specified explicitly, and the affinity should be set
in this case. Oppositely, the offlined vcpu pinning policy should
be free()'ed.

12 years agoqemu: Create or remove cgroup when doing vcpu hotpluging
Osier Yang [Fri, 12 Oct 2012 09:50:46 +0000 (17:50 +0800)]
qemu: Create or remove cgroup when doing vcpu hotpluging

Various APIs use cgroup to either set or get the statistics of
host or guest. Hotplug or hot unplug new vcpus without creating
or removing the cgroup for the vcpus could cause problems for
those APIs. E.g.

% virsh vcpucount dom
maximum      config        10
maximum      live          10
current      config         1
current      live           1

% virsh setvcpu dom 2

% virsh schedinfo dom --set vcpu_quota=1000
Scheduler      : posix
error: Unable to find vcpu cgroup for rhel6.2(vcpu: 1): No such file or
directory

This patch fixes the problem by creating cgroups for each of the
onlined vcpus, and destroying cgroups for each of the offlined
vcpus.

12 years agoconf: Initialize the pinning policy for vcpus
Osier Yang [Fri, 12 Oct 2012 09:50:45 +0000 (17:50 +0800)]
conf: Initialize the pinning policy for vcpus

Document for <vcpu>'s "cpuset" says:

Since 0.4.4, this element can contain an optional cpuset attribute,
which is a comma-separated list of physical CPU numbers that virtual
CPUs can be pinned to.

However, it's not the truth, libvirt actually pins the domain
process to the specified pCPUs by "cpuset" of <vcpu>. And the
vcpu thread are pinned to all available pCPUs if no <vcpupin>
is specified for it.

This patch is to implement the codes to inherit <vcpu>'s "cpuset" for
vcpu that doesn't have <vcpupin> specified, and <vcpupin>
for these vcpu will be ignored when formating. Underlying
driver implementation will make sure the vcpu thread pinned
to correct pCPUs.

12 years agoconf: Ignore vcpupin for not onlined vcpus when parsing
Osier Yang [Fri, 12 Oct 2012 13:52:07 +0000 (21:52 +0800)]
conf: Ignore vcpupin for not onlined vcpus when parsing

Setting pinning policy for vcpu which exceeds current vcpus number
just makes no sense, however, it could cause various problems, E.g.

<vcpu current='1'>4</vcpu>
<cputune>
  <vcpupin vcpuid='3' cpuset='4'/>
</cputune>

% virsh start linux
error: Failed to start domain linux
error: cannot set CPU affinity on process 32534: No such process

We must have some odd codes underlying which produces the
"on process 32534", but the point is why we not to prevent
earlier when parsing? Note that this is only one of the
problem it could cause.

This patch is to ignore the <vcpupin> for not onlined vcpus.

12 years agodoc: Sort out the relationship between <vcpu>, <vcpupin>, and <emulatorpin>
Osier Yang [Fri, 12 Oct 2012 09:50:43 +0000 (17:50 +0800)]
doc: Sort out the relationship between <vcpu>, <vcpupin>, and <emulatorpin>

These 3 elements conflicts with each other in either the doc
or the underlying codes.

Current problems:

Problem 1:

The doc shouldn't simply say "These settings are superseded
by CPU tuning. " for element <vcpu>. As except the tuning, <vcpu>
allows to specify the current, maxmum vcpu number. Apart from that,
<vcpu> also allows to specify the placement as "auto", which binds
the domain process to the advisory nodeset from numad.

Problem 2:

Doc for <vcpu> says its "cpuset" specify the physical CPUs
that the vcpus can be pinned. But it's not the truth, as
actually it only pin domain process to the specified physical
CPUs. So either it's a document bug, or code bug.

Problem 3:

Doc for <vcpupin> says it supersed "cpuset" of <vcpu>, it's
not quite correct, as each <vcpupin> specify the pinning policy
only for one vcpu. How about the ones which doesn't have
<vcpupin> specified? it says the vcpu will be pinned to all
available physical CPUs, but what's the meaning of attribute
"cpuset" of <vcpu> then?

Problem 4:

Doc for <emulatorpin> says it pin the emulator threads (domain
process in other context, perhaps another follow up patch to
cleanup the inconsistency is needed) to the physical CPUs
specified its attribute "cpuset". Which conflicts with
<vcpu>'s "cpuset". And actually in the underlying codes,
it set the affinity for domain process twice if both
"cpuset" for <vcpu> and <emulatorpin> are specified,
and <emulatorpin>'s pinning will override <vcpu>'s.

Problem 5:

When "placement" of <vcpu> is "auto" (I.e. uses numad to
get the advisory nodeset to which the domain process is
pinned to), it will also be overridden by <emulatorpin>,

This patch is trying to sort out the conflicts or bugs by:

1) Don't say <vcpu> is superseded by <cputune>

2) Keep the semanteme for "cpuset" of <vcpu> (I.e. Still says it
   specify the physical CPUs the virtual CPUs). But modifying it
   to mention it also set the pinning policy for domain process,
   and the CPU placement of domain process specified by "cpuset"
   of <vcpu> will be ingored if <emulatorpin> specified, and
   similary, the CPU placement of vcpu thread will be ignored
   if it has <vcpupin> specified, for vcpu which doesn't have
   <vcpupin> specified, it inherits "cpuset" of <vcpu>.

3) Don't say <vcpu> is supersed by <vcpupin>. If neither <vcpupin>
   nor "cpuset" of <vcpu> is specified, the vcpu will be pinned
   to all available pCPUs.

4) If neither <emulatorpin> nor "cpuset" of <vcpu> is specified,
   the domain process (emulator threads in the context) will be
   pinned to all available pCPUs.

5) If "placement" of <vcpu> is "auto", <emulatorpin> is not allowed.

6) hotplugged vcpus will also inherit "cpuset" of <vcpu>

Codes changes according to above document changes:

1) Inherit def->cpumask for each vcpu which doesn't have <vcpupin>
   specified, during parsing.

2) ping the vcpu which doesn't have <vcpupin> specified to def->cpumask
   either by cgroup for sched_setaffinity(2), which is actually done
   by 1).

3) Error out if "placement" == "auto", and <emulatorpin> is specified.
   Otherwise, <emulatorpin> is honored, and "cpuset" of <cpuset> is
   ignored.

4) Setup cgroup for each hotplugged vcpu, and setup the pinning policy
   by either cgroup or sched_setaffinity(2).

5) Remove cgroup and <vcpupin> for each hot unplugged vcpu.

Patches are following (6 in total except this patch)

12 years agoTweak comments in the policykit rules file
Cole Robinson [Fri, 12 Oct 2012 15:56:17 +0000 (11:56 -0400)]
Tweak comments in the policykit rules file

- Add the XML header so vim gives us syntax highlighting
- polkit-policy-file-validate hasn't existed for 3 years
- Permissions comment was not accurate

12 years agoOnly keep one polkit rules file
Cole Robinson [Fri, 12 Oct 2012 14:51:48 +0000 (10:51 -0400)]
Only keep one polkit rules file

Just tweak it at build time depending on what polkit version we are
building for.

12 years agodaemon: Use $(AM_V_GEN) in a few more places
Cole Robinson [Sat, 13 Oct 2012 14:12:04 +0000 (10:12 -0400)]
daemon: Use $(AM_V_GEN) in a few more places

12 years agoProperly parse (unsigned) long long
Guido Günther [Fri, 12 Oct 2012 23:05:40 +0000 (01:05 +0200)]
Properly parse (unsigned) long long

This fixes problems on platforms where sizeof(long) != sizeof(long long)
like ia32.

12 years agospec: Add support for libssh2 transport
Peter Krempa [Fri, 12 Oct 2012 14:50:42 +0000 (16:50 +0200)]
spec: Add support for libssh2 transport

Libssh2 transport support was enabled lately but the spec file wasn't
updated to take this into account. This caused libvirt to be built
without libssh2 support in Red Hat based OSes.

12 years agoselinux: Use raw contexts
Martin Kletzander [Fri, 5 Oct 2012 14:41:22 +0000 (16:41 +0200)]
selinux: Use raw contexts

We are currently able to work only with non-translated SELinux
contexts, but we are using functions that work with translated
contexts throughout the code.  This patch swaps all SELinux context
translation relative calls with their raw sisters to avoid parsing
problems.

The problems can be experienced with mcstrans for example.  The
difference is that if you have translations enabled (yum install
mcstrans; service mcstrans start), fgetfilecon_raw() will get you
something like 'system_u:object_r:virt_image_t:s0', whereas
fgetfilecon() will return 'system_u:object_r:virt_image_t:SystemLow'
that we cannot parse.

I was trying to confirm that the _raw variants were here since the dawn of
time, but the only thing I see now is that it was imported together in
the upstream repo [1] from svn, so before 2008.

Thanks Laurent Bigonville for finding this out.

[1] http://oss.tresys.com/git/selinux.git

12 years agoconf: Mark missing optional USB devices in domain XML
Jiri Denemark [Thu, 11 Oct 2012 20:33:46 +0000 (22:33 +0200)]
conf: Mark missing optional USB devices in domain XML

When startupPolicy set for a USB devices allows such device to be
missing, there was no way this could be detected from domain XML. With
this patch, libvirt emits a new missing='yes' attribute for such devices
when active domain XML is generated.

12 years agovirsh: remove reference to migration in blockcopy
Ján Tomko [Thu, 11 Oct 2012 15:14:39 +0000 (17:14 +0200)]
virsh: remove reference to migration in blockcopy

12 years agovirsh: block SIGINT while getting BlockJobInfo
Ján Tomko [Thu, 11 Oct 2012 15:12:13 +0000 (17:12 +0200)]
virsh: block SIGINT while getting BlockJobInfo

SIGINT hasn't been blocked, which could lead to losing it somewhere in
virDomainGetBlockJobInfo and not aborting the job.

12 years agoVarious typos and misspellings
Ján Tomko [Thu, 11 Oct 2012 16:31:20 +0000 (18:31 +0200)]
Various typos and misspellings

12 years agoqemu: Fix misleading comment for qemuDomainObjBeginJobWithDriver()
Peter Krempa [Thu, 27 Sep 2012 09:17:19 +0000 (11:17 +0200)]
qemu: Fix misleading comment for qemuDomainObjBeginJobWithDriver()

The comment stated that you may call qemuDomainObjBeginJobWithDriver
without passing qemud_driver to signal it's not locked.
qemuDomainObjBeginJobWithDriver still accesses the qemud_driver
structure and the lock singaling is done through a separate parameter.

12 years agoqemu: Make save/restore with USB devices usable
Jiri Denemark [Tue, 9 Oct 2012 11:15:46 +0000 (13:15 +0200)]
qemu: Make save/restore with USB devices usable

Save/restore with passed through USB devices currently only works if the
USB device can be found at the same USB address where it used to be
before saving a domain. This makes sense in case a user explicitly
configure the USB address in domain XML. However, if the device was
found automatically by vendor/product identification, we should try to
search for that device when restoring the domain and use any device we
find as long as there is only one available. In other words, the USB
device can now be removed and plugged again or the host can be rebooted
between saving and restoring the domain.

12 years agoAdd MIGRATABLE flag for virDomainGetXMLDesc
Jiri Denemark [Mon, 8 Oct 2012 09:58:05 +0000 (11:58 +0200)]
Add MIGRATABLE flag for virDomainGetXMLDesc

Using VIR_DOMAIN_XML_MIGRATABLE flag, one can request domain's XML
configuration that is suitable for migration or save/restore. Such XML
may contain extra run-time stuff internal to libvirt and some default
configuration may be removed for better compatibility of the XML with
older libvirt releases.

This flag may serve as an easy way to get the XML that can be passed
(after desired modifications) to APIs that accept custom XMLs, such as
virDomainMigrate{,ToURI}2 or virDomainSaveFlags.

12 years agoqemu: Implement startupPolicy for USB passed through devices
Jiri Denemark [Thu, 4 Oct 2012 14:18:16 +0000 (16:18 +0200)]
qemu: Implement startupPolicy for USB passed through devices

12 years agoqemu: Add option to treat missing USB devices as success
Jiri Denemark [Wed, 3 Oct 2012 14:57:28 +0000 (16:57 +0200)]
qemu: Add option to treat missing USB devices as success

All USB device lookup functions emit an error when they cannot find the
requested device. With this patch, their caller can choose if a missing
device is an error or normal condition.

12 years agoqemu: Introduce qemuFindHostdevUSBDevice
Jiri Denemark [Wed, 3 Oct 2012 11:55:35 +0000 (13:55 +0200)]
qemu: Introduce qemuFindHostdevUSBDevice

The code which looks up a USB device specified by hostdev is duplicated
in two places. This patch creates a dedicated function that can be
called in both places.

12 years agoconf: Add support for startupPolicy for USB devices
Jiri Denemark [Tue, 2 Oct 2012 13:14:02 +0000 (15:14 +0200)]
conf: Add support for startupPolicy for USB devices

USB devices can disappear without OS being mad about it, which makes
them ideal for startupPolicy. With this attribute, USB devices can be
configured to be mandatory (the default), requisite (will disappear
during migration if they cannot be found), or completely optional.

12 years agolocking: Implement lock failure action in sanlock driver
Jiri Denemark [Tue, 18 Sep 2012 11:41:26 +0000 (13:41 +0200)]
locking: Implement lock failure action in sanlock driver

While the changes to sanlock driver should be stable, the actual
implementation of sanlock_helper is supposed to be replaced in the
future. However, before we can implement a better sanlock_helper, we
need an administrative interface to libvirtd so that the helper can just
pass a "leases lost" event to the particular libvirt driver and
everything else will be taken care of internally. This approach will
also allow libvirt to pass such event to applications and use
appropriate reasons when changing domain states.

The temporary implementation handles all actions directly by calling
appropriate libvirt APIs (which among other things means that it needs
to know the credentials required to connect to libvirtd).

12 years agolocking: Add support for lock failure action
Jiri Denemark [Tue, 18 Sep 2012 11:40:13 +0000 (13:40 +0200)]
locking: Add support for lock failure action

12 years agolocking: Pass hypervisor driver name when acquiring locks
Jiri Denemark [Mon, 17 Sep 2012 13:36:47 +0000 (15:36 +0200)]
locking: Pass hypervisor driver name when acquiring locks

This is required in case a lock manager needs to contact libvirtd in
case of an unexpected event.

12 years agolocking: Add const char * parameter to avoid ugly typecasts
Jiri Denemark [Mon, 17 Sep 2012 13:12:53 +0000 (15:12 +0200)]
locking: Add const char * parameter to avoid ugly typecasts

12 years agoconf: Add on_lockfailure event configuration
Jiri Denemark [Thu, 6 Sep 2012 20:17:01 +0000 (22:17 +0200)]
conf: Add on_lockfailure event configuration

Using this new element, one can configure an action that should be
performed when resource locks are lost.

12 years agoconf: Rename life cycle actions to event actions
Jiri Denemark [Thu, 6 Sep 2012 19:56:49 +0000 (21:56 +0200)]
conf: Rename life cycle actions to event actions

While current on_{poweroff,reboot,crash} action configuration is about
configuring life cycle actions, they can all be considered events and
actions that need to be done on a particular event. Let's generalize the
code by renaming life cycle actions to event actions so that it can be
reused later for non-lifecycle events.

12 years agoCorrect name of domain/pm/suspend-to-mem in docs
Zeeshan Ali (Khattak) [Wed, 10 Oct 2012 19:44:35 +0000 (22:44 +0300)]
Correct name of domain/pm/suspend-to-mem in docs

12 years agostorage: Report UUID/name consistently in driver errors
Cole Robinson [Mon, 8 Oct 2012 22:37:22 +0000 (18:37 -0400)]
storage: Report UUID/name consistently in driver errors

Done with:

sed -i -e "s/no pool with matching uuid/no storage pool with matching uuid/g" src/storage/storage_driver.c
sed -i -e 's/"%s", _("no storage pool with matching uuid")/_("no storage pool with matching uuid %s"), obj->uuid/g' src/storage/storage_driver.c
sed -i -e 's/"%s", _("storage pool is not active")/_("storage pool '%s' is not active"), pool->def->name/g' src/storage/storage_driver.c

And a couple fixups before, during, and after, and a manual inspection
pass to make sure nothing was wonky.

12 years agoChange qemuSetSchedularParameters to use AFFECT_CURRENT
Daniel P. Berrange [Wed, 26 Sep 2012 11:14:42 +0000 (12:14 +0100)]
Change qemuSetSchedularParameters to use AFFECT_CURRENT

When adding variants of parameter setting APIs which accepted
flags, the existing APIs were all adapted internally to pass
VIR_DOMAIN_AFFECT_CURRENT to the new API. The QEMU impl
qemuSetSchedularParameters was an exception, which instead
used VIR_DOMAIN_AFFECT_LIVE. Change this to match other
compatibility scenarios, so that calling

   virDomainSetSchedularParameters(dom, params, nparams);

Has the same semantics as

   virDomainSetSchedularParametersFlags(dom, params, nparams, 0);

And

   virDomainSetSchedularParametersFlags(dom, params, nparams, VIR_DOMAIN_AFFECT_CURRENT);

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agowin32: Pretend that close-on-exec works
Matthias Bolte [Tue, 9 Oct 2012 20:49:46 +0000 (22:49 +0200)]
win32: Pretend that close-on-exec works

Currently virNetSocketNew fails because virSetCloseExec fails as there
is no proper implementation for it on Windows at the moment. Workaround
this by pretending that setting close-on-exec on the fd works. This can
be done because libvirt currently lacks the ability to create child
processes on Windows anyway. So there is no point in failing to set a
flag that isn't useful at the moment anyway.

12 years agoesx: Fix dynamic dispatch for types with more than one level of inheritance
Matthias Bolte [Sat, 6 Oct 2012 16:30:45 +0000 (18:30 +0200)]
esx: Fix dynamic dispatch for types with more than one level of inheritance

Traverse the whole inheritance hierarchy for dynamic dispatch as it is
already done for the dynamic cast.

Also make AnyType cast errors more verbose.

Reported by Ata Bohra.

12 years agointerface: add udevIfaceIsActive() to udev backend
Doug Goldstein [Sat, 6 Oct 2012 19:20:29 +0000 (14:20 -0500)]
interface: add udevIfaceIsActive() to udev backend

Add support to check if a specific interface is active by supporting the
following API function in the udev based virInterface backend:
* virConnectInterfaceIsActive()

12 years agointerface: always build all available backends
Doug Goldstein [Sat, 6 Oct 2012 19:20:27 +0000 (14:20 -0500)]
interface: always build all available backends

Always build all available backends to avoid bit-rot. At run time we
select the correct backend and load it by attempting netcf first and
then udev.

12 years agointerface: fix netcf based backend naming
Doug Goldstein [Sat, 6 Oct 2012 19:20:26 +0000 (14:20 -0500)]
interface: fix netcf based backend naming

All other backends for virInterface or other HVs implementations of
virInterface list their own names for the name instead of the generic
'Interface' value. This does the same for the netcf based backend.
Also, report any errors during registration.

12 years agointerface: add udev based backend for virInterface
Doug Goldstein [Sat, 6 Oct 2012 19:20:25 +0000 (14:20 -0500)]
interface: add udev based backend for virInterface

Add a read-only udev based backend for virInterface. Useful for distros
that do not have netcf support yet. Multiple libvirt based utilities use
a HAL based fallback when virInterface is not available which is less
than ideal. This implements:
* virConnectNumOfInterfaces()
* virConnectListInterfaces()
* virConnectNumOfDefinedInterfaces()
* virConnectListDefinedInterfaces()
* virConnectListAllInterfaces()
* virConnectInterfaceLookupByName()
* virConnectInterfaceLookupByMACString()

12 years agohooks: let virCommand do the error reporting
Eric Blake [Tue, 9 Oct 2012 03:44:36 +0000 (21:44 -0600)]
hooks: let virCommand do the error reporting

The code was reporting raw exit status without decoding it into
normal vs. signal exit.  virCommandRun already does this, but
with a different error type, so all we have to do is recast
the error to the correct type.
Reported by li guang.

* src/util/hooks.c (virHookCall): Simplify.

12 years agodoc: update description about user/group in qemu.conf
Marcelo Cerri [Tue, 9 Oct 2012 12:57:58 +0000 (09:57 -0300)]
doc: update description about user/group in qemu.conf

As a side effect of changes in the functions virGetUserID and
virGetGroupID, the user and group configurations for DAC in qemu.conf
are now able to accept both names and IDs, supporting a leading plus
sign to ensure that a numeric value will not be interpreted as a name.

This patch updates the comments in qemu.conf, including a description of
this new behavior.

12 years agodocs: Drop useless </p> in drvphyp.html.in
Michal Privoznik [Tue, 9 Oct 2012 13:20:32 +0000 (15:20 +0200)]
docs: Drop useless </p> in drvphyp.html.in

12 years agonodeinfo: Fully convert to new virReportError
Michal Privoznik [Tue, 9 Oct 2012 09:46:48 +0000 (11:46 +0200)]
nodeinfo: Fully convert to new virReportError

With our latest s/[a-z]+ReportError/virReportError/ rewrite
(47ab34e2) we forgot to update arm part of the code.

12 years agoqemu: Fix QMP detection of QXL graphics
Jiri Denemark [Tue, 9 Oct 2012 06:25:02 +0000 (08:25 +0200)]
qemu: Fix QMP detection of QXL graphics

With the recent introduction of QMP capabilities probing, libvirt failed
to detect support for QXL graphics in QEMU 1.2 and newer. In addition to
fixing that, this patch also causes libvirt to detect QXL support for
qemu-kvm-0.13.0, which doesn't advertise it in -help output but mentions
it in device list. Since qemu-kvm-0.13.0 supported -spice, it looks like
not having qxl in -help was a bug.