]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
11 years agoRemove test case average timing
Daniel P. Berrange [Fri, 20 Sep 2013 18:13:35 +0000 (19:13 +0100)]
Remove test case average timing

The test case average timing code has not been used by any test
case ever. Delete it to remove complexity.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove existing OOM test impl
Daniel P. Berrange [Fri, 20 Sep 2013 18:11:02 +0000 (19:11 +0100)]
Remove existing OOM test impl

The current OOM test impl is too inefficient to be used on the
large test suites. It loops running 'main' multiple times, once
for each alloc in the 'main' method. This has complexity
'n * (n + 1) / 2' in terms of total alloc count. It will be
replaced by a more efficient impl whicih runs individual test
cases instead. This will have same complexity but the values
of 'n' will be much smaller, so a net win.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't clobber 'ret' variable in testCompareXMLToXMLHelper
Daniel P. Berrange [Wed, 25 Sep 2013 14:56:05 +0000 (15:56 +0100)]
Don't clobber 'ret' variable in testCompareXMLToXMLHelper

The qemuxml2xmltest.c function testCompareXMLToXMLHelper would
clobber the 'ret' variable causing it to mis-diagnose OOM
errors.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agovirerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/
Michal Privoznik [Mon, 7 Oct 2013 17:21:47 +0000 (19:21 +0200)]
virerror: s/VIR_ERR_STORAGE_VOL_EXISTS/VIR_ERR_STORAGE_VOL_EXISTS/

We currently have other error codes in singular form, e.g.
VIR_ERR_NETWORK_EXIST. Cleanup the previous patch to match the form.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agofix a ambiguous output of the command:'virsh vol-create-as'
Hongwei Bi [Mon, 7 Oct 2013 14:04:26 +0000 (22:04 +0800)]
fix a ambiguous output of the command:'virsh vol-create-as'

I created a storage volume(eg: test) from a storage pool(eg:vg10) using
the following command:"virsh vol-create-as --pool vg10 --name test --capacity 300M."
When I re-executed the above command, the output was as the following:
"error: Failed to create vol test
 error: Storage volume not found: storage vol 'test' already exists"

I think the output "Storage volume not found" is not appropriate. Because in fact storage
vol test has been found at this time. And then I think virErrorNumber should includes
VIR_ERR_STORAGE_EXIST which can also be used elsewhere. So I make this patch. The result
is as following:
"error: Failed to create vol test
 error: storage volume 'test' exists already"

11 years agotests: avoid compile failure on linux kernels older than 2.6.19
Giuseppe Scrivano [Mon, 7 Oct 2013 09:45:00 +0000 (11:45 +0200)]
tests: avoid compile failure on linux kernels older than 2.6.19

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
11 years agobuild: add configure --without-readline
Eric Blake [Fri, 4 Oct 2013 17:51:41 +0000 (11:51 -0600)]
build: add configure --without-readline

Make it much easier to test a configuration built without readline
support, by reusing our existing library probe machinery.  It gets
a bit tricky with readline, which does not provide a pkg-config
snippet, and which on some platforms requires one of several
terminal libraries as a prerequiste, but the end result should be
the same default behavior but now with the option to disable things.

* m4/virt-readline.m4 (LIBVIRT_CHECK_READLINE): Simplify by using
LIBVIRT_CHECK_LIB.
* tools/virsh.c: Convert USE_READLINE to WITH_READLINE.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: move readline check into its own macro
Eric Blake [Thu, 2 May 2013 02:54:57 +0000 (20:54 -0600)]
build: move readline check into its own macro

A future patch will allow disabling readline; doing this in an
isolated file instead of configure.ac will make the task easier.

* configure.ac: Move readline code...
* m4/virt-readline.m4: ...here.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: kill maintainer mode, always rebuild by default
Eric Blake [Fri, 4 Oct 2013 22:52:27 +0000 (16:52 -0600)]
build: kill maintainer mode, always rebuild by default

The automake manual recommends against the use of disabling
maintainer mode by default:

https://www.gnu.org/software/automake/manual/automake.html#maintainer_002dmode

because when it is disabled, the user gets no indication if they
touch a file that would normally require a rebuild.  Automake
1.11 changed things so that AM_MAINTAINER_MODE([enable]) will set
the mode to enabled by default; but RHEL 5 still uses automake 1.9,
where AM_MAINTAINER_MODE did not recognize an argument, and
therefore disables maintainer mode by default.  Having the default
be different according to which version of automake built the
project is annoying, and I _have_ been bitten on RHEL 5 rebuilds
where the default disabled mode led to silently incorrect builds.

The automake manual admits that being able to disable maintainer
mode still makes sense for projects that still store generated
files from the autotools in version control; but we have dropped
that for several years now.  As such, it's finally time to just
ditch the whole idea of maintainer mode, and unconditionally
rebuild autotools files if a dependency changes, without offering
a configure option to disable that mode.

* configure.ac (AM_MAINTAINER_MODE): Drop.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoRemove use of virConnectPtr from all remaining nwfilter code
Daniel P. Berrange [Thu, 3 Oct 2013 11:51:48 +0000 (12:51 +0100)]
Remove use of virConnectPtr from all remaining nwfilter code

The virConnectPtr is passed around loads of nwfilter code in
order to provide it as a parameter to the callback registered
by the virt drivers. None of the virt drivers use this param
though, so it serves no purpose.

Avoiding the need to pass a virConnectPtr means that the
nwfilterStateReload method no longer needs to open a bogus
QEMU driver connection. This addresses a race condition that
can lead to a crash on startup.

