]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
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.

12 years agovirsh: add qemu-monitor-command --pretty
Eric Blake [Thu, 4 Oct 2012 23:14:19 +0000 (17:14 -0600)]
virsh: add qemu-monitor-command --pretty

I was using qemu-monitor-command during development, and found it quite
hard to use.  Compare the results of this patch on ease of reading:

$ virsh qemu-monitor-command          dom '{"execute":"query-version"}'
{"return":{"qemu":{"micro":1,"minor":12,"major":0},"package":"(qemu-kvm-0.12.1.2)"},"id":"libvirt-7683"}

$ virsh qemu-monitor-command --pretty dom '{"execute":"query-version"}'
{
    "return": {
        "qemu": {
            "micro": 1,
            "minor": 12,
            "major": 0
        },
        "package": "(qemu-kvm-0.12.1.2)"
    },
    "id": "libvirt-7674"
}

* tools/virsh-host.c (cmdQemuMonitorCommand): New option.
* tools/virsh.pod (qemu-monitor-command): Document it.

12 years agosecurity: update user and group parsing in security_dac.c
Marcelo Cerri [Mon, 8 Oct 2012 20:37:02 +0000 (17:37 -0300)]
security: update user and group parsing in security_dac.c

The functions virGetUserID and virGetGroupID are now able to parse
user/group names and IDs in a similar way to coreutils' chown. So, user
and group parsing in security_dac can be simplified.

12 years agoutil: extend virGetUserID and virGetGroupID to support names and IDs
Marcelo Cerri [Mon, 8 Oct 2012 20:37:01 +0000 (17:37 -0300)]
util: extend virGetUserID and virGetGroupID to support names and IDs

This patch updates virGetUserID and virGetGroupID to be able to parse a
user or group name in a similar way to coreutils' chown. This means that
a numeric value with a leading plus sign is always parsed as an ID,
otherwise the functions try to parse the input first as a user or group
name and if this fails they try to parse it as an ID.

This patch includes Peter Krempa's changes to correctly handle errors
returned by getpwnam_r and getgrnam_r.

12 years agoCall curl_global_init from virInitialize to avoid thread-safety issues
Matthias Bolte [Sat, 6 Oct 2012 18:09:20 +0000 (20:09 +0200)]
Call curl_global_init from virInitialize to avoid thread-safety issues

curl_global_init is not thread-safe. curl_easy_init might call
curl_global_init when it was no called before. But curl_easy_init
can be called from different threads by the ESX driver. Therefore,
call curl_global_init from virInitialize to stop curl_easy_init from
calling it.

Reported by Benjamin Wang.

12 years agofix kvm_pv_eoi with kvmclock
Martin Kletzander [Mon, 8 Oct 2012 16:51:57 +0000 (18:51 +0200)]
fix kvm_pv_eoi with kvmclock

When both kvmclock and kvm_pv_eoi are configured (either disabled or
enabled) libvirt will generate invalid CPU specification due to the
fact that even though kvmclock causes the CPU to be specified, it
doesn't set have_cpu flag to true (and the new kvm_pv_eoi as well).
This patch fixes the issue and adds a test exactly for that to show
that it is fixed correctly (and also to keep it that way in the future
of course).

12 years agoFix typo in HAVE_DBUS automake conditional
Alexander Larsson [Mon, 8 Oct 2012 14:57:47 +0000 (16:57 +0200)]
Fix typo in HAVE_DBUS automake conditional

The variable that is set in the script is with_dbus, not have_dbus.

12 years agopython: keep consistent handling of Python integer conversion
Guannan Ren [Fri, 28 Sep 2012 12:29:03 +0000 (20:29 +0800)]
python: keep consistent handling of Python integer conversion

libvirt_ulonglongUnwrap requires the integer type of python obj.
But libvirt_longlongUnwrap still could handle python obj of
Pyfloat_type which causes the float value to be rounded up
to an integer.

For example
 >>> dom.setSchedulerParameters({'vcpu_quota': 0.88})
 0
