]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
12 years agobuild: avoid -Wno-format on new-enough gcc
Eric Blake [Tue, 2 Oct 2012 14:37:00 +0000 (08:37 -0600)]
build: avoid -Wno-format on new-enough gcc

Commit c579d6b added a sledgehammer to silence spurious warnings from
gcc 4.2, but in the process, it also silenced useful warnings from
gcc 4.3 through 4.5.  As a result, a bug slipped in to commit 0caccb58.

Tested with FreeBSD (gcc 4.2.1), RHEL 6.3 (gcc 4.4), and F17 (gcc 4.7.2),
where the former didn't trip on spurious warnings, and where the latter
two detected a revert of 2b804cf.

* m4/virt-compile-warnings.m4 (-Wno-format): Probe for the actual
spurious message, to once again allow gcc 4.4 to use -Wformat.

12 years agobuild: fix typo in debug message
Eric Blake [Tue, 2 Oct 2012 12:36:50 +0000 (06:36 -0600)]
build: fix typo in debug message

Introduced in commit 0caccb58.

  CC     libvirt_driver_qemu_impl_la-qemu_capabilities.lo
../../src/qemu/qemu_capabilities.c: In function 'qemuCapsInitQMP':
../../src/qemu/qemu_capabilities.c:2327:13: error: format '%d' expects argument of type 'int', but argument 8 has type 'const char *' [-Werror=format]

* src/qemu/qemu_capabilities.c (qemuCapsInitQMP): Use correct format.

12 years agoqemu: Kill processes used for QMP caps probing
Jiri Denemark [Tue, 2 Oct 2012 08:59:56 +0000 (10:59 +0200)]
qemu: Kill processes used for QMP caps probing

Since libvirt switched to QMP capabilities probing recently, it starts
QEMU process used for this probing with -daemonize, which means
virCommandAbort can no longer reach these processes. As a result of
that, restarting libvirtd will leave several new QEMU processes behind.
Let's use QEMU's -pidfile and use it to kill the process when QMP caps
probing is done.

12 years agoqemu: Use proper agent entering function when freezing filesystems
Peter Krempa [Mon, 1 Oct 2012 15:58:29 +0000 (17:58 +0200)]
qemu: Use proper agent entering function when freezing filesystems

When doing snapshots, the filesystem freeze function used the agent
entering function that expects the qemud_driver unlocked. This might
cause a deadlock of the qemu driver if the agent does not respond.

The only call path of this function has the qemud_driver locked, so this
patch changes the entering functions to those expecting the driver
locked.

12 years agolxc: Correctly report active cgroups
Michal Privoznik [Mon, 1 Oct 2012 12:22:42 +0000 (14:22 +0200)]
lxc: Correctly report active cgroups

There was an inverted return value in lxcCgroupControllerActive().
The function assumes cgroups are active and do couple of checks
to prove that. If any of them fails, false is returned. Therefore,
at the end, after all checks are done we must return true, not false.

12 years agobuild: avoid journald on rhel 5
Eric Blake [Mon, 1 Oct 2012 22:38:56 +0000 (16:38 -0600)]
build: avoid journald on rhel 5

Commit f6430390 broke builds on RHEL 5, where glibc (2.5) is too
old to support mkostemp (2.7) or htole64 (2.9).  While gnulib
has mkostemp, it still lacks htole64; and it's not worth dragging
in replacements on systems where journald is unlikely to exist
in the first place, so we just use an extra configure-time check
as our witness of whether to attempt compiling the code.

* src/util/logging.c (virLogParseOutputs): Don't attempt to
compile journald on older glibc.
* configure.ac (AC_CHECK_DECLS): Check for htole64.

12 years agobuild: fix bitmap conversion when !CPU_ALLOC
Eric Blake [Mon, 1 Oct 2012 23:00:58 +0000 (17:00 -0600)]
build: fix bitmap conversion when !CPU_ALLOC

Commit f1a43a8 missed one side of an #if/#else.

* src/util/processinfo.c (virProcessInfoGetAffinity): Use correct
bitmap operation.

12 years agoAdd note about numeric domain names to manpage
Dave Allan [Mon, 1 Oct 2012 18:01:36 +0000 (14:01 -0400)]
Add note about numeric domain names to manpage

Clarify that domains with numeric names can only be identified by
their domain id.

12 years agobuild: avoid infinite autogen loop
Eric Blake [Mon, 1 Oct 2012 15:10:20 +0000 (09:10 -0600)]
build: avoid infinite autogen loop

Several people have reported that if the .gnulib submodule is dirty,
then 'make' will go into an infinite loop attempting to rerun bootstrap,
because that never cleans up the dirty submodule.  By default, we
should halt and make the user investigate, but if the user doesn't
know why or care that the submodule is dirty, I also added the ability
to 'make CLEAN_SUBMODULE=1' to get things going again.

Also, while testing this, I noticed that when a submodule update was
needed, 'make' would first run autoreconf, then bootstrap (which
reruns autoreconf); adding a strategic dependency allows for less work.

* .gnulib: Update to latest, for maint.mk improvements.
* cfg.mk (_autogen): Also hook maint.mk, to run before autoreconf.
* autogen.sh (bootstrap): Refuse to run if gnulib is dirty, unless
user requests discarding gnulib changes.

12 years agohyperv: Fix and improve hypervListAllDomains
Matthias Bolte [Sun, 9 Sep 2012 15:39:40 +0000 (17:39 +0200)]
hyperv: Fix and improve hypervListAllDomains

Use MATCH for all flags checks.

hypervMsvmComputerSystemToDomain expects the domain pointer to the
initialized to NULL.

All items in doms up to the count-th one are valid, no need to double
check before freeing them.

12 years agoesx: Fix and improve esxListAllDomains function
Matthias Bolte [Sun, 9 Sep 2012 10:31:16 +0000 (12:31 +0200)]
esx: Fix and improve esxListAllDomains function

Avoid requesting information such as identity or power state when it
is not necessary.

Lookup virtual machine list with the required fields (configStatus,
name, and config.uuid) to make esxVI_GetVirtualMachineIdentity work.

No need to call esxVI_GetNumberOfSnapshotTrees. rootSnapshotTreeList
can be tested for emptiness by checking it for NULL.

esxVI_LookupRootSnapshotTreeList already does the error reporting,
don't overwrite it.

Check if autostart is enabled at all before looking up the individual
autostart setting of a virtual machine.

Reorder VIR_EXPAND_N(doms, ndoms, 1) to avoid leaking the result of
the call to virGetDomain if VIR_EXPAND_N fails.

Replace VIR_EXPAND_N by VIR_RESIZE_N to avoid quadratic scaling, as in
the Hyper-V version of the function.