The nwfilter driver starts before the QEMU driver and registers
some callbacks with DBus to detect firewalld reload. If the
firewalld reload happens while the QEMU driver is still starting
up though, the nwfilterStateReload method will open a connection
to the partially initialized QEMU driver and cause a crash.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't pass virConnectPtr in nwfilter 'struct domUpdateCBStruct'
Daniel P. Berrange [Thu, 3 Oct 2013 11:45:26 +0000 (12:45 +0100)]
Don't pass virConnectPtr in nwfilter 'struct domUpdateCBStruct'

The nwfilter driver only needs a reference to its private
state object, not a full virConnectPtr. Update the domUpdateCBStruct
struct to have a 'void *opaque' field instead of a virConnectPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRemove virConnectPtr arg from virNWFilterDefParse*
Daniel P. Berrange [Thu, 3 Oct 2013 11:35:34 +0000 (12:35 +0100)]
Remove virConnectPtr arg from virNWFilterDefParse*

None of the virNWFilterDefParse* methods require a virConnectPtr
arg, so just drop it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAdjust legacy max payload size to account for header information
Claudio Bley [Mon, 7 Oct 2013 10:13:00 +0000 (12:13 +0200)]
Adjust legacy max payload size to account for header information

Commit 27e81517a87 set the payload size to 256 KB, which is
actually the max packet size, including the size of the header.

Reduce this by VIR_NET_MESSAGE_HEADER_MAX (24) and set
VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX to 262120, which was the original
value before increasing the limit in commit eb635de1fed.

11 years agonodeinfo: make freebsdNodeGetCPUCount work on Mac OS X
Ryota Ozaki [Sat, 5 Oct 2013 05:56:37 +0000 (14:56 +0900)]
nodeinfo: make freebsdNodeGetCPUCount work on Mac OS X

This fixes the following error:
  error : nodeGetInfo:933 : this function is not supported
  by the connection driver: node info not implemented on this platform

The freebsdNodeGetCPUCount was renamed to appleFreebsdNodeGetCPUCount
in order to make more visible the fact, that it works on Mac OS X too.

Mac OS X can use sysctlbyname as same as FreeBSD to get the CPU
frequency. However, the MIB style name is different from FreeBSD's.
And the unit of the return frequency is also different.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agorpc: fix getsockopt for LOCAL_PEERCRED on Mac OS X
Ryota Ozaki [Sat, 5 Oct 2013 05:56:36 +0000 (14:56 +0900)]
rpc: fix getsockopt for LOCAL_PEERCRED on Mac OS X

This fixes the following error:
  error : virGetUserEnt:703 : Failed to find user record for uid '32654'

'32654' (it's random and varies) comes from getsockopt with
LOCAL_PEERCRED option. getsockopt returns w/o error but seems
to not set any value to the buffer for uid.

For Mac OS X, LOCAL_PEERCRED has to be used with SOL_LOCAL level.
With SOL_LOCAL, getsockopt returns a correct uid.

Note that SOL_LOCAL can be found in
/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/un.h.

Signed-off-by: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agodoc: fix typo in HACKING
Chen Hanxiao [Mon, 7 Oct 2013 04:51:13 +0000 (12:51 +0800)]
doc: fix typo in HACKING

s/installion/installation

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
11 years agobuild: fix build on 32-bit platforms
Eric Blake [Fri, 4 Oct 2013 23:46:43 +0000 (17:46 -0600)]
build: fix build on 32-bit platforms

qemumonitorjsontest.c: In function 'testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo':
qemumonitorjsontest.c:1134: warning: integer constant is too large for 'long' type

* tests/qemumonitorjsontest.c
(testQemuMonitorJSONqemuMonitorJSONGetBalloonInfo)
(testQemuMonitorJSONqemuMonitorJSONGetBlockStatsInfo): Use correct
type.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build on RHEL 5
Eric Blake [Fri, 4 Oct 2013 23:25:13 +0000 (17:25 -0600)]
build: fix build on RHEL 5

On RHEL 5, compilation fails with:

storage/storage_backend.c: In function 'createRawFile':
storage/storage_backend.c:339: warning: implicit declaration of function 'fallocate'
storage/storage_backend.c:339: warning: nested extern declaration of 'fallocate' [-Wnested-externs]

But:

$ grep HAVE_FALLOCATE config.h
/* #undef HAVE_FALLOCATE */

Huh? It turns out that in kernels that old, fallocate() is not
implemented (config.h is correct), but <linux/fs.h> defines
HAVE_FALLOCATE as an empty witness macro for a completely
different purpose.  Since storage_backend.c is including
<linux/fs.h> on RHEL 5, we are hosed by the kernel definition.
Newer kernels no longer pollute the namespace, and it's fairly
easy to convert to an expression that works with both the old
kernel witness and the new-style config.h (undefined or 1).

Problem introduced in commit 532fef3.

* src/storage/storage_backend.c (createRawFile): Avoid namespace
pollution from kernel, by checking HAVE_FALLOCATE for a value.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: fix build --without-remote
Eric Blake [Fri, 27 Sep 2013 23:09:20 +0000 (17:09 -0600)]
build: fix build --without-remote

I tried to test ./configure --without-lxc --without-remote.
First, the build failed with some odd errors, such as an
inability to build xen, or link failures for virNetTLSInit.
But when you think about it, once there is no remote code,
all of libvirtd is useless, any stateful driver that depends
on libvirtd is also not worth compiling, and any libraries
used only by RPC code are not needed.  So I patched
configure.ac to make for some saner defaults when an
explicit disable is attempted.  Similarly, since we have
migrated virnetdevbridge into generic code, the workaround
for Linux kernel stupidity must not depend on stateful
drivers being in use.

Then there's 'make check' that needs segregation.

Wow - quite a bit of cleanup to make --without-remote useful :)