libvirt_longlongUnwrap treats 0.88 as a valid value 0

However
 >>> dom.setSchedulerParameters({'cpu_shares': 1000.22})
libvirt_ulonglongUnwrap will throw out an error
"TypeError: an integer is required"

The patch make this consistent.

12 years agopython: cleanup vcpu related binding APIs
Guannan Ren [Fri, 28 Sep 2012 08:27:38 +0000 (16:27 +0800)]
python: cleanup vcpu related binding APIs

libvirt_virDomainGetVcpus: add error handling, return -1 instead of None
libvirt_virDomainPinVcpu and libvirt_virDomainPinVcpuFlags:
  check the type of argument
  make use of libvirt_boolUnwrap

  Set bitmap according to these values which are contained in given
  argument of vcpu tuple and turn off these bit corresponding to
  missing vcpus in argument tuple

  The original way ignored the error info from PyTuple_GetItem
  if index is out of range.
  "IndexError: tuple index out of range"
  The error message will only be raised on next command in interactive mode.

12 years agoesx: Disable libcurl's use of signals to fix a segfault
Matthias Bolte [Sat, 29 Sep 2012 20:16:30 +0000 (22:16 +0200)]
esx: Disable libcurl's use of signals to fix a segfault

libcurl uses a SIGALRM in combination with sigsetjmp/siglongjmp to be
able to abort a DNS lookup when it takes too long. The problem with this
in a multi-threaded application is that the signal handler for SIGALRM
and the call to siglongjmp can be executed on a thread that is different
from the one that initially did the SIGALRM setup and the call to
sigsetjmp. In the reported case this triggered a segfault.

Disable libcurl's use of signals to avoid this situation. This has the
disadvantage of losing the ability to abort synchronous DNS lookups which
might result in libcurl getting stuck in a DNS lookup in the worst case.
When libcurl was build with an asynchronous DNS backend such as c-ares
then there is no problem because the timeout mechanism works without
signals here anyway.

Reported by Benjamin Wang.

12 years agoS390: Buffer too small for large CPU numbers.
Viktor Mihajlovski [Fri, 5 Oct 2012 13:59:08 +0000 (15:59 +0200)]
S390: Buffer too small for large CPU numbers.

The output buffer for virFileReadAll was too small for systems with
more than 30 CPUs which leads to a log entry and incorrect behavior.
The new size will be sufficient for the current
architectural limits.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
12 years agobuild: fix VPATH builds
Eric Blake [Fri, 5 Oct 2012 14:53:17 +0000 (08:53 -0600)]
build: fix VPATH builds

This reverts part of commit 5468594f465; the perl changes in that
patch were sufficient.  Since libvirt.syms is already a generated
file created in part from libvirt_private.syms, we don't need a
second pass over libvirt_private.syms in isolation.

* src/Makefile.am: Undo addition of check-private-symfile.

12 years agoCheck for private symbols presence as well
Michal Privoznik [Fri, 5 Oct 2012 12:57:36 +0000 (14:57 +0200)]
Check for private symbols presence as well

Currently, we are checking if libvirt.so contains public symbols.
However, sometimes we rename an internal symbol and forget to
change libvirt_private.syms accordingly. Hence, it's safer to check
for internal symbols as well.

12 years agospec: prefer canonical name of util-linux
Eric Blake [Thu, 4 Oct 2012 16:02:02 +0000 (10:02 -0600)]
spec: prefer canonical name of util-linux

I noticed that in two places, we require util-linux, and in a third,
we require util-linux-ng.  On Fedora (I tested F15 through rawhide),
util-linux-ng is obsoleted by util-linux; on RHEL 6, util-linux
is obsoleted by util-linux-ng.  That is, on either platform, either
name will get you the correct package installed (where the preferred
name on fedora is util-linux, and on RHEL 6 is util-linux-ng).  But
on RHEL 5, there is no util-linux-ng

* libvirt.spec.in (Requires): Use util-linux, not util-linux-ng.