If virGetDomain fails it already reports an error, don't overwrite it
with an OOM error.

All items in doms up to the count-th one are valid, no need to double
check before freeing them.

Finally, don't leak autoStartDefaults and powerInfoList.

12 years agobuild: default selinuxfs mount point to /sys/fs/selinux
Daniel J Walsh [Fri, 28 Sep 2012 18:11:43 +0000 (14:11 -0400)]
build: default selinuxfs mount point to /sys/fs/selinux

Currently if you build on a machine that does not support SELinux we end up
with the default mount point being /selinux, since this is moved to
/sys/fs/selinux, we should start defaulting there.

I believe this is causing a bug in libvirt-lxc when /selinux does not exists,
even though /sys/fs/selinux exists.

12 years agoAdd support for detecting capablities using QMP commands
Daniel P. Berrange [Wed, 22 Aug 2012 17:05:08 +0000 (18:05 +0100)]
Add support for detecting capablities using QMP commands

Start a QEMU process using

   $QEMU -S -no-user-config -nodefaults \
         -nographic -M none -qmp unix:/some/path,server,nowait

and talk QMP over stdio to discover what capabilities the
binary supports. This works for QEMU 1.2.0 or later and
for older QEMU automatically fallback to the old approach
of parsing -help and related command line args.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoIgnore error from query-cpu-definitions
Daniel P. Berrange [Fri, 28 Sep 2012 14:55:54 +0000 (15:55 +0100)]
Ignore error from query-cpu-definitions

