]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agocgroups: Do not enforce nonexistent controllers
Viktor Mihajlovski [Thu, 23 May 2013 13:26:31 +0000 (15:26 +0200)]
cgroups: Do not enforce nonexistent controllers

Currently, the controllers argument to virCgroupDetect acts both as
a result filter and a required controller specification, which is
a bit overloaded. If both functionalities are needed, it would be
better to have them seperated into a filter and a requirement mask.
The only situation where it is used today is to ensure that only
CPU related controllers are used for the VCPU directories. But here
we clearly do not want to enforce the existence of cpu, cpuacct and
specifically not cpuset at the same time.
This commit changes the semantics of controllers to "filter only".
Should a required mask ever be needed, more work will have to be done.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agovirsh: Fix regression of vol-resize
Osier Yang [Fri, 24 May 2013 03:59:14 +0000 (11:59 +0800)]
virsh: Fix regression of vol-resize

Introduced by commit 1daa4ba33acf. vshCommandOptStringReq returns
0 on *success* or the option is not required && not present, both
are right result. Error out when returning 0 is not correct.
the caller, it doesn't have to check wether it

11 years agoIntroduce syntax-check rule to prefer VIR_STRDUP over strdup
Michal Privoznik [Thu, 4 Apr 2013 18:16:43 +0000 (20:16 +0200)]
Introduce syntax-check rule to prefer VIR_STRDUP over strdup

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c
Michal Privoznik [Thu, 23 May 2013 07:51:59 +0000 (09:51 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in tools/virsh.c

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/*
Michal Privoznik [Fri, 24 May 2013 07:19:51 +0000 (09:19 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/*

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c
Michal Privoznik [Fri, 24 May 2013 07:19:34 +0000 (09:19 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/util/vircgroup.c

This commit is separate due to unusual paradigm compared to the
most source files.

11 years agovirCgroupAddTaskStrController: s/-1/-ENOMEM/
Michal Privoznik [Fri, 24 May 2013 07:49:54 +0000 (09:49 +0200)]
virCgroupAddTaskStrController: s/-1/-ENOMEM/

Within whole vircgroup.c we 'return -errno', e.g. 'return -ENOMEM'.
However, in this specific function virCgroupAddTaskStrController
we weren't returning -ENOMEM but -1 despite fact that later in
the function we are returning one of errno values indeed.

11 years agoxen: Resolve Coverity FORWARD_NULL issue
John Ferlan [Thu, 23 May 2013 15:07:36 +0000 (11:07 -0400)]
xen: Resolve Coverity FORWARD_NULL issue

Commit '18b14012' refactored the Xen code resulting in a Coverity
warning about possible NULL reference if the path where the XM driver
takes puts the def on it's list.  Moved/duplicated the virGetDomain()
call to pacify the possible NULL deref.

11 years agodocs: domain: /dev/urandom isn't a valid rng patch
Cole Robinson [Thu, 23 May 2013 18:37:08 +0000 (14:37 -0400)]
docs: domain: /dev/urandom isn't a valid rng patch

Only /dev/random and /dev/hwrng are accepted, list them explicitly.

11 years agoconf: add missing OOM errors
Ján Tomko [Wed, 22 May 2013 10:56:37 +0000 (12:56 +0200)]
conf: add missing OOM errors

11 years agoqemu: fix NBD migration to hosts with IPv6 enabled
Ján Tomko [Thu, 23 May 2013 13:51:05 +0000 (15:51 +0200)]
qemu: fix NBD migration to hosts with IPv6 enabled

Since f03dcc5 we use [::] as the listening address both on qemu
command line in -incoming and in nbd-server-start QMP command.
However the latter requires just :: without the braces.

11 years agoconf: fix use after free in virChrdevOpen
Ján Tomko [Wed, 22 May 2013 10:56:23 +0000 (12:56 +0200)]
conf: fix use after free in virChrdevOpen

Don't free the stream on error if we've successfully added it
to the hash table, since it will be freed by virChrdevHashEntryFree
callback.

Preserve the error message before calling virStreamFree, since it
resets the error.

Introduced by 4716138, crashing since 6921892.

Reported by Sergey Fionov on libvir-list.

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

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

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

11 years agovirNetMessageSaveError: Fix copy and paste error
Michal Privoznik [Thu, 23 May 2013 13:47:47 +0000 (15:47 +0200)]
virNetMessageSaveError: Fix copy and paste error

Previously, we were freeing verr fields instead of rerr which we've
allocated just a line above.

11 years agovirNWFilterHashTablePut: Free the correct variable
Michal Privoznik [Thu, 23 May 2013 13:40:42 +0000 (15:40 +0200)]
virNWFilterHashTablePut: Free the correct variable

In bf1fe848 I've introduced 'newName' variable to substitute the old
'const char *name' as previously we had an ugly code there:

  name = strdup(name);

However, some parts of the function were not updated, so they were still
calling VIR_FREE(name) instead of VIR_FREE(newName).

11 years agoumlConnectTapDevice: initialize tapfd variable
Michal Privoznik [Thu, 23 May 2013 13:22:35 +0000 (15:22 +0200)]
umlConnectTapDevice: initialize tapfd variable

There is possibility to jump to 'cleanup' label without tapfd variable
being initialized. In the label, VIR_FORCE_CLOSE(tapfd) is called which
can have fatal consequences.

11 years agoremote: fix dom->id after virDomainCreateWithFlags
Marek Marczykowski [Thu, 23 May 2013 00:01:30 +0000 (02:01 +0200)]
remote: fix dom->id after virDomainCreateWithFlags

The same issue as (already fixed) in virDomainCreate -
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS doesn't return new domain ID, only
-1 on error or 0 on success.

Besides this one fix it is more general problem - local domain object
ID can desynchronize with the real one, for example in case of another
client creates/destroys domain in the meantime. Perhaps virDomainGetID
should be called remotely (with all performance implications...)? Or
some event-based notification used?

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
11 years agoFix the build failure
Osier Yang [Thu, 23 May 2013 11:58:28 +0000 (19:58 +0800)]
Fix the build failure

Commit 16251193afdc forgot to include "virstring.h". Pushed under
build-breaker rule.

11 years agovirsh: Fix virDomainFree for NULL domain in blkdeviotune
Martin Kletzander [Thu, 23 May 2013 10:24:08 +0000 (12:24 +0200)]
virsh: Fix virDomainFree for NULL domain in blkdeviotune

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

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

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

11 years agoAdapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/*
Michal Privoznik [Mon, 20 May 2013 09:23:13 +0000 (11:23 +0200)]
Adapt to VIR_STRDUP and VIR_STRNDUP in src/qemu/*

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)