]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoxenapi: fix coding style in xenapi_driver.c
Hongwei Bi [Tue, 22 Oct 2013 18:20:17 +0000 (02:20 +0800)]
xenapi: fix coding style in xenapi_driver.c

Fix the if statement coding style.

Signed-off-by: Hongwei Bi <hwbi2008@gmail.com>
11 years agostorage: use correct type for array count
Eric Blake [Wed, 30 Oct 2013 21:42:31 +0000 (15:42 -0600)]
storage: use correct type for array count

Using size_t counts will let us use VIR_APPEND_ELEMENT and friends.

* src/conf/storage_conf.h (_virStoragePoolObjList)
(_virStorageVolDefList): Track list sizes with size_t.
* src/storage/storage_backend_rbd.c
(virStorageBackendRBDRefreshPool): Fix type fallout.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: avoid further typedef accidents
Eric Blake [Tue, 29 Oct 2013 19:57:19 +0000 (13:57 -0600)]
maint: avoid further typedef accidents

To make it easier to forbid future attempts at a confusing typedef
name ending in Ptr that isn't actually a pointer, insist that we
follow our preferred style of 'typedef foo *fooPtr'.

* cfg.mk (sc_forbid_const_pointer_typedef): Enforce consistent
style, to prevent issue fixed in previous storage patch.
* src/conf/capabilities.h (virCapsPtr): Fix offender.
* src/security/security_stack.c (virSecurityStackItemPtr):
Likewise.
* tests/qemucapabilitiestest.c (testQemuDataPtr): Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodocs: generate links from plain text documentation
Claudio Bley [Mon, 14 Jan 2013 12:37:02 +0000 (13:37 +0100)]
docs: generate links from plain text documentation

There are two forms used throughout libvirt code comments, which
are both supported by this patch.

* plain links like e.g. http://www.libvirt.org/
* links enclosed in <> characters, e.g. <http://www.libvirt.org/>

Signed-off-by: Claudio Bley <cbley@av-test.de>
11 years agolibvirt.c: indent code of virDomainGetMemoryParameters's documentation
Claudio Bley [Wed, 30 Jan 2013 09:42:21 +0000 (10:42 +0100)]
libvirt.c: indent code of virDomainGetMemoryParameters's documentation

By indenting code inside of comments, it gets recognized as a
code block when generating the HTML documentation.

11 years agolibvirt.c: add 2 spaces of indentation to example code of virStreamSend
Claudio Bley [Wed, 30 Jan 2013 15:18:23 +0000 (16:18 +0100)]
libvirt.c: add 2 spaces of indentation to example code of virStreamSend

See libvirt-libvirt.html#virStreamSend for the effect.

11 years agodocs: define style of code blocks inside descriptions
Claudio Bley [Tue, 22 Jan 2013 13:41:58 +0000 (14:41 +0100)]
docs: define style of code blocks inside descriptions

11 years agodocs: add class "description" to div's containing descriptions
Claudio Bley [Tue, 22 Jan 2013 13:39:41 +0000 (14:39 +0100)]
docs: add class "description" to div's containing descriptions

11 years agodocs: process code blocks similar to Markdown
Claudio Bley [Tue, 22 Jan 2013 12:45:11 +0000 (13:45 +0100)]
docs: process code blocks similar to Markdown

Wrap pre-formatted example code in <code> elements. This works
similar to Markdown[1] code blocks[2]:

Every line indented with at least 2 spaces is considered a code
block and gets wrapped in <pre> and <code> tags.

Look at the documentation for e.g. virStreamSend for before-and-after
effects.

[1] http://daringfireball.net/projects/markdown/
[2] http://daringfireball.net/projects/markdown/syntax#precode

11 years agoFix race condition reconnecting to vms & loading configs
Daniel P. Berrange [Mon, 28 Oct 2013 11:49:18 +0000 (11:49 +0000)]
Fix race condition reconnecting to vms & loading configs

The following sequence

 1. Define a persistent QMEU guest
 2. Start the QEMU guest
 3. Stop libvirtd
 4. Kill the QEMU process
 5. Start libvirtd
 6. List persistent guests

At the last step, the previously running persistent guest
will be missing. This is because of a race condition in the
QEMU driver startup code. It does

 1. Load all VM state files
 2. Spawn thread to reconnect to each VM
 3. Load all VM config files

Only at the end of step 3, does the 'virDomainObjPtr' get
marked as "persistent". There is therefore a window where
the thread reconnecting to the VM will remove the persistent
VM from the list.

The easy fix is to simply switch the order of steps 2 & 3.

In addition to this though, we must only attempt to reconnect
to a VM which had a non-zero PID loaded from its state file.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix leak of objects when reconnecting to QEMU instances
Daniel P. Berrange [Tue, 29 Oct 2013 13:58:00 +0000 (13:58 +0000)]
Fix leak of objects when reconnecting to QEMU instances

The 'error' cleanup block in qemuProcessReconnect() had a
'return' statement in the middle of it. This caused a leak
of virConnectPtr & virQEMUDriverConfigPtr instances. This
was identified because netcf recently started checking its
refcount in libvirtd shutdown:

netcfStateCleanup:109 : internal error: Attempt to close netcf state driver with open connections

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't update dom->persistent without lock held
Daniel P. Berrange [Mon, 28 Oct 2013 14:07:26 +0000 (14:07 +0000)]
Don't update dom->persistent without lock held

virDomainObjListLoadAllConfigs sets dom->persistent after
having released its lock on the domain object. This exposes
a possible race condition.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agodocs: fix typos in formatnwfilter
Chen Hanxiao [Wed, 30 Oct 2013 01:11:51 +0000 (09:11 +0800)]
docs: fix typos in formatnwfilter

s/initated/initiated

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoMacOS: Re-add support for QEMU backend
Doug Goldstein [Mon, 28 Oct 2013 18:20:35 +0000 (13:20 -0500)]
MacOS: Re-add support for QEMU backend

The QEMU backend was disabled on Mac OS X without a reason in the code
and due to refactors its difficult to understand when/why it was
disabled. With QEMU being supported on Mac OS X there is no reason to
disable QEMU on this platform.

11 years agoAdd '+' to uid/gid printing for label processing
John Ferlan [Tue, 22 Oct 2013 07:50:08 +0000 (08:50 +0100)]
Add '+' to uid/gid printing for label processing

