]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agointerface: list all interfaces with flags == 0
Guannan Ren [Tue, 21 May 2013 13:29:38 +0000 (21:29 +0800)]
interface: list all interfaces with flags == 0

virConnectListAllInterfaces should support to list all of
interfaces when the value of flags is 0. The behaviour is
consistent with other virConnectListAll* APIs

11 years agocgroup: be robust against cgroup movement races
Eric Blake [Tue, 21 May 2013 02:30:30 +0000 (20:30 -0600)]
cgroup: be robust against cgroup movement races

https://bugzilla.redhat.com/show_bug.cgi?id=965169 documents a
problem starting domains when cgroups are enabled; I was able
to reliably reproduce the race about 5% of the time when I added
hooks to domain startup by 3 seconds (as that seemed to be about
the length of time that qemu created and then closed a temporary
thread, probably related to aio handling of initially opening
a disk image).  The problem has existed since we introduced
virCgroupMoveTask in commit 9102829 (v0.10.0).

There are some inherent TOCTTOU races when moving tasks between
kernel cgroups, precisely because threads can be created or
completed in the window between when we read a thread id from the
source and when we write to the destination.  As the goal of
virCgroupMoveTask is merely to move ALL tasks into the new
cgroup, it is sufficient to iterate until no more threads are
being created in the old group, and ignoring any threads that
die before we can move them.

It would be nicer to start the threads in the right cgroup to
begin with, but by default, all child threads are created in
the same cgroup as their parent, and we don't want vcpu child
threads in the emulator cgroup, so I don't see any good way
of avoiding the move.  It would also be nice if the kernel were
to implement something like rename() as a way to atomically move
a group of threads from one cgroup to another, instead of forcing
a window where we have to read and parse the source, then format
and write back into the destination.