12 years agoprivate.syms: Drop virKillProcess
Michal Privoznik [Fri, 5 Oct 2012 11:32:09 +0000 (13:32 +0200)]
private.syms: Drop virKillProcess

After it got renamed to virProcessKill (cf470068a11)
it is no longer needed in the private syms file.

12 years agodocs: fix links in migration.html TOC
Eric Blake [Thu, 4 Oct 2012 22:57:27 +0000 (16:57 -0600)]
docs: fix links in migration.html TOC

Use of the wrong attribute name caused the table of contents to
be useless.  Fix suggested by Daniel P. Berrange.

* docs/migration.html.in: Use correct anchoring attribute.

12 years agodoc: Add Maven repository to Java bindings documentation
Wido den Hollander [Thu, 27 Sep 2012 20:48:17 +0000 (22:48 +0200)]
doc: Add Maven repository to Java bindings documentation

Getting a artifact into Maven central has a lot of restrictions as
where the artifact should be hosted.

This seemed like a big hassle which we don't want to go through now.

Document a way for users to use libvirt.org as a repository so they can
fetch the Java bindings with maven.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
12 years agoCorrect checking of virStrcpyStatic() return value
Kyle Mestery [Wed, 3 Oct 2012 19:46:55 +0000 (15:46 -0400)]
Correct checking of virStrcpyStatic() return value

Correct the check for the return value of virStrcpyStatic()
when copying port-profile names. Fixes Open vSwitch ports
which utilize port-profiles from network definitions.

Signed-off-by: Kyle Mestery <kmestery@cisco.com>
12 years agodocs: rudimentary phyp documentation
Eric Blake [Thu, 27 Sep 2012 22:19:37 +0000 (16:19 -0600)]
docs: rudimentary phyp documentation

Based on a report that phyp is undocumented:
https://www.redhat.com/archives/libvirt-users/2012-July/msg00013.html

* docs/drvphyp.html.in (phyp): New file.
* docs/drivers.html.in: List it.

12 years agobuild: update gnulib for FreeBSD build
Eric Blake [Tue, 2 Oct 2012 23:18:04 +0000 (17:18 -0600)]
build: update gnulib for FreeBSD build

Several gnulib tests were failing 'make check', and compilation with
CFLAGS=-g failed due to a gcc 4.2.1 limitation.

* .gnulib: Update to latest, for gcc 4.2 support and fixed FreeBSD tests.

12 years agodoc: update description about security labels on formatdomain.html
Marcelo Cerri [Tue, 2 Oct 2012 17:57:37 +0000 (14:57 -0300)]
doc: update description about security labels on formatdomain.html

This patch adds a brief description about labels for each security
driver.

12 years agosecurity: also parse user/group names instead of just IDs for DAC labels
Marcelo Cerri [Tue, 2 Oct 2012 17:57:36 +0000 (14:57 -0300)]
security: also parse user/group names instead of just IDs for DAC labels

The DAC driver is missing parsing of group and user names for DAC labels
and currently just parses uid and gid. This patch extends it to support
names, so the following security label definition is now valid:

  <seclabel type='static' model='dac' relabel='yes'>
      <label>qemu:qemu</label>
      <imagelabel>qemu:qemu</imagelabel>
  </seclabel>

When it tries to parse an owner or a group, it first tries to resolve it as
a name, if it fails or it's an invalid user/group name then it tries to
parse it as an UID or GID. A leading '+' can also be used for both owner and
group to force it to be parsed as IDs, so the following example is also
valid:

  <seclabel type='static' model='dac' relabel='yes'>
      <label>+101:+101</label>
      <imagelabel>+101:+101</imagelabel>
  </seclabel>

This ensures that UID 101 and GUI 101 will be used instead of an user or
group named "101".

12 years agobuild: avoid -Wno-format on new-enough gcc
Eric Blake [Tue, 2 Oct 2012 14:37:00 +0000 (08:37 -0600)]
build: avoid -Wno-format on new-enough gcc

