]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoAdapt to VIR_ALLOC and virAsprintf in src/xen/*
Michal Privoznik [Thu, 4 Jul 2013 10:18:49 +0000 (12:18 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/xen/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vmx/*
Michal Privoznik [Thu, 4 Jul 2013 10:18:18 +0000 (12:18 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vmx/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vmware/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:55 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vmware/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/vbox/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:38 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/vbox/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/util/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:18 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/util/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/uml/*
Michal Privoznik [Thu, 4 Jul 2013 10:17:01 +0000 (12:17 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/uml/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/test/*
Michal Privoznik [Thu, 4 Jul 2013 10:16:47 +0000 (12:16 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/test/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/storage/*
Michal Privoznik [Thu, 4 Jul 2013 10:16:29 +0000 (12:16 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/storage/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/security/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:50 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/security/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/secret/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:29 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/secret/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/rpc/*
Michal Privoznik [Thu, 4 Jul 2013 10:15:05 +0000 (12:15 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/rpc/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/remote/*
Michal Privoznik [Thu, 4 Jul 2013 10:14:34 +0000 (12:14 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/remote/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/qemu/*
Michal Privoznik [Thu, 4 Jul 2013 10:14:12 +0000 (12:14 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/qemu/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/phyp/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:48 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/phyp/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/parallels/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:24 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/parallels/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/openvz/*
Michal Privoznik [Thu, 4 Jul 2013 10:13:02 +0000 (12:13 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/openvz/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/nwfilter/*
Michal Privoznik [Thu, 4 Jul 2013 10:12:44 +0000 (12:12 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/nwfilter/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/network/*
Michal Privoznik [Thu, 4 Jul 2013 10:12:21 +0000 (12:12 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/network/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/node_device/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:59 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/node_device/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/lxc/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:37 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/lxc/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/locking/*
Michal Privoznik [Thu, 4 Jul 2013 10:11:02 +0000 (12:11 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/locking/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/libxl/*
Michal Privoznik [Thu, 4 Jul 2013 10:10:38 +0000 (12:10 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/libxl/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/interface/*
Michal Privoznik [Thu, 4 Jul 2013 10:10:05 +0000 (12:10 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/interface/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/hyperv/*
Michal Privoznik [Thu, 4 Jul 2013 10:09:29 +0000 (12:09 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/hyperv/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/esx/*
Michal Privoznik [Thu, 4 Jul 2013 10:05:43 +0000 (12:05 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/esx/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/cpu/*
Michal Privoznik [Thu, 4 Jul 2013 10:03:29 +0000 (12:03 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/cpu/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/conf/*
Michal Privoznik [Thu, 4 Jul 2013 10:02:00 +0000 (12:02 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/conf/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in src/access/*
Michal Privoznik [Thu, 4 Jul 2013 10:00:19 +0000 (12:00 +0200)]
Adapt to VIR_ALLOC and virAsprintf in src/access/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in daemon/*
Michal Privoznik [Thu, 4 Jul 2013 09:58:18 +0000 (11:58 +0200)]
Adapt to VIR_ALLOC and virAsprintf in daemon/*

11 years agoAdapt to VIR_ALLOC and virAsprintf in docs/
Michal Privoznik [Thu, 4 Jul 2013 10:21:16 +0000 (12:21 +0200)]
Adapt to VIR_ALLOC and virAsprintf in docs/

11 years agoIntroduce OOM reporting to virAsprintf
Michal Privoznik [Fri, 7 Jun 2013 15:10:28 +0000 (17:10 +0200)]
Introduce OOM reporting to virAsprintf

Actually, I'm turning this function into a macro as filename,
function name and line number needs to be passed. The new
function virAsprintfInternal is introduced with the extended set
of arguments.

11 years agoviralloc: Report OOM error on failure
Michal Privoznik [Fri, 7 Jun 2013 08:37:25 +0000 (10:37 +0200)]
viralloc: Report OOM error on failure

Similarly to VIR_STRDUP, we want the OOM error to be reported in
VIR_ALLOC and friends.

11 years agoProperly detect VMDK with internal version 2
Martin Kletzander [Tue, 9 Jul 2013 13:16:34 +0000 (15:16 +0200)]
Properly detect VMDK with internal version 2

Initially proposed as [1], but then changed to comment fix only.  VMDK
can have internal version set to 2 when there are few features added
which do not affect us.  Thanks to Jan's commit a1ee8e18 this can be
easily fixed by adding it to list of supported versions.

[1] http://www.redhat.com/archives/libvir-list/2013-June/msg00419.html

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

11 years agobuild: honor autogen.sh --no-git
Eric Blake [Wed, 3 Jul 2013 20:43:11 +0000 (14:43 -0600)]
build: honor autogen.sh --no-git

Based on a report by Chandrashekar Shastri, at
https://bugzilla.redhat.com/show_bug.cgi?id=979360

On systems where git cannot access the outside world, a developer
can instead arrange to get a copy of gnulib at the right commit
via side channels (such as NFS share drives), set GNULIB_SRCDIR,
then use ./autogen.sh --no-git.  In this setup, we will now
avoid direct use of git.  Of course, this means no automatic
gnulib updates when libvirt.git updates its submodule, but it
is expected that any developer in such a situation is already
prepared to deal with the fallout.

* .gnulib: Update to latest, for bootstrap.
* bootstrap: Synchronize from gnulib.
* autogen.sh (no_git): Avoid git when requested.
* cfg.mk (_update_required): Skip automatic rerun of bootstrap if
we can't use git.
* docs/compiling.html.in: Document this setup.
* docs/hacking.html.in: Mention this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: tweak use of <a> in HACKING
Eric Blake [Mon, 8 Jul 2013 22:37:11 +0000 (16:37 -0600)]
maint: tweak use of <a> in HACKING

The previous handling of <a> tags led to some less-than-ideal
layout in HACKING (most noticeable on a mid-sentence reference
to the valgrind home page).

* docs/hacking.html.in: Slight tweaks to <a> tags.
* docs/hacking1.xsl: Move <a> handling...
* docs/hacking2.xsl: ...here.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: fix typo in qemu error message
Eric Blake [Tue, 9 Jul 2013 17:37:36 +0000 (11:37 -0600)]
maint: fix typo in qemu error message

Introduced in commit d47eff88.

* src/qemu/qemu_driver.c (qemuDomainSetVcpusFlags): Fix spelling.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodaemon: Fix command example in libvirtd.sasl
Cole Robinson [Tue, 9 Jul 2013 14:01:55 +0000 (10:01 -0400)]
daemon: Fix command example in libvirtd.sasl

sasldblistusers2 doesn't have a '-a' option

11 years agoLXC: hostdev: create parent directory for hostdev
Gao feng [Tue, 9 Jul 2013 10:16:20 +0000 (11:16 +0100)]
LXC: hostdev: create parent directory for hostdev

Create parent directroy for hostdev automatically when we
start a lxc domain or attach a hostdev to a lxc domain.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath
Gao feng [Tue, 9 Jul 2013 10:15:11 +0000 (11:15 +0100)]
LXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath

This helper function is used to create parent directory for
the hostdev which will be added to the container. If the
parent directory of this hostdev doesn't exist, the mknod of
the hostdev will fail. eg with /dev/net/tun

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: Create /dev/tty within a container
Richard Weinberger [Tue, 9 Jul 2013 10:05:14 +0000 (11:05 +0100)]
LXC: Create /dev/tty within a container

Many applications use /dev/tty to read from stdin.
e.g. zypper on openSUSE.

Let's create this device node to unbreak those applications.
As /dev/tty is a synonym for the current controlling terminal
it cannot harm the host or any other containers.

Signed-off-by: Richard Weinberger <richard@nod.at>
11 years agoscsi: Fix construction of sysfs device path
Viktor Mihajlovski [Mon, 8 Jul 2013 16:57:58 +0000 (18:57 +0200)]
scsi: Fix construction of sysfs device path

The device bus value was used instead of the device target when
building the sysfs device path. Trivial.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agoselinux: Always generate imagelabel
Peter Krempa [Tue, 2 Jul 2013 16:34:58 +0000 (18:34 +0200)]
selinux: Always generate imagelabel

The imagelabel SELinux label was only generated when relabeling was
enabled. This prohibited labeling of files created by libvirt that need
to be labeled even if relabeling is turned off.

The only codepath this change has direct impact on is labeling of FDs
passed to qemu which is always safe in current state.

11 years agoselinux: Cleanup coding style
Peter Krempa [Tue, 2 Jul 2013 16:27:09 +0000 (18:27 +0200)]
selinux: Cleanup coding style

11 years agoResolve Coverity complaints in tests/securityselinuxlabeltest.c
John Ferlan [Wed, 3 Jul 2013 13:14:33 +0000 (09:14 -0400)]
Resolve Coverity complaints in tests/securityselinuxlabeltest.c

Two complaints of RESOURCE_FREE due to going to cleanup prior to a
VIR_FREE(line).  Two complaints of FORWARD_NULL due to 'tmp' being
accessed after a strchr() without first checking if the return was NULL.

While looking at the code it seems that 'line' need only be allocated
once as the while loop will keep reading into line until eof causing
an unreported leak since line was never VIR_FREE()'d at the bottom of
the loop.

11 years agoqemu: Set RLIMIT_MEMLOCK when memoryBacking/locked is used
Jiri Denemark [Fri, 28 Jun 2013 14:58:03 +0000 (16:58 +0200)]
qemu: Set RLIMIT_MEMLOCK when memoryBacking/locked is used

If a domain is configured to have all its memory locked, we need to set
RLIMIT_MEMLOCK so that QEMU is actually allowed to lock the memory.

11 years agoqemu: Use qemuDomainMemoryLimit when computing memory for VFIO
Jiri Denemark [Fri, 28 Jun 2013 14:54:38 +0000 (16:54 +0200)]
qemu: Use qemuDomainMemoryLimit when computing memory for VFIO

11 years agoqemu: Move memory limit computation to a reusable function
Jiri Denemark [Fri, 28 Jun 2013 14:16:44 +0000 (16:16 +0200)]
qemu: Move memory limit computation to a reusable function

11 years agoDon't spam logs with "port 0 must be in range" errors
Jiri Denemark [Thu, 4 Jul 2013 19:16:57 +0000 (21:16 +0200)]
Don't spam logs with "port 0 must be in range" errors

Whenever virPortAllocatorRelease is called with port == 0, it complains
that the port is not in an allowed range, which is expectable as the
port was never allocated. Let's make virPortAllocatorRelease ignore 0
ports in a similar way free() ignores NULL pointers.

11 years agoqemu: Release correct websocket port
Jiri Denemark [Thu, 4 Jul 2013 19:16:08 +0000 (21:16 +0200)]
qemu: Release correct websocket port

11 years agoPaused domain should remain paused after migration
Jiri Denemark [Thu, 4 Jul 2013 17:58:51 +0000 (19:58 +0200)]
Paused domain should remain paused after migration

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

If a domain is paused before migration starts, we need to tell that to
the destination libvirtd to prevent it from resuming the domain at the
end of migration. This regression was introduced by commit 5379bb0.

11 years agoconf: don't check hyperv spinlock retries if disabled
Ján Tomko [Thu, 4 Jul 2013 10:12:57 +0000 (12:12 +0200)]
conf: don't check hyperv spinlock retries if disabled

<hyperv>
  <spinlocks state='off'/>
</hyperv>

results in:
error: XML error: missing HyperV spinlock retry count

Don't require retries when state is off and use virXPathUInt
instead of virXPathString to simplify parsing.

https://bugzilla.redhat.com/show_bug.cgi?id=784836#c19

11 years agoFix NULL dereference caused by ACL filtering of domains
Jiri Denemark [Thu, 4 Jul 2013 14:55:53 +0000 (16:55 +0200)]
Fix NULL dereference caused by ACL filtering of domains

Caused by 763973607ddace04562da1a1e545ab6692d5175f.

11 years agoUnlock the storage volume object after looking it up
Ján Tomko [Thu, 4 Jul 2013 12:41:46 +0000 (14:41 +0200)]
Unlock the storage volume object after looking it up

Introduced by c930410.

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

11 years agoFix build with clang
Ján Tomko [Thu, 4 Jul 2013 09:35:59 +0000 (11:35 +0200)]
Fix build with clang

Partially revert cdd703f's revert of c163410, as linking with clang
with --param=ssp-buffer-size=4 still fails with:
"argument unused during compilation".

11 years agolibxl: fix deadlock in libxlReconnectDomain
Marek Marczykowski-Górecki [Thu, 13 Jun 2013 01:54:09 +0000 (03:54 +0200)]
libxl: fix deadlock in libxlReconnectDomain

Use virDomainObjListRemoveLocked instead of virDomainObjListRemove, as
driver->domains is already taken by virDomainObjListForEach.

Above deadlock can be triggered when libvirtd is started after some
domain have been started by hand (in which case driver will not find
libvirt-xml domain config).

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
11 years agoconf: virDomainObjListRemoveLocked function
Marek Marczykowski-Górecki [Thu, 13 Jun 2013 01:54:08 +0000 (03:54 +0200)]
conf: virDomainObjListRemoveLocked function

While iterating with virDomainObjListForEach it is safe to remove
current element. But while iterating, 'doms' lock is already taken, so
can't use standard virDomainObjListRemove. So introduce
virDomainObjListRemoveLocked for this purpose.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
11 years agomaint: update to latest gnulib
Eric Blake [Tue, 2 Jul 2013 23:26:42 +0000 (17:26 -0600)]
maint: update to latest gnulib

The latest mingw headers on Fedora 19 fail to build with gnulib
without an update.

Meanwhile, now that upstream gnulib has better handling of -W
probing for clang, we can drop some of our own solutions in
favor of upstream; thus this reverts commit c1634100, "Correctly
detect warning flags with clang".

* .gnulib: Update to latest, for mingw and clang.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoExtend the ACL test case to validate filter rule checks
Daniel P. Berrange [Thu, 27 Jun 2013 16:12:20 +0000 (17:12 +0100)]
Extend the ACL test case to validate filter rule checks

The 'check-aclrules' test case validates that there are ACL
checks in each method. This extends it so that it can also
validate that methods which return info about lists of objects,
will filter their returned info throw an ACL check.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of interface objects
Daniel P. Berrange [Thu, 27 Jun 2013 16:07:22 +0000 (17:07 +0100)]
Add access control filtering of interface objects

Ensure that all APIs which list interface objects filter
them against the access control system.

This makes the APIs for listing names and counting devices
slightly less efficient, since we can't use the direct
netcf APIs for these tasks. Instead we have to ask netcf
for the full list of objects & iterate over the list
filtering them out.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of nwfilter objects
Daniel P. Berrange [Thu, 27 Jun 2013 11:18:33 +0000 (12:18 +0100)]
Add access control filtering of nwfilter objects

Ensure that all APIs which list nwfilter objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of secret objects
Daniel P. Berrange [Thu, 27 Jun 2013 11:12:30 +0000 (12:12 +0100)]
Add access control filtering of secret objects

Ensure that all APIs which list secret objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of storage objects
Daniel P. Berrange [Wed, 26 Jun 2013 17:47:48 +0000 (18:47 +0100)]
Add access control filtering of storage objects

Ensure that all APIs which list storage objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of node device objects
Daniel P. Berrange [Wed, 26 Jun 2013 16:50:54 +0000 (17:50 +0100)]
Add access control filtering of node device objects

Ensure that all APIs which list node device objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of network objects
Daniel P. Berrange [Wed, 26 Jun 2013 15:42:27 +0000 (16:42 +0100)]
Add access control filtering of network objects

Ensure that all APIs which list network objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoChange signature of ACL filter functions
Daniel P. Berrange [Wed, 3 Jul 2013 14:32:01 +0000 (15:32 +0100)]
Change signature of ACL filter functions

Change the ACL filter functions to use a 'bool' return
type instead of a tri-state 'int' return type. The callers
of these functions don't want to distinguish 'auth failed'
from other errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd access control filtering of domain objects
Daniel P. Berrange [Mon, 24 Jun 2013 16:49:47 +0000 (17:49 +0100)]
Add access control filtering of domain objects

Ensure that all APIs which list domain objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoPut virt-sanlock-cleanup into section 8
Guido Günther [Tue, 2 Jul 2013 21:15:53 +0000 (23:15 +0200)]
Put virt-sanlock-cleanup into section 8

as indicated by the filename.

11 years agoqemu: Allow seamless migration for domains with multiple graphics
Martin Kletzander [Mon, 1 Jul 2013 12:16:51 +0000 (14:16 +0200)]
qemu: Allow seamless migration for domains with multiple graphics

Since commit 23e8b5d8, the code is refactored in a way that supports
domains with multiple graphics elements and commit 37b415200 allows
starting such domains.  However none of those commits take migration
into account.  Even though qemu doesn't support relocation for
anything else than SPICE and for no more than one graphics, there is no
reason to hardcode one graphics into this part of the code as well.

11 years agoqemu: Don't miss errors when changing graphics passwords
Martin Kletzander [Mon, 1 Jul 2013 07:23:04 +0000 (09:23 +0200)]
qemu: Don't miss errors when changing graphics passwords

Commit 23e8b5d8e7a92bac85b7fd2aca8992501bf680ee forgot to check the
return value for all calls to qemuDomainChangeGraphicsPasswords().

11 years agoLXC: blkio: allow to setup weight_device
Gao feng [Wed, 3 Jul 2013 11:35:54 +0000 (12:35 +0100)]
LXC: blkio: allow to setup weight_device

libivrt lxc can only set generic weight for container,
This patch allows user to setup per device blkio
weigh for container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: fix memory leak when userns configuration is incorrect
Gao feng [Wed, 3 Jul 2013 11:19:50 +0000 (12:19 +0100)]
LXC: fix memory leak when userns configuration is incorrect

We forgot to free the stack when Kernel doesn't
support user namespace.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agovirNetDevBandwidthUnplug: Don't leak @cmd
Michal Privoznik [Wed, 3 Jul 2013 07:43:14 +0000 (09:43 +0200)]
virNetDevBandwidthUnplug: Don't leak @cmd

When removing a TAP device, the associated bandwidth settings are
removed. Currently, the /sbin/tc is used for that. It is spawned
several times. Moreover, we use the same @cmd variable to
construct the command and its arguments. That means we need to
virCommandFree(cmd); prior to each virCommandNew(TC); which
wasn't done.

11 years agovirCgroupNewPartition: Don't leak @newpath
Michal Privoznik [Wed, 3 Jul 2013 07:42:11 +0000 (09:42 +0200)]
virCgroupNewPartition: Don't leak @newpath

The @newpath variable is allocated in virCgroupSetPartitionSuffix(). But
it's newer freed.

11 years agoqemu: Implement 'oncrash' coredump events when guest panicked
Chen Fan [Fri, 7 Jun 2013 10:23:35 +0000 (18:23 +0800)]
qemu: Implement 'oncrash' coredump events when guest panicked

Add doDumpCoreToAutoPath to implement
'coredump-destroy' and 'coredump-restart' events of the 'on_crash'
in the XML when domain crashed.

11 years agoqemu: Implement 'oncrash' events when guest panicked
Chen Fan [Fri, 7 Jun 2013 10:23:34 +0000 (18:23 +0800)]
qemu: Implement 'oncrash' events when guest panicked

Add monitor callback API domainGuestPanic, that implements
'destroy', 'restart' and 'preserve' events of the 'on_crash'
in the XML when domain crashed.

11 years agoqemu: expose qemuProcessShutdownOrReboot()
Chen Fan [Fri, 7 Jun 2013 10:23:33 +0000 (18:23 +0800)]
qemu: expose qemuProcessShutdownOrReboot()

Later code will need this outside of qemu_process.c

11 years agoqemu: refactor processWatchdogEvent
Chen Fan [Fri, 7 Jun 2013 10:23:32 +0000 (18:23 +0800)]
qemu: refactor processWatchdogEvent

Split the code to make the driver workpool more generalized

11 years agolibvirt: Define domain crash event types
Chen Fan [Fri, 7 Jun 2013 10:23:31 +0000 (18:23 +0800)]
libvirt: Define domain crash event types

This patch introduces domain crashed types and crashed reasons which
will be used while guest panicked.

11 years agobuild: don't ship access syms files in tarball
Eric Blake [Tue, 2 Jul 2013 16:28:20 +0000 (10:28 -0600)]
build: don't ship access syms files in tarball

On a mingw VPATH build (such as done by ./autobuild.sh), the tarball
created by 'make dist' was including generated files.  The VPATH
rules were then seeing that the tarball files were up-to-date, and
not regenerating files locally, leading to this failure:

  GEN      libvirt.syms
cat: libvirt_access.syms: No such file or directory
cat: libvirt_access_qemu.syms: No such file or directory
cat: libvirt_access_lxc.syms: No such file or directory
make: *** [libvirt.syms] Error 1

We already have a category for generated sym files, which are
intentionally not part of the tarball; stick the access sym
files in that category.  The rearrange the declarations a bit
to make it harder to repeat the problem, dropping things that
are now redundant (for example, BUILT_FILES already includes
GENERATED_SYM_FILES, so it does not also need to call out
ACCESS_DRIVER_SYM_FILES).

* src/Makefile.am (USED_SYM_FILES): Don't include generated files.
(GENERATED_SYM_FILES): Access syms files are generated.
(libvirt.syms): Include access syms files here.
(ACCESS_DRIVER_SYMFILES): Rename...
(ACCESS_DRIVER_SYM_FILES): ...for consistency.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoAdd some misc debugging to LXC startup
Daniel P. Berrange [Mon, 1 Jul 2013 16:42:25 +0000 (17:42 +0100)]
Add some misc debugging to LXC startup

Add some debug logging of LXC wait/continue messages
and uid/gid map update code.

11 years agoIgnore failure to mount SELinux filesystem in container
Daniel P. Berrange [Mon, 1 Jul 2013 16:41:21 +0000 (17:41 +0100)]
Ignore failure to mount SELinux filesystem in container

User namespaces will deny the ability to mount the SELinux
filesystem. This is harmless for libvirt's LXC needs, so the
error can be ignored.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agobuild: work around mingw header pollution
Eric Blake [Tue, 2 Jul 2013 12:09:30 +0000 (06:09 -0600)]
build: work around mingw header pollution

On Fedora 18, when cross-compiling to mingw with the mingw*-dbus
packages installed, compilation fails with:

  CC       libvirt_net_rpc_server_la-virnetserver.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30,
                 from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31,
                 from ../../src/util/virdbus.h:26,
                 from ../../src/rpc/virnetserver.c:39:
/usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct'

I have reported this as a bug against two packages:
- mingw-headers, for polluting the namespace
https://bugzilla.redhat.com/show_bug.cgi?id=980270
- dbus, for not dealing with the pollution
https://bugzilla.redhat.com/show_bug.cgi?id=980278

At least dbus has agreed that a future version of dbus headers will
do s/interface/iface/, regardless of what happens in mingw. But it
is also easy to workaround in libvirt in the meantime, without having
to wait for either mingw or dbus to upgrade.

* src/util/virdbus.h (includes): Undo mingw's pollution so that
dbus doesn't fail.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemuNodeDeviceDetachFlags: Avoid use of uninitialized variables
Michal Privoznik [Tue, 2 Jul 2013 09:20:53 +0000 (11:20 +0200)]
qemuNodeDeviceDetachFlags: Avoid use of uninitialized variables

After abf75aea24 the compiler screams:

qemu/qemu_driver.c: In function 'qemuNodeDeviceDetachFlags':
qemu/qemu_driver.c:10693:9: error: 'domain' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     pci = virPCIDeviceNew(domain, bus, slot, function);
         ^
qemu/qemu_driver.c:10693:9: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
qemu/qemu_driver.c:10693:9: error: 'slot' may be used uninitialized in this function [-Werror=maybe-uninitialized]
qemu/qemu_driver.c:10693:9: error: 'function' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Since the other functions qemuNodeDeviceReAttach and qemuNodeDeviceReset
looks exactly the same, I've initialized the variables there as well.
However, I am still wondering why those functions don't matter to gcc
while the first one does.

11 years agoLXC: fuse: Change files owner to the root user of container
Gao feng [Fri, 7 Jun 2013 07:12:27 +0000 (15:12 +0800)]
LXC: fuse: Change files owner to the root user of container

The owner of the /proc/meminfo in container should
be the root user of container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: controller: change the owner of /dev/pts and ptmx to the root of container
Gao feng [Fri, 7 Jun 2013 07:12:26 +0000 (15:12 +0800)]
LXC: controller: change the owner of /dev/pts and ptmx to the root of container

These files are created for container,
the owner should be the root user of container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: controller: change the owner of devices created on host
Gao feng [Fri, 7 Jun 2013 07:12:25 +0000 (15:12 +0800)]
LXC: controller: change the owner of devices created on host

Since these devices are created for the container.
the owner should be the root user of the container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: controller: change the owner of /dev to the root user of container
Gao feng [Fri, 7 Jun 2013 07:12:24 +0000 (15:12 +0800)]
LXC: controller: change the owner of /dev to the root user of container

container will create /dev/pts directory in /dev.
the owner of /dev should be the root user of container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: controller: change the owner of tty devices to the root user of container
Gao feng [Fri, 7 Jun 2013 07:12:23 +0000 (15:12 +0800)]
LXC: controller: change the owner of tty devices to the root user of container

Since these tty devices will be used by container,
the owner of them should be the root user of container.

This patch also adds a new function virLXCControllerChown,
we can use this general function to change the owner of
files.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: Creating devices for container on host side
Gao feng [Fri, 7 Jun 2013 07:12:22 +0000 (15:12 +0800)]
LXC: Creating devices for container on host side

user namespace doesn't allow to create devices in
uninit userns. We should create devices on host side.

We first mount tmpfs on dev directroy under state dir
of container. then create devices under this dev dir.

Finally in container, mount the dev directroy created
on host to the /dev/ directroy of container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: introduce virLXCControllerSetupUserns and lxcContainerSetID
Gao feng [Fri, 7 Jun 2013 07:12:21 +0000 (15:12 +0800)]
LXC: introduce virLXCControllerSetupUserns and lxcContainerSetID

This patch introduces new helper function
virLXCControllerSetupUserns, in this function,
we set the files uid_map and gid_map of the init
task of container.

lxcContainerSetID is used for creating cred for
tasks running in container. Since after setuid/setgid,
we may be a new user. This patch calls lxcContainerSetUserns
at first to make sure the new created files belong to
right user.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: sort the uidmap/gidmap of domain
Gao feng [Fri, 7 Jun 2013 07:12:20 +0000 (15:12 +0800)]
LXC: sort the uidmap/gidmap of domain

Make sure the mapping line contains the root user of container
is the first element of idmap array. So we can get the real
user id on host for the container easily.

This patch also check the map information, User must map
the root user of container to any user of host.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: enable user namespace only when user set the uidmap
Gao feng [Fri, 7 Jun 2013 07:12:19 +0000 (15:12 +0800)]
LXC: enable user namespace only when user set the uidmap

User namespace will be enabled only when the idmap exist
in configuration.

If you want disable user namespace,just remove these
elements from XML.

If kernel doesn't support user namespace and idmap exist
in configuration file, libvirt lxc will start failed and
return "Kernel doesn't support user namespace" message.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: Introduce New XML element for user namespace
Gao feng [Fri, 7 Jun 2013 07:12:18 +0000 (15:12 +0800)]
LXC: Introduce New XML element for user namespace

This patch introduces new element <idmap> for
user namespace. for example
<idmap>
    <uid start='0' target='1000' count='10'/>
    <gid start='0' target='1000' count='10'/>
</idmap>

this new element is used for setting proc files
/proc/<pid>/{uid_map,gid_map}.

This patch also supports multiple uid/gid elements
setting in XML configuration.

We don't support the semi configuation, user has to
configure uid and gid both.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoqemu: Improve info message and remove a variable in qemuDomainManagedSave
Peter Krempa [Tue, 25 Jun 2013 08:43:13 +0000 (10:43 +0200)]
qemu: Improve info message and remove a variable in qemuDomainManagedSave

Mention the domain name that is being saved and remove the unneeded
variable that only stores a constant.

11 years agodocs: Document hypervisor drivers that support certain timer models
Peter Krempa [Mon, 24 Jun 2013 14:03:37 +0000 (16:03 +0200)]
docs: Document hypervisor drivers that support certain timer models

Not every timer model is supported with each hypervisor. Explicitly
mention the driver supporting each timer model.

11 years agoqemu: fix return value of qemuDomainBlockPivot on errors
Ján Tomko [Mon, 1 Jul 2013 10:41:34 +0000 (12:41 +0200)]
qemu: fix return value of qemuDomainBlockPivot on errors

If qemuMonitorBlockJob returned 0, qemuDomainBlockPivot
might return 0 even if an error occured.

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

11 years agolibxl: implement per NUMA node free memory reporting
Dario Faggioli [Fri, 28 Jun 2013 14:32:52 +0000 (16:32 +0200)]
libxl: implement per NUMA node free memory reporting

By providing the implementation of nodeGetCellsFreeMemory for
the driver. This is all just a matter of properly formatting, in
a way that libvirt like, what Xen provides via libxl_get_numainfo().

[raistlin@Zhaman ~]$ sudo virsh --connect xen:/// freecell --all
    0:      25004 KiB
    1:     105848 KiB
--------------------
Total:     130852 KiB

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
11 years agobuild: configure must not affect tarball contents
Eric Blake [Mon, 1 Jul 2013 22:48:11 +0000 (16:48 -0600)]
build: configure must not affect tarball contents

On mingw, configure sets the name of the lxc symfile to
libvirt_lxc.defs rather than libvirt_lxc.syms.  But tarballs
must be arch-independent, regardless of the configure options
used for the tree where we ran 'make dist'.  This led to the
following failure in autobuild.sh:

  CCLD     libvirt-lxc.la
  CCLD     libvirt-qemu.la
/usr/lib64/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld: cannot find libvirt_lxc.def: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [libvirt-lxc.la] Error 1
make[3]: *** Waiting for unfinished jobs....

We were already doing the right thing with libvirt_qemu.syms.

* src/Makefile.am (EXTRA_DIST): Don't ship a built file which
depends on configure for its final name.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: avoid build failure without gnutls
Eric Blake [Mon, 1 Jul 2013 19:21:57 +0000 (13:21 -0600)]
build: avoid build failure without gnutls

Found while trying to cross-compile to mingw:

  CC       libvirt_driver_remote_la-remote_driver.lo
../../src/remote/remote_driver.c: In function 'doRemoteOpen':
../../src/remote/remote_driver.c:487:23: error: variable 'verify' set but not used [-Werror=unused-but-set-variable]

* src/remote/remote_driver.c (doRemoteOpen): Also ignore 'verify'.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoDrop iptablesContext
Roman Bogorodskiy [Fri, 28 Jun 2013 04:52:30 +0000 (00:52 -0400)]
Drop iptablesContext

iptablesContext holds only 4 pairs of iptables
(table, chain) and there's no need to pass
it around.

This is a first step towards separating bridge_driver.c
in platform-specific parts.