* src/util/vircgroup.c (virCgroupAddTaskStrController): Ignore
ESRCH, because a thread ended between read and write attempts.
(virCgroupMoveTask): Loop until all threads have moved.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agosrc/*.[ch]: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:08:42 +0000 (16:08 +0800)]
src/*.[ch]: Remove the whitespace before ";"

11 years agosrc/locking: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:06:00 +0000 (16:06 +0800)]
src/locking: Remove the whitespace before ";"

11 years agopython: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:05:06 +0000 (16:05 +0800)]
python: Remove the whitespace before ";"

11 years agoexamples: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 08:04:26 +0000 (16:04 +0800)]
examples: Remove the whitespace before ';'

11 years agosrc/lxc: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:03:33 +0000 (16:03 +0800)]
src/lxc: Remove the whitespace before ";"

11 years agosrc/remote: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 08:01:50 +0000 (16:01 +0800)]
src/remote: Remove the whitespace before ";"

11 years agosrc/rpc: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:59:54 +0000 (15:59 +0800)]
src/rpc: Remove the whitespace before ";"

11 years agosrc/utils: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:58:16 +0000 (15:58 +0800)]
src/utils: Remove the whitespace before ";"

11 years agotests/: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:53:48 +0000 (15:53 +0800)]
tests/: Remove the whitespace before ";"

11 years agodaemon: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:45:26 +0000 (15:45 +0800)]
daemon: Remove the whitespace before ";"

11 years agotools: Remove the whitespace before ";"
Osier Yang [Tue, 21 May 2013 07:44:53 +0000 (15:44 +0800)]
tools: Remove the whitespace before ";"

11 years agosrc/storage: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/storage: Remove the whitespace before ';'

11 years agosrc/security: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/security: Remove the whitespace before ';'

11 years agosrc/xen: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/xen: Remove the whitespace before ';'

11 years agosrc/vmware: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:21 +0000 (15:21 +0800)]
src/vmware: Remove the whitespace before ';'

11 years agosrc/qemu: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/qemu: Remove the whitespace before ';'

11 years agosrc/interface: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/interface: Remove the whitespace before ';'

11 years agosrc/parallels: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:20 +0000 (15:21 +0800)]
src/parallels: Remove the whitespace before ';'

11 years agosrc/uml: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/uml: Remove the whitespace before ';'

11 years agosrc/openvz: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/openvz: Remove the whitespace before ';'

11 years agosrc/node_device: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/node_device: Remove the whitespace before ';'

11 years agosrc/phyp: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/phyp: Remove the whitespace before ';'

11 years agosrc/nwfilter: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/nwfilter: Remove the whitespace before ';'

11 years agosrc/xenxs: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:19 +0000 (15:21 +0800)]
src/xenxs: Remove the whitespace before ';'

11 years agosrc/vbox: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:18 +0000 (15:21 +0800)]
src/vbox: Remove the whitespace before ';'

11 years agosrc/test: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:18 +0000 (15:21 +0800)]
src/test: Remove the whitespace before ';'

11 years agosrc/conf: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:17 +0000 (15:21 +0800)]
src/conf: Remove the whitespace before ';'

11 years agosrc/libxl: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:16 +0000 (15:21 +0800)]
src/libxl: Remove the whitespace before ';'

11 years agosrc/network: Remove the whitespace before ';'
Osier Yang [Tue, 21 May 2013 07:21:15 +0000 (15:21 +0800)]
src/network: Remove the whitespace before ';'

11 years agoConvert Xen domain core dump driver methods to use virDomainDefPtr
Daniel P. Berrange [Thu, 2 May 2013 10:26:40 +0000 (11:26 +0100)]
Convert Xen domain core dump driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain coredump
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain stats/peek driver methods to use virDomainDefPtr
Daniel P. Berrange [Thu, 2 May 2013 10:24:49 +0000 (11:24 +0100)]
Convert Xen domain stats/peek driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain stats &
peek APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain scheduler driver methods to use virDomainDefPtr
Daniel P. Berrange [Thu, 2 May 2013 10:13:39 +0000 (11:13 +0100)]
Convert Xen domain scheduler driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain scheduler
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain autostart driver methods to use virDomainDefPtr
Daniel P. Berrange [Thu, 2 May 2013 10:05:55 +0000 (11:05 +0100)]
Convert Xen domain autostart driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain autostart
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain device hotplug driver methods to use virDomainDefPtr
Daniel P. Berrange [Thu, 2 May 2013 09:56:31 +0000 (10:56 +0100)]
Convert Xen domain device hotplug driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain hotplug
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain VCPU driver methods to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 17:37:29 +0000 (18:37 +0100)]
Convert Xen domain VCPU driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain VCPU
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain create/define/getxml/migration APIs to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 13:15:10 +0000 (14:15 +0100)]
Convert Xen domain create/define/getxml/migration APIs to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain create, migrate,
getxml, & define APIs to simplify introduction of ACL security
checks. The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain managed save driver methods to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 13:03:26 +0000 (14:03 +0100)]
Convert Xen domain managed save driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain save
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain property driver methods to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 10:29:08 +0000 (11:29 +0100)]
Convert Xen domain property driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain property
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain lifecycle driver methods to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 09:54:30 +0000 (10:54 +0100)]
Convert Xen domain lifecycle driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain lifecycle
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoConvert Xen domain lookup driver methods to use virDomainDefPtr
Daniel P. Berrange [Wed, 1 May 2013 09:31:23 +0000 (10:31 +0100)]
Convert Xen domain lookup driver methods to use virDomainDefPtr

Introduce use of a virDomainDefPtr in the domain lookup
APIs to simplify introduction of ACL security checks.
The virDomainPtr cannot be safely used, since the app
may have supplied mis-matching name/uuid/id fields. eg
the name points to domain X, while the uuid points to
domain Y. Resolving the virDomainPtr to a virDomainDefPtr
ensures a consistent name/uuid/id set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemu: Don't remove the "return 0"
Osier Yang [Tue, 21 May 2013 15:02:36 +0000 (23:02 +0800)]
qemu: Don't remove the "return 0"

Commit f60a50c7957 intended to remove the warning only, but not with
the "return 0" together.

11 years agoshunloadtest: Resolve Coverity CHECKED_RETURN error
John Ferlan [Thu, 16 May 2013 13:50:58 +0000 (09:50 -0400)]
shunloadtest: Resolve Coverity CHECKED_RETURN error

The shunloadStart function didn't check the status of virInitialize which
was flagged by Coverity.  Adjust the function and shunloadtest in order
to handle the situation.

11 years agoxencapstest: Resolve Coverity CHECKED_RETURN error
John Ferlan [Thu, 16 May 2013 12:56:56 +0000 (08:56 -0400)]
xencapstest: Resolve Coverity CHECKED_RETURN error

The return from virInitialize() needs to be checked.

11 years agoqemu: fix a typo in qemuAddSharedDevice
Guannan Ren [Tue, 21 May 2013 10:38:57 +0000 (18:38 +0800)]
qemu: fix a typo in qemuAddSharedDevice

11 years agodocs: formatdomain: fix links in the table of contents
Ján Tomko [Tue, 21 May 2013 08:55:42 +0000 (10:55 +0200)]
docs: formatdomain: fix links in the table of contents

11 years agoqemuDomainChangeEjectableMedia: Unlock domain while waiting for event
Michal Privoznik [Mon, 20 May 2013 17:26:14 +0000 (19:26 +0200)]
qemuDomainChangeEjectableMedia: Unlock domain while waiting for event

In 84c59ffa I've tried to fix changing ejectable media process. The
process should go like this:

1) we need to call 'eject' on the monitor
2) we should wait for 'DEVICE_TRAY_MOVED' event
3) now we can issue 'change' command

However, while waiting in step 2) the domain monitor was locked. So
even if qemu reported the desired event, the proper callback was not
called immediately. The monitor handling code needs to lock the
monitor in order to read the event. So that's the first lock we must
not hold while waiting. The second one is the domain lock. When
monitor handling code reads an event, the appropriate callback is
called then. The first thing that each callback does is locking the
corresponding domain as a domain or its device is about to change
state. So we need to unlock both monitor and VM lock. Well, holding
any lock while sleep()-ing is not the best thing to do anyway.

11 years agoesx: Replace almost all esxVI_String_DeepCopyValue vith VIR_STRDUP
Matthias Bolte [Fri, 17 May 2013 21:19:21 +0000 (23:19 +0200)]
esx: Replace almost all esxVI_String_DeepCopyValue vith VIR_STRDUP

11 years agovmware: Restore OOM error reporting in vmwareCopyVMXFileName
Matthias Bolte [Fri, 17 May 2013 20:54:35 +0000 (22:54 +0200)]
vmware: Restore OOM error reporting in vmwareCopyVMXFileName

Got lost in commit e6ab10098066dd04794ff2ee5d10bc9b1db93327.

11 years agomaint: enforce correct copyright usage
Eric Blake [Tue, 14 May 2013 23:41:15 +0000 (17:41 -0600)]
maint: enforce correct copyright usage

To ensure we don't regress and cause the need for further
cleanups, add a 'make syntax-check' rule that ensures new
files have proper copyright contents.

* cfg.mk (sc_copyright_address): Rename...
(sc_copyright_usage): ...and enhance.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: refer to correct license file
Eric Blake [Wed, 15 May 2013 20:30:23 +0000 (14:30 -0600)]
maint: refer to correct license file

Now that COPYING no longer contains the text of the LGPL,
modify the LGPLv2-only files from vbox to call out the
correct file.

* src/vbox/vbox_CAPI_v2_2.h: Refer to correct file.
* src/vbox/vbox_CAPI_v3_0.h: Likewise.
* src/vbox/vbox_CAPI_v3_1.h: Likewise.
* src/vbox/vbox_CAPI_v3_2.h: Likewise.
* src/vbox/vbox_CAPI_v4_0.h: Likewise.
* src/vbox/vbox_CAPI_v4_1.h: Likewise.
* src/vbox/vbox_V2_2.c: Likewise.
* src/vbox/vbox_V3_0.c: Likewise.
* src/vbox/vbox_V3_1.c: Likewise.
* src/vbox/vbox_XPCOMCGlue.c: Likewise.
* src/vbox/vbox_XPCOMCGlue.h: Likewise.
* src/vbox/vbox_driver.c: Likewise.
* src/vbox/vbox_driver.h: Likewise.
* src/vbox/vbox_tmpl.c: Likewise.
* src/vbox/vbox_V3_2.c: Copy license notice from vbox_V3_1.c.
* src/vbox/vbox_V4_0.c: Likewise.
* src/vbox/vbox_V4_1.c: Likewise.
* src/vbox/README: Mention copyright issues; this particular
file contains no code and therefore does not need LGPL.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: follow recommended practice for using LGPL
Eric Blake [Tue, 14 May 2013 23:25:02 +0000 (17:25 -0600)]
maint: follow recommended practice for using LGPL

https://www.gnu.org/licenses/gpl-howto.html states:

You should also include a copy of the license itself somewhere in the
distribution of your program. All programs, whether they are released
under the GPL or LGPL, should include the text version of the GPL. In
GNU programs the license is usually in a file called COPYING.

If you are releasing your program under the LGPL, you should also
include the text version of the LGPL, usually in a file called
COPYING.LESSER. Please note that, since the LGPL is a set of
additional permissions on top of the GPL, it's important to include
both licenses so users have all the materials they need to understand
their rights.

* configure.ac (COPYING): No more games with non-git file.
* COPYING: New file, copied from gnulib.
* COPYING.LIB: Rename...
* COPYING.LESSER: ...to this.
* .gitignore: Track licenses in git.
* cfg.mk (exclude_file_name_regexp--sc_copyright_address): Tweak
rule.
* libvirt.spec.in (daemon, client, python): Reflect rename.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: use LGPL correctly
Eric Blake [Tue, 14 May 2013 23:42:12 +0000 (17:42 -0600)]
maint: use LGPL correctly

Several files called out COPYING or COPYING.LIB instead of using
the normal boilerplate.  It's especially important that we don't
call out COPYING from an LGPL file, since COPYING is traditionally
used for the GPL.  A few files were lacking copyright altogether.

* src/rpc/gendispatch.pl: Add missing copyright.
* Makefile.nonreentrant: Likewise.
* src/check-symfile.pl: Likewise.
* src/check-symsorting.pl: Likewise.
* src/driver.h: Likewise.
* src/internal.h: Likewise.
* tools/libvirt-guests.sh.in: Likewise.
* tools/virt-pki-validate.in: Mention copyright in comment, not just code.
* tools/virt-sanlock-cleanup.in: Likewise.
* src/rpc/genprotocol.pl: Spell out license terms.
* src/xen/xend_internal.h: Likewise.
* src/xen/xend_internal.c: Likewise.
* Makefile.am: Likewise.
* daemon/Makefile.am: Likewise.
* docs/Makefile.am: Likewise.
* docs/schemas/Makefile.am: Likewise.
* examples/apparmor/Makefile.am: Likewise.
* examples/domain-events/events-c/Makefile.am: Likewise.
* examples/dominfo/Makefile.am: Likewise.
* examples/domsuspend/Makefile.am: Likewise.
* examples/hellolibvirt/Makefile.am: Likewise.
* examples/openauth/Makefile.am: Likewise.
* examples/python/Makefile.am: Likewise.
* examples/systemtap/Makefile.am: Likewise.
* examples/xml/nwfilter/Makefile.am: Likewise.
* gnulib/lib/Makefile.am: Likewise.
* gnulib/tests/Makefile.am: Likewise.
* include/Makefile.am: Likewise.
* include/libvirt/Makefile.am: Likewise.
* python/Makefile.am: Likewise.
* python/tests/Makefile.am: Likewise.
* src/Makefile.am: Likewise.
* tests/Makefile.am: Likewise.
* tools/Makefile.am: Likewise.
* configure.ac: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoLXC: move the comments to the proper place
Gao feng [Mon, 20 May 2013 10:12:19 +0000 (18:12 +0800)]
LXC: move the comments to the proper place

The comments is for virLXCControllerSetupPrivateNS.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: fix memory leak in virLXCControllerSetupDevPTS
Gao feng [Mon, 20 May 2013 10:12:18 +0000 (18:12 +0800)]
LXC: fix memory leak in virLXCControllerSetupDevPTS

We forgot to free the mount_options.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoLXC: remove unnecessary check on root filesystem
Gao feng [Mon, 20 May 2013 10:12:17 +0000 (18:12 +0800)]
LXC: remove unnecessary check on root filesystem

After commit c131525bec5af248e3843224bc5ce8d6435760f0
"Auto-add a root <filesystem> element to LXC containers on startup"
for libvirt lxc, root must be existent.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoopenvzDomainSetNetwork: use virCommand
Michal Privoznik [Sun, 19 May 2013 09:17:19 +0000 (11:17 +0200)]
openvzDomainSetNetwork: use virCommand

Currently, the openvzDomainSetNetwork function constructs an
array of strings representing a command line for VZCTL binary.
This is a overkill since our virCommand APIs can cover all the
functionality. Moreover, the function is not following our
structure where return value is set to -1 initially, and after
all operations succeeded then it is set to zero.

11 years agoqemu: Add callback struct for qemuBuildCommandLine
Osier Yang [Fri, 17 May 2013 10:34:24 +0000 (18:34 +0800)]
qemu: Add callback struct for qemuBuildCommandLine

Since 0d70656afded, it starts to access the sysfs files to build
the qemu command line (by virSCSIDeviceGetSgName, which is to find
out the scsi generic device name by adpater:bus:target:unit), there
is no way to work around, qemu wants to see the scsi generic device
like "/dev/sg6" anyway.

And there might be other places which need to access sysfs files
when building qemu command line in future.

Instead of increasing the arguments of qemuBuildCommandLine, this
introduces a new callback for qemuBuildCommandLine, and thus tests
can register their own callbacks for sysfs test input files accessing.

* src/qemu/qemu_command.h: (New callback struct
                            qemuBuildCommandLineCallbacks;
                            extern buildCommandLineCallbacks)
* src/qemu/qemu_command.c: (wire up the callback struct)
* src/qemu/qemu_driver.c: (Use the new syntax of qemuBuildCommandLine)
* src/qemu/qemu_hotplug.c: Likewise
* src/qemu/qemu_process.c: Likewise
* tests/testutilsqemu.[ch]: (Helper testSCSIDeviceGetSgName;
                             callback struct testCallbacks;)
* tests/qemuxml2argvtest.c: (Use testCallbacks)
* src/tests/qemuxmlnstest.c: (Like above)

11 years agostorage_conf: Improve the coding style in storage_conf.h
Osier Yang [Thu, 16 May 2013 12:40:54 +0000 (20:40 +0800)]
storage_conf: Improve the coding style in storage_conf.h

Changes:
  * Remove useless comments
  * Remove useless blank lines
  * If the struct member is a enum type, comment it like
    /* enum fooBar */
  * Break the long lines
  * Prefer the common function style for the inline function