Commit c579d6b added a sledgehammer to silence spurious warnings from
gcc 4.2, but in the process, it also silenced useful warnings from
gcc 4.3 through 4.5.  As a result, a bug slipped in to commit 0caccb58.

Tested with FreeBSD (gcc 4.2.1), RHEL 6.3 (gcc 4.4), and F17 (gcc 4.7.2),
where the former didn't trip on spurious warnings, and where the latter
two detected a revert of 2b804cf.

* m4/virt-compile-warnings.m4 (-Wno-format): Probe for the actual
spurious message, to once again allow gcc 4.4 to use -Wformat.

12 years agobuild: fix typo in debug message
Eric Blake [Tue, 2 Oct 2012 12:36:50 +0000 (06:36 -0600)]
build: fix typo in debug message

Introduced in commit 0caccb58.

  CC     libvirt_driver_qemu_impl_la-qemu_capabilities.lo
../../src/qemu/qemu_capabilities.c: In function 'qemuCapsInitQMP':
../../src/qemu/qemu_capabilities.c:2327:13: error: format '%d' expects argument of type 'int', but argument 8 has type 'const char *' [-Werror=format]

* src/qemu/qemu_capabilities.c (qemuCapsInitQMP): Use correct format.

12 years agoqemu: Kill processes used for QMP caps probing
Jiri Denemark [Tue, 2 Oct 2012 08:59:56 +0000 (10:59 +0200)]
qemu: Kill processes used for QMP caps probing

Since libvirt switched to QMP capabilities probing recently, it starts
QEMU process used for this probing with -daemonize, which means
virCommandAbort can no longer reach these processes. As a result of
that, restarting libvirtd will leave several new QEMU processes behind.
Let's use QEMU's -pidfile and use it to kill the process when QMP caps
probing is done.

12 years agoqemu: Use proper agent entering function when freezing filesystems
Peter Krempa [Mon, 1 Oct 2012 15:58:29 +0000 (17:58 +0200)]
qemu: Use proper agent entering function when freezing filesystems

When doing snapshots, the filesystem freeze function used the agent
entering function that expects the qemud_driver unlocked. This might
cause a deadlock of the qemu driver if the agent does not respond.

The only call path of this function has the qemud_driver locked, so this
patch changes the entering functions to those expecting the driver
locked.

12 years agolxc: Correctly report active cgroups
Michal Privoznik [Mon, 1 Oct 2012 12:22:42 +0000 (14:22 +0200)]
lxc: Correctly report active cgroups

There was an inverted return value in lxcCgroupControllerActive().
The function assumes cgroups are active and do couple of checks
to prove that. If any of them fails, false is returned. Therefore,
at the end, after all checks are done we must return true, not false.

12 years agobuild: avoid journald on rhel 5
Eric Blake [Mon, 1 Oct 2012 22:38:56 +0000 (16:38 -0600)]
build: avoid journald on rhel 5

Commit f6430390 broke builds on RHEL 5, where glibc (2.5) is too
old to support mkostemp (2.7) or htole64 (2.9).  While gnulib
has mkostemp, it still lacks htole64; and it's not worth dragging
in replacements on systems where journald is unlikely to exist
in the first place, so we just use an extra configure-time check
as our witness of whether to attempt compiling the code.

* src/util/logging.c (virLogParseOutputs): Don't attempt to
compile journald on older glibc.
* configure.ac (AC_CHECK_DECLS): Check for htole64.

12 years agobuild: fix bitmap conversion when !CPU_ALLOC
Eric Blake [Mon, 1 Oct 2012 23:00:58 +0000 (17:00 -0600)]
build: fix bitmap conversion when !CPU_ALLOC

Commit f1a43a8 missed one side of an #if/#else.

* src/util/processinfo.c (virProcessInfoGetAffinity): Use correct
bitmap operation.

12 years agoAdd note about numeric domain names to manpage
Dave Allan [Mon, 1 Oct 2012 18:01:36 +0000 (14:01 -0400)]
Add note about numeric domain names to manpage

Clarify that domains with numeric names can only be identified by
their domain id.