To ensure proper processing by virGetUserID() and virGetGroupID()
of a uid/gid add a "+" prior to the uid/gid to denote it's really
a uid/gid for the label.

11 years agostorage: fix incorrect typedef
Eric Blake [Tue, 29 Oct 2013 15:56:48 +0000 (09:56 -0600)]
storage: fix incorrect typedef

The rbd code had a confusing typedef ending in Ptr that was not
actually a pointer, which made the rest of the code harder to
read.  This fixes things to actually pass by pointer rather than
by copy.

* src/storage/storage_backend_rbd.c (virStorageBackendStatePtr):
Fix typedef.
(virStorageBackendRBDOpenRADOSConn)
(virStorageBackendRBDCloseRADOSConn)
(volStorageBackendRBDRefreshVolInfo)
(virStorageBackendRBDRefreshPool, virStorageBackendRBDDeleteVol)
(virStorageBackendRBDCreateVol, virStorageBackendRBDRefreshVol)
(virStorageBackendRBDResizeVol): Fix fallout.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoapparmor: Fix typo in function name in driver struct initialization
Peter Krempa [Tue, 29 Oct 2013 16:01:22 +0000 (17:01 +0100)]
apparmor: Fix typo in function name in driver struct initialization

Commit 64a68a4a introduced a typo in the initialization of the apparmor
driver structure breaking the build with apparmor enabled.

11 years agoqemu: fix well-formed migration URI formatting
Michael Chapman [Wed, 23 Oct 2013 04:15:12 +0000 (15:15 +1100)]
qemu: fix well-formed migration URI formatting

When adding an automatically allocated port to a well-formed migration
URI, keep it well-formed:

  tcp://1.2.3.4/  ->  tcp://1.2.3.4/:12345   # wrong
  tcp://1.2.3.4/  ->  tcp://1.2.3.4:12345/   # fixed
  tcp://1.2.3.4   ->  tcp://1.2.3.4:12345    # still works
  tcp:1.2.3.4     ->  tcp:1.2.3.4:12345      # still works (old syntax)

Signed-off-by: Michael Chapman <mike@very.puzzling.org>
11 years agoLXC: don't free tty before using it in lxcContainerSetupDevices
Gao feng [Tue, 29 Oct 2013 06:19:35 +0000 (14:19 +0800)]
LXC: don't free tty before using it in lxcContainerSetupDevices

Introduced by commit 0f31f7b.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
11 years agoPush RPM deps down into libvirt-daemon-driver-XXXX sub-RPMs
Daniel P. Berrange [Tue, 29 Oct 2013 11:27:45 +0000 (11:27 +0000)]
Push RPM deps down into libvirt-daemon-driver-XXXX sub-RPMs

For inexplicable reasons, many of the 3rd party package deps
were left against the 'libvirt-daemon' RPM when the drivers
were split out. This makes a minimal install heavier that
it should be. Push them all down into libvirt-daemon-driver-XXX
so they're only pulled in when truly needed

With this change applied, a minimal install of just the
libvirt-daemon-driver-lxc RPM is reduced by 41 MB on a
Fedora 19 host.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agocapabilities: add baselabel per sec driver/virt type to secmodel
Giuseppe Scrivano [Fri, 18 Oct 2013 12:13:21 +0000 (14:13 +0200)]
capabilities: add baselabel per sec driver/virt type to secmodel

Expand the "secmodel" XML fragment of "host" with a sequence of
baselabel's which describe the default security context used by
libvirt with a specific security model and virtualization type:

<secmodel>
  <model>selinux</model>
  <doi>0</doi>
  <baselabel type='kvm'>system_u:system_r:svirt_t:s0</baselabel>
  <baselabel type='qemu'>system_u:system_r:svirt_tcg_t:s0</baselabel>
</secmodel>
<secmodel>
  <model>dac</model>
  <doi>0</doi>
  <baselabel type='kvm'>107:107</baselabel>
  <baselabel type='qemu'>107:107</baselabel>
</secmodel>

"baselabel" is driver-specific information, e.g. in the DAC security
model, it indicates USER_ID:GROUP_ID.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agosecurity: add new internal function "virSecurityManagerGetBaseLabel"
Giuseppe Scrivano [Fri, 18 Oct 2013 12:13:20 +0000 (14:13 +0200)]
security: add new internal function "virSecurityManagerGetBaseLabel"

virSecurityManagerGetBaseLabel queries the default settings used by
a security model.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agosecurity: use a single function to set DAC user and group
Giuseppe Scrivano [Fri, 18 Oct 2013 12:13:19 +0000 (14:13 +0200)]
security: use a single function to set DAC user and group

Merge the functions 'virSecurityDACSetUser' and
'virSecurityDACSetGroup' into 'virSecurityDACSetUserAndGroup'.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agovirsh: new environment variable VIRSH_HISTSIZE
Pavel Raiskup [Mon, 28 Oct 2013 13:38:46 +0000 (14:38 +0100)]
virsh: new environment variable VIRSH_HISTSIZE

Allow adjust the number of commands to remember in the command
history.

* tools/virsh.c (vshReadlineInit): Read and sanity the
VIRSH_HISTSIZE variable.
(VIRSH_HISTSIZE_MAX): New constant.
* tools/virsh.pod: Document VIRSH_HISTSIZE variable.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agomaint: update to latest gnulib
Eric Blake [Mon, 28 Oct 2013 21:47:20 +0000 (15:47 -0600)]
maint: update to latest gnulib

Since we haven't quite frozen yet, it's time to pick up some
gnulib fixes.  I know at least cygwin benefits from this update.

* .gnulib: Update to latest, in part for cygwin compilation.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoSkip debug message in lxcContainerSetID if no map is set.
Chen Hanxiao [Mon, 28 Oct 2013 11:18:26 +0000 (11:18 +0000)]
Skip debug message in lxcContainerSetID if no map is set.

The lxcContainerSetID() method prints a misleading log
message about setting the uid/gid when no ID map is
present in the XML config. Skip the debug message in
this case.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agodoc: fix a typo in formatdomain
Chen Hanxiao [Fri, 25 Oct 2013 03:51:06 +0000 (11:51 +0800)]
doc: fix a typo in formatdomain