11 years agostorage_conf: Fix indentions in storage_conf.c
Osier Yang [Thu, 16 May 2013 12:40:51 +0000 (20:40 +0800)]
storage_conf: Fix indentions in storage_conf.c

Uses the 4 spaces for indention.

11 years agostorage_conf: Fix the coding stype in storage_conf.c
Osier Yang [Thu, 16 May 2013 12:40:50 +0000 (20:40 +0800)]
storage_conf: Fix the coding stype in storage_conf.c

Changes:
  * Remove the useless space in "for" statement (e.g.
    for (i = 0 ; i < something ; i++)

  * Change the function's style to:
    void
    foo(bar)
    {
        printf("foo is not bar\n");
    }

  * Don't lose "{}" for "if...else" branches if one of the branch
    has more than one line block. Example of the old ones:
    if (a) {
        printf("a is not funny");
    } else
        printf("a is funny");

  * Remove the 1 space before "goto" label.

  * Remove the useless blank line(s)

  * Add blank line if it can make the code more clear to eyes.

11 years agoqemu: Abstract code for cpuset controller setting into a helper
Osier Yang [Fri, 17 May 2013 11:59:34 +0000 (19:59 +0800)]
qemu: Abstract code for cpuset controller setting into a helper

11 years agoqemu: Abstract code for devices controller setting into a helper
Osier Yang [Fri, 17 May 2013 11:59:33 +0000 (19:59 +0800)]
qemu: Abstract code for devices controller setting into a helper

11 years agoqemu: Abstract code for memory controller setting into a helper
Osier Yang [Mon, 20 May 2013 11:39:54 +0000 (19:39 +0800)]
qemu: Abstract code for memory controller setting into a helper

11 years agoqemu: Abstract the code for blkio controller setting into a helper
Osier Yang [Fri, 17 May 2013 11:59:31 +0000 (19:59 +0800)]
qemu: Abstract the code for blkio controller setting into a helper

11 years agoesx: Fix error reporting in esxVI_LookupManagedObjectHelper
Matthias Bolte [Wed, 15 May 2013 21:43:04 +0000 (23:43 +0200)]
esx: Fix error reporting in esxVI_LookupManagedObjectHelper

As the name parameter can be NULL the error message can only contain it
conditionally.

11 years agoAdd missing c-ctype.h to virfile.c
Daniel P. Berrange [Fri, 17 May 2013 12:32:59 +0000 (13:32 +0100)]
Add missing c-ctype.h to virfile.c

The virfile.c file uses c_isalpha on Win32 platforms, so must
include c-ctype.h

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd libvirt-daemon-vbox & libvirt-daemon-driver-vbox RPMs
Daniel P. Berrange [Fri, 17 May 2013 12:31:59 +0000 (13:31 +0100)]
Add libvirt-daemon-vbox & libvirt-daemon-driver-vbox RPMs

Now the VirtualBox driver is a loadable module, it needs
to live in its own sub-RPM

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoInclude GNULIB mkdtemp module
Daniel P. Berrange [Fri, 17 May 2013 12:30:37 +0000 (13:30 +0100)]
Include GNULIB mkdtemp module

The mkdtemp function is missing on mingw platforms. It is
used in various Linux specific places in libvirt, but
recently became used in fdstreamtest.c which is cross
platform. Thus the GNULIB mkdtemp module should be used
to provide mkdtemp.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoSet PKG_CONFIG_LIBDIR in autobuild.sh
Daniel P. Berrange [Fri, 17 May 2013 12:29:12 +0000 (13:29 +0100)]
Set PKG_CONFIG_LIBDIR in autobuild.sh

If PKG_CONFIG_LIBDIR is not set when doing mingw32/64 builds,
then pkg-config may silently fallback to native versions of
libraries, with predictably bad results. Setting PKG_CONFIG_LIBDIR
forces it to only consider the mingw32/64 libraries.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agodocs: add another user
Eric Blake [Fri, 17 May 2013 15:14:16 +0000 (09:14 -0600)]
docs: add another user

Described here:
https://www.redhat.com/archives/libvir-list/2013-May/msg01329.html

* docs/apps.html.in: Mention Cracow Cloud One.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: report useful error failling to destroy domain gracefully
Guannan Ren [Fri, 17 May 2013 14:22:46 +0000 (22:22 +0800)]
qemu: report useful error failling to destroy domain gracefully

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

 #kill -STOP `pidof qemu-kvm`
 #virsh destroy $guest --graceful
 error: Failed to destroy domain testVM
 error: An error occurred, but the cause is unknown

With --graceful, SIGTERM always is emitted to kill driver
process, but it won't success till burning out waiting time
in case of process being stopped.
But domain destroy without --graceful can work, SIGKILL will
be emitted to the stopped process after 10 secs which always
kills a process even one that is currently stopped.
So report an error after burning out waiting time in this case.

11 years agoqemu: Check conflicts for shared scsi host device
Osier Yang [Fri, 3 May 2013 18:07:44 +0000 (02:07 +0800)]
qemu: Check conflicts for shared scsi host device

Just like previous patches, this changes qemuCheckSharedDisk
into qemuCheckSharedDevice, which takes a virDomainDeviceDefPtr
argument instead.

11 years agotest: fix VPATH fchosttest failure
Viktor Mihajlovski [Thu, 16 May 2013 15:49:59 +0000 (17:49 +0200)]
test: fix VPATH fchosttest failure

Running make check in a VPATH configured build directory fails
in fchosttest as the test data files are searched for relative to
the current working directory.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agoRe-add selinux/selinux.h to lxc_container.c
Daniel P. Berrange [Fri, 17 May 2013 09:59:25 +0000 (10:59 +0100)]
Re-add selinux/selinux.h to lxc_container.c

Re-add the selinux header to lxc_container.c since other
functions now use it, beyond the patch that was just
reverted.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix failure to detect missing cgroup partitions
Daniel P. Berrange [Thu, 16 May 2013 17:47:07 +0000 (18:47 +0100)]
Fix failure to detect missing cgroup partitions

Change bbe97ae968eba60b71e0066d49f9fc909966d9d6 caused the
QEMU driver to ignore ENOENT errors from cgroups, in order
to cope with missing /proc/cgroups. This is not good though
because many other things can cause ENOENT and should not
be ignored. The callers expect to see ENXIO when cgroups
are not present, so adjust the code to report that errno
when /proc/cgroups is missing

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRevert "Change label of fusefs mounted at /proc/meminfo in lxc containers"
Daniel P. Berrange [Fri, 17 May 2013 09:22:54 +0000 (10:22 +0100)]
Revert "Change label of fusefs mounted at /proc/meminfo in lxc containers"

This reverts commit 940c6f1085c3aafced51152b17a044af8c42b16e.

11 years agolibxl: fix leaking libxl events
Jim Fehlig [Thu, 16 May 2013 15:38:56 +0000 (09:38 -0600)]
libxl: fix leaking libxl events

libxl expects the event handler to free the event passed to it.  From
libxl_event.h:

   event becomes owned by the application and must be freed, either
   by event_occurs or later

11 years agolibxl: fix build with Xen4.3
Jim Fehlig [Thu, 16 May 2013 14:42:21 +0000 (08:42 -0600)]
libxl: fix build with Xen4.3

Xen 4.3 fixes a mistake in the libxl event handler signature where the
event owned by the application was defined as const.  Detect this and
define the libvirt libxl event handler signature appropriately.

11 years agoschema: make source optional in volume XML
Ján Tomko [Thu, 16 May 2013 13:43:06 +0000 (15:43 +0200)]
schema: make source optional in volume XML

We don't parse it anyway.

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

11 years agoschema: require target path in storage pool xml
Ján Tomko [Thu, 16 May 2013 13:37:14 +0000 (15:37 +0200)]
schema: require target path in storage pool xml

Make target path mandatory for pool types that require target,
since we refuse to parse a target without a path.

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

11 years agoqemu: Change values of disk discard
Osier Yang [Fri, 17 May 2013 02:35:02 +0000 (10:35 +0800)]
qemu: Change values of disk discard

QEMU might support more values for "-drive discard", so using Bi-state
values (on/off) for it doesn't make sense.

"on" maps to "unmap", "off" maps to "ignore":

<...>
@var{discard} is one of "ignore" (or "off") or "unmap" (or "on") and
controls whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
requests are ignored or passed to the filesystem.  Some machine types
may not support discard requests.
</...>

11 years agoqemu: Implement support for locking domain's memory pages
Jiri Denemark [Thu, 16 May 2013 20:01:05 +0000 (22:01 +0200)]
qemu: Implement support for locking domain's memory pages

11 years agoAdd support for locking domain's memory pages
Jiri Denemark [Thu, 16 May 2013 20:00:03 +0000 (22:00 +0200)]
Add support for locking domain's memory pages

The following XML configuration can be used to request all domain's
memory pages to be kept locked in host's memory (i.e., domain's memory
pages will not be swapped out):

      <memoryBacking>
        <locked/>
      </memoryBacking>