Some architectures provide the query-cpu-definitions command,
but are set to always return a "GenericError" from it :-(
Catch this & treat it as if there was an empty list of CPUs
returned

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAvoid bogus I/O event errors when closing the QEMU monitor
Daniel P. Berrange [Fri, 28 Sep 2012 14:27:39 +0000 (15:27 +0100)]
Avoid bogus I/O event errors when closing the QEMU monitor

After calling qemuMonitorClose(), it is still possible for
the QEMU monitor I/O event callback to get invoked. This
will trigger an error message because mon->fd has been set
to -1 at this point. Silently ignore the case where mon->fd
is -1, likewise for mon->watch being zero.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove need to pass in a virDomainObjPtr instance to qemuMonitorOpen
Daniel P. Berrange [Fri, 28 Sep 2012 14:26:36 +0000 (15:26 +0100)]
Remove need to pass in a virDomainObjPtr instance to qemuMonitorOpen

The qemuMonitorOpen method only needs a virDomainObjPtr in order
to access the QEMU pid. This is not critical when detecting the
QEMU capabilties, so can easily be skipped

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix QEMU test with 1.2.0 help output
Daniel P. Berrange [Fri, 28 Sep 2012 15:48:58 +0000 (16:48 +0100)]
Fix QEMU test with 1.2.0 help output

The help output for QEMU 1.2.0 changed 'pci-assign' to 'kvm-pci-assign'.
Since the new capabilities code does exact device name matching
instead of substring matching, this caused the capabilities to go
missing.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoARMHF: implement /proc/cpuinfo parsing
Chuck Short [Thu, 26 Jul 2012 13:32:07 +0000 (08:32 -0500)]
ARMHF: implement /proc/cpuinfo parsing

Minimal CPU "parser" for armhf to avoid compile time warning.

Signed-off-by: Chuck Short <chuck.short@canonical.com>
12 years agoAutomatically enable systemd journal logging
Daniel P. Berrange [Thu, 27 Sep 2012 12:13:09 +0000 (13:13 +0100)]
Automatically enable systemd journal logging

Probe to see if the systemd journal is accessible, and if
so enable logging to the journal by default, rather than
stderr (current default under systemd).

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd systemd journal support
Daniel P. Berrange [Tue, 25 Sep 2012 17:31:01 +0000 (18:31 +0100)]
Add systemd journal support

Add support for logging to the systemd journal, using its
simple client library. The benefit over syslog is that it
accepts structured log data, so the journald can store
individual items like code file/line/func separately from
the string message. Tools which require structured log
data can then query the journal to extract exactly what
they desire without resorting to string parsing

While systemd provides a simple client library for logging,
it is more convenient for libvirt to directly write its
own client code. This lets us build up the iovec's on
the stack, avoiding the need to alloc memory when writing
log messages.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRefactor qemuCapsParseDeviceStr to work from data tables
Daniel P. Berrange [Thu, 13 Sep 2012 17:04:24 +0000 (18:04 +0100)]
Refactor qemuCapsParseDeviceStr to work from data tables

Currently the qemuCapsParseDeviceStr method has a bunch of open
coded string searches/comparisons to detect devices and their
properties. Soon this data will be obtained from QMP queries
instead of -device help output. Maintaining the list of device
and properties in two places is undesirable. Thus the existing
qemuCapsParseDeviceStr() method needs to be refactored to
separate the device types and properties from the actual
search code.

Thus the -device help output is now parsed to construct a
list of device names, and device properties. These are then
checked against a set of datatables to set the capability
flags

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't initialize logging twice in libvirtd
Daniel P. Berrange [Thu, 27 Sep 2012 16:27:17 +0000 (17:27 +0100)]
Don't initialize logging twice in libvirtd

The virInitialize function initializes logging from the env,
so there is no need for another call to virLogSetFromEnv

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoChange logging category parameter into an enum
Daniel P. Berrange [Thu, 27 Sep 2012 13:44:22 +0000 (14:44 +0100)]
Change logging category parameter into an enum

The 'const char *category' parameter only has a few possible
values now that the filename has been separated. Turn this
parameter into an enum instead.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoInclude filename explicitly in logging APIs
Daniel P. Berrange [Thu, 27 Sep 2012 13:28:44 +0000 (14:28 +0100)]
Include filename explicitly in logging APIs

Currently the logging APIs have a 'const char *category' parameter
which indicates where the log message comes from. This is typically
a combination of the __FILE__ string and other prefix. Split the
__FILE__ off into a dedicated parameter so it can passed to the
log outputs

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoWhitespace cleanup in logging files
Daniel P. Berrange [Thu, 27 Sep 2012 13:14:01 +0000 (14:14 +0100)]
Whitespace cleanup in logging files

General whitespace cleanup in the logging files

 - Move '{' to a new line after funtion declaration
 - Put each parameter on a new line to avoid long lines
 - Put return type on new line
 - Leave 2 blank lines between functions

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agos/int/virLogDestination/ in logging code
Daniel P. Berrange [Thu, 27 Sep 2012 13:04:21 +0000 (14:04 +0100)]
s/int/virLogDestination/ in logging code

The log destinations are an enum, but most of the code was
just using a plain 'int' for function params / variables.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agos/long long/size_t/ for file line numbers in logging code
Daniel P. Berrange [Thu, 27 Sep 2012 13:00:21 +0000 (14:00 +0100)]
s/long long/size_t/ for file line numbers in logging code

The __LINE__ macro value is specified to fit in the size_t
type, so use that instead of 'long long' in the logging code

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agos/int/virLogPriority/ in logging code
Daniel P. Berrange [Thu, 27 Sep 2012 12:58:58 +0000 (13:58 +0100)]
s/int/virLogPriority/ in logging code

The log priority levels are an enum, but most of the code was
just using a plain 'int' for function params / variables.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agopython: return error if PyObject obj is NULL for unwrapper helper functions
Guannan Ren [Wed, 26 Sep 2012 17:33:50 +0000 (01:33 +0800)]
python: return error if PyObject obj is NULL for unwrapper helper functions

The result is indeterminate for NULL argument to python
functions as follows. It's better to return negative value in
these situations.

PyObject_IsTrue will segfault if the argument is NULL
PyFloat_AsDouble(NULL) is -1.000000
PyLong_AsUnsignedLongLong(NULL) is 0.000000

12 years agonetwork: fix dnsmasq/radvd binding to IPv6 on recent kernels
Benjamin Cama [Wed, 26 Sep 2012 19:02:20 +0000 (21:02 +0200)]
network: fix dnsmasq/radvd binding to IPv6 on recent kernels

I hit this problem recently when trying to create a bridge with an IPv6
address on a 3.2 kernel: dnsmasq (and, further, radvd) would not bind to
the given address, waiting 20s and then giving up with -EADDRNOTAVAIL
(resp. exiting immediately with "error parsing or activating the config
file", without libvirt noticing it, BTW). This can be reproduced with (I
think) any kernel >= 2.6.39 and the following XML (to be used with
"virsh net-create"):

        <network>
          <name>test-bridge</name>
          <bridge name='testbr0' />
          <ip family='ipv6' address='fd00::1' prefix='64'>
          </ip>
        </network>

(it happens even when you have an IPv4, too)

The problem is that since commit [1] (which, ironically, was made to
“help IPv6 autoconfiguration”) the linux bridge code makes bridges
behave like “real” devices regarding carrier detection. This makes the
bridges created by libvirt, which are started without any up devices,
stay with the NO-CARRIER flag set, and thus prevents DAD (Duplicate
address detection) from happening, thus letting the IPv6 address flagged
as “tentative”. Such addresses cannot be bound to (see RFC 2462), so
dnsmasq fails binding to it (for radvd, it detects that "interface XXX
is not RUNNING", thus that "interface XXX does not exist, ignoring the
interface" (sic)). It seems that this behavior was enhanced somehow with
commit [2] by avoiding setting NO-CARRIER on empty bridges, but I
couldn't reproduce this behavior on my kernel. Anyway, with the “dummy
tap to set MAC address” trick, this wouldn't work.

To fix this, the idea is to get the bridge's attached device to be up so
that DAD can happen (deactivating DAD altogether is not a good idea, I
think). Currently, libvirt creates a dummy TAP device to set the MAC
address of the bridge, keeping it down. But even if we set this device
up, it is not RUNNING as soon as the tap file descriptor attached to it
is closed, thus still preventing DAD. So, we must modify the API a bit,
so that we can get the fd, keep the tap device persistent, run the
daemons, and close it after DAD has taken place. After that, the bridge
will be flagged NO-CARRIER again, but the daemons will be running, even
if not happy about the device's state (but we don't really care about
the bridge's daemons doing anything when no up interface is connected to
it).

Other solutions that I envisioned were:
      * Keeping the *-nic interface up: this would waste an fd for each
        bridge during all its life. May be acceptable, I don't really
        know.
      * Stop using the dummy tap trick, and set the MAC address directly
        on the bridge: it is possible since quite some time it seems,
        even if then there is the problem of the bridge not being
        RUNNING when empty, contrary to what [2] says, so this will need
        fixing (and this fix only happened in 3.1, so it wouldn't work
        for 2.6.39)
      * Using the --interface option of dnsmasq, but I saw somewhere
        that it's not used by libvirt for backward compatibility. I am
        not sure this would solve this problem, though, as I don't know
        how dnsmasq binds itself to it with this option.

This is why this patch does what's described earlier.

This patch also makes radvd start even if the interface is
“missing” (i.e. it is not RUNNING), as it daemonizes before binding to
it, and thus sometimes does it after the interface has been brought down
by us (by closing the tap fd), and then originally stops. This also
makes it stop yelling about it in the logs when the interface is down at
a later time.

[1]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=1faa4356a3bd89ea11fb92752d897cff3a20ec0e
[2]
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=b64b73d7d0c480f75684519c6134e79d50c1b341

12 years agoFix regression starting QEMU instances without query-events
Daniel P. Berrange [Thu, 27 Sep 2012 14:25:16 +0000 (15:25 +0100)]
Fix regression starting QEMU instances without query-events

If QEMU reports CommandNotFound for the 'query-events' command,
we must treat that as success, returning a zero-length array
of events

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix compilation of legacy xen driver with Xen 4.2
Jim Fehlig [Wed, 26 Sep 2012 21:20:35 +0000 (15:20 -0600)]
Fix compilation of legacy xen driver with Xen 4.2

In Xen 4.2, xs.h is deprecated in favor of xenstore.h.  xs.h now
contains

#warning xs.h is deprecated use xenstore.h instead
#include <xenstore.h>

which fails compilation when warnings are treated as errors.

Introduce a configure-time check for xenstore.h and if found,
use it instead of xs.h.

12 years agoPass the "raw" log message to each virLogOutputFunc
Miloslav Trmač [Thu, 27 Sep 2012 11:45:33 +0000 (12:45 +0100)]
Pass the "raw" log message to each virLogOutputFunc

In addition to the preformatted text line, pass the raw message as well,
to allow the output functions to use a different output format.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSplit priority conversion from virLogOutputToSyslog
Miloslav Trmač [Thu, 27 Sep 2012 11:34:04 +0000 (12:34 +0100)]
Split priority conversion from virLogOutputToSyslog

Allow for the code converting from libvirt log levels to syslog
log levels to be reused.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove command/event capabilities detection out of QEMU monitor code
Daniel P. Berrange [Thu, 13 Sep 2012 14:54:02 +0000 (15:54 +0100)]
Move command/event capabilities detection out of QEMU monitor code

The qemuMonitorSetCapabilities() API is used to initialize the QMP
protocol capabilities. It has since been abused to initialize some
libvirt internal capabilities based on command/event existance too.
Move the latter code out into qemuCapsProbeQMP() in the QEMU
capabilities source file instead

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove some unused includes in QEMU code
Daniel P. Berrange [Thu, 13 Sep 2012 14:36:56 +0000 (15:36 +0100)]
Remove some unused includes in QEMU code

The qemu monitor does not require qemu_conf.h, and the
qemu capabilities code actually wants bitmap.h

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetTargetArch() method for QMP query-target command
Daniel P. Berrange [Wed, 22 Aug 2012 09:48:41 +0000 (10:48 +0100)]
Add a qemuMonitorGetTargetArch() method for QMP query-target command

Add a new qemuMonitorGetTargetArch() method to support invocation
of the 'query-target' JSON monitor command. No HMP equivalent
is required, since this will only be present for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetObjectProps() method for QMP device-list-properties command
Daniel P. Berrange [Wed, 22 Aug 2012 09:48:41 +0000 (10:48 +0100)]
Add a qemuMonitorGetObjectProps() method for QMP device-list-properties command

Add a new qemuMonitorGetObjectProps() method to support invocation
of the 'device-list-properties' JSON monitor command. No HMP equivalent
is required, since this will only be present for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetObjectTypes() method for QMP qom-list-types command
Daniel P. Berrange [Wed, 22 Aug 2012 09:48:41 +0000 (10:48 +0100)]
Add a qemuMonitorGetObjectTypes() method for QMP qom-list-types command

Add a new qemuMonitorGetObjectTypes() method to support invocation
of the 'qom-list-types' JSON monitor command. No HMP equivalent
is required, since this will only be present for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetEvents() method for QMP query-events command
Daniel P. Berrange [Wed, 22 Aug 2012 09:48:41 +0000 (10:48 +0100)]
Add a qemuMonitorGetEvents() method for QMP query-events command

Add a new qemuMonitorGetEvents() method to support invocation
of the 'query-events' JSON monitor command. No HMP equivalent
is required, since this will only be used when JSON is available

The existing qemuMonitorJSONCheckEvents() method is refactored
to use this new method

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetCommands() method for QMP query-commands command
Daniel P. Berrange [Wed, 22 Aug 2012 09:25:20 +0000 (10:25 +0100)]
Add a qemuMonitorGetCommands() method for QMP query-commands command

Add a new qemuMonitorGetCPUCommands() method to support invocation
of the 'query-commands' JSON monitor command. No HMP equivalent
is required, since this will only be used when JSON is available

The existing qemuMonitorJSONCheckCommands() method is refactored
to use this new method

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetCPUDefinitions method for QMP query-cpu-definitions command
Daniel P. Berrange [Mon, 20 Aug 2012 14:58:20 +0000 (15:58 +0100)]
Add a qemuMonitorGetCPUDefinitions method for QMP query-cpu-definitions command

Add a new qemuMonitorGetCPUDefinitions() method to support invocation
of the 'query-cpu-definitions' JSON monitor command. No HMP equivalent
is required, since this will only be present for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetMachines() method for QMP query-machines command
Daniel P. Berrange [Wed, 15 Aug 2012 15:18:41 +0000 (16:18 +0100)]
Add a qemuMonitorGetMachines() method for QMP query-machines command

Add a new qemuMonitorGetMachines() method to support invocation
of the 'query-machines' JSON monitor command. No HMP equivalent
is required, since this will only be present for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemuMonitorGetVersion() method for QMP query-version command
Daniel P. Berrange [Wed, 15 Aug 2012 14:04:09 +0000 (15:04 +0100)]
Add a qemuMonitorGetVersion() method for QMP query-version command

Add a new qemuMonitorGetVersion() method to support invocation
of the 'query-version' JSON monitor command. No HMP equivalent
is provided, since this will only be used for QEMU >= 1.2

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRefactor guest init to support qemu-system-i386 binary too
Daniel P. Berrange [Wed, 22 Aug 2012 16:59:39 +0000 (17:59 +0100)]
Refactor guest init to support qemu-system-i386 binary too

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove xenner support
Daniel P. Berrange [Wed, 22 Aug 2012 16:29:01 +0000 (17:29 +0100)]
Remove xenner support

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMake qemuCapsProbeMachineTypes & qemuCapsProbeCPUModels static
Daniel P. Berrange [Wed, 22 Aug 2012 16:23:00 +0000 (17:23 +0100)]
Make qemuCapsProbeMachineTypes & qemuCapsProbeCPUModels static

The qemuCapsProbeMachineTypes & qemuCapsProbeCPUModels methods
do not need to be invoked directly anymore. Make them static
and refactor them to directly populate the qemuCapsPtr object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove probing of CPU models when launching QEMU guests
Daniel P. Berrange [Wed, 22 Aug 2012 15:28:55 +0000 (16:28 +0100)]
Remove probing of CPU models when launching QEMU guests

When launching a QEMU guest the binary is probed to discover
the list of supported CPU names. Remove this probing with a
simple lookup of CPU models in the qemuCapsPtr object. This
avoids another invocation of the QEMU binary during the
startup path.

As a nice benefit we can now remove all the nasty hacks from
the test suite which were done to avoid having to exec QEMU
on the test system. The building of the -cpu command line
can just rely on data we pre-populate in qemuCapsPtr.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove probing of machine types when canonicalizing XML
Daniel P. Berrange [Wed, 22 Aug 2012 15:25:57 +0000 (16:25 +0100)]
Remove probing of machine types when canonicalizing XML

When XML for a new guest is received, the machine type is
immediately canonicalized into the version specific name.
This involves probing QEMU for supported machine types.
Replace this probing with a lookup of the machine types
in the (hopefully cached) qemuCapsPtr object

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove probing of flags when launching QEMU guests
Daniel P. Berrange [Wed, 22 Aug 2012 14:39:54 +0000 (15:39 +0100)]
Remove probing of flags when launching QEMU guests

Remove all use of the existing APIs for querying QEMU
capability flags. Instead obtain a qemuCapsPtr object
from the global cache. This avoids the execution of
'qemu -help' (and related commands) when launching new
guests.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSwitch over to use cache for building QEMU capabilities
Daniel P. Berrange [Wed, 22 Aug 2012 13:37:05 +0000 (14:37 +0100)]
Switch over to use cache for building QEMU capabilities

When building up a virCapsPtr instance, the QEMU driver
was copying the list of machine types across from the
previous virCapsPtr instance, if the QEMU binary had not
changed. Replace this ad-hoc caching of data with use
of the new qemuCapsCache global cache.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoAdd a qemu capabilities cache manager
Daniel P. Berrange [Wed, 22 Aug 2012 12:54:13 +0000 (13:54 +0100)]
Add a qemu capabilities cache manager

Introduce a qemuCapsCachePtr object to provide a global cache
of capabilities for QEMU binaries. The cache auto-populates
on first request for capabilities about a binary, and will
auto-refresh if the binary has changed since a previous cache
was populated

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix handling of itanium arch name in QEMU driver
Daniel P. Berrange [Wed, 26 Sep 2012 12:48:31 +0000 (13:48 +0100)]
Fix handling of itanium arch name in QEMU driver

For historical compat we use 'itanium' as the arch name, so
if the QEMU binary suffix is 'ia64' we need to translate it

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix potential deadlock when agent is closed
Daniel P. Berrange [Wed, 26 Sep 2012 15:23:24 +0000 (16:23 +0100)]
Fix potential deadlock when agent is closed

If the qemuAgentClose method is called from a place which holds
the domain lock, it is theoretically possible to get a deadlock
in the agent destroy callback. This has not been observed, but
the equivalent code in the QEMU monitor destroy callback has seen
a deadlock.

Remove the redundant locking while unrefing the object and the
bogus assignment

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoUse size_t instead of int for virDomainDefPtr struct
Daniel P. Berrange [Wed, 26 Sep 2012 15:12:28 +0000 (16:12 +0100)]
Use size_t instead of int for virDomainDefPtr struct

Many parts of virDomainDefPtr were using 'int' variables as
array length counts. Replace all these with size_t and update
various format strings & API signatures to adapt

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix (rare) deadlock in QEMU monitor callbacks
Daniel P. Berrange [Wed, 26 Sep 2012 14:54:58 +0000 (15:54 +0100)]
Fix (rare) deadlock in QEMU monitor callbacks

Some users report (very rarely) seeing a deadlock in the QEMU
monitor callbacks

 Thread 10 (Thread 0x7fcd11e20700 (LWP 26753)):
 #0  0x00000030d0e0de4d in __lll_lock_wait () from /lib64/libpthread.so.0
 #1  0x00000030d0e09ca6 in _L_lock_840 () from /lib64/libpthread.so.0
 #2  0x00000030d0e09ba8 in pthread_mutex_lock () from /lib64/libpthread.so.0
 #3  0x00007fcd162f416d in virMutexLock (m=<optimized out>)
     at util/threads-pthread.c:85
 #4  0x00007fcd1632c651 in virDomainObjLock (obj=<optimized out>)
     at conf/domain_conf.c:14256
 #5  0x00007fcd0daf05cc in qemuProcessHandleMonitorDestroy (mon=0x7fcccc0029e0,
     vm=0x7fcccc00a850) at qemu/qemu_process.c:1026
 #6  0x00007fcd0db01710 in qemuMonitorDispose (obj=0x7fcccc0029e0)
     at qemu/qemu_monitor.c:249
 #7  0x00007fcd162fd4e3 in virObjectUnref (anyobj=<optimized out>)
     at util/virobject.c:139
 #8  0x00007fcd0db027a9 in qemuMonitorClose (mon=<optimized out>)
     at qemu/qemu_monitor.c:860
 #9  0x00007fcd0daf61ad in qemuProcessStop (driver=driver@entry=0x7fcd04079d50,
     vm=vm@entry=0x7fcccc00a850,
     reason=reason@entry=VIR_DOMAIN_SHUTOFF_DESTROYED, flags=flags@entry=0)
     at qemu/qemu_process.c:4057
 #10 0x00007fcd0db323cf in qemuDomainDestroyFlags (dom=<optimized out>,
     flags=<optimized out>) at qemu/qemu_driver.c:1977
 #11 0x00007fcd1637ff51 in virDomainDestroyFlags (
     domain=domain@entry=0x7fccf00c1830, flags=1) at libvirt.c:2256