s/no/not

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoAvoid Coverity DEADCODE warning
John Ferlan [Fri, 18 Oct 2013 10:43:47 +0000 (06:43 -0400)]
Avoid Coverity DEADCODE warning

Commit '922b7fda' resulted in two DEADCODE warnings from Coverity in
remoteDispatchAuthPolkit and virAccessDriverPolkitFormatProcess.
Commit '604ae657' modified the daemon.c code to remove the deadcode
issue, but did not do so for viracessdriverpolkit.c. This just mimics
the same changes

11 years agovirsh: undocument --shareable (--mode already covers it)
Eric Blake [Thu, 24 Oct 2013 07:15:56 +0000 (08:15 +0100)]
virsh: undocument --shareable (--mode already covers it)

Commit e962a57 added 'attach-disk --shareable', even though we
already had 'attach-disk --mode=shareable'.  Worse, if the user
types 'attach-disk --mode=readonly --shareable', we create
non-sensical XML.  The best solution is just to undocument the
duplicate spelling, by having it fall back to the preferred
spelling.

* tools/virsh-domain.c (cmdAttachDisk): Let alias handling fix our
mistake in exposing a second spelling for an existing option.
* tools/virsh.pod: Fix documentation.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirsh: allow alias to expand to opt=value pair
Eric Blake [Thu, 24 Oct 2013 07:06:29 +0000 (08:06 +0100)]
virsh: allow alias to expand to opt=value pair

We want to treat 'attach-disk --shareable' as an undocumented
alias for 'attach-disk --mode=shareable'.  By improving our
alias handling, we can allow all such --bool -> --opt=value
replacements, and guarantee up front that the alias is not
mixed with its replacement.

* tools/virsh.c (vshCmddefOptParse, vshCmddefGetOption): Add
support for expanding bool alias to --opt=value.
(opts_echo): Add another alias to test it.
* tests/virshtest.c (mymain): Test it.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agolibxl: Fix possible invalid read
Martin Kletzander [Thu, 24 Oct 2013 09:21:07 +0000 (10:21 +0100)]
libxl: Fix possible invalid read

According to the following valgrind output, there seems to be a
invalid limit for the iterator (captured on Fedora 19):

==3945== Invalid read of size 1
==3945==    at 0x1E1FA410: libxlVmStart (libxl_driver.c:475)
==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
==3945==    by 0x8758E1C: clone (clone.S:113)
==3945==  Address 0x23424d81 is 0 bytes after a block of size 1 alloc'd
==3945==    at 0x4A08121: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3945==    by 0x50B1F8C: virAllocN (viralloc.c:189)
==3945==    by 0x1E1FA3CA: libxlVmStart (libxl_driver.c:468)
==3945==    by 0x1E1FAD9A: libxlDomainCreateWithFlags (libxl_driver.c:2633)
==3945==    by 0x5187D46: virDomainCreate (libvirt.c:9439)
==3945==    by 0x13BAA6: remoteDispatchDomainCreateHelper (remote_dispatch.h:2910)
==3945==    by 0x51DE5B9: virNetServerProgramDispatch (virnetserverprogram.c:435)
==3945==    by 0x51D93E7: virNetServerHandleJob (virnetserver.c:165)
==3945==    by 0x50F5BF4: virThreadPoolWorker (virthreadpool.c:144)
==3945==    by 0x50F5670: virThreadHelper (virthreadpthread.c:161)
==3945==    by 0x8046C52: start_thread (pthread_create.c:308)
==3945==    by 0x8758E1C: clone (clone.S:113)
==3945==

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1013045
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agovirsh: fix doc typos
Eric Blake [Thu, 24 Oct 2013 08:57:20 +0000 (09:57 +0100)]
virsh: fix doc typos

Reported in https://bugzilla.redhat.com/show_bug.cgi?id=1022872

* tools/virsh.pod: s/COMMMANDS/COMMANDS/

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoIgnore GNU Global tag files
Martin Kletzander [Wed, 23 Oct 2013 08:58:55 +0000 (09:58 +0100)]
Ignore GNU Global tag files

... the same way we ignore other TAGS

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
11 years agobuild: Fix prohibit_int_ijk (and iijjkk) on RHEL 5
Martin Kletzander [Tue, 22 Oct 2013 16:09:57 +0000 (17:09 +0100)]
build: Fix prohibit_int_ijk (and iijjkk) on RHEL 5

On RHEL 5, make syntax-check was failing because even strings like
'int isTempChain' matched the 'int i' rule.  To be honest, I haven't
found the root cause, but the change added makes it work as expected
and keeps the proper behavior on newer systems as well.

11 years agopython: Fix Create*WithFiles filefd passing
Marian Neagul [Tue, 22 Oct 2013 15:03:39 +0000 (16:03 +0100)]
python: Fix Create*WithFiles filefd passing

Commit d76227be added functions virDomainCreateWithFiles and
virDomainCreateXMLWithFiles, but there was a little piece missing in
python bindings.  This patch fixes proper passing of file descriptors
in the overwrites of these functions.

11 years agonetworkStartDhcpDaemon: Check for dnsmasqCapsRefresh failure
Hongwei Bi [Tue, 22 Oct 2013 13:38:01 +0000 (21:38 +0800)]
networkStartDhcpDaemon: Check for dnsmasqCapsRefresh failure

Currently, we ignore whether dnsmasqCapsRefresh succeeds or fails. We
shouldn't do that as we may generate wrong dnsmasq command line (what
is done just a few lines below).

Signed-off-by: Hongwei Bi <hwbi2008@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agorpc: Retrieve peer PID via new getsockopt() for Mac
Doug Goldstein [Sat, 12 Oct 2013 17:06:27 +0000 (12:06 -0500)]
rpc: Retrieve peer PID via new getsockopt() for Mac

While LOCAL_PEERCRED on the BSDs does not return the pid information of
the peer, Mac OS X 10.8 added LOCAL_PEERPID to retrieve the pid so we
should use that when its available to get that information.

11 years agomaint: typo fixes
Eric Blake [Tue, 22 Oct 2013 15:48:18 +0000 (16:48 +0100)]
maint: typo fixes

* ChangeLog-old: s/guarentee/guarantee/

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build of virt-login-shell on systems with older gnutls
Jim Fehlig [Tue, 22 Oct 2013 05:12:22 +0000 (23:12 -0600)]
build: fix build of virt-login-shell on systems with older gnutls