11 years agoFix build with VirtualBox
Jiri Denemark [Thu, 16 May 2013 20:56:56 +0000 (22:56 +0200)]
Fix build with VirtualBox

Commit ba5f3c7c moved vbox driver into libvirtd but forgot to adapt
daemon's Makefile.am.

11 years agoqemu: Fix cgroup handling when setting VCPU BW
Martin Kletzander [Thu, 16 May 2013 12:37:54 +0000 (14:37 +0200)]
qemu: Fix cgroup handling when setting VCPU BW

Commit 632f78c introduced a regression which causes schedinfo being
unable to set some parameters.  When migrating to priv->cgroup there
was missing variable left out and due to passed NULL to underlying
function, the setting failed.

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

11 years agoqemu: Set unpriv_sgio for scsi host device
Osier Yang [Fri, 3 May 2013 18:07:43 +0000 (02:07 +0800)]
qemu: Set unpriv_sgio for scsi host device

11 years agoqemu: Refactor qemuSetUnprivSGIO to support scsi host device
Osier Yang [Fri, 3 May 2013 18:07:42 +0000 (02:07 +0800)]
qemu: Refactor qemuSetUnprivSGIO to support scsi host device

Just like what previous patches do, it refactors qemuSetUnprivSGIO
to take the virDomainDeviceDefPtr as argument instead.

