Commit Graph

13686 Commits

Author SHA1 Message Date
Michal Privoznik
dc6f2dadac Introduce OOM reporting to virAsprintf
Actually, I'm turning this function into a macro as filename,
function name and line number needs to be passed. The new
function virAsprintfInternal is introduced with the extended set
of arguments.
2013-07-10 11:07:31 +02:00
Michal Privoznik
8290cbbc38 viralloc: Report OOM error on failure
Similarly to VIR_STRDUP, we want the OOM error to be reported in
VIR_ALLOC and friends.
2013-07-10 11:07:31 +02:00
Martin Kletzander
1cdaebf237 Properly detect VMDK with internal version 2
Initially proposed as [1], but then changed to comment fix only.  VMDK
can have internal version set to 2 when there are few features added
which do not affect us.  Thanks to Jan's commit a1ee8e18 this can be
easily fixed by adding it to list of supported versions.

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

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=836676
2013-07-10 10:17:18 +02:00
Eric Blake
1e503ee534 build: honor autogen.sh --no-git
Based on a report by Chandrashekar Shastri, at
https://bugzilla.redhat.com/show_bug.cgi?id=979360

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

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-09 16:15:29 -06:00
Eric Blake
040d3f7758 maint: tweak use of <a> in HACKING
The previous handling of <a> tags led to some less-than-ideal
layout in HACKING (most noticeable on a mid-sentence reference
to the valgrind home page).

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-09 11:49:20 -06:00
Eric Blake
5598f81fe6 maint: fix typo in qemu error message
Introduced in commit d47eff88.

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-09 11:39:07 -06:00
Cole Robinson
0be94418a8 daemon: Fix command example in libvirtd.sasl
sasldblistusers2 doesn't have a '-a' option
2013-07-09 10:01:55 -04:00
Gao feng
468ee0bc4d LXC: hostdev: create parent directory for hostdev
Create parent directroy for hostdev automatically when we
start a lxc domain or attach a hostdev to a lxc domain.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-07-09 11:16:20 +01:00
Gao feng
c0d8c7c885 LXC: hostdev: introduce lxcContainerSetupHostdevCapsMakePath
This helper function is used to create parent directory for
the hostdev which will be added to the container. If the
parent directory of this hostdev doesn't exist, the mknod of
the hostdev will fail. eg with /dev/net/tun

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-07-09 11:15:11 +01:00
Richard Weinberger
9a0ac6d9c2 LXC: Create /dev/tty within a container
Many applications use /dev/tty to read from stdin.
e.g. zypper on openSUSE.

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

Signed-off-by: Richard Weinberger <richard@nod.at>
2013-07-09 11:05:14 +01:00
Viktor Mihajlovski
2c94e00c60 scsi: Fix construction of sysfs device path
The device bus value was used instead of the device target when
building the sysfs device path. Trivial.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
2013-07-09 11:23:54 +08:00
Peter Krempa
2ce63c1611 selinux: Always generate imagelabel
The imagelabel SELinux label was only generated when relabeling was
enabled. This prohibited labeling of files created by libvirt that need
to be labeled even if relabeling is turned off.

The only codepath this change has direct impact on is labeling of FDs
passed to qemu which is always safe in current state.
2013-07-08 15:04:20 +02:00
Peter Krempa
e45ee23c59 selinux: Cleanup coding style 2013-07-08 15:04:07 +02:00
John Ferlan
a443c3a77a Resolve Coverity complaints in tests/securityselinuxlabeltest.c
Two complaints of RESOURCE_FREE due to going to cleanup prior to a
VIR_FREE(line).  Two complaints of FORWARD_NULL due to 'tmp' being
accessed after a strchr() without first checking if the return was NULL.