* configure.ac: Let --without-remote toggle defaults on stateful
drivers and other libraries.  Pick up Linux kernel workarounds
even when qemu and lxc are not being compiled.
* tests/Makefile.am (test_programs): Factor out programs that
require remote.
* src/libvirt_private.syms (rpc/virnet*.h): Move...
* src/libvirt_remote.syms: ...into new file.
* src/Makefile.am (SYM_FILES): Ship new syms file.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agodocs: aclpolkit: Fix a heading typo
Cole Robinson [Fri, 4 Oct 2013 17:38:57 +0000 (13:38 -0400)]
docs: aclpolkit: Fix a heading typo

11 years agostorage: fix file allocation behavior in file cloning
Oskari Saarenmaa [Mon, 30 Sep 2013 16:57:35 +0000 (19:57 +0300)]
storage: fix file allocation behavior in file cloning

Fixed the safezero call for allocating the rest of the file after cloning
an existing volume; it used to always use a zero offset, causing it to
only allocate the beginning of the file.

Also modified file creation to try to use fallocate(2) to pre-allocate
disk space before copying any data to make sure it fails early on if disk
is full and makes sure we can skip zero blocks when copying file contents.

If fallocate isn't available we will zero out the rest of the file after
cloning and only use sparse cloning if client requested a lower allocation
than the input volume's capacity.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agovirfile: safezero: fix buffer allocation max size
Oskari Saarenmaa [Fri, 4 Oct 2013 13:49:05 +0000 (16:49 +0300)]
virfile: safezero: fix buffer allocation max size

My previous commit 7dc1d4ab was supposed to change safezero to allocate
1 megabyte at maximum, but had the logic reversed and will allocate 1
megabyte at minimum (and a lot more at maximum.)

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agotest: Fix coverity warnings
Cole Robinson [Fri, 4 Oct 2013 12:48:39 +0000 (08:48 -0400)]
test: Fix coverity warnings

11 years agoqemu: Use maximum guest memory size when getting NUMA placement advice
Peter Krempa [Fri, 4 Oct 2013 09:11:31 +0000 (11:11 +0200)]
qemu: Use maximum guest memory size when getting NUMA placement advice

When starting the VM the guest balloon driver is not loaded at that
time. We need to ask numad for placement of the complete VM.

11 years agonodedev: Resolve Relax-NG validity error
John Ferlan [Thu, 3 Oct 2013 21:11:57 +0000 (17:11 -0400)]
nodedev: Resolve Relax-NG validity error

Commit id 'c4a4603de' added an output <path> to the nodedev xml, but
did not update the schema.

This resulted in the failure of the 'virt-xml-validate' on a file
generated by 'virsh nodedev-dumpxml pci_0000_00_00_0' (for example).

This was found/seen by running autotest on my host.

11 years agoFree cmd in virNetDevVethCreate
Gao feng [Fri, 4 Oct 2013 10:53:53 +0000 (18:53 +0800)]
Free cmd in virNetDevVethCreate

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agoFree cmd in virNetDevVethDelete
Gao feng [Fri, 4 Oct 2013 10:53:52 +0000 (18:53 +0800)]
Free cmd in virNetDevVethDelete

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
11 years agovirfile: safezero: fall back to writing block by block if mmap fails
Oskari Saarenmaa [Wed, 2 Oct 2013 07:31:09 +0000 (10:31 +0300)]
virfile: safezero: fall back to writing block by block if mmap fails

mmap can fail on 32-bit systems if we're trying to zero out a lot of data.
Fall back to using block-by-block writing in that case.  While we could map
smaller blocks it's unlikely that this code is used a lot and its easier to
just fall back to one of the existing methods.

Also modified the block-by-block zeroing to not allocate a megabyte of
zeroes if we're writing less than that.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agotest: snapshot: Add REDEFINE support
Cole Robinson [Wed, 21 Aug 2013 20:54:17 +0000 (16:54 -0400)]
test: snapshot: Add REDEFINE support

11 years agoqemu: snapshot: Break out redefine preparation to shared function
Cole Robinson [Wed, 21 Aug 2013 20:39:02 +0000 (16:39 -0400)]
qemu: snapshot: Break out redefine preparation to shared function

11 years agotest: Implement snapshot create/delete/revert APIs
Cole Robinson [Wed, 7 Aug 2013 17:40:46 +0000 (13:40 -0400)]
test: Implement snapshot create/delete/revert APIs

Again stolen from qemu_driver.c, but dropping all the unneeded bits.
This aims to copy all the current qemu validation checks since that's
the most commonly used real driver, but some of the checks are
completely artificial in the test driver.

This only supports creation of internal snapshots for initial
simplicity.

11 years agotest: Allow specifying domainsnapshot XML
Cole Robinson [Wed, 7 Aug 2013 14:57:55 +0000 (10:57 -0400)]
test: Allow specifying domainsnapshot XML

The user can pass it as a <test:domainsnapshot> subelement of a <domain>.

11 years agoqemu: snapshots: Simplify REDEFINE flag check
Cole Robinson [Wed, 21 Aug 2013 20:10:37 +0000 (16:10 -0400)]
qemu: snapshots: Simplify REDEFINE flag check