11 years agoqemu: Move qemuSetUnprivSGIO into qemu_conf.c
Osier Yang [Fri, 3 May 2013 18:07:41 +0000 (02:07 +0800)]
qemu: Move qemuSetUnprivSGIO into qemu_conf.c

unpriv_sgio setting is tight with the shared device helpers, let's
put them together in qemu_conf.c

11 years agoconf: Introduce sgio for hostdev
Osier Yang [Fri, 3 May 2013 18:07:40 +0000 (02:07 +0800)]
conf: Introduce sgio for hostdev

"sgio" is only valid for scsi host device.

11 years agoRename virDomainDiskSGIO to virDomainDeviceSGIO
Osier Yang [Fri, 3 May 2013 18:07:39 +0000 (02:07 +0800)]
Rename virDomainDiskSGIO to virDomainDeviceSGIO

SCSI host device will also support "sgio", and perhaps we could
use "sgio" in other places too in future, renaming the enum to
reuse.

11 years agoqemu: Manage shared device entry for scsi host device
Osier Yang [Fri, 3 May 2013 18:07:38 +0000 (02:07 +0800)]
qemu: Manage shared device entry for scsi host device

This adds the shared device entry when starting domain (more
exactly, when preparing host devices), and remove the entry
when destroying domain (when reattaching host devices).