At frame #10 we are holding the domain lock, we call into
qemuProcessStop() to cleanup QEMU, which triggers the monitor
to close, which invokes qemuProcessHandleMonitorDestroy() which
tries to obtain the domain lock again. This is a non-recursive
lock, hence hang.

Since qemuMonitorPtr is a virObject, the unref call in
qemuProcessHandleMonitorDestroy no longer needs mutex
protection. The assignment of priv->mon = NULL, can be
instead done by the caller of qemuMonitorClose(), thus
removing all need for locking.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't skip over socket label cleanup
Daniel P. Berrange [Wed, 26 Sep 2012 14:46:47 +0000 (15:46 +0100)]
Don't skip over socket label cleanup

If QEMU quits immediately after we opened the monitor it was
possible we would skip the clearing of the SELinux process
socket context

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove most of qemuProcessKill into virProcessKillPainfully
Daniel P. Berrange [Wed, 26 Sep 2012 14:42:58 +0000 (15:42 +0100)]
Move most of qemuProcessKill into virProcessKillPainfully

In the cgroups APIs we have a virCgroupKillPainfully function
which does the loop sending SIGTERM, then SIGKILL and waiting
for the process to exit. There is similar functionality for
simple processes in qemuProcessKill, but it is tangled with
the QEMU code. Untangle it to provide a virProcessKillPainfuly
function

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't ignore return value of qemuProcessKill
Daniel P. Berrange [Thu, 27 Sep 2012 09:07:03 +0000 (10:07 +0100)]
Don't ignore return value of qemuProcessKill

