]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agovirsh: omit OPTION section in 'virsh help' if no option exists
Zhang Xiaohe [Wed, 22 May 2013 03:15:45 +0000 (11:15 +0800)]
virsh: omit OPTION section in 'virsh help' if no option exists

Don't print 'OPTION' if there's no options. Just behaves as DESCRIPTION
does.
This mostly affects 'interface' command group.

Signed-off-by: Zhang Xiaohe <zhangxh@cn.fujitsu.com>
Reported-by: Li Yang <liyang.fnst@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoChange virConnectDomainEventGraphicsCallback signature
Michal Privoznik [Sun, 19 May 2013 10:48:11 +0000 (12:48 +0200)]
Change virConnectDomainEventGraphicsCallback signature

For future work we need _virDomainEventGraphicsAddress and
_virDomainEventGraphicsSubjectIdentity members to be char * not const
char *. We are strdup()-ing them anyway, so they should have been char *
anyway (from const correctness POV). However, we don't want users to
change passed values, so we need to make the callback's argument const.

Although this is an API change (not ABI though), real callers won't be
impacted. Why?
 1. these callback members are read-only, so it is less likely that
someone is trying to assign into the struct members.
 2. The only way to register a virConnectDomainEventGraphicsCallback is
to cast it through a call to virConnectDomainEventRegisterAny.  That is,
even if the user's callback function leaves out the const, we never use
the typedef as the direct type of any API parameter.  Since they are
already casting their function pointer into a munged type before
registering it, their code will continue to compile.

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/*
Michal Privoznik [Fri, 3 May 2013 12:45:31 +0000 (14:45 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/openvz/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/conf/*
Michal Privoznik [Fri, 3 May 2013 12:40:46 +0000 (14:40 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/conf/*

11 years agovirNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE
Michal Privoznik [Wed, 22 May 2013 16:32:27 +0000 (18:32 +0200)]
virNetDevTapCreate: Fail on systems not supporting IFF_MULTI_QUEUE

In my previous patches I enabled the IFF_MULTI_QUEUE flag every
time the user requested multiqueue TAP device. However, this
works only at runtime. During build time the flag may be
undeclared.

11 years agoqemu: Enable multiqueue network
Michal Privoznik [Thu, 18 Apr 2013 08:47:01 +0000 (10:47 +0200)]
qemu: Enable multiqueue network

11 years agoqemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net
Michal Privoznik [Tue, 21 May 2013 13:50:09 +0000 (15:50 +0200)]
qemu: Adapt qemuBuildInterfaceCommandLine to to multiqueue net

In order to learn libvirt multiqueue several things must be done:

1) The '/dev/net/tun' device needs to be opened multiple times with
IFF_MULTI_QUEUE flag passed to ioctl(fd, TUNSETIFF, &ifr);

2) Similarly, '/dev/vhost-net' must be opened as many times as in 1)
in order to keep 1:1 ratio recommended by qemu and kernel folks.

3) The command line construction code needs to switch from 'fd=X' to
'fds=X:Y:...:Z' and from 'vhostfd=X' to 'vhostfds=X:Y:...:Z'.

4) The monitor handling code needs to learn to pass multiple FDs.

11 years agoqemu: Move interface cmd line construction into a separate function
Michal Privoznik [Mon, 13 May 2013 15:31:06 +0000 (17:31 +0200)]
qemu: Move interface cmd line construction into a separate function

Currently, we have one huge function to construct qemu command line.
This is very ineffective esp. if there's a fault somewhere.

11 years agoIntroduce /domain/devices/interface/driver/@queues attribute
Michal Privoznik [Wed, 10 Apr 2013 10:19:37 +0000 (12:19 +0200)]
Introduce /domain/devices/interface/driver/@queues attribute

This attribute is going to represent number of queues for
multique vhost network interface. This commit implements XML
extension part of the feature and add one test as well. For now,
we can only do xml2xml test as qemu command line generation code
is not adapted yet.

11 years agoqemu: add ', share=<policy>' to qemu commandline
Guannan Ren [Tue, 21 May 2013 14:31:49 +0000 (22:31 +0800)]
qemu: add ', share=<policy>' to qemu commandline

example: qemu ${otherargs} \
             -vnc 127.0.0.1:0,share=allow-exclusive

11 years agoconf: add 'sharePolicy' attribute to graphics element for vnc
Guannan Ren [Tue, 21 May 2013 14:31:48 +0000 (22:31 +0800)]
conf: add 'sharePolicy' attribute to graphics element for vnc

 -vnc :5900,share=allow-exclusive
allows clients to ask for exclusive access which is
implemented by dropping other connections Connecting
multiple clients in parallel requires all clients asking
for a shared session (vncviewer: -shared switch)

 -vnc :5900,share=force-shared
disables exclusive client access.  Useful for shared
desktop sessions, where you don't want someone forgetting
specify -shared disconnect everybody else.

 -vnc :5900,share=ignore
completely ignores the shared flag and allows everybody
connect unconditionally

11 years agoqemu: new vnc display sharing policy caps flag
Guannan Ren [Tue, 21 May 2013 14:31:47 +0000 (22:31 +0800)]
qemu: new vnc display sharing policy caps flag

QEMU_CAPS_VNC_SHARE_POLICY (qemu >= 1.1)

11 years agovbox: fix VIR_STRDUP value check
Ján Tomko [Mon, 20 May 2013 09:48:34 +0000 (11:48 +0200)]
vbox: fix VIR_STRDUP value check

In my review of 31532ca I missed the fact that VIR_STRDUP
now returns 1 on success, and 0 if the source was NULL.

(This still doesn't add proper OOM error handling.)

11 years agosyntax-check: Add the rule to forbid whitespace before ";"
Osier Yang [Tue, 21 May 2013 10:01:01 +0000 (18:01 +0800)]
syntax-check: Add the rule to forbid whitespace before ";"

Only a few cases are allowed:

1) The expression is empty for "for" loop, E.g.

  for (i = 0; ; i++)

2) An empty statement

  while (write(statuswrite, &status, 1) == -1 &&
         errno == EINTR)
      ; /* empty */

3) ";" is inside double-quote, I.e, as part of const string. E.g.

  vshPrint(ctl, "a ; b ; cd;\n");

The "for" loop in src/rpc/virnettlscontext.c is the special case,
1) applies for it, so change it together in this patch.

11 years agonwfilter: Change the comment style
Osier Yang [Tue, 21 May 2013 10:01:00 +0000 (18:01 +0800)]
nwfilter: Change the comment style

The more common habit is to add the comment after the statements.

11 years agoFix the syntax-check failure
Osier Yang [Wed, 22 May 2013 05:12:34 +0000 (13:12 +0800)]
Fix the syntax-check failure

Introduced by commit 7ac2c4fe624, pushed under build-breaker rule.

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