11 years agoqemu: Refactor the helpers to track shared scsi host device
Osier Yang [Fri, 3 May 2013 18:07:37 +0000 (02:07 +0800)]
qemu: Refactor the helpers to track shared scsi host device

This changes the helpers qemu{Add,Remove}SharedDisk into
qemu{Add,Remove}SharedDevice, as most of the code in the helpers
can be reused for scsi host device.

To track the shared scsi host device, first it finds out the
device path (e.g. /dev/s[dr]*) which is mapped to the sg device,
and use device ID of the found device path (/dev/s[dr]*) as the
hash key. This is because of the device ID is not unique between
between /dev/s[dr]* and /dev/sg*, e.g.

% sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0

% ls -l /dev/sda
brw-rw----. 1 root disk 8, 0 May  2 19:26 /dev/sda

%ls -l /dev/sg0
crw-rw----. 1 root disk 21, 0 May  2 19:26 /dev/sg0

11 years agoutils: Add a helper to get the device name that sg device mapped to
Osier Yang [Fri, 3 May 2013 18:07:36 +0000 (02:07 +0800)]
utils: Add a helper to get the device name that sg device mapped to

E.g.

% sg_map
/dev/sg0  /dev/sda
/dev/sg1  /dev/sr0

What the helper gets for /dev/sg0 is /dev/sda, it will be used by
later patch.