On systems where gnutls uses libgcrypt, I'm seeing the following
build failure

libvirt.c:314: error: variable 'virTLSThreadImpl' has initializer but incomplete type
libvirt.c:319: error: 'GCRY_THREAD_OPTION_PTHREAD' undeclared here (not in a function)
...

Fix by undefining WITH_GNUTLS_GCRYPT in config-post.h

11 years agoGet rid of shadowed booleans
Michal Privoznik [Tue, 22 Oct 2013 09:33:06 +0000 (10:33 +0100)]
Get rid of shadowed booleans

There are still two places where we are using 1bit width unsigned
integer to store a boolean. There's no real need for this and these
occurrences can be replaced with 'bool'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agobuild: fix linking virt-login-shell
Jim Fehlig [Mon, 21 Oct 2013 21:36:11 +0000 (15:36 -0600)]
build: fix linking virt-login-shell

After commit 3e2f27e1, I've noticed build failures of virt-login-shell
when libapparmor-devel is installed on the build host

CCLD     virt-login-shell
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-vircommand.o):
In function `virExec':
/home/jfehlig/virt/upstream/libvirt/src/util/vircommand.c:653: undefined
reference to `aa_change_profile'
collect2: error: ld returned 1 exit status

I was about to commit an easy fix under the build-breaker rule
(build-fix-1.patch), but thought to extend the notion of SECDRIVER_LIBS
to SECDRIVER_CFLAGS, and use both throughout src/Makefile.am where it
makes sense (build-fix-2.patch).

Should I just stick with the simple fix, or is something along the lines
of patch 2 preferred?

Regards,
Jim

>From a0f35945f3127ab70d051101037e821b1759b4bb Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@suse.com>
Date: Mon, 21 Oct 2013 15:30:02 -0600
Subject: [PATCH] build: fix virt-login-shell build with apparmor

With libapparmor-devel installed, virt-login-shell fails to link

CCLD     virt-login-shell
../src/.libs/libvirt-setuid-rpc-client.a(libvirt_setuid_rpc_client_la-vircommand.o): In function `virExec':
/home/jfehlig/virt/upstream/libvirt/src/util/vircommand.c:653: undefined reference to `aa_change_profile'
collect2: error: ld returned 1 exit status

Fix by linking libvirt_setuid_rpc_client with previously determined
SECDRIVER_LIBS in src/Makefile.am.  While at it, introduce SECDRIVER_CFLAGS
and use both throughout src/Makefile.am where it makes sense.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
11 years agovircgroupmock: Mock access() to some more files
Michal Privoznik [Tue, 22 Oct 2013 12:15:21 +0000 (13:15 +0100)]
vircgroupmock: Mock access() to some more files

Currently, if access(path, mode) is invoked, we check if @path has this
special prefix SYSFS_PREFIX. If it does, we modify the path a bit and
call realaccess. If it doesn't we act just like a wrapper and call
realaccess directly. However, we are mocking fopen() as well. And as one
can clearly see there, fopen("/proc/cgroups") will succeed. Hence, we
have an error in our mocked access(): We need to check whether @path is
not equal to /proc/cgroups as it may not exists on real system we're
running however we definitely know how to fopen() it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotests: Use lv_abs_top_builddir instead of bare abs_top_builddir
Michal Privoznik [Tue, 22 Oct 2013 11:29:13 +0000 (12:29 +0100)]
tests: Use lv_abs_top_builddir instead of bare abs_top_builddir

As stated in the comment above introduction of the lv_abs_top_builddir
variable, older automake doesn't provide abs_top_builddir variable.
Hence, we are creating our own one with lv_ prefix. However, when
exporting env variables to the tests, the variables are not evaluated
but only substituted. Hence:

  LIBVIRT_DRIVER_DIR="$(abs_top_builddir)/src/.libs"

is set to "/src/.libs" with old automake (even though we *think* we've
set the $abs_top_builddir variable just a few line above).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirsh: Fix job watching when STDIN is not a tty
Peter Krempa [Tue, 22 Oct 2013 14:01:26 +0000 (15:01 +0100)]
virsh: Fix job watching when STDIN is not a tty

In commit b46c4787dde79b015dad67dedda4ccf6ff1a3082 I changed the code to
watch long running jobs in virsh. Unfortunately I didn't take into
account that poll may get a hangup if the terminal is not a TTY and will
be closed.

This patch avoids polling the STDIN fd when there's no TTY.

11 years agodocs: fix some typos about 'informations'
Chen Hanxiao [Tue, 22 Oct 2013 03:02:43 +0000 (11:02 +0800)]
docs: fix some typos about 'informations'

s/informations/information

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agonodeinfo: fix physical memory size on Mac OS X
Ryota Ozaki [Sun, 20 Oct 2013 15:14:52 +0000 (00:14 +0900)]
nodeinfo: fix physical memory size on Mac OS X

HW_PHYSMEM is available on Mac OS X as well as FreeBSD, however,
its resulting value for Mac OS X is 32 bits. Mac OS X provides
HW_MEMSIZE that is 64 bits version of HW_PHYSMEM. We have to use it.

I tested the patch on Mac OS X 10.6.8, 10.7.4, 10.8.5 and FreeBSD 9.2.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
11 years agoqemu: fix removal of <interface type='hostdev'>
Laine Stump [Fri, 18 Oct 2013 09:34:53 +0000 (12:34 +0300)]
qemu: fix removal of <interface type='hostdev'>

This patch (and the two patches that precede it) resolve:

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

When libvirt was changed to delay the final cleanup of device removal
until the qemu process had signaled it with a DEVICE_DELETED event for
that device, the hostdev removal function
(qemuDomainRemoveHostDevice()) was written to properly handle the
removal of a hostdev that was actually an SRIOV virtual function
(defined with <interface type='hostdev'>). However, the function used
to search for a device matching the alias name provided in the
DEVICE_DELETED message (virDomainDefFindDevice()) would search through
the list of netdevs before hostdevs, so qemuDomainRemoveHostDevice()
was never called; instead the netdev function,
qemuDomainRemoveNetDevice() (which *doesn't* properly cleanup after
removal of <interface type='hostdev'>), was called.