When calling qemuProcessKill from the virDomainDestroy impl
in QEMU, do not ignore the return value. This ensures that
if QEMU fails to respond to SIGKILL, the caller will know
about the failure.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix deadlock in handling EOF in LXC monitor
Daniel P. Berrange [Wed, 26 Sep 2012 14:08:20 +0000 (15:08 +0100)]
Fix deadlock in handling EOF in LXC monitor

Depending on the scenario in which LXC containers exit, it is
possible for the EOF callback of the LXC monitor to deadlock
the driver.

  #0  0x00000038a0a0de4d in __lll_lock_wait () from /lib64/libpthread.so.0
  #1  0x00000038a0a09ca6 in _L_lock_840 () from /lib64/libpthread.so.0
  #2  0x00000038a0a09ba8 in pthread_mutex_lock () from /lib64/libpthread.so.0
  #3  0x00007f4bd9579d55 in virMutexLock (m=<optimized out>) at util/threads-pthread.c:85
  #4  0x00007f4bcacc7597 in lxcDriverLock (driver=0x7f4bc40c8290) at lxc/lxc_conf.h:81
  #5  virLXCProcessMonitorEOFNotify (mon=<optimized out>, vm=0x7f4bb4000b00) at lxc/lxc_process.c:581
  #6  0x00007f4bd9645c91 in virNetClientCloseLocked (client=client@entry=0x7f4bb4009e60)
      at rpc/virnetclient.c:554
  #7  0x00007f4bd96460f8 in virNetClientIOEventLoopPassTheBuck (thiscall=0x0, client=0x7f4bb4009e60)
      at rpc/virnetclient.c:1306
  #8  virNetClientIOEventLoopPassTheBuck (client=0x7f4bb4009e60, thiscall=0x0)
      at rpc/virnetclient.c:1287
  #9  0x00007f4bd96467a2 in virNetClientCloseInternal (reason=3, client=0x7f4bb4009e60)
      at rpc/virnetclient.c:589
  #10 virNetClientCloseInternal (client=0x7f4bb4009e60, reason=3) at rpc/virnetclient.c:561
  #11 0x00007f4bcacc4a82 in virLXCMonitorClose (mon=0x7f4bb4000a00) at lxc/lxc_monitor.c:201
  #12 0x00007f4bcacc55ac in virLXCProcessCleanup (reason=<optimized out>, vm=0x7f4bb4000b00,
      driver=0x7f4bc40c8290) at lxc/lxc_process.c:240
  #13 virLXCProcessStop (driver=0x7f4bc40c8290, vm=vm@entry=0x7f4bb4000b00,
      reason=reason@entry=VIR_DOMAIN_SHUTOFF_DESTROYED) at lxc/lxc_process.c:735
  #14 0x00007f4bcacc5bd2 in virLXCProcessAutoDestroyDom (payload=<optimized out>,
      name=0x7f4bb4003c80, opaque=0x7fff41af2df0) at lxc/lxc_process.c:94
  #15 0x00007f4bd9586649 in virHashForEach (table=0x7f4bc409b270,
      iter=iter@entry=0x7f4bcacc5ab0 <virLXCProcessAutoDestroyDom>, data=data@entry=0x7fff41af2df0)
      at util/virhash.c:514
  #16 0x00007f4bcacc52d7 in virLXCProcessAutoDestroyRun (driver=driver@entry=0x7f4bc40c8290,
      conn=conn@entry=0x7f4bb8000ab0) at lxc/lxc_process.c:120
  #17 0x00007f4bcacca628 in lxcClose (conn=0x7f4bb8000ab0) at lxc/lxc_driver.c:128
  #18 0x00007f4bd95e67ab in virReleaseConnect (conn=conn@entry=0x7f4bb8000ab0) at datatypes.c:114