While looking at the code it seems that 'line' need only be allocated
once as the while loop will keep reading into line until eof causing
an unreported leak since line was never VIR_FREE()'d at the bottom of
the loop.
2013-07-08 07:03:21 -04:00
Jiri Denemark
59cc0fe5aa qemu: Set RLIMIT_MEMLOCK when memoryBacking/locked is used
If a domain is configured to have all its memory locked, we need to set
RLIMIT_MEMLOCK so that QEMU is actually allowed to lock the memory.
2013-07-08 12:35:28 +02:00
Jiri Denemark
6d8ebc7538 qemu: Use qemuDomainMemoryLimit when computing memory for VFIO 2013-07-08 12:35:27 +02:00
Jiri Denemark
e0e438af00 qemu: Move memory limit computation to a reusable function 2013-07-08 12:35:27 +02:00
Jiri Denemark
86dba8f3de Don't spam logs with "port 0 must be in range" errors
Whenever virPortAllocatorRelease is called with port == 0, it complains
that the port is not in an allowed range, which is expectable as the
port was never allocated. Let's make virPortAllocatorRelease ignore 0
ports in a similar way free() ignores NULL pointers.
2013-07-08 12:27:58 +02:00
Jiri Denemark
0d7dc70824 qemu: Release correct websocket port 2013-07-08 12:27:58 +02:00
Jiri Denemark
d4ce75ba76 Paused domain should remain paused after migration
https://bugzilla.redhat.com/show_bug.cgi?id=981139

If a domain is paused before migration starts, we need to tell that to
the destination libvirtd to prevent it from resuming the domain at the
end of migration. This regression was introduced by commit 5379bb0.
2013-07-08 12:27:58 +02:00
Ján Tomko
2e4dd4107e conf: don't check hyperv spinlock retries if disabled
<hyperv>
  <spinlocks state='off'/>
</hyperv>

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

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

https://bugzilla.redhat.com/show_bug.cgi?id=784836#c19
2013-07-04 18:39:56 +02:00
Jiri Denemark
db0a18a165 Fix NULL dereference caused by ACL filtering of domains
Caused by 763973607d.
2013-07-04 16:55:53 +02:00
Ján Tomko
fe89fd3b40 Unlock the storage volume object after looking it up
Introduced by c930410.