(As a reminder - each <interface type='hostdev'> results in a
virDomainNetDef which contains a virDomainHostdevDef having a parent
type of VIR_DOMAIN_DEVICE_NET, and parent.data.net pointing back to
the virDomainNetDef; both Defs point to the same device info object
(and the info contains the device's "alias", which is used by qemu to
identify the device). The virDomainHostdevDef is added to the domain's
hostdevs list *and* the virDomainNetDef is added to the domain's nets
list, so searching either list for a particular alias will yield a
positive result.)

This function modifies the qemuDomainRemoveNetDevice() to short
circuit itself and call qemu DomainRemoveHostDevice() instead when the
actual device is a VIR_DOMAIN_NET_TYPE_HOSTDEV (similar logic to what
is done in the higher level qemuDomainDetachNetDevice())

Note that even if virDomainDefFindDevice() changes in the future so
that it finds the hostdev entry first, the current code will continue
to work properly.

11 years agoqemu: move qemuDomainRemoveNetDevice to avoid forward reference
Laine Stump [Fri, 18 Oct 2013 09:28:40 +0000 (12:28 +0300)]
qemu: move qemuDomainRemoveNetDevice to avoid forward reference

pure code movement to setup for next patch.

11 years agoqemu: simplify calling qemuDomainHostdevNetConfigRestore
Laine Stump [Fri, 18 Oct 2013 08:39:08 +0000 (11:39 +0300)]
qemu: simplify calling qemuDomainHostdevNetConfigRestore

This function was called in three places, and in each the call was
qualified by a slightly different conditional. In reality, this
function should only be called for a hostdev if all of the following
are true:

  1) mode='subsystem'
  2) type='pci'
  3) there is a parent device definition which is an <interface>
     (VIR_DOMAIN_DEVICE_NET)

We can simplify the callers and make them more consistent by checking
these conditions at the top ov qemuDomainHostdevNetConfigRestore and
returning 0 if one of them isn't satisfied.

The location of the call to qemuDomainHostdevNetConfigRestore() has
also been changed in the hot-plug case - it is moved into the caller
of its previous location (i.e. from qemuDomainRemovePCIHostDevice() to
qemuDomainRemoveHostDevice()). This was done to be more consistent
about which functions pay attention to whether or not this is one of
the special <interface> hostdevs or just a normal hostdev -
qemuDomainRemoveHostDevice() already contained a call to
networkReleaseActualDevice() and virDomainNetDefFree(), so it makes
sense for it to also handle the resetting of the device's MAC address
and vlan tag (which is what's done by
qemuDomainHostdevNetConfigRestore()).

11 years agoMove virt-login-shell into libvirt-login-shell sub-RPM
Daniel P. Berrange [Thu, 17 Oct 2013 13:18:18 +0000 (14:18 +0100)]
Move virt-login-shell into libvirt-login-shell sub-RPM

Many people will not want the setuid virt-login-shell binary
installed by default, so move it into a separate sub-RPM
named libvirt-login-shell. This RPM is only generated if
LXC is enabled

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoBlock all use of libvirt.so in setuid programs
Daniel P. Berrange [Thu, 10 Oct 2013 16:45:14 +0000 (17:45 +0100)]
Block all use of libvirt.so in setuid programs

Avoid people introducing security flaws in their apps by
forbidding the use of libvirt.so in setuid programs, with
a check in virInitialize.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove (nearly) all use of getuid()/getgid()
Daniel P. Berrange [Wed, 9 Oct 2013 11:13:45 +0000 (12:13 +0100)]
Remove (nearly) all use of getuid()/getgid()

Most of the usage of getuid()/getgid() is in cases where we are
considering what privileges we have. As such the code should be
using the effective IDs, not real IDs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd stub getegid impl for platforms lacking it
Daniel P. Berrange [Thu, 17 Oct 2013 13:51:32 +0000 (14:51 +0100)]
Add stub getegid impl for platforms lacking it

We already have stubs for getuid, geteuid, getgid but
not for getegid. Something in gnulib already does a
check for it during configure, so we already have the
HAVE_GETEGID macro defined.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't allow remote driver daemon autostart when running setuid
Daniel P. Berrange [Wed, 9 Oct 2013 10:47:13 +0000 (11:47 +0100)]
Don't allow remote driver daemon autostart when running setuid

We don't want setuid programs automatically spawning libvirtd,
so disable any use of autostart when setuid.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoOnly allow the UNIX transport in remote driver when setuid
Daniel P. Berrange [Wed, 9 Oct 2013 10:44:50 +0000 (11:44 +0100)]
Only allow the UNIX transport in remote driver when setuid

We don't know enough about quality of external libraries used
for non-UNIX transports, nor do we want to spawn external
commands when setuid. Restrict to the bare minimum which is
UNIX transport for local usage. Users shouldn't need to be
running setuid if connecting to remote hypervisors in any
case.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoBlock all use of getenv with syntax-check
Daniel P. Berrange [Wed, 9 Oct 2013 10:19:27 +0000 (11:19 +0100)]
Block all use of getenv with syntax-check

The use of getenv is typically insecure, and we want people
to use our wrappers, to force them to think about setuid
needs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove all direct use of getenv
Daniel P. Berrange [Wed, 9 Oct 2013 10:18:15 +0000 (11:18 +0100)]
Remove all direct use of getenv

Unconditional use of getenv is not secure in setuid env.
While not all libvirt code runs in a setuid env (since
much of it only exists inside libvirtd) this is not always
clear to developers. So make all the code paranoid, even
if it only ever runs inside libvirtd.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoMake virCommand env handling robust in setuid env
Daniel P. Berrange [Wed, 9 Oct 2013 10:03:02 +0000 (11:03 +0100)]
Make virCommand env handling robust in setuid env

When running setuid, we must be careful about what env vars
we allow commands to inherit from us. Replace the
virCommandAddEnvPass function with two new ones which do
filtering

  virCommandAddEnvPassAllowSUID
  virCommandAddEnvPassBlockSUID

And make virCommandAddEnvPassCommon use the appropriate
ones

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoSet a sane $PATH for virt-login-shell
Daniel P. Berrange [Wed, 9 Oct 2013 10:19:52 +0000 (11:19 +0100)]
Set a sane $PATH for virt-login-shell