When the driver calls virLXCMonitorClose, there is really no
need for the EOF callback to be invoked in this case, since
the caller can easily handle events itself. In changing this,
the monitor needs to take a deep copy of the callback list,
not merely a reference.

Also adds debug statements in various places to aid
troubleshooting

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSupport Xen sysctl version 9 in Xen 4.2
Jim Fehlig [Wed, 26 Sep 2012 16:34:17 +0000 (10:34 -0600)]
Support Xen sysctl version 9 in Xen 4.2

Xen upstream c/s 24102:dc8e55c9 bumped the sysctl version to 9.
Support this sysctl version in the xen_hypervisor sub-driver.

12 years agonetwork: backend for virNetworkUpdate of interface list
Laine Stump [Fri, 21 Sep 2012 16:50:53 +0000 (12:50 -0400)]
network: backend for virNetworkUpdate of interface list

<interface> elements are location inside the <forward> element of a
network. There is only one <forward> element in any network, but it
might have many <interface> elements. This element only contains a
single attribute, "dev", which is the name of a network device
(e.g. "eth0").

Since there is only a single attribute, the modify operation isn't
supported for this "section", only add-first, add-last, and
delete. Also, note that it's not permitted to delete an interface from
the list while any guest is using it. We may later decide this is safe
(because removing it from the list really only excludes it from
consideration in future guest allocations of interfaces, but doesn't
affect any guests currently connected), but for now this limitation
seems prudent (of course when changing the persistent config, this
limitation doesn't apply, because the persistent config doesn't
support the concept of "in used").

Another limitation - it is also possible for the interfraces in this
list to be described by PCI address rather than netdev name. However,
I noticed while writing this function that we currently don't support
defining interfaces that way in config - the only method of getting
interfaces specified as <adress type='pci' ..../> instead of
<interface dev='xx'/> is to provide a <pf dev='yy'/> element under
forward, and let the entries in the interface list be automatically
populated with the virtual functions (VF) of the physical function
device given in <pg>.

As with the other virNetworkUpdate section backends, support for this
section is completely contained within a single static function, no
other changes were required, and only functions already called from
elsewhere within the same file are used in the new content for this
existing function (i.e., adding this code should not cause a new build
problem on any platform).

12 years agobuild: avoid older gcc warning
Eric Blake [Wed, 26 Sep 2012 17:16:36 +0000 (11:16 -0600)]
build: avoid older gcc warning

Jim Fehlig reported a compilation error with older gcc 4.3.4:

libvirt.c: In function 'virDomainGetEmulatorPinInfo':
libvirt.c:9111: error: logical '&&' with non-zero constant will always evaluate as true [-Wlogical-op]

It looks like someone programmed via too much copy-and-paste.

* src/libvirt.c (virDomainGetEmulatorPinInfo): Multiplying by 1 is
a no-op, and thus will never overflow.

12 years agoparallels: don't give null pointers to virBitmapEqual
Dmitry Guryanov [Wed, 26 Sep 2012 12:30:02 +0000 (16:30 +0400)]
parallels: don't give null pointers to virBitmapEqual

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: remove unneded code from parallelsDoCmdRun
Dmitry Guryanov [Wed, 26 Sep 2012 12:30:01 +0000 (16:30 +0400)]
parallels: remove unneded code from parallelsDoCmdRun

scmd was used for debugging and I forgot to remove it before
commit, so remove it now.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: fix memory allocation
Dmitry Guryanov [Wed, 26 Sep 2012 12:30:00 +0000 (16:30 +0400)]
parallels: fix memory allocation

size of videos array must be increased.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoparallels: remove unused member 'os' from parallelsDomObj
Dmitry Guryanov [Wed, 26 Sep 2012 12:29:59 +0000 (16:29 +0400)]
parallels: remove unused member 'os' from parallelsDomObj

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
12 years agoqemu: wait for SPICE to migrate
Michal Privoznik [Thu, 20 Sep 2012 09:15:31 +0000 (11:15 +0200)]
qemu: wait for SPICE to migrate

Recently, there have been some improvements made to qemu so it
supports seamless migration or something very close to it.
However, it requires libvirt interaction. Once qemu is migrated,
the SPICE server needs to send its internal state to the destination.
Once it's done, it fires SPICE_MIGRATE_COMPLETED event and this
fact is advertised in 'query-spice' output as well.
We must not kill qemu until SPICE server finishes the transfer.