https://bugzilla.redhat.com/show_bug.cgi?id=980676
2013-07-04 14:41:46 +02:00
Ján Tomko
4b91dc24d1 Fix build with clang
Partially revert cdd703f's revert of c163410, as linking with clang
with --param=ssp-buffer-size=4 still fails with:
"argument unused during compilation".
2013-07-04 11:35:59 +02:00
Marek Marczykowski-Górecki
1d76326536 libxl: fix deadlock in libxlReconnectDomain
Use virDomainObjListRemoveLocked instead of virDomainObjListRemove, as
driver->domains is already taken by virDomainObjListForEach.

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

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2013-07-03 14:43:31 -06:00
Marek Marczykowski-Górecki
8f65fcb4a4 conf: virDomainObjListRemoveLocked function
While iterating with virDomainObjListForEach it is safe to remove
current element. But while iterating, 'doms' lock is already taken, so
can't use standard virDomainObjListRemove. So introduce
virDomainObjListRemoveLocked for this purpose.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2013-07-03 14:42:51 -06:00
Eric Blake
cdd703f475 maint: update to latest gnulib
The latest mingw headers on Fedora 19 fail to build with gnulib
without an update.

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

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-03 11:02:33 -06:00
Daniel P. Berrange
57f2e3274d Extend the ACL test case to validate filter rule checks
The 'check-aclrules' test case validates that there are ACL
checks in each method. This extends it so that it can also
validate that methods which return info about lists of objects,
will filter their returned info throw an ACL check.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:54 +01:00
Daniel P. Berrange
71f2434fe7 Add access control filtering of interface objects
Ensure that all APIs which list interface objects filter
them against the access control system.

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

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:54 +01:00
Daniel P. Berrange
70b1573fc1 Add access control filtering of nwfilter objects
Ensure that all APIs which list nwfilter objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
f02d65041c Add access control filtering of secret objects
Ensure that all APIs which list secret objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
323049a089 Add access control filtering of storage objects
Ensure that all APIs which list storage objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
b1f3029afd Add access control filtering of node device objects
Ensure that all APIs which list node device objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
bbaa4e1cba Add access control filtering of network objects
Ensure that all APIs which list network objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
4d39952ebe Change signature of ACL filter functions
Change the ACL filter functions to use a 'bool' return
type instead of a tri-state 'int' return type. The callers
of these functions don't want to distinguish 'auth failed'
from other errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Daniel P. Berrange
763973607d Add access control filtering of domain objects
Ensure that all APIs which list domain objects filter
them against the access control system.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-07-03 15:54:53 +01:00
Guido Günther
9d5d4700c2 Put virt-sanlock-cleanup into section 8
as indicated by the filename.
2013-07-03 15:06:36 +02:00
Martin Kletzander
a72582cb91 qemu: Allow seamless migration for domains with multiple graphics
Since commit 23e8b5d8, the code is refactored in a way that supports
domains with multiple graphics elements and commit 37b415200 allows
starting such domains.  However none of those commits take migration
into account.  Even though qemu doesn't support relocation for
anything else than SPICE and for no more than one graphics, there is no
reason to hardcode one graphics into this part of the code as well.
2013-07-03 14:58:01 +02:00
Martin Kletzander
556808ec9d qemu: Don't miss errors when changing graphics passwords
Commit 23e8b5d8e7 forgot to check the
return value for all calls to qemuDomainChangeGraphicsPasswords().
2013-07-03 14:56:13 +02:00
Gao feng
350fd95f40 LXC: blkio: allow to setup weight_device
libivrt lxc can only set generic weight for container,
This patch allows user to setup per device blkio
weigh for container.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-07-03 12:35:54 +01:00
Gao feng
e7b3349f5a LXC: fix memory leak when userns configuration is incorrect
We forgot to free the stack when Kernel doesn't
support user namespace.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
2013-07-03 12:19:50 +01:00
Michal Privoznik
5995fcf04a virNetDevBandwidthUnplug: Don't leak @cmd
When removing a TAP device, the associated bandwidth settings are
removed. Currently, the /sbin/tc is used for that. It is spawned
several times. Moreover, we use the same @cmd variable to
construct the command and its arguments. That means we need to
virCommandFree(cmd); prior to each virCommandNew(TC); which
wasn't done.
2013-07-03 09:43:14 +02:00
Michal Privoznik
bc13222185 virCgroupNewPartition: Don't leak @newpath
The @newpath variable is allocated in virCgroupSetPartitionSuffix(). But
it's newer freed.
2013-07-03 09:42:11 +02:00
Chen Fan
36bac65d8a qemu: Implement 'oncrash' coredump events when guest panicked
Add doDumpCoreToAutoPath to implement
'coredump-destroy' and 'coredump-restart' events of the 'on_crash'
in the XML when domain crashed.
2013-07-02 12:02:31 -06:00
Chen Fan
9aa527dccb qemu: Implement 'oncrash' events when guest panicked
Add monitor callback API domainGuestPanic, that implements
'destroy', 'restart' and 'preserve' events of the 'on_crash'
in the XML when domain crashed.
2013-07-02 12:02:30 -06:00
Chen Fan
e8ccf7ed8a qemu: expose qemuProcessShutdownOrReboot()
Later code will need this outside of qemu_process.c
2013-07-02 12:02:27 -06:00
Chen Fan
bcf0c14491 qemu: refactor processWatchdogEvent
Split the code to make the driver workpool more generalized
2013-07-02 12:02:27 -06:00
Chen Fan
14e7e0ae8d libvirt: Define domain crash event types
This patch introduces domain crashed types and crashed reasons which
will be used while guest panicked.
2013-07-02 12:02:27 -06:00
Eric Blake
336bf8e28b build: don't ship access syms files in tarball
On a mingw VPATH build (such as done by ./autobuild.sh), the tarball
created by 'make dist' was including generated files.  The VPATH
rules were then seeing that the tarball files were up-to-date, and
not regenerating files locally, leading to this failure:

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

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

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

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-02 11:49:32 -06:00
Daniel P. Berrange
1165e39ca3 Add some misc debugging to LXC startup
Add some debug logging of LXC wait/continue messages
and uid/gid map update code.
2013-07-02 14:00:13 +01:00