The virt-login-shell binary shouldn't need to execute programs
relying on $PATH, but just in case set a fixed $PATH value
of /bin:/usr/bin

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't link virt-login-shell against libvirt.so (CVE-2013-4400)
Daniel P. Berrange [Thu, 10 Oct 2013 12:09:08 +0000 (13:09 +0100)]
Don't link virt-login-shell against libvirt.so (CVE-2013-4400)

The libvirt.so library has far too many library deps to allow
linking against it from setuid programs. Those libraries can
do stuff in __attribute__((constructor) functions which is
not setuid safe.

The virt-login-shell needs to link directly against individual
files that it uses, with all library deps turned off except
for libxml2 and libselinux.

Create a libvirt-setuid-rpc-client.la library which is linked
to by virt-login-shell. A config-post.h file allows this library
to disable all external deps except libselinux and libxml2.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoClose all non-stdio FDs in virt-login-shell (CVE-2013-4400)
Daniel P. Berrange [Wed, 9 Oct 2013 14:14:34 +0000 (15:14 +0100)]
Close all non-stdio FDs in virt-login-shell (CVE-2013-4400)

We don't want to inherit any FDs in the new namespace
except for the stdio FDs. Explicitly close them all,
just in case some do not have the close-on-exec flag
set.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoOnly allow 'stderr' log output when running setuid (CVE-2013-4400)
Daniel P. Berrange [Wed, 9 Oct 2013 09:59:36 +0000 (10:59 +0100)]
Only allow 'stderr' log output when running setuid (CVE-2013-4400)

We must not allow file/syslog/journald log outputs when running
setuid since they can be abused to do bad things. In particular
the 'file' output can be used to overwrite files.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd helpers for getting env vars in a setuid environment
Daniel P. Berrange [Wed, 9 Oct 2013 09:52:39 +0000 (10:52 +0100)]
Add helpers for getting env vars in a setuid environment

Care must be taken accessing env variables when running
setuid. Introduce a virGetEnvAllowSUID for env vars which
are safe to use in a setuid environment, and another
virGetEnvBlockSUID for vars which are not safe. Also add
a virIsSUID helper method for any other non-env var code
to use.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix perms for virConnectDomainXML{To,From}Native (CVE-2013-4401)
Daniel P. Berrange [Thu, 3 Oct 2013 15:37:57 +0000 (16:37 +0100)]
Fix perms for virConnectDomainXML{To,From}Native (CVE-2013-4401)

The virConnectDomainXMLToNative API should require 'connect:write'
not 'connect:read', since it will trigger execution of the QEMU
binaries listed in the XML.

Also make virConnectDomainXMLFromNative API require a full
read-write connection and 'connect:write' permission. Although the
current impl doesn't trigger execution of QEMU, we should not
rely on that impl detail from an API permissioning POV.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agodocs: fix a typo in formatdomain
Chen Hanxiao [Mon, 21 Oct 2013 01:35:11 +0000 (09:35 +0800)]
docs: fix a typo in formatdomain

s/effect/affect

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoFix a problem introduced by commit 99889012
Geoff Hickey [Fri, 18 Oct 2013 18:36:39 +0000 (14:36 -0400)]
Fix a problem introduced by commit 99889012

The meaning of one line of code was accidentally inverted.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoqemu: Fix augeas support for migration ports
Michal Privoznik [Fri, 18 Oct 2013 16:28:14 +0000 (18:28 +0200)]
qemu: Fix augeas support for migration ports

Commit e3ef20d7 allows user to configure migration ports range via
qemu.conf. However, it forgot to update augeas definition file and
even the test data was malicious.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agodocs: Expand description of host-model CPU mode
Jiri Denemark [Thu, 17 Oct 2013 14:02:38 +0000 (16:02 +0200)]
docs: Expand description of host-model CPU mode

host-model is a nice idea but it's current implementation make it
useless on some hosts so it should be used with care.

11 years agoqemu: Make migration port range configurable
Jiri Denemark [Tue, 15 Oct 2013 13:26:52 +0000 (15:26 +0200)]
qemu: Make migration port range configurable

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

11 years agoqemu: Avoid assigning unavailable migration ports
Wang Yufei [Fri, 11 Oct 2013 03:27:13 +0000 (11:27 +0800)]
qemu: Avoid assigning unavailable migration ports

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

When we migrate vms concurrently, there's a chance that libvirtd on
destination assigns the same port for different migrations, which will
lead to migration failure during prepare phase on destination. So we use
virPortAllocator here to solve the problem.

Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoviralloc.h: Fix typo in VIR_APPEND_ELEMENT_COPY_QUIT
Michal Privoznik [Fri, 18 Oct 2013 13:50:31 +0000 (15:50 +0200)]
viralloc.h: Fix typo in VIR_APPEND_ELEMENT_COPY_QUIT

In fact, the suffix should be _QUIET not _QUIT to stress the
fact, that no OOM error is reported on error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agonetcf: Don't complain when cleanup is called before init
Christophe Fergeau [Thu, 17 Oct 2013 13:48:33 +0000 (15:48 +0200)]
netcf: Don't complain when cleanup is called before init

netcfStateInitialize() initializes the driverState variable,
and when netcfStateCleanup is called, it will call virReportError()
if driverState is NULL.
This is not consistent with what other state objects are doing,
they return -1 without reporting an error in such cases.

See also
https://www.redhat.com/archives/libvir-list/2013-October/msg00809.html:

On Thu, Oct 17, 2013 at 01:40:19PM +0100, Daniel P. Berrange wrote:
> We don't want virStateCleanup to skip execution if virStateInitialize
> has failed though - every callback in virStateCleanup should be written
> to be safe if its corresponding init function hasn't run.

11 years agoremote: fix regression in event deregistration
Zhou Yimin [Thu, 17 Oct 2013 07:59:21 +0000 (15:59 +0800)]
remote: fix regression in event deregistration

Introduced by 7b87a3
When I quit the process which only register VIR_DOMAIN_EVENT_ID_REBOOT,
I got error like:
"libvirt: XML-RPC error : internal error: domain event 0 not registered".
Then I add the following code, it fixed.

Signed-off-by: Zhou Yimin <zhouyimin@huawei.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodaemon: don't free domain if it's null
Chen Hanxiao [Fri, 18 Oct 2013 02:12:00 +0000 (10:12 +0800)]
daemon: don't free domain if it's null

If we fail to get domain, we had to judge whether
it's null or not when doing 'cleanup'.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agoRemove ATTRIBUTE_NONNULL(3) from qemuMonitorJSONDrivePivot
John Ferlan [Thu, 17 Oct 2013 13:21:46 +0000 (09:21 -0400)]
Remove ATTRIBUTE_NONNULL(3) from qemuMonitorJSONDrivePivot

The header definition didn't match the function declaration, so adjusted
header to reflect the definition.

Found during a Coverity build where STATIC_ANALYSIS is enabled resulting
in the internal.h adding __nonnull__ handling to arguments.

Commit '6d264c91' added support for the qemuMonitorJSONDrivePivot() and
commit 'fbc3adc9' added a corresponding test which ended up triggering
the build failure which I didn't notice until today!

11 years agovirsh: improve usability of '--print-xml' flag for attach-disk command
Chen Hanxiao [Thu, 17 Oct 2013 04:05:21 +0000 (12:05 +0800)]
virsh: improve usability of '--print-xml' flag for attach-disk command

'--print-xml' option is very useful for doing some test.
But we had to specify a real domain for it.
This patch could enable us to specify a fake domain
when using --print-xml option.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoesx: Remove unnecessary NULL comparisons (3/3)
Geoff Hickey [Thu, 17 Oct 2013 17:04:13 +0000 (13:04 -0400)]
esx: Remove unnecessary NULL comparisons (3/3)

Code cleanup: remove explicit NULL comparisons like ptr == NULL and
ptr != NULL from the ESX code, replacing them with the simpler ptr
and !ptr.

Part three of three.

11 years agoesx: Remove unnecessary NULL comparisons (2/3)
Geoff Hickey [Thu, 17 Oct 2013 17:04:12 +0000 (13:04 -0400)]
esx: Remove unnecessary NULL comparisons (2/3)

Code cleanup: remove explicit NULL comparisons like ptr == NULL and
ptr != NULL from the ESX code, replacing them with the simpler ptr
and !ptr.

Part two of three.

11 years agoesx: Remove unnecessary NULL comparisons (1/3)
Geoff Hickey [Thu, 17 Oct 2013 17:04:11 +0000 (13:04 -0400)]
esx: Remove unnecessary NULL comparisons (1/3)

Code cleanup: remove explicit NULL comparisons like ptr == NULL and
ptr != NULL from the ESX code, replacing them with the simpler ptr
and !ptr.

Part one of three.

11 years agoAdd support for enabling SASL for SPICE guests
Daniel P. Berrange [Fri, 24 Feb 2012 14:13:06 +0000 (14:13 +0000)]
Add support for enabling SASL for SPICE guests

QEMU has support for SASL auth for SPICE guests, but libvirt
has no way to enable it. Following the example from VNC where
it is globally enabled via qemu.conf

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemuDomainCleanupRemove: s/memmove/VIR_DELETE_ELEMENT_INPLACE/
Michal Privoznik [Tue, 15 Oct 2013 17:07:42 +0000 (19:07 +0200)]
qemuDomainCleanupRemove: s/memmove/VIR_DELETE_ELEMENT_INPLACE/

The last argument of memmove is the amount of bytes to be moved. The
amount is in Bytes. We are moving some void pointers around. However,
since sizeof(void *) is not Byte on any architecture, we've got the
arithmetic wrong.

11 years agobetter error checking for LOCAL_PEERCRED
Brian Candler [Thu, 17 Oct 2013 12:21:57 +0000 (06:21 -0600)]
better error checking for LOCAL_PEERCRED

This patch improves the error checking in the LOCAL_PEERCRED version
of virNetSocketGetUNIXIdentity, used by FreeBSD and Mac OSX.

1. The error return paths now correctly unlock the socket. This is
implemented in exactly the same way as the SO_PEERCRED version,
using "goto cleanup"

2. cr.cr_ngroups is initialised to -1, and cr.cr_ngroups is checked
for negative and overlarge values.

This means that if the getsockopt() call returns success but doesn't
actually update the xucred structure, this is now caught. This
happened previously when getsockopt was called with SOL_SOCKET
instead of SOL_LOCAL, prior to commit 5a468b3, and resulted in
random uids being accepted.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agovirsh: fix a typo in virsh-domain
Chen Hanxiao [Thu, 17 Oct 2013 01:42:25 +0000 (09:42 +0800)]
virsh: fix a typo in virsh-domain

s/it's/its

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agobuild: use the gnulib version of the .m4 files when present
Giuseppe Scrivano [Mon, 7 Oct 2013 21:44:45 +0000 (23:44 +0200)]
build: use the gnulib version of the .m4 files when present

prevent aclocal from preferring .m4 files under m4/ over the version
provided by gnulib, by using only one directory.

I have noticed this after './configure --help' gave me two different
versions of "--enable-threads".  This was caused by aclocal that
preferred the version of lock.m4 provided by autopoint instead of
using the newer version distributed with gnulib.

Having two different directories made sense back when we checked
gnulib files into libvirt.git, but that was ages ago.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agostorage: allow interleave in pool XML
Eric Blake [Tue, 15 Oct 2013 22:59:48 +0000 (16:59 -0600)]
storage: allow interleave in pool XML

The RNG grammar did not allow arbitrary interleaving, which makes
it harder than necessary to create a new pool from handwritten XML.

* docs/schemas/storagepool.rng: Allow interleaving.
* tests/storagepoolxml2xmlin/pool-sheepdog.xml: Test interleave.
* tests/storagepoolxml2xmlin/pool-iscsi-auth.xml: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agostorage: document existing pools
Eric Blake [Tue, 15 Oct 2013 22:59:48 +0000 (16:59 -0600)]
storage: document existing pools

We forgot to document several pool types.

* docs/formatstorage.html.in: Add docs for scsi, mpath, rbd, and
sheepdog.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoremote-driver: Fix 'leav' typo in comment
Christophe Fergeau [Wed, 16 Oct 2013 15:26:18 +0000 (17:26 +0200)]
remote-driver: Fix 'leav' typo in comment

11 years agorpc: Correct the wrong payload size checking
Osier Yang [Mon, 14 Oct 2013 07:09:31 +0000 (15:09 +0800)]
rpc: Correct the wrong payload size checking

<...>
/* Size of message length field. Not counted in VIR_NET_MESSAGE_MAX
 * and VIR_NET_MESSAGE_INITIAL.
 */
const VIR_NET_MESSAGE_LEN_MAX = 4;
</...>

However, msg->bufferLength includes the length word. The wrong checking
was introduced by commit e914dcfd.

* src/rpc/virnetmessage.c:
  - Correct the checking in virNetMessageEncodePayloadRaw
  - Use a new variable to track the new payload length in
    virNetMessageEncodePayloadRaw

11 years agoAdd support for detecting PPC little endian arches
Daniel P. Berrange [Thu, 8 Aug 2013 13:03:51 +0000 (14:03 +0100)]
Add support for detecting PPC little endian arches

The recent patch series proposing the addition of PPC little endian
arch support to Linux defines new arch names 'ppcle' and 'ppc64le':

https://lists.ozlabs.org/pipermail/linuxppc-dev/2013-August/109908.html

This just makes libvirt know about these arch names, so it doesn't
immediately trip up if it seems these new names from uname.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoFix typo breaking cgroups for NBD backed filesystems
Daniel P. Berrange [Tue, 8 Oct 2013 15:36:49 +0000 (16:36 +0100)]
Fix typo breaking cgroups for NBD backed filesystems

A typo in the setup of NBD backed filesystems meant the
/dev/nbdN device would not be added to the cgroups device
ACL.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd some logging to LXC disk/fs nbd/loop setup
Daniel P. Berrange [Tue, 8 Oct 2013 15:36:26 +0000 (16:36 +0100)]
Add some logging to LXC disk/fs nbd/loop setup

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd logging to LXC cgroup devices setup
Daniel P. Berrange [Tue, 8 Oct 2013 15:35:38 +0000 (16:35 +0100)]
Add logging to LXC cgroup devices setup

To facilitate debugging, add some more logging to LXC cgroup
devices ACL setup.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdd log statement when NBD device is setup
Daniel P. Berrange [Tue, 8 Oct 2013 15:35:15 +0000 (16:35 +0100)]
Add log statement when NBD device is setup

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAArch64: Add qemu capabilities schemeta for test.
Pranavkumar Sawargaonkar [Tue, 8 Oct 2013 13:49:11 +0000 (19:19 +0530)]
AArch64: Add qemu capabilities schemeta for test.

Add qemu AArch64 capabilities schemeta in caps-qemu-kvm.xml.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
(crobinso: add aarch64 to schema arch list)

11 years agoImplement minimal sysinfo for AArch64 platforms.
Pranavkumar Sawargaonkar [Tue, 8 Oct 2013 13:49:09 +0000 (19:19 +0530)]
Implement minimal sysinfo for AArch64 platforms.

Implement the bare minimal sysinfo for AArch64 platforms by
reading the CPU models from /proc/cpuinfo.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
11 years agoAArch64: Parse cputopology from /proc/cpuinfo.
Pranavkumar Sawargaonkar [Tue, 8 Oct 2013 13:49:08 +0000 (19:19 +0530)]
AArch64: Parse cputopology from /proc/cpuinfo.

CPU "parser" for AArch64.
Showing cputopology in arm64 linux is work-in-progress so for now
all AArch64 cpus belong to same socket (like PPC).

Also we parse BogoMIPS same like arm 32bit.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
11 years agoAArch64: CPU Support for AArch64 (ARMv8 64bit).
Pranavkumar Sawargaonkar [Tue, 8 Oct 2013 13:49:07 +0000 (19:19 +0530)]
AArch64: CPU Support for AArch64 (ARMv8 64bit).

Adding CPU encoder/decoder for AArch64.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
(crobinso: fix for recent libvirt Ptr refactoring)

11 years agoAArch64: Add AArch64 architecture to list of valid arches.
Pranavkumar Sawargaonkar [Tue, 8 Oct 2013 13:49:06 +0000 (19:19 +0530)]
AArch64: Add AArch64 architecture to list of valid arches.

Adding AArch64(ARMv8 64bit) to the current list of valid architectures.

For now, AArch64 name would imply AArch64 LE mode only. In future,
we might have separate names for AArch64 LE and BE.

Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
11 years agoIgnore thin pool LVM devices.
Dusty Mabe [Wed, 9 Oct 2013 03:51:18 +0000 (23:51 -0400)]
Ignore thin pool LVM devices.

This should resolve:

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

For BZ 924672 the problem stems from the fact that thin pool logical
volume devices show up in /sbin/lvs output just like normal logical
volumes do. Libvirt incorrectly assumes they are just normal logical
volumes and that they will have a corresponding /dev/vgname/lvname
device that has been created by udev and tries to use this device.

To illustrate here is an example of the /dev/vgname/ directory and
the lvs output for a normal lv, thin lv, and thin pool:

    LV     VG       Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
    lv     vgguests -wi-a----  1.00g
    pool   vgguests twi-a-tz- 11.00g               0.00
    thinlv vgguests Vwi-a-tz-  1.00g pool          0.00
total 0
lrwxrwxrwx. 1 root root 7 Oct  8 19:35 lv -> ../dm-7
lrwxrwxrwx. 1 root root 7 Oct  8 19:37 thinlv -> ../dm-6

This patch modifies virStorageBackendLogicalMakeVol() to ignore thin pool
devices.

11 years agodomain_conf.c: Initialize arrVar and cntVar
Michal Privoznik [Tue, 15 Oct 2013 17:32:28 +0000 (19:32 +0200)]
domain_conf.c: Initialize arrVar and cntVar

Some ancient gcc fails to see the variables are initialized in a
separate function and a false positive is produced:

cc1: warnings being treated as errors
conf/domain_conf.c: In function 'virDomainChrGetDomainPtrs':
conf/domain_conf.c:10342: error: 'arrVar' may be used uninitialized in this function [-Wuninitialized]
conf/domain_conf.c:10343: error: 'cntVar' may be used uninitialized in this function [-Wuninitialized]
conf/domain_conf.c: In function 'virDomainChrInsert':
conf/domain_conf.c:10362: error: 'arrPtr' may be used uninitialized in this function [-Wuninitialized]
conf/domain_conf.c:10363: error: 'cntPtr' may be used uninitialized in this function [-Wuninitialized]
conf/domain_conf.c: In function 'virDomainChrRemove':
conf/domain_conf.c:10374: error: 'arrPtr' may be used uninitialized in this function [-Wuninitialized]
conf/domain_conf.c:10375: error: 'cntPtr' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>