12 years agoFix typo in header file comment
Daniel P. Berrange [Wed, 26 Sep 2012 09:38:26 +0000 (10:38 +0100)]
Fix typo in header file comment

s/mmeory/memory/ in libvirt.h.in

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoDon't use O_TRUNC when opening QEMU logfiles
Daniel P. Berrange [Fri, 21 Sep 2012 09:37:53 +0000 (10:37 +0100)]
Don't use O_TRUNC when opening QEMU logfiles

SELinux wants all log files opened with O_APPEND. When
running non-root though, libvirtd likes to use O_TRUNC
to avoid log files growing in size indefinitely. Instead
of using O_TRUNC though, we can use O_APPEND and then
call ftruncate() which keeps SELinux happier.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoSimplify some redundant locking while unref'ing objects
Daniel P. Berrange [Mon, 24 Sep 2012 14:19:34 +0000 (15:19 +0100)]
Simplify some redundant locking while unref'ing objects

There is no need to hold the mutex when unref'ing
virObject instances

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRemove pointless virLXCProcessMonitorDestroy method
Daniel P. Berrange [Mon, 24 Sep 2012 14:13:10 +0000 (15:13 +0100)]
Remove pointless virLXCProcessMonitorDestroy method

Asynchronously setting priv->mon to NULL was pointless,
just remove the destroy callback entirely.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoConvert virLXCMonitor to use virObject
Daniel P. Berrange [Fri, 21 Sep 2012 14:09:42 +0000 (15:09 +0100)]
Convert virLXCMonitor to use virObject

Remove custom reference counting from virLXCMonitor, using
virObject instead

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove virProcess{Kill,Abort,TranslateStatus} into virprocess.{c,h}
Daniel P. Berrange [Mon, 24 Sep 2012 17:10:37 +0000 (18:10 +0100)]
Move virProcess{Kill,Abort,TranslateStatus} into virprocess.{c,h}

Continue consolidation of process functions by moving some
helpers out of command.{c,h} into virprocess.{c,h}

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoMove virProcessKill into virprocess.{h,c}
Daniel P. Berrange [Mon, 24 Sep 2012 16:54:51 +0000 (17:54 +0100)]
Move virProcessKill into virprocess.{h,c}

There are a number of process related functions spread
across multiple files. Start to consolidate them by
creating a virprocess.{c,h} file

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virCommandTranslateStatus to virProcessTranslateStatus
Daniel P. Berrange [Mon, 24 Sep 2012 17:01:26 +0000 (18:01 +0100)]
Rename virCommandTranslateStatus to virProcessTranslateStatus

The virCommand prefix was inappropriate because the API
does not use any virCommandPtr object instance. This
API closely related to waitpid/exit, so use virProcess
as the prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virPid{Abort,Wait} to virProcess{Abort,Wait}
Daniel P. Berrange [Mon, 24 Sep 2012 16:59:31 +0000 (17:59 +0100)]
Rename virPid{Abort,Wait} to virProcess{Abort,Wait}

Change "Pid" to "Process" to align with the virProcessKill
API naming prefix

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoRename virKillProcess to virProcessKill
Daniel P. Berrange [Mon, 24 Sep 2012 15:29:20 +0000 (16:29 +0100)]
Rename virKillProcess to virProcessKill

Changing naming to follow the convention of "object" followed
by "action"

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agoFix start of containers with custom root filesystem
Daniel P. Berrange [Tue, 25 Sep 2012 15:24:10 +0000 (16:24 +0100)]
Fix start of containers with custom root filesystem

A prefix change to unmount the SELinux filesystem broke starting
of LXC containers with a custom root filesystem

12 years agoUpdate how to compile with -Werror
Doug Goldstein [Mon, 24 Sep 2012 23:44:34 +0000 (18:44 -0500)]
Update how to compile with -Werror

--enable-compile-warnings=error has been renamed to --enable-werror so
update the HACKING and the hacking.html to reflect that.

12 years agoqemu: Avoid holding the driver lock in trivial snapshot API's
Peter Krempa [Mon, 24 Sep 2012 20:31:35 +0000 (22:31 +0200)]
qemu: Avoid holding the driver lock in trivial snapshot API's

In most of the snapshot API's there's no need to hold the driver lock
the whole time.

This patch adds helper functions that get the domain object in functions
that don't require the driver lock and simplifies call paths from
snapshot-related API's.

12 years agostorage: Add timeout for iscsi volume's stable path discovery
Osier Yang [Mon, 24 Sep 2012 08:44:20 +0000 (16:44 +0800)]
storage: Add timeout for iscsi volume's stable path discovery

It might need some time till the LUN's stable path shows up on
initiator host, and although the time window is not foreseeable,
as a better than nothing fix, this patch adds timeout for the
stable path discovery process.

12 years agobuild: fix detection of netcf linked with libnl1
Christophe Fergeau [Wed, 19 Sep 2012 15:00:55 +0000 (17:00 +0200)]
build: fix detection of netcf linked with libnl1

Commit 9298bfbcb introduced code to detect if netcf is linked with
libnl1, and to prefer libnl1 over libnl3 when this is the case.
This behaviour can be disabled by setting LIBNL_CFLAGS to any value,
including the empty string.
However, configure.ac sets LIBNL_CFLAGS to "" before attempting
libnl detection, so the libnl1 detection code is always disabled.
This caused issues on my f17 system where netcf is linked with libnl1
but libvirt got built with libnl3.

This commit removes the setting of the LIBNL_* variables to "" as
this does not appear to be needed. After this change, libnl1 is
used when building libvirt on my f17 system.

12 years agonode_memory: Improve the docs
Osier Yang [Mon, 24 Sep 2012 15:08:31 +0000 (23:08 +0800)]
node_memory: Improve the docs

To declare that it's not recommended to use the tuning API while
the outside tuning program (such as ksmtuned under Linux) is running.

12 years agotests: test previous commit
Eric Blake [Mon, 24 Sep 2012 23:04:46 +0000 (17:04 -0600)]
tests: test previous commit

Add a test to avoid virCommand regressions.

* tests/commandtest.c (test8): Explicitly test env-var overrides.

12 years agocommand: Change virCommandAddEnv so it replaces existing environment variables.
Richard W.M. Jones [Mon, 24 Sep 2012 16:35:47 +0000 (17:35 +0100)]
command: Change virCommandAddEnv so it replaces existing environment variables.

12 years agocommand: Move environ-adding code to common function virCommandAddEnv.
Richard W.M. Jones [Mon, 24 Sep 2012 16:30:18 +0000 (17:30 +0100)]
command: Move environ-adding code to common function virCommandAddEnv.

This is just code motion.  The semantics of the code should be
identical after this change.