11 years agoqemu: Rename qemu_driver->sharedDisks to qemu_driver->sharedDevices
Osier Yang [Fri, 3 May 2013 18:07:35 +0000 (02:07 +0800)]
qemu: Rename qemu_driver->sharedDisks to qemu_driver->sharedDevices

"Shared disk" is not only the thing we should care about after "scsi
hostdev" is introduced. A same scsi device can be used as "disk" for
one domain, and as "scsi hostdev" for another domain at the same time.
That's why this patch renames qemu_driver->sharedDisks. Related functions
and structs are also renamed.

11 years agoconf: Introduce <shareable> for hostdev
Osier Yang [Fri, 3 May 2013 18:07:33 +0000 (02:07 +0800)]
conf: Introduce <shareable> for hostdev

Unlike disk device, the scsi-generic always writethrough the data,
so no need to introduce a "cache" tag, and set "cache=off".

11 years agoDon't mount selinux fs in LXC if selinux is disabled
Daniel P. Berrange [Wed, 15 May 2013 15:26:59 +0000 (16:26 +0100)]
Don't mount selinux fs in LXC if selinux is disabled

Before trying to mount the selinux filesystem in a container
use is_selinux_enabled() to check if the machine actually
has selinux support (eg not booted with selinux=0)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoMove VirtualBox driver into libvirtd
Daniel P. Berrange [Wed, 15 May 2013 10:31:36 +0000 (11:31 +0100)]
Move VirtualBox driver into libvirtd

Change the build process & driver initialization so that the
VirtualBox driver is built into libvirtd, instead of libvirt.so
This change avoids the VirtualBox GPLv2-only license causing
compatibility problems with libvirt.so which is under the
GPLv2-or-later license.

NB this change prevents use of the VirtualBox driver on the
Windows platform, until such time as libvirtd can be made
to work there.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix LXC startup when /var/run is an absolute symlink
Daniel P. Berrange [Wed, 15 May 2013 09:49:20 +0000 (10:49 +0100)]
Fix LXC startup when /var/run is an absolute symlink

During startup, the LXC driver uses paths such as

  /.oldroot/var/run/libvirt/lxc/...

to access directories from the previous root filesystem
after doing a pivot_root(). Unfortunately if /var/run
is an absolute symlink to /run, instead of a relative
symlink to ../run, these paths break.

At least one Linux distro is known to use an absolute
symlink for /var/run, so workaround this, by resolving
all symlinks before doing the pivot_root().

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>