Makes things more readable IMO

11 years agoqemu: check actual netdev type rather than config netdev type during init
Laine Stump [Thu, 3 Oct 2013 10:02:35 +0000 (13:02 +0300)]
qemu: check actual netdev type rather than config netdev type during init

This resolves:

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

Note that a similar problem was reported in:

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

but the fix only worked for <interface type='hostdev'>, *not* for
<interface type='network'> where the network itself was a pool of
hostdevs.

The symptom in both cases was this error message:

   internal error: Unable to determine device index for network device

In both cases the cause was lack of proper handling for netdevs
(<interface>) of type='hostdev' when scanning the netdev list looking
for alias names in qemuAssignDeviceNetAlias() - those that aren't
type='hostdev' have an alias of the form "net%d", while those that are
hostdev use "hostdev%d". This special handling was completely lacking
prior to the fix for Bug 827519 which was:

When searching for the highest alias index, libvirt looks at the alias
for each netdev and if it is type='hostdev' it ignores the entry. If
the type is not hostdev, then it expects the "net%d" form; if it
doesn't find that, it fails and logs the above error message.

That fix works except in the case of <interface type='network'> where
the network uses hostdev (i.e. the network is a pool of VFs to be
assigned to the guests via PCI passthrough). In this case, the check
for type='hostdev' would fail because it was done as:

     def->net[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV

(which compares what was written in the config) when it actually
should have been:

    virDomainNetGetActualType(def->net[i]) == VIR_DOMAIN_NET_TYPE_HOSTDEV

(which compares the type of netdev that was actually allocated from
the network at runtime).

Of course the latter wouldn't be of any use if the netdevs of
type='network' hadn't already acquired their actual network connection
yet, but manual examination of the code showed that this is never the
case.

While looking through qemu_command.c, two other places were found to
directly compare the net[i]->type field rather than getting actualType:

* qemuAssignDeviceAliases() - in this case, the incorrect comparison
  would cause us to create a "net%d" alias for a netdev with
  type='network' but actualType='hostdev'. This alias would be
  subsequently overwritten by the proper "hostdev%d" form, so
  everything would operate properly, but a string would be
  leaked. This patch also fixes this problem.

* qemuAssignDevicePCISlots() - would defer assigning a PCI address to
  a netdev if it was type='hostdev', but not for type='network +
  actualType='hostdev'. In this case, the actual device usually hasn't
  been acquired yet anyway, and even in the case that it has, there is
  no practical difference between assigning a PCI address while
  traversing the netdev list or while traversing the hostdev
  list. Because changing it would be an effective NOP (but potentially
  cause some unexpected regression), this usage was left unchanged.

11 years agoqemucapabilitiesdata: Add qemu-1.6.50 data
Michal Privoznik [Thu, 3 Oct 2013 11:27:45 +0000 (13:27 +0200)]
qemucapabilitiesdata: Add qemu-1.6.50 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.6.0 data
Michal Privoznik [Thu, 3 Oct 2013 13:02:02 +0000 (15:02 +0200)]
qemucapabilitiesdata: Add qemu-1.6.0 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.4.2 data
Michal Privoznik [Thu, 3 Oct 2013 12:00:57 +0000 (14:00 +0200)]
qemucapabilitiesdata: Add qemu-1.4.2 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.3.1 data
Michal Privoznik [Thu, 3 Oct 2013 12:16:32 +0000 (14:16 +0200)]
qemucapabilitiesdata: Add qemu-1.3.1 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemucapabilitiesdata: Add qemu-1.2.2 data
Michal Privoznik [Thu, 3 Oct 2013 12:30:26 +0000 (14:30 +0200)]
qemucapabilitiesdata: Add qemu-1.2.2 data

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemuMonitorTestFree: Join worker thread
Michal Privoznik [Wed, 2 Oct 2013 16:20:18 +0000 (18:20 +0200)]
qemuMonitorTestFree: Join worker thread

Join the worker thread no matter if it is running or zombie already.
With current implementation the thread is joined iff @running is true.
However, when worker executes the last line, @running is set to false.
Hence qemuMonitorTestFree() won't join it (and free resources) even
though we can clearly see worker has run (nobody else sets @running =
false).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONSystemPowerdown
Michal Privoznik [Tue, 1 Oct 2013 14:28:51 +0000 (16:28 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONSystemPowerdown

Right now, we are testing qemuMonitorSystemPowerdown instead of
qemuMonitorJSONSystemPowerdown. It makes no harm, as both functions have
the same header and the former is just a wrapper over the latter. But we
should be consistent as we're testing the JSON functions only in here.

11 years agoUse 'vnet' as prefix for veth devices
Daniel P. Berrange [Wed, 2 Oct 2013 11:24:54 +0000 (12:24 +0100)]
Use 'vnet' as prefix for veth devices

The XML parser reserves 'vnet' as a prefix for automatically
generated NIC device names. Switch the veth device creation
to use this prefix, so it does not have to worry about clashes
with user specified names in the XML.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoRetry veth device creation on failure
Daniel P. Berrange [Wed, 2 Oct 2013 11:18:49 +0000 (12:18 +0100)]
Retry veth device creation on failure

The veth device creation code run in two steps, first it looks
for two free veth device names, then it runs ip link to create
the veth pair. There is an obvious race between finding free
names and creating them, when guests are started in parallel.

Rewrite the code to loop and re-try creation if it fails, to
deal with the race condition.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid deleting NULL veth device name
Daniel P. Berrange [Wed, 2 Oct 2013 10:26:59 +0000 (11:26 +0100)]
Avoid deleting NULL veth device name

If veth device allocation has a fatal error, the veths
array may contain NULL device names. Avoid calling the
virNetDevVethDelete function on such names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoAvoid reporting an error if veth device is already deleted
Daniel P. Berrange [Wed, 2 Oct 2013 10:16:14 +0000 (11:16 +0100)]
Avoid reporting an error if veth device is already deleted

The kernel automatically destroys veth devices when cleaning
up the container network namespace. During normal shutdown, it
is thus likely that the attempt to run 'ip link del vethN'
will fail. If it fails, check if the device exists, and avoid
reporting an error if it has gone. This switches to use the
virCommand APIs instead of virRun too.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoDon't set netdev offline in container cleanup
Daniel P. Berrange [Wed, 2 Oct 2013 10:10:45 +0000 (11:10 +0100)]
Don't set netdev offline in container cleanup

During container cleanup there is a race where the kernel may
have destroyed the veth device before we try to set it offline.
This causes log error messages. Given that we're about to
delete the device entirely, setting it offline is pointless.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability
Michal Privoznik [Wed, 2 Oct 2013 17:03:53 +0000 (19:03 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCapability

And so do qemuMonitorJSONSetMigrationCapability.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetTargetArch
Michal Privoznik [Wed, 2 Oct 2013 16:55:42 +0000 (18:55 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetTargetArch

11 years agoqemumonitorjsontest: Test qemuMonitorJSONSetBlockIoThrottle
Michal Privoznik [Wed, 2 Oct 2013 16:46:42 +0000 (18:46 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONSetBlockIoThrottle

Also do qemuMonitorJSONGetBlockIoThrottle.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetPtyPaths
Michal Privoznik [Wed, 2 Oct 2013 15:11:30 +0000 (17:11 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetPtyPaths

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus
Michal Privoznik [Wed, 2 Oct 2013 14:52:36 +0000 (16:52 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetSpiceMigrationStatus

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationStatus
Michal Privoznik [Wed, 2 Oct 2013 14:43:35 +0000 (16:43 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationStatus

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetMigrationCacheSize
Michal Privoznik [Wed, 2 Oct 2013 14:01:46 +0000 (16:01 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetMigrationCacheSize

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBlockStatsInfo
Michal Privoznik [Wed, 2 Oct 2013 13:08:02 +0000 (15:08 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBlockStatsInfo

While the reply can be reused test qemuMonitorJSONGetBlockExtent and
qemuMonitorJSONGetBlockExtent too.

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBlockInfo
Michal Privoznik [Wed, 2 Oct 2013 12:39:10 +0000 (14:39 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBlockInfo

11 years agoqemumonitorjsontest: Test qemuMonitorJSONGetBalloonInfo
Michal Privoznik [Wed, 2 Oct 2013 10:02:53 +0000 (12:02 +0200)]
qemumonitorjsontest: Test qemuMonitorJSONGetBalloonInfo

11 years agoqemuMonitorJSONSendKey: Avoid double free
Michal Privoznik [Wed, 2 Oct 2013 16:18:13 +0000 (18:18 +0200)]
qemuMonitorJSONSendKey: Avoid double free

After successful @cmd construction the memory where @keys points to is
part of @cmd. Avoid double freeing it.

11 years agoqemuMonitorJSONGetVirtType: Fix error message
Michal Privoznik [Wed, 2 Oct 2013 11:58:40 +0000 (13:58 +0200)]
qemuMonitorJSONGetVirtType: Fix error message

When querying for kvm, we try to find 'enabled' field. Hence the error
message should report we haven't found 'enabled' and not 'running'
(which is not even in the reply). Probably a typo or copy-paste error.

11 years agoqemu_hotplug: Allow QoS update in qemuDomainChangeNet
Michal Privoznik [Tue, 1 Oct 2013 13:04:48 +0000 (15:04 +0200)]
qemu_hotplug: Allow QoS update in qemuDomainChangeNet

The qemuDomainChangeNet() is called when 'virsh update-device' is
invoked on a NIC. Currently, we fail to update the QoS even though
we have routines for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agovirNetDevBandwidthEqual: Make it more robust
Michal Privoznik [Wed, 2 Oct 2013 07:18:02 +0000 (09:18 +0200)]
virNetDevBandwidthEqual: Make it more robust

So far the virNetDevBandwidthEqual() expected both ->in and ->out items
to be allocated for both @a and @b compared. This is not necessary true
for all our code. For instance, running 'update-device' twice over a NIC
with the very same XML results in SIGSEGV-ing in this function.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotest: Implement readonly snapshot APIs
Cole Robinson [Tue, 6 Aug 2013 15:20:37 +0000 (11:20 -0400)]
test: Implement readonly snapshot APIs

This is just stolen from qemu_driver.c with tweaks to fit the
test driver.

11 years agotest: Wire up managed save APIs
Cole Robinson [Tue, 6 Aug 2013 23:33:25 +0000 (19:33 -0400)]
test: Wire up managed save APIs

Also add a <test:hasmanagedsave> element to set this data when starting
the connection.

11 years agotest: Allow specifying object transient state in driver XML
Cole Robinson [Tue, 6 Aug 2013 22:36:30 +0000 (18:36 -0400)]
test: Allow specifying object transient state in driver XML

Similar to the runstate commit, allow a boolean <test:transient/>
element for setting domain persistence at driver startup.

11 years agoqemu: cgroup: Fix crash if starting nographics guest
Cole Robinson [Tue, 1 Oct 2013 11:55:19 +0000 (07:55 -0400)]
qemu: cgroup: Fix crash if starting nographics guest

We can dereference graphics[0] even if guest has no graphics device
configured. I screwed this up in a216e6487255d3b65d97c7ec1fa5da63dbced902

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

11 years agoselinux: Only close the selabel_handle once
Ján Tomko [Tue, 1 Oct 2013 11:15:12 +0000 (13:15 +0200)]
selinux: Only close the selabel_handle once

On selinux driver initialization failure (missing/incorrectly
formatted contexts file), selabel_handle was closed twice.

Introduced by 6159710.

11 years agoFix handling of IPv6 listen addresses in cmdDomDisplay
Ján Tomko [Tue, 1 Oct 2013 09:16:30 +0000 (11:16 +0200)]
Fix handling of IPv6 listen addresses in cmdDomDisplay

Use virSocketAddrIsWildcard instead of STREQ to check for the ANY
address and put brackets around the address if it contains ':'.

11 years agoutil: recognize SMB/CIFS filesystems as shared
Laine Stump [Thu, 26 Sep 2013 09:40:17 +0000 (05:40 -0400)]
util: recognize SMB/CIFS filesystems as shared

This should resolve:

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

libvirt previously recognized NFS, GFS2, OCFS2, and AFS filesystems as
"shared", and thus eligible for exceptions to certain rules/actions
about chowning image files before handing them off to a guest. This
patch widens the definition of "shared filesystem" to include SMB and
CIFS filesystems (aka "Windows file sharing"); both of these use the
same protocol, but different drivers so there are different magic
numbers for each.

11 years agotests: Introduce qemucapabilitiestest
Michal Privoznik [Thu, 19 Sep 2013 11:44:41 +0000 (13:44 +0200)]
tests: Introduce qemucapabilitiestest

This test is there to ensure that our capabilities detection code isn't
broken somehow.

How to gather test data:

Firstly, the data is split into two separate files. The former (with
suffix .replies) contains all the qemu replies. This is very fragile as
introducing a new device can mean yet another monitor command and hence
edit of this file in the future. But there's no better way of doing
this. To get this data simply turn on debug logs and copy all the
QEMU_MONITOR_IO_PROCESS lines. But be careful to not copy incomplete
ones (yeah, we report some incomplete lines too). Long story short, at
the libvirtd startup, a dummy qemu is spawn to get all the capabilities.

The latter (with suffix .caps) contains capabilities XML. Just start a
domain and copy the corresponding part from its state XML file.
Including <qemuCaps> tag.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemuMonitorTest: Make check for monitor command match optional
Michal Privoznik [Thu, 19 Sep 2013 13:19:08 +0000 (15:19 +0200)]
qemuMonitorTest: Make check for monitor command match optional

In a few cases we might want to not care if monitor command executed on
the mocked monitor matches the one we have reply for. Sounds crazy, but
if we just want monitor to return certain values (e.g. read from a file)
there is no need to care about command match.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agotests: Learn qemuMonitorTestNew optional greeting
Michal Privoznik [Thu, 19 Sep 2013 11:56:30 +0000 (13:56 +0200)]
tests: Learn qemuMonitorTestNew optional greeting

Currently, when creating a new mocked monitor, the greeting can't be
chosen. This is crucial for next patches, because some info as qemu
version is obtained in the greeting message.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoqemu_capabilities: Introduce virQEMUCapsInitQMPMonitor
Michal Privoznik [Thu, 19 Sep 2013 11:14:25 +0000 (13:14 +0200)]
qemu_capabilities: Introduce virQEMUCapsInitQMPMonitor

This basically covers the talking-to-monitor part of
virQEMUCapsInitQMP.  The patch itself has no real value,
but it creates an entity to be tested in the next patches.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoRelease of libvirt-1.1.3
Daniel Veillard [Tue, 1 Oct 2013 07:04:14 +0000 (15:04 +0800)]
Release of libvirt-1.1.3

- configure.ac docs/news.html.in libvirt.spec.in: update for release
- po/*.po*: updated localization and regenerated

11 years agoVMware: Add Fusion version test
Doug Goldstein [Mon, 30 Sep 2013 21:58:37 +0000 (16:58 -0500)]
VMware: Add Fusion version test

This adds a test for the version string of VMware Fusion.

11 years agolxc: do cleanup when failed to bind fs as read-only
Chen Hanxiao [Mon, 30 Sep 2013 09:06:25 +0000 (17:06 +0800)]
lxc: do cleanup when failed to bind fs as read-only

We forgot to do cleanup when lxcContainerMountFSTmpfs
failed to bind fs as read-only.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoFix max stream packet size for old clients
Daniel P. Berrange [Mon, 30 Sep 2013 16:27:51 +0000 (17:27 +0100)]
Fix max stream packet size for old clients

The libvirtd server pushes data out to clients. It does not
know what protocol version the client might have, so must be
conservative and use the old payload limits. ie send no more
than 256kb of data per packet.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agoLXC: workaround machined uncleaned data with containers running systemd.
Cédric Bosdonnat [Mon, 30 Sep 2013 14:46:29 +0000 (16:46 +0200)]
LXC: workaround machined uncleaned data with containers running systemd.

The problem is described by [0] but its effect on libvirt is that
starting a container with a full distro running systemd after having
stopped it simply fails.

The container cleanup now calls the machined Terminate function to make
sure that everything is in order for the next run.

 [0]: https://bugs.freedesktop.org/show_bug.cgi?id=68370

11 years agovirfile: safezero: align mmap offset to page size
Oskari Saarenmaa [Mon, 30 Sep 2013 11:01:45 +0000 (14:01 +0300)]
virfile: safezero: align mmap offset to page size

mmap's offset must be aligned to page size or mapping will fail.
mmap-based safezero is only used if posix_fallocate isn't available.

Signed-off-by: Oskari Saarenmaa <os@ohmu.fi>
11 years agovirscsi: hostdev SCSI AdapterId retrieval fix
Boris Fiuczynski [Mon, 30 Sep 2013 12:23:17 +0000 (14:23 +0200)]
virscsi: hostdev SCSI AdapterId retrieval fix

Fixed the retrieval of the AdapterId from the AdapterName of the
hostdev source so it does return an error instead of leaving the
adapter_id uninitialized.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agovirsh-volume: Add missing check when calling virStreamNew
Hongwei Bi [Sun, 29 Sep 2013 09:24:11 +0000 (17:24 +0800)]
virsh-volume: Add missing check when calling virStreamNew

Check return value of virStreamNew when called by cmdVolUpload and
cmdVolDownload.

11 years agovirsh-domain: Free dom before return false in cmdDump
Hongwei Bi [Fri, 27 Sep 2013 22:02:31 +0000 (06:02 +0800)]
virsh-domain: Free dom before return false in cmdDump

11 years agoqemu: process: Silence coverity warning when rewinding log file
Peter Krempa [Mon, 30 Sep 2013 09:47:47 +0000 (11:47 +0200)]
qemu: process: Silence coverity warning when rewinding log file

The change in ef29de14c37d14abc546e90555a0093797facfdd that introduced
better error logging from qemu introduced a warning from coverity about
unused return value from lseek. Silence this warning and fix typo in the
corresponding error message.

Reported by: John Ferlan

11 years agopython: Document virNodeGetInfo bug
Michal Privoznik [Mon, 30 Sep 2013 09:23:08 +0000 (11:23 +0200)]
python: Document virNodeGetInfo bug

The memory size in virNodeGetInfo python API binding is reported in MiB
instead of KiB (like we have in C struct). However, there already might
be applications out there relying on this inconsistence so we can't
simply fix it. Document this sad fact as known bug.

11 years agoRemove tab from previous commit
Daniel Veillard [Sun, 29 Sep 2013 16:09:59 +0000 (00:09 +0800)]
Remove tab from previous commit

11 years agoVMware: Initial VMware Fusion support
Doug Goldstein [Tue, 24 Sep 2013 16:24:31 +0000 (11:24 -0500)]
VMware: Initial VMware Fusion support

Add support for VMware Fusion in the existing VMware driver.  Connect
via the URI vmwarefusion:///session

11 years agoVMware: Support more than 2 driver backends
Doug Goldstein [Tue, 24 Sep 2013 16:24:30 +0000 (11:24 -0500)]
VMware: Support more than 2 driver backends

Currently the VMware version check code only supports two types of
VMware backends, Workstation and Player. But in the near future we will
have an additional one so we need to support more. Additionally, we
discover and cache the path to the vmrun binary so we should use that
path when using the corresponding binary from the VMware VIX SDK.

11 years agobuild: fix build --without-lxc
Eric Blake [Sat, 28 Sep 2013 03:21:02 +0000 (21:21 -0600)]
build: fix build --without-lxc

'make distcheck' fails from a directory configured --without-lxc:

  GEN      virt-login-shell.1
Can't write-open ../../tools/virt-login-shell.1: Permission denied at /usr/bin/pod2man line 69.

* tools/Makefile.am (EXTRA_DIST): Ship pre-built man page.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: tweak vpath builds of net_rpc
Eric Blake [Fri, 27 Sep 2013 17:12:20 +0000 (11:12 -0600)]
build: tweak vpath builds of net_rpc

Another case missed by commits 716c7bb and 6973e02.

* src/Makefile.am (VIR_NET_RPC_GENERATED): Drop $(srcdir).
(libvirt_net_rpc_la_SOURCES): List generated files more compactly.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agoMakefile.am: Always include rule to make org.libvirt.api.policy
Michal Privoznik [Fri, 27 Sep 2013 16:04:31 +0000 (18:04 +0200)]
Makefile.am: Always include rule to make org.libvirt.api.policy

When running 'make dist' on a system without policykit, we currently
fail. This is because $(srcdir)/access/org.libvirt.api.policy is in
EXTRA_DIST, however, the rule to generate the file is conditional
whether we build with polkit or not.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agofchosttest: Run the test only under linux
Michal Privoznik [Fri, 27 Sep 2013 14:47:12 +0000 (16:47 +0200)]
fchosttest: Run the test only under linux

Currently, we have functions to handle fc_host implemented just
for linux. On all other platforms an error is thrown. It makes no
sense to run the test on those platforms then.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agogenprotocol.pl: Fix code on FreeBSD too
Michal Privoznik [Fri, 27 Sep 2013 14:20:49 +0000 (16:20 +0200)]
genprotocol.pl: Fix code on FreeBSD too

On some systems (linux, cygwin and gnukfreebsd) rpcgen generates files
which when compiling produces this warning:

remote/remote_protocol.c: In function 'xdr_remote_node_get_cpu_stats_ret':
remote/remote_protocol.c:530: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Hence, on those systems we need to post-process the files by the
rpc/genprotocol.pl perl script. At the beginning of the script the OS is
detected via $^O perl variable. From my latest build on FreeBSD I see we
need to fix the code there too. On FreeBSD the variable contains
'freebsd' string:

http://perldoc.perl.org/perlport.html#PLATFORMS

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
11 years agoevent: Make debug message match function comments
Doug Goldstein [Sat, 21 Sep 2013 16:07:21 +0000 (11:07 -0500)]
event: Make debug message match function comments

The debug message said there was a timeout of 0 pending for -1 ms which
made me think this is where a hang was coming from but according to the
function comments this case means that there is no timeout pending so
make the debug message say that instead of saying there's a -1 ms
timeout.

11 years agoBSD: Ensure process creation timestamp is init'd
Doug Goldstein [Sat, 21 Sep 2013 16:02:08 +0000 (11:02 -0500)]
BSD: Ensure process creation timestamp is init'd

While BSDs don't support process creation timestamp information via
PEERCRED for Unix sockets, we need to actually initialize the value
because it is used by the libvirt code.

11 years agoBSD: Ensure UNIX socket credentials are valid
Doug Goldstein [Wed, 4 Sep 2013 17:21:45 +0000 (12:21 -0500)]
BSD: Ensure UNIX socket credentials are valid

Ensure that the socket credentials we got back on BSD are valid before
using them.

11 years agoFix crash in libvirtd when events are registered & ACLs active
Daniel P. Berrange [Fri, 27 Sep 2013 14:46:07 +0000 (15:46 +0100)]
Fix crash in libvirtd when events are registered & ACLs active

When a client disconnects from libvirtd, all event callbacks
must be removed. This involves running the public API

  virConnectDomainEventDeregisterAny

This code does not run in normal API dispatch context, so no
identity was set. The result was that the access control drivers
denied the attempt to deregister callbacks. The callbacks thus
continued to trigger after the client was free'd causing fairly
predictable use of free memory & a crash.

This can be triggered by any client with readonly access when
the ACL drivers are active.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
11 years agovirsh: Fix domdisplay when domain only uses TLS
Christophe Fergeau [Wed, 25 Sep 2013 15:48:01 +0000 (17:48 +0200)]
virsh: Fix domdisplay when domain only uses TLS

It's possible to create a domain which will only use a TLS port
and will not have a non-TLS port set by using:
<graphics type='spice' autoport='yes' defaultMode='secure'/>
In such a setup, the 'graphics' node for the running domain will be:
<graphics type='spice' tlsPort='5900'
          autoport='yes' listen='127.0.0.1'
          defaultMode='secure'>

However, cmdDomDisplay loops over all the 'graphics' node, and it
ignores nodes which don't have a 'port' attribute. This means
'virsh domdisplay' will only return an empty string for domains
as the one above.

This commit looks for both 'port' and 'tlsPort' before deciding
to ignore a graphics node. It also makes sure 'port' is not printed
when it's not set.
This makes 'virsh domdisplay' return
'spice://127.0.0.1?tls-port=5900' for domains using only a TLS
port.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
11 years agoqemu: Free all driver data in qemuStateCleanup
Jiri Denemark [Fri, 27 Sep 2013 13:34:43 +0000 (15:34 +0200)]
qemu: Free all driver data in qemuStateCleanup

https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case A)

While activeScsiHostdevs and webSocketPorts were allocated in
qemuStateInitialize, they were not freed in qemuStateCleanup.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agoqemu: Don't leak reference to virQEMUDriverConfigPtr
Jiri Denemark [Fri, 27 Sep 2013 13:07:38 +0000 (15:07 +0200)]
qemu: Don't leak reference to virQEMUDriverConfigPtr

https://bugzilla.redhat.com/show_bug.cgi?id=1011330 (case D)

qemuProcessStart created two references to virQEMUDriverConfigPtr before
calling fork():

    cfg = virQEMUDriverGetConfig(driver);
    ...
    hookData.cfg = virObjectRef(cfg);

However, the child only unreferenced hookData.cfg and the parent only
removed the cfg reference. That said, we don't need to increment the
reference counter when assigning cfg to hookData. Both the child and the
parent will correctly remove the reference on cfg (the child will do
that through hookData).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
11 years agobuild: fix testsuite building under cygwin
Eric Blake [Fri, 27 Sep 2013 11:01:47 +0000 (05:01 -0600)]
build: fix testsuite building under cygwin

Similar to commit 8f34f19.

* tests/Makefile.am (virnetserverclienttest_CFLAGS): Add XDR_CFLAGS.

Signed-off-by: Eric Blake <eblake@redhat.com>
11 years agobuild: Fix VPATH build error for locking daemon
Viktor Mihajlovski [Fri, 27 Sep 2013 12:46:59 +0000 (14:46 +0200)]
build: Fix VPATH build error for locking daemon

Removed superfluous/wrong srcdir prefix.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
11 years agorpc: Increase bound limit for virDomainGetJobStats
Jiri Denemark [Fri, 27 Sep 2013 08:48:02 +0000 (10:48 +0200)]
rpc: Increase bound limit for virDomainGetJobStats

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

Commit 6d7d0b1869ed293e3208d11f375cecea0129dfc5 (in 1.1.2) added bounds
checking to virDomainGetJobStats. But even at that time the API was able
to return 20 parameters while the limit was set to 16.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>