12 years agoRelease of libvirt-0.10.2
Daniel Veillard [Mon, 24 Sep 2012 04:06:05 +0000 (12:06 +0800)]
Release of libvirt-0.10.2

* configure.ac docs/news.html.in libvirt.spec.in: update for the release
* po/*.po*: update from transifex and regenerate

12 years agoFix another rpmbuild failure
Daniel Veillard [Mon, 24 Sep 2012 04:41:56 +0000 (12:41 +0800)]
Fix another rpmbuild failure

without systemd we should not try to package the non-installed
%{_sysconfdir}/rc.d/init.d/libvirtd

12 years agoFix an rpmbuild failure
Daniel Veillard [Mon, 24 Sep 2012 04:37:02 +0000 (12:37 +0800)]
Fix an rpmbuild failure

$RPM_BUILD_ROOT was embedded in /etc/rc.d/init.d/libvirt-guests

12 years agoDon't install legacy initscripts at same time as systemd ones
Daniel P. Berrange [Fri, 21 Sep 2012 10:24:31 +0000 (11:24 +0100)]
Don't install legacy initscripts at same time as systemd ones

The Fedora policies don't want us installing the legacy initscripts
in parallel with the systemd ones, so switch to only install the
systemd unit

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
12 years agonetwork: log error for unknown virNetworkUpdate command codes
Laine Stump [Fri, 21 Sep 2012 16:11:51 +0000 (12:11 -0400)]
network: log error for unknown virNetworkUpdate command codes

Every level of the code for virNetworkUpdate was assuming that some
other level was checking for validity of the "command" arg, but none
actually were. The result was that an invalid command code would do
nothing, but also report success.

Since the command code isn't used until the very lowest level backend
functions, that's where I put the check. I made a separate one-line
function to log the error. The compiler would have combined the
identical strings used by multiple calls if I'd just called
virReportError directly in each location, but sending them all to the
same string in the source guards against inadvertant divergence (which
would lead to extra work for translators.)

12 years agonetwork: make virNetworkObjUpdate error detection/recovery better
Laine Stump [Fri, 21 Sep 2012 18:48:17 +0000 (14:48 -0400)]
network: make virNetworkObjUpdate error detection/recovery better

1) virNetworkObjUpdate should be an all or none operation, but in the
case that we want to update both the live state and persistent config
versions of the network, it was committing the update to the live
state before starting to update the persistent config. If update of
the persistent config failed, we would leave with things in an
inconsistent state - the live state would be updated (even though an
error was returned), but persistent config unchanged.

This patch changed virNetworkObjUpdate to use a separate pointer for
each copy of the virNetworkDef, and not commit either of them in the
virNetworkObj until both live and config parts of the update have
successfully completed.

2) The parsers for various pieces of the virNetworkDef have all sorts
of subtle limitations on them that may not be known by the
Update[section] function, making it possible for one of these
functions to make a modification directly to the object that may not
pass the scrutiny of a subsequent parse. But normally another parse
wouldn't be done on the data until the *next* time the object was
updated (which could leave the network definition in an unusable
state).

Rather than fighting the losing battle of trying to duplicate all the
checks from the parsers into the update functions as well, the more
foolproof solution to this is to simply do an extra
virNetworkDefCopy() operation on the updated networkdef -
virNetworkDefCopy() does a virNetworkFormat() followed by a
virNetworkParseString(), so it will do all the checks we need. If this
fails, then we don't commit the changed def.

12 years agonetwork: don't "refresh" iptables rules on rule-less networks
Laine Stump [Fri, 21 Sep 2012 19:28:11 +0000 (15:28 -0400)]
network: don't "refresh" iptables rules on rule-less networks

The bridge driver implementation of virNetworkUpdate() removes and
re-adds iptables rules any time a network has an <ip>, <forward>, or
<forward>/<interface> element updated. There are some types of
networks that have those elements and yet have no iptables rules
associated with them, and unfortunately the functions that remove/add
iptables rules don't check the type of network before attempting to
remove/add the rules, sometimes leading to an erroneous failure of the
entire update operation.

Under normal circumstances I would refactor the lower level functions
to be more robust, but to avoid code churn as much as possible, I've
just added extra checks directly to networkUpdate().

12 years agoDrop unused return value of virLogOutputFunc
Miloslav Trmač [Thu, 20 Sep 2012 18:24:00 +0000 (20:24 +0200)]
Drop unused return value of virLogOutputFunc

Nothing uses the return value, and creating it requries otherwise
unnecessary strlen () calls.

This cleanup is conceptually independent from the rest of the series
(although the later patches won't apply without it).  This just seems
a good opportunity to clean this up, instead of entrenching the unnecessary
return value in the virLogOutputFunc instance that will be added in this
series.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
12 years agoRemove redundant lines in src/qemu/qemu_driver.c
Tang Chen [Fri, 21 Sep 2012 09:50:10 +0000 (17:50 +0800)]
Remove redundant lines in src/qemu/qemu_driver.c

maxcpu and hostcpus are defined and calculated in qemudDomainPinVcpuFlags()
and qemudDomainPinEmulator(), but never used. So remove them including nodeinfo.

Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
12 years agoAdd <seclabel> to character devices.
Richard W.M. Jones [Thu, 20 Sep 2012 13:16:17 +0000 (14:16 +0100)]
Add <seclabel> to character devices.

This allows the user to control labelling of each character device
separately (the default is to inherit from the VM).

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoMake virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser.
Richard W.M. Jones [Thu, 20 Sep 2012 13:58:12 +0000 (14:58 +0100)]
Make virSecurityDeviceLabelDefParseXML into generic device <seclabel> parser.

This is just code motion, allowing us to reuse the same function to
parse the <seclabel> from character devices too.

However it also fixes a possible segfault in the original code if
VIR_ALLOC_N returns an error and the cleanup code (at the error:
label) tries to iterate over the unallocated array (thanks Michal
Privoznik for spotting this).

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
12 years agoqemu: Fix failure path in disk hotplug
Jiri Denemark [Thu, 20 Sep 2012 20:28:35 +0000 (22:28 +0200)]
qemu: Fix failure path in disk hotplug

Disk hotplug is a two phase action: qemuMonitorAddDrive followed by
qemuMonitorAddDevice. When the first part succeeds but the second one
fails, we need to rollback the drive addition.

12 years agolocking: Remove README file in favor of internals/locking.html
Jiri Denemark [Mon, 17 Sep 2012 13:18:57 +0000 (15:18 +0200)]
locking: Remove README file in favor of internals/locking.html

The README file seems to be a leftover from some previous version of
locking driver. It is not consistent with what the code does nor is it
consistent with existing documentation in internals/locking.html.