]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoqemu: correct misspelled 'enospc' option, and only use for werror
Laine Stump [Tue, 4 Oct 2011 17:26:29 +0000 (13:26 -0400)]
qemu: correct misspelled 'enospc' option, and only use for werror

This resolves:

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

When support for setting the qemu disk error policy to "enospc" was
added, it was inadvertently spelled "enospace". This patch corrects
that on the qemu commandline (while retaining the "enospace" spelling
for libvirt's XML).

Also, while examining the qemu source, I found that "enospc" is not
allowed for the read error policy, only for write error policy (makes
sense). Since libvirt currently only has a single error policy
setting, when "enospace" is selected, the read error policy is set to
"ignore".

13 years agosnapshot: better virsh handling of missing current, parent
Eric Blake [Fri, 30 Sep 2011 15:45:43 +0000 (09:45 -0600)]
snapshot: better virsh handling of missing current, parent

Previously, virsh 'snapshot-parent' and 'snapshot-current' were
completely silent in the case where the code conclusively proved
there was no parent or current snapshot, but differed in exit
status; this silence caused some confusion on whether the commands
worked.  Furthermore, commit d1be48f introduced a regression where
snapshot-parent would leak output about an unknown function, but
only on the first attempt, when talking to an older server that
lacks virDomainSnapshotGetParent.  This changes things to consistenly
report an error message and exit with status 1 when no snapshot
exists, and to avoid leaking unknown function warnings when using
fallbacks.

* tools/virsh.c (vshGetSnapshotParent): Alter signature, to
distinguish between real error and missing parent.  Don't pollute
last_error on success.
(cmdSnapshotParent): Adjust caller.  Always output message on
failure.
(cmdSnapshotList): Adjust caller.
(cmdSnapshotCurrent): Always output message on failure.

13 years agoDocument that ff callbacks need to be invoked from a clean stack.
Guido Günther [Mon, 3 Oct 2011 20:24:13 +0000 (22:24 +0200)]
Document that ff callbacks need to be invoked from a clean stack.

Also fix a typo.

13 years agoqemu: Fix migration with dname
Jiri Denemark [Tue, 4 Oct 2011 07:11:35 +0000 (09:11 +0200)]
qemu: Fix migration with dname

Destination libvirtd remembers the original name in the prepare phase
and clears it in the finish phase. The original name is used when
comparing domain name in migration cookie.

13 years agoAllow passing of command line args to LXC container
Daniel P. Berrange [Mon, 3 Oct 2011 17:37:47 +0000 (18:37 +0100)]
Allow passing of command line args to LXC container

When booting a virtual machine with a kernel/initrd it is possible
to pass command line arguments using the <cmdline>...args...</cmdline>
element in the guest XML. These appear to the kernel / init process
in /proc/cmdline.

When booting a container we do not have a custom /proc/cmdline,
but we can easily set an environment variable for it. Ideally
we could pass individual arguments to the init process as a
regular set of 'char *argv[]' parameters, but that would involve
libvirt parsing the <cmdline> XML text. This can easily be added
later, even if we add the env variable now

* docs/drvlxc.html.in: Document env variables passed to LXC
* src/conf/domain_conf.c: Add <cmdline> to be parsed for
  guests of type='exe'
* src/lxc/lxc_container.c: Set LIBVIRT_LXC_CMDLINE env var

13 years agoAdd support for bandwidth filtering on LXC guests
Daniel P. Berrange [Mon, 3 Oct 2011 17:25:10 +0000 (18:25 +0100)]
Add support for bandwidth filtering on LXC guests

Call virBandwidthEnable after creating the LXC veth, so that any
bandwidth controls get applied

* src/lxc/lxc_driver.c: Enable bandwidth limiting

13 years agonetwork: fill in bandwidth from portgroup for all forward modes
Laine Stump [Tue, 4 Oct 2011 03:53:36 +0000 (23:53 -0400)]
network: fill in bandwidth from portgroup for all forward modes

This patch is a fix for:

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

which was discovered by Dan Berrange while making bandwidth
configuration work for LXC guests.

Background: Although virtportprofile data from a network portgroup is
only applicable for direct mode interfaces, the code that copies
bandwidth data from the portgroup was also only being executed in the
case of direct mode interfaces. The result was that interfaces using
traditional virtual networks (forward mode='nat|route|none'), and
those using a host bridge for forwarding, would not pick up bandwidth
data from a portgroup defined in the network.

This patch moves that code outside the conditional, so that bandwidth
information is *alway* copied from the appropriate portgroup (unless
the <interface> definition itself already has bandwidth information,
which would take precedence over what's in the portgroup anyway).

13 years agobridge_driver.c: Fix autoconf setting
Neil Wilson [Mon, 3 Oct 2011 09:58:55 +0000 (10:58 +0100)]
bridge_driver.c: Fix autoconf setting

Code altered so that it is consistent with the associated comment. The
'autoconf' variable is forced to zero.

Signed-off-by: Neil Wilson <neil@brightbox.co.uk>
13 years agoSet to NULL members that have been freed to prevent crashes
Marc-André Lureau [Sat, 1 Oct 2011 01:39:14 +0000 (03:39 +0200)]
Set to NULL members that have been freed to prevent crashes

Do not crash if virStreamFinish is called after error.

==11000== Invalid read of size 4
==11000==    at 0x373A8099A0: pthread_mutex_lock (pthread_mutex_lock.c:51)
==11000==    by 0x4C7CADE: virMutexLock (threads-pthread.c:85)
==11000==    by 0x4D57C31: virNetClientStreamRaiseError (virnetclientstream.c:203)
==11000==    by 0x4D385E4: remoteStreamFinish (remote_driver.c:3541)
==11000==    by 0x4D182F9: virStreamFinish (libvirt.c:14157)
==11000==    by 0x40FDC4: cmdScreenshot (virsh.c:3075)
==11000==    by 0x42BA40: vshCommandRun (virsh.c:14922)
==11000==    by 0x42ECCA: main (virsh.c:16381)
==11000==  Address 0x59b86c0 is 16 bytes inside a block of size 216 free'd
==11000==    at 0x4A06928: free (vg_replace_malloc.c:427)
==11000==    by 0x4C69E2B: virFree (memory.c:310)
==11000==    by 0x4D57B56: virNetClientStreamFree (virnetclientstream.c:184)
==11000==    by 0x4D3DB7A: remoteDomainScreenshot (remote_client_bodies.h:1812)
==11000==    by 0x4CFD245: virDomainScreenshot (libvirt.c:2903)
==11000==    by 0x40FB73: cmdScreenshot (virsh.c:3029)
==11000==    by 0x42BA40: vshCommandRun (virsh.c:14922)
==11000==    by 0x42ECCA: main (virsh.c:16381)

13 years agosnapshot: implement getparent for vbox
Eric Blake [Thu, 29 Sep 2011 20:26:03 +0000 (14:26 -0600)]
snapshot: implement getparent for vbox

Built by copying from existing functions.

* src/vbox/vbox_tmpl.c (vboxDomainSnapshotGetParent): New function.

13 years agosnapshot: implement getparent for esx
Eric Blake [Thu, 29 Sep 2011 20:11:56 +0000 (14:11 -0600)]
snapshot: implement getparent for esx

Pretty easy to paste together compared to existing functions.

* src/esx/esx_driver.c (esxDomainSnapshotGetParent): New function.

13 years agoqemu: make PCI multifunction support more manual
Laine Stump [Thu, 29 Sep 2011 17:00:32 +0000 (13:00 -0400)]
qemu: make PCI multifunction support more manual

When support for was added for PCI multifunction cards (in commit
9f8baf, first included in libvirt 0.9.3), it was done by always
turning on the multifunction bit for all PCI devices. Since that time
it has been realized that this is not an ideal solution, and that the
multifunction bit must be selectively turned on. For example, see

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

and the discussion before and after

  https://www.redhat.com/archives/libvir-list/2011-September/msg01036.html

This patch modifies multifunction support so that the multifunction=on
option is only added to the qemu commandline for a device if its PCI
<address> definition has the attribute "multifunction='on'", e.g.:

  <address type='pci' domain='0x0000' bus='0x00'
           slot='0x04' function='0x0' multifunction='on'/>

In practice, the multifunction bit should only be turned on if
function='0' AND other functions will be used in the same slot - it
usually isn't needed for functions 1-7 (although there are apparently
some exceptions, e.g. the Intel X53 according to the QEMU source
code), and should never be set if only function 0 will be used in the
slot. The test cases have been changed accordingly to illustrate.

With this patch in place, if a user attempts to assign multiple
functions in a slot without setting the multifunction bit for function
0, libvirt will issue an error when the domain is defined, and the
define operation will fail. In the future, we may decide to detect
this situation and automatically add multifunction=on to avoid the
error; even then it will still be useful to have a manual method of
turning on multifunction since, as stated above, there are some
devices that excpect it to be turned on for all functions in a slot.

A side effect of this patch is that attempts to use the same PCI
address for two different devices will now log an error (previously
this would cause the domain define operation to fail, but there would
be no log message generated). Because the function doing this log was
almost completely rewritten, I didn't think it worthwhile to make a
separate patch for that fix (the entire patch would immediately be
obsoleted).

13 years agoconf: remove unused VIR_ENUM_DECL
Laine Stump [Wed, 28 Sep 2011 18:19:59 +0000 (14:19 -0400)]
conf: remove unused VIR_ENUM_DECL

While adding a new enum, I noticed a VIR_ENUM_DECL for a type that
doesn't exist. There is also of course no matching VIR_ENUM_IMPL for
it.

13 years agovirsh: do not unlink NULL file
Marc-André Lureau [Sat, 1 Oct 2011 01:05:13 +0000 (03:05 +0200)]
virsh: do not unlink NULL file

error:could not take a screenshot of xp
==6216== Syscall param unlink(pathname) points to unaddressable byte(s)
==6216==    at 0x373A0D4937: unlink (syscall-template.S:82)
==6216==    by 0x40FD73: cmdScreenshot (virsh.c:3070)
==6216==    by 0x42BA0D: vshCommandRun (virsh.c:14920)
==6216==    by 0x42EC97: main (virsh.c:16379)
==6216==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==6216==
error:Requested operation is not valid: domain is not running

13 years agolvm storage backend: handle command_names=1 in lvm.conf
Serge E. Hallyn [Wed, 28 Sep 2011 20:08:34 +0000 (15:08 -0500)]
lvm storage backend: handle command_names=1 in lvm.conf

If the regexes supported (?:pvs)?, then we could handle this by
optionally matching but not returning the initial command name.  But it
doesn't.  So add a new char* argument to
virStorageBackendRunProgRegex().  If that argument is NULL then we act
as usual.  Otherwise, if the string at that argument is found at the
start of a returned line, we drop that before running the regex.

With this patch, virt-manager shows me lvs with command_names 1 or 0.

The definitions of PVS_BASE etc may want to be moved into the configure
scripts (though given how PVS is found, IIUC that could only happen if
pvs was a link to pvs_real), but in any case no sense dealing with that
until we're sure this is an ok way to handle it.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agoqemu: Check for outstanding async job too
Michal Privoznik [Thu, 29 Sep 2011 13:14:13 +0000 (15:14 +0200)]
qemu: Check for outstanding async job too

Currently, qemuDomainGetXMLDesc and qemudDomainGetInfo check for
outstanding synchronous job before (eventual) monitor entering.
However, there can be already async job set, e.g. migration.

13 years agoqemu: Fix error message mentioning VNC instead of SPICE
Peter Krempa [Thu, 29 Sep 2011 13:00:20 +0000 (15:00 +0200)]
qemu: Fix error message mentioning VNC instead of SPICE

13 years agovirsh: Add 'reset' command for virsh
Xu He Jie [Thu, 29 Sep 2011 08:57:12 +0000 (16:57 +0800)]
virsh: Add 'reset' command for virsh

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
13 years agoremote: Implement 'reset' for remote driver
Xu He Jie [Thu, 29 Sep 2011 08:56:24 +0000 (16:56 +0800)]
remote: Implement 'reset' for remote driver

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
13 years agoqemu: Implement 'reset' for qemu driver
Xu He Jie [Thu, 29 Sep 2011 08:54:44 +0000 (16:54 +0800)]
qemu: Implement 'reset' for qemu driver

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
13 years agoapi: Add public api for 'reset'
Xu He Jie [Thu, 29 Sep 2011 08:53:29 +0000 (16:53 +0800)]
api: Add public api for 'reset'

Add new public api for 'reset'.
It can reset domain immediately without any guest shutdown.

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
13 years agologging: Add date to log timestamp
Jiri Denemark [Wed, 28 Sep 2011 14:44:50 +0000 (16:44 +0200)]
logging: Add date to log timestamp

13 years agologging: Do not log timestamp through syslog
Jiri Denemark [Wed, 28 Sep 2011 13:20:07 +0000 (15:20 +0200)]
logging: Do not log timestamp through syslog

Syslog puts the timestamp to every message anyway so this removes
redundant data.

13 years agohyperv: Report an error for acceptable URI schemes with a transport
Matthias Bolte [Tue, 27 Sep 2011 11:11:14 +0000 (13:11 +0200)]
hyperv: Report an error for acceptable URI schemes with a transport

Before, URIs such as hyperv+ssh:// have been declined by the Hyper-V
driver resulting in the remote driver trying to connect to an
non-existing libvirtd.

Now such URIs trigger an error in the yper-V driver suggesting to
try again without the transport part in the scheme.

13 years agoesx: Report an error for acceptable URI schemes with a transport
Matthias Bolte [Tue, 27 Sep 2011 11:08:09 +0000 (13:08 +0200)]
esx: Report an error for acceptable URI schemes with a transport

Before, URIs such as esx+ssh:// have been declined by the ESX driver
resulting in the remote driver trying to connect to an non-existing
libvirtd.

Now such URIs trigger an error in the ESX driver suggesting to try
again without the transport part in the scheme.

13 years agoformatdomain.html.in: fix tickpolicy
Douglas Schilling Landgraf [Thu, 29 Sep 2011 00:58:00 +0000 (20:58 -0400)]
formatdomain.html.in: fix tickpolicy

there is no option "none":

>From libvirt/src/conf/domain_conf.c

<snip>
VIR_ENUM_IMPL(virDomainTimerTickpolicy,
VIR_DOMAIN_TIMER_TICKPOLICY_LAST,
              "delay",
              "catchup",
              "merge",
              "discard");
</snip>

Replacing with delay.

Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
13 years agovirsh: describe attach-interface parameter target
Daniel Veillard [Wed, 28 Sep 2011 03:58:29 +0000 (11:58 +0800)]
virsh: describe attach-interface parameter target

This patch is based on a improvement suggested by Kazuhiro Kikuchi
of Fujitsu, it gives a description of the target parameter for that
command

* tools/virsh.pod: add description for target parameter of
  attach-interface

13 years agovirsh: update man page for cpu_shares parameter
Daniel Veillard [Wed, 28 Sep 2011 01:59:43 +0000 (09:59 +0800)]
virsh: update man page for cpu_shares parameter

The man page suggest that the cpu_shares parameter of schedinfo
allows values 0-262144, but the kernel remaps values 0 and 1 to
the minimum 2, just document that behaviour:

[root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
1024
[root@test ~]# echo 0 > /cgroup/cpu/libvirt/qemu/cpu.shares
[root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
2
[root@test ~]# echo 1 > /cgroup/cpu/libvirt/qemu/cpu.shares
[root@test ~]# cat /cgroup/cpu/libvirt/qemu/cpu.shares
2
[root@test ~]#

* tools/virsh.pod: update description of the cpu_shares parameter
  to indicate the values 0 and 1 are automatically changed by the
  kernel to minimal value 2

13 years agoqemu: Check for ejected media during startup and migration
Michal Privoznik [Tue, 13 Sep 2011 13:49:50 +0000 (15:49 +0200)]
qemu: Check for ejected media during startup and migration

If the daemon is restarted so we reconnect to monitor, cdrom media
can be ejected. In that case we don't want to show it in domain xml,
or require it on migration destination.

To check for disk status use 'info block' monitor command.

13 years agoqemu: add return value check
Alex Jia [Wed, 28 Sep 2011 08:00:49 +0000 (16:00 +0800)]
qemu: add return value check

* src/qemu/qemu_migration.c: if 'vmdef' is NULL, the function
  virDomainSaveConfig still dereferences it, it doesn't make
  sense, so should add return value check to make sure 'vmdef'
  is non-NULL before calling virDomainSaveConfig, in addition,
  in order to debug later, also should record error information
  into log.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agosnapshot: implement getparent in qemu
Eric Blake [Sun, 25 Sep 2011 00:02:24 +0000 (18:02 -0600)]
snapshot: implement getparent in qemu

First hypervisor implementation of the new API.
Allows 'virsh snapshot-list --tree' to be more efficient.

* src/qemu/qemu_driver.c (qemuDomainSnapshotGetParent): New
function.

13 years agosnapshot: add virsh snapshot-list --tree
Eric Blake [Sat, 24 Sep 2011 23:42:50 +0000 (17:42 -0600)]
snapshot: add virsh snapshot-list --tree

Reuse the tree listing of nodedev-list, coupled with the new helper
function to efficiently grab snapshot parent names, to produce
tree output for a snapshot hierarchy.  For example:

$ virsh snapshot-list dom --tree
root1
 |
  +- sibling1
  +- sibling2
  |   |
  |   +- grandchild
  |
  +- sibling3

root2
 |
  +- child

* tools/virsh.c (cmdSnapshotList): Add --tree.
* tools/virsh.pod (snapshot-list): Document it.

13 years agosnapshot: refactor virsh snapshot parent computation
Eric Blake [Wed, 10 Aug 2011 23:31:04 +0000 (17:31 -0600)]
snapshot: refactor virsh snapshot parent computation

Make parent computation reusable, using virDomainSnapshotGetParent
when possible.

* tools/virsh.c (vshGetSnapshotParent): New helper.
(cmdSnapshotParent): Use it.

13 years agosnapshot: remote protocol for getparent
Eric Blake [Sat, 24 Sep 2011 19:19:35 +0000 (13:19 -0600)]
snapshot: remote protocol for getparent

Mostly straight-forward, although this is the first API that
returns a new snapshot based on a snapshot rather than a domain.

* src/remote/remote_protocol.x
(REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT): New rpc.
(remote_domain_snapshot_get_parent_args)
(remote_domain_snapshot_get_parent_ret): New structs.
* src/rpc/gendispatch.pl: Adjust generator.
* src/remote/remote_driver.c (remote_driver): Use it.
* src/remote_protocol-structs: Update.

13 years agosnapshot: new virDomainSnapshotGetParent API
Eric Blake [Fri, 23 Sep 2011 18:38:04 +0000 (12:38 -0600)]
snapshot: new virDomainSnapshotGetParent API

Although a client can already obtain a snapshot's parent by
dumping and parsing the xml, then doing a snapshot lookup by
name, it is more efficient to get the parent in one step, which
in turn will make operations that must traverse a snapshot
hierarchy easier to perform.

* include/libvirt/libvirt.h.in (virDomainSnapshotGetParent):
Declare.
* src/libvirt.c (virDomainSnapshotGetParent): New function.
* src/libvirt_public.syms: Export it.
* src/driver.h (virDrvDomainSnapshotGetParent): New callback.

13 years agodocs: document node device XML
Eric Blake [Tue, 27 Sep 2011 17:04:52 +0000 (11:04 -0600)]
docs: document node device XML

Coupled with the recent virsh nodedev-* doc patch, this should now
give a better picture of libvirt node device handling.

* docs/formatnode.html.in: Fill in page.

13 years agodocs: document virsh nodedev-* commands
Eric Blake [Fri, 23 Sep 2011 23:26:24 +0000 (17:26 -0600)]
docs: document virsh nodedev-* commands

This section of the man page was completely missing; I stumbled on
it when I had no clue that I had to use nodedev-reattach after
I was done playing with <hostdev> device passthrough to one of my
guests.

* tools/virsh.pod (NODEDEV COMMANDS): New section.
(attach-device, detach-device): Add cross-references.

13 years agosecurity: properly chown/label bidirectional and unidirectional fifos
Laine Stump [Tue, 27 Sep 2011 18:04:53 +0000 (14:04 -0400)]
security: properly chown/label bidirectional and unidirectional fifos

This patch fixes the regression with using named pipes for qemu serial
devices noted in:

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

The problem was that, while new code in libvirt looks for a single
bidirectional fifo of the name given in the config, then relabels that
and continues without looking for / relabelling the two unidirectional
fifos named ${name}.in and ${name}.out, qemu looks in the opposite
order. So if the user had naively created all three fifos, libvirt
would relabel the bidirectional fifo to allow qemu access, but qemu
would attempt to use the two unidirectional fifos and fail (because it
didn't have proper permissions/rights).

This patch changes the order that libvirt looks for the fifos to match
what qemu does - first it looks for the dual fifos, then it looks for
the single bidirectional fifo. If it finds the dual unidirectional
fifos first, it labels/chowns them and ignores any possible
bidirectional fifo.

(Note commit d37c6a3a (which first appeared in libvirt-0.9.2) added
the code that checked for a bidirectional fifo. Prior to that commit,
bidirectional fifos for serial devices didn't work because libvirt
always required the ${name}.(in|out) fifos to exist, and qemu would
always prefer those.

13 years agoqemu: Preserve fakeReboot flag in domain status
Jiri Denemark [Wed, 28 Sep 2011 10:10:13 +0000 (12:10 +0200)]
qemu: Preserve fakeReboot flag in domain status

Thus, when libvirtd is restarted, it will know if a domain is supposed
to be killed or reset when it shuts down.

13 years agoqemu: Finish domain shutdown on reconnect
Jiri Denemark [Tue, 27 Sep 2011 12:56:17 +0000 (14:56 +0200)]
qemu: Finish domain shutdown on reconnect

If a domain started with -no-shutdown shuts down while libvirtd is not
running, it will be seen as paused when libvirtd reconnects to it. Use
the paused reason to detect if a domain was stopped because of shutdown
and finish the process just as if a SHUTDOWN event is delivered from
qemu.

13 years agoqemu: Check domain status details when reconnecting monitor
Jiri Denemark [Tue, 27 Sep 2011 09:42:04 +0000 (11:42 +0200)]
qemu: Check domain status details when reconnecting monitor

Current qemu is able to give us detailed domain status (not just if it
is running or not) which we can translate into a status reason.

13 years agoqemu: Always remove domain object if MigratePrepare fails
Jiri Denemark [Mon, 26 Sep 2011 11:36:37 +0000 (13:36 +0200)]
qemu: Always remove domain object if MigratePrepare fails

If migration failed in Prepare phase after virDomainAssignDef and before
a job was started, the domain object was not properly removed.

13 years agofix AppArmor driver for pipe character devices
Jamie Strandboge [Wed, 28 Sep 2011 07:43:39 +0000 (15:43 +0800)]
fix AppArmor driver for pipe character devices

The AppArmor security driver adds only the path specified in the domain
XML for character devices of type 'pipe'. It should be using <path>.in
and <path>.out. We do this by creating a new vah_add_file_chardev() and
use it for char devices instead of vah_add_file(). Also adjust
valid_path() to accept S_FIFO (since qemu chardevs of type 'pipe' use
fifos). This is https://launchpad.net/bugs/832507

13 years agovirsh: Allow using complete <capabilities> elements with cpu-baseline
Peter Krempa [Thu, 15 Sep 2011 11:51:01 +0000 (13:51 +0200)]
virsh: Allow using complete <capabilities> elements with cpu-baseline

This patch cleans the cpu baseline function using new libvirt helper
functions and fixes XPath expression that selects <cpu> elements from
the source file, that can contain concatenated <capabilities> XMLs,
domain XMLs and bare <cpu> elements. The fixed XPath expression ensures
not to select NUMA <cpu id=... elements.

This patch also removes vshRealloc function, that remained unused after
cleaning up cpu-baseline.

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

13 years agovirsh: Allow using domain and capabilities XMLs with cpu-compare
Peter Krempa [Thu, 15 Sep 2011 07:18:04 +0000 (09:18 +0200)]
virsh: Allow using domain and capabilities XMLs with cpu-compare

This patch adds extraction of the <cpu> element from capabilities and
domain definition XML documents to improve user experience.

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

13 years agosnapshot: fix man page typos
Eric Blake [Tue, 27 Sep 2011 23:33:55 +0000 (17:33 -0600)]
snapshot: fix man page typos

pod2man from perl-5.8.8 (RHEL 5) errors out on ill-formed POD:

*** ERROR: unterminated I<...> at line 1114 in file virsh.pod
*** ERROR: unterminated I<...> at line 1851 in file virsh.pod

Newer pod2man appears to be more tolerant (which is a shame,
because it meant that this error is harder to detect).

* tools/virsh.pod (undefine, snapshot-current): Add missing >.

13 years agoqemu: add ability to set PCI device "rombar" on or off
Laine Stump [Tue, 20 Sep 2011 17:31:52 +0000 (13:31 -0400)]
qemu: add ability to set PCI device "rombar" on or off

This patch was made in response to:

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

In short, qemu's default for the rombar setting (which makes the
firmware ROM of a PCI device visible/not on the guest) was previously
0 (not visible), but they recently changed the default to 1
(visible). Unfortunately, there are some PCI devices that fail in the
guest when rombar is 1, so the setting must be exposed in libvirt to
prevent a regression in behavior (it will still require explicitly
setting <rom bar='off'/> in the guest XML).

rombar is forced on/off by adding:

  <rom bar='on|off'/>

inside a <hostdev> element that defines a PCI device. It is currently
ignored for all other types of devices.

At the moment there is no clean method to determine whether or not the
rombar option is supported by QEMU - this patch uses the advice of a
QEMU developer to assume support for qemu-0.12+. There is currently a
patch in the works to put this information in the output of "qemu-kvm
-device pci-assign,?", but of course if we switch to keying off that,
we would lose support for setting rombar on all the versions of qemu
between 0.12 and whatever version gets that patch.

13 years agospec: F15 still uses cgconfig, RHEL lacks hyperv
Eric Blake [Mon, 26 Sep 2011 20:28:47 +0000 (14:28 -0600)]
spec: F15 still uses cgconfig, RHEL lacks hyperv

Commit ecd8725c dropped attempts to probe the cgconfig service on
new enough Fedora where systemd took over that aspect of the system,
but mistakenly used F14 instead of F15 as the cutoff point.

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

Also, RHEL does not include HyperV support yet.

* libvirt.spec.in (with_cgconfig): Check cgconfig service in F15.
(%{?rhel}): Provide default for with_hyperv.

13 years agoqemu: Relax -no-shutdown check to [0.14.0, 0.15.50)
Jiri Denemark [Tue, 27 Sep 2011 12:46:35 +0000 (14:46 +0200)]
qemu: Relax -no-shutdown check to [0.14.0, 0.15.50)

SIGTERM handling for -no-shutdown is already fixed in qemu git and
libvirt can safely use it. The downside is that 0.15.50 version of qemu
can be any qemu compiled from git, even that without the fix for
SIGTERM. However, I think this patch is worth it since excluding 0.15.50
from the check makes testing current qemu with libvirt much easier and
someone running qemu from git should be able to rebuild fixed qemu from
git if they hit the problem with a hang on shutdown.

13 years agovirsh: Better document --copy-storage migrate options
Jiri Denemark [Mon, 26 Sep 2011 13:09:08 +0000 (15:09 +0200)]
virsh: Better document --copy-storage migrate options

Both --copy-storage-{all,inc} options require disk images to be present
on destination host.

13 years agovirsh: Enhance documentation of commands starting jobs
Jiri Denemark [Mon, 26 Sep 2011 12:55:22 +0000 (14:55 +0200)]
virsh: Enhance documentation of commands starting jobs

Some virsh commands start a (long-running) job that can be monitored
using domjobinfo and aborted with domjobabort. Let's be explicit about
this in virsh man page.

13 years agovirLockManagerNopInit: Rename flags to unused_flags
Michal Privoznik [Tue, 27 Sep 2011 09:11:14 +0000 (11:11 +0200)]
virLockManagerNopInit: Rename flags to unused_flags

As these might be not used and make syntax-check complains about checking
them via virCheckFlags.

13 years agodaemon: Don't remove pidfiles in init scripts
Peter Krempa [Mon, 26 Sep 2011 18:06:39 +0000 (20:06 +0200)]
daemon: Don't remove pidfiles in init scripts

Init scripts removed pid file of the daemon. Removing pid files may be
harmful as new api for crash-safe pidfiles is used (introduced by
c8a3a26).

13 years agodebug: Annotate some variables as unused
Michal Privoznik [Mon, 26 Sep 2011 16:51:47 +0000 (18:51 +0200)]
debug: Annotate some variables as unused

as they are not used with debugging turned off.

13 years agostorage: Do not break the whole vol lookup process in the middle
Osier Yang [Mon, 26 Sep 2011 06:30:44 +0000 (14:30 +0800)]
storage: Do not break the whole vol lookup process in the middle

* src/storage/storage_driver.c: As virStorageVolLookupByPath lookups
all the pool objs of the drivers, breaking when failing on getting
the stable path of the pool will just breaks the whole lookup process,
it can cause the API fails even if the vol exists indeed. It won't get
any benefit. This patch is to fix it.

13 years agomaint: update authors
Peter Krempa [Fri, 23 Sep 2011 17:15:37 +0000 (19:15 +0200)]
maint: update authors

13 years agoAdd unsafe cache mode support for disk driver
Oskari Saarenmaa [Thu, 22 Sep 2011 19:33:47 +0000 (22:33 +0300)]
Add unsafe cache mode support for disk driver

QEMU 0.13 introduced cache=unsafe for -drive, this patch exposes
it in the libvirt layer.

  * Introduced a new QEMU capability flag ($prefix_CACHE_UNSAFE),
    as even if $prefix_CACHE_V2 is set, we can't know if unsafe
    is supported.

  * Improved the reliability of qemu cache type detection.

13 years agoFix synchronous reading of stream data
Daniel P. Berrange [Wed, 21 Sep 2011 13:51:33 +0000 (14:51 +0100)]
Fix synchronous reading of stream data

commit 984840a2c292402926ad100aeea33f8859ff31a9 removed the
notification of waiting calls when VIR_NET_CONTINUE messages
arrive. This was to fix the case of a virStreamAbort() call
being prematurely notified of completion.

The problem is that sometimes there are dummy calls from a
virStreamRecv() call waiting that *do* need to be notified.

These dummy calls should have a status VIR_NET_CONTINUE. So
re-add the notification upon VIR_NET_CONTINUE, but only if
the waiter also has a status of VIR_NET_CONTINUE.

* src/rpc/virnetclient.c: Notify waiting call if stream data
  arrives
* src/rpc/virnetclientstream.c:  Mark dummy stream read packet
  with status VIR_NET_CONTINUE

13 years agoselinux: Correctly report warning if virt_use_nfs not set
Michal Privoznik [Thu, 22 Sep 2011 08:57:24 +0000 (10:57 +0200)]
selinux: Correctly report warning if virt_use_nfs not set

Previous patch c9b37fee tried to deal with virt_use_nfs. But
setfilecon() returns EOPNOTSUPP on NFS so we need to move the
warning to else branch.

13 years agovirsh: Improve virsh manual for virsh memtune command
Peter Krempa [Thu, 22 Sep 2011 10:14:18 +0000 (12:14 +0200)]
virsh: Improve virsh manual for virsh memtune command

Commit 0a22f54 added --min-guarantee option for the memtune command.
This option is supported only by the ESX hypervisor. This patch adds a
statement about this fact, to prevent user confusion.

This patch also adds explanation how to clear/set to unlimited the
memory tunables. (documments the -1 value).

13 years agovirsh: Do not ignore the specified flags for cmdSaveImageDefine
Osier Yang [Thu, 22 Sep 2011 12:01:06 +0000 (20:01 +0800)]
virsh: Do not ignore the specified flags for cmdSaveImageDefine

Introduced by commit 42c52d53c, which added the support for new
flags, but forgot to update the API use to pass the flags.

13 years agoqemu: Transfer inactive XML among cookie
Michal Privoznik [Thu, 15 Sep 2011 13:13:11 +0000 (15:13 +0200)]
qemu: Transfer inactive XML among cookie

If a domain has inactive XML we want to transfer it to destination
when migrating with VIR_MIGRATE_PERSIST_DEST. In order to harm
the migration protocol as least as possible, a optional cookie was
chosen.

13 years agoRelease of libvirt-0.9.6
Daniel Veillard [Thu, 22 Sep 2011 06:53:23 +0000 (14:53 +0800)]
Release of libvirt-0.9.6

13 years agosnapshot: also delete empty directory
Eric Blake [Wed, 21 Sep 2011 22:08:42 +0000 (16:08 -0600)]
snapshot: also delete empty directory

The previous patch removed all snapshots, but not the directory
where the snapshots lived, which is still a form of stale data.

* src/qemu/qemu_domain.c (qemuDomainRemoveInactive): Wipe any
snapshot directory.

13 years agosnapshot: remove snapshot metadata on transient exit
Eric Blake [Thu, 22 Sep 2011 06:02:03 +0000 (14:02 +0800)]
snapshot: remove snapshot metadata on transient exit

Commit 282fe1f0 documented that transient domains will auto-delete
any snapshot metadata when the last reference to the domain is
removed, and that management apps are in charge of grabbing any
snapshot metadata prior to that point.  However, this was not
actually implemented for qemu until now.

* src/qemu/qemu_driver.c (qemudDomainCreate)
(qemuDomainDestroyFlags, qemuDomainSaveInternal)
(qemudDomainCoreDump, qemuDomainRestoreFlags, qemudDomainDefine)
(qemuDomainUndefineFlags, qemuDomainMigrateConfirm3)
(qemuDomainRevertToSnapshot): Clean up snapshot metadata.
* src/qemu/qemu_migration.c (qemuMigrationPrepareAny)
(qemuMigrationPerformJob, qemuMigrationPerformPhase)
(qemuMigrationFinish): Likewise.
* src/qemu/qemu_process.c (qemuProcessHandleMonitorEOF)
(qemuProcessReconnect, qemuProcessReconnectHelper)
(qemuProcessAutoDestroyDom): Likewise.

13 years agosnapshot: prepare to remove transient snapshot metadata
Eric Blake [Wed, 21 Sep 2011 19:08:51 +0000 (13:08 -0600)]
snapshot: prepare to remove transient snapshot metadata

This patch is mostly code motion - moving some functions out
of qemu_driver and into qemu_domain so they can be reused by
multiple qemu_* files (since qemu_driver.h must not grow).
It also adds a new helper function, qemuDomainRemoveInactive,
which will be used in the next patch.

* src/qemu/qemu_domain.h (qemuFindQemuImgBinary)
(qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
(qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll)
(qemuDomainRemoveInactive): New prototypes.
(struct qemu_snap_remove): New struct.
* src/qemu/qemu_domain.c (qemuDomainRemoveInactive)
(qemuDomainSnapshotDiscardAllMetadata): New functions.
(qemuFindQemuImgBinary, qemuDomainSnapshotWriteMetadata)
(qemuDomainSnapshotForEachQcow2, qemuDomainSnapshotDiscard)
(qemuDomainSnapshotDiscardAll): Move here...
* src/qemu/qemu_driver.c (qemuFindQemuImgBinary)
(qemuDomainSnapshotWriteMetadata, qemuDomainSnapshotForEachQcow2)
(qemuDomainSnapshotDiscard, qemuDomainSnapshotDiscardAll): ...from
here.
(qemuDomainUndefineFlags): Update caller.
* src/conf/domain_conf.c (virDomainRemoveInactive): Doc fixes.

13 years agosnapshot: fix logic bug in qemu undefine
Eric Blake [Wed, 21 Sep 2011 19:08:50 +0000 (13:08 -0600)]
snapshot: fix logic bug in qemu undefine

Commit 19f8c98 introduced VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA,
with the intent that omitting the flag makes undefine fail, and
including the flag deletes metadata.  But it used the wrong logic.
Also, hoist the transient domain sooner, so that we don't
accidentally remove metadata of a transient domain.

* src/qemu/qemu_driver.c (qemuDomainUndefineFlags): Check correct
flag value.

13 years agosanlock: fix memory leak
Eric Blake [Wed, 21 Sep 2011 20:22:57 +0000 (14:22 -0600)]
sanlock: fix memory leak

Detected by Coverity.  The only way to get to error_unlink is if
path was successfully assigned, so the if was useless.  Meanwhile,
there was a return statement that did not free path.

* src/locking/lock_driver_sanlock.c
(virLockManagerSanlockSetupLockspace): Fix mem-leak, and drop
useless if.

13 years agovirsh: fix regression in argv parsing
Eric Blake [Wed, 21 Sep 2011 14:54:47 +0000 (08:54 -0600)]
virsh: fix regression in argv parsing

Prior to commit 85d2810, we had an issue where:

snapshot-create-as dom name --diskspec spec --diskspec spec

failed to parse the second spec, because the first spec had marked
that option as no longer requiring an argument.

In commit 85d2810, I fixed it by making argv options no longer mark
the option as seen.  But this in turn breaks mandatory argv options,
which now complain that the argv option is missing.

This patch reverts that part of 85d2810, and instead replaces it with
fixes to no longer clear opts_need_arg of an argv argument.

* tools/virsh.c (vshCmddefGetOption, vshCmddefGetData)
(vshCommandParse): Fix option parsing for required argv option.
(vshCmddefOptParse): Check that argv option is last.
* tests/virsh-optparse: Enhance test.

13 years agovirsh: More friendly err if no pool is specified for looking up a vol
Osier Yang [Wed, 21 Sep 2011 06:29:49 +0000 (14:29 +0800)]
virsh: More friendly err if no pool is specified for looking up a vol

There are 3 ways to lookup a volume, only virStorageVolLookupByName
needs pool object. So if no --pool is specified, it will tries to
get the volume via virStorageVolLookupByPath/virStorageVolLookupByKey.

But if all 3 ways fails, and no --pool is specified, a friendly
error might help the user get right way quickly.

13 years agostorage: Wait udev events are handled before removing lvm vol
Osier Yang [Wed, 21 Sep 2011 06:02:30 +0000 (14:02 +0800)]
storage: Wait udev events are handled before removing lvm vol

Related #BZ: https://bugzilla.redhat.com/show_bug.cgi?id=702260.

There are two problems described in the BZ:
1) "Can't remove open logical volume".
2) "Unable to deactivate logical volume "foo""

This patch just intends to fix 2), as 1) is expected if the vol
is still used by something, and you never known if "lvchange -an"
will fail or not either (sometime, it will succeed, sometimes not).
We'd better not look for trouble, :-)

For 2), that's caused by race between lvremove and udev event handling,
the only workable way now is to wait the events handling are finished,
though it might introduce latencies, as "udevadmin settle" exits
after *all* events are handled, it's the only way we can fix
the racing in libvirt layer.

See https://bugzilla.redhat.com/show_bug.cgi?id=570359 for more
details.

13 years agoqemu: avoid dereferencing a NULL pointer
Alex Jia [Wed, 21 Sep 2011 19:02:44 +0000 (03:02 +0800)]
qemu: avoid dereferencing a NULL pointer

* src/qemu/qemu_process.c: Taking if (qemuDomainObjEndJob(driver, obj) == 0)
  true branch then 'obj' is NULL, virDomainObjIsActive(obj) and
  virDomainObjUnref(obj) will dereference NULL pointer.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agotests: improve test failure diagnosis
Oskari Saarenmaa [Wed, 21 Sep 2011 16:29:31 +0000 (19:29 +0300)]
tests: improve test failure diagnosis

  * qemuhelptest prints test case name on failure.

13 years agoqemu: Avoid loop of fake reboots
Jiri Denemark [Wed, 21 Sep 2011 14:03:22 +0000 (16:03 +0200)]
qemu: Avoid loop of fake reboots

Once virDomainReboot is called for a domain, guest OS initiated shutdown
would always result in reboot instead of shutdown. Only
virDomainShutdown would actually shutd such domain down. That's because
we forgot to reset fakeReboot flag once we asked the domain to reboot.

13 years agoqemu: Fix shutdown regression with buggy qemu
Jiri Denemark [Wed, 21 Sep 2011 08:25:29 +0000 (10:25 +0200)]
qemu: Fix shutdown regression with buggy qemu

The commit that prevents disk corruption on domain shutdown
(96fc4784177ecb70357518fa863442455e45ad0e) causes regression with QEMU
0.14.* and 0.15.* because of a regression bug in QEMU that was fixed
only recently in QEMU git. The affected versions of QEMU do not quit on
SIGTERM if started with -no-shutdown, which we use to implement fake
reboot. Since -no-shutdown tells QEMU not to quit automatically on guest
shutdown, domains started using the affected QEMU cannot be shutdown
properly and stay in a paused state.

This patch disables fake reboot feature on such QEMU by not using
-no-shutdown, which makes shutdown work as expected. However,
virDomainReboot will not work in this case and it will report "Requested
operation is not valid: Reboot is not supported with this QEMU binary".

13 years agoAPI: prefer to use NULLSTR macro
Osier Yang [Wed, 21 Sep 2011 09:03:43 +0000 (17:03 +0800)]
API: prefer to use NULLSTR macro

13 years agoremote: fix crash on OOM
Eric Blake [Tue, 20 Sep 2011 18:11:32 +0000 (12:11 -0600)]
remote: fix crash on OOM

Bug introduced in commit 675464b.  On an OOM, this would try to
dereference a char* and free the contents as a pointer, which is
doomed to failure.

Adding a syntax check will prevent mistakes like this in the future.

* cfg.mk (sc_prohibit_internal_functions): New syntax check.
(exclude_file_name_regexp--sc_prohibit_internal_functions): Add
exemptions.
* daemon/remote.c (remoteRelayDomainEventIOError)
(remoteRelayDomainEventIOErrorReason)
(remoteRelayDomainEventGraphics, remoteRelayDomainEventBlockJob):
Use correct free function.

13 years agoxen: use typical allocations
Eric Blake [Tue, 20 Sep 2011 18:11:31 +0000 (12:11 -0600)]
xen: use typical allocations

The next patch will add a syntax check that flags this usage in xen
as awkward - while it was valid memory management, it was very hard
to maintain.  Swapping to a more traditional allocation may be a bit
slower, but easier to understand.

* src/xen/xend_internal.c (xenDaemonListDomainsOld): Use two-level
allocation, rather than abusing allocation function.
(xenDaemonLookupByUUID): Update caller.

13 years agovirsh: Remove useless codes of cmdVolPath
Osier Yang [Tue, 20 Sep 2011 08:33:30 +0000 (16:33 +0800)]
virsh: Remove useless codes of cmdVolPath

Variable "name" is never used in the codes, it's useless.

13 years agobuild: silence warning on 32-bit build
Eric Blake [Tue, 20 Sep 2011 22:53:58 +0000 (16:53 -0600)]
build: silence warning on 32-bit build

gcc warns when building libvirt 0.9.5 on a 32-bit machine:

qemu/qemu_migration.c: In function 'qemuMigrationToFile':
qemu/qemu_migration.c:2727:38: error: large integer implicitly truncated to unsigned type [-Woverflow]

* src/qemu/qemu_domain.h (QEMU_DOMAIN_FILE_MIG_BANDWIDTH_MAX): Cap
to long when building for 32-bit platform.

13 years agoRelease of libvirt-0.9.5
Daniel Veillard [Tue, 20 Sep 2011 06:17:47 +0000 (14:17 +0800)]
Release of libvirt-0.9.5

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

13 years agoFix crash on events due to allocation errors
Daniel Veillard [Tue, 20 Sep 2011 03:51:50 +0000 (11:51 +0800)]
Fix crash on events due to allocation errors

remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics
were using const string directly in rpc structure, before calling
remoteDispatchDomainEventSend(). But that routine now frees up all
the pointed allocated memory from the rpc structure and we end up
with a double free.
This now strdup() all the strings passed and provide mem_error goto
labels to be used when an allocation error occurs.
Note that the cleanup isn't completely finished because all relaying
function also call make_nonnull_domain() which also allocate a string
and never handle the error case. This patches doesn't try to address
this as this is only error correctness a priori and touches far more
functions in this module:

* daemon/remote.c: fix string allocations and memory error handling
  for remoteRelayDomainEventBlockJob, remoteRelayDomainEventIOError,
  remoteRelayDomainEventIOErrorReason and remoteRelayDomainEventGraphics

13 years agoUpdate to require sanlock 1.8 for license compliance
Daniel P. Berrange [Mon, 19 Sep 2011 10:04:59 +0000 (11:04 +0100)]
Update to require sanlock 1.8 for license compliance

Inexplicably the sanlock code all got placed under the GPLv2-only,
so libvirt's use of sanlock introduces a license incompatibility.
The sanlock developers have now rearranged the code such that there
is a 'sanlock_client.so' which is LGPLv2+ while their daemon remains
GPLv2-only. To use the new client library we need to call the new
sanlock_init and sanlock_align APIs instead of sanlock_direct_init
and sanlock_direct_align. These APIs calls are now routed via the
sanlock daemon, instead of doing direct I/O calls to disk.

For all this we require sanlock >= 1.8

* configure.ac: Check for sanlock_client.so instead of sanlock.so
  and fix various comments
* libvirt.spec.in: Mandate sanlock >= 1.8
* src/Makefile.am: Link to -lsanlock_client
* src/locking/lock_driver_sanlock.c: Use sanlock_init and
  sanlock_align

13 years agoconf: Assign newDef of active domain as persistent conf if it is NULL
Osier Yang [Thu, 1 Sep 2011 13:33:29 +0000 (21:33 +0800)]
conf: Assign newDef of active domain as persistent conf if it is NULL

Libvirt loads the domain conf from status XML if it's running when
starting up. The problem is there is no record of the original conf.
(dom->newDef is NULL here).

So libvirt won't be able to restore the domain conf to original one
when destroying/shutdown. E.g.

1) attach a device without "--persistent"
2) restart libvirtd
3) destroy domain
4) start domain

One will see the the disk still exists.

This patch is to fix the peoblem by assigning persistent domain conf
to dom->newDef if it's NULL and the domain is running.

13 years agostorage: Ensure the device path exists before refreshing disk pool
Osier Yang [Mon, 19 Sep 2011 07:35:15 +0000 (15:35 +0800)]
storage: Ensure the device path exists before refreshing disk pool

Doing libvirt_parthelper on an not existed device path will get
an unfriendly error message. This patch is to prohibit it.

13 years agodaemon: Error and exit if specified value for timeout is not valid
Osier Yang [Mon, 19 Sep 2011 04:16:45 +0000 (12:16 +0800)]
daemon: Error and exit if specified value for timeout is not valid

Silently setting "timeout" as -1 if the specified value is invalid
is a bit confused.

13 years agoRemove devname identifier from autogenerated RPC code
Peter Krempa [Mon, 19 Sep 2011 14:14:34 +0000 (16:14 +0200)]
Remove devname identifier from autogenerated RPC code

Patch 79cf07a missed one instance of "devname" in source for RPC code
generator.

13 years agovirsh: tweak previous domblkstat patch
Eric Blake [Mon, 19 Sep 2011 20:49:08 +0000 (14:49 -0600)]
virsh: tweak previous domblkstat patch

Translators are likely to botch trailing spacing; by doing the
formatting outside of the translation, we can generally get
better alignment.  Also, for consistency, use 'bytes read' to
match 'bytes written'.

* tools/virsh.c (domblkstat_output): Drop trailing space. Tweak
rd_bytes output.
(cmdDomblkstat, DOMBLKSTAT_LEGACY_PRINT): Update formatting.

13 years agovirsh: doc: Fix supported driver types for attach-disk command
Peter Krempa [Mon, 19 Sep 2011 12:57:07 +0000 (14:57 +0200)]
virsh: doc: Fix supported driver types for attach-disk command

Virsh man page lists driver types to be used with attach-device
command, but does not specify that those are usable only with the XEN
Hypervisor.

This patch adds statement, that those options specified are applicable
only on the Xen hypervisor and adds option usable with qemu emulator.

This patch also changes type of error returned by QEMU driver if the
user specifies incompatible driver type from VIR_ERR_INTERNAL_ERROR to
VIR_ERR_CONFIG_UNSUPPORTED.

13 years agomaint: Prefer names over email in 'git shortlog'
Eric Blake [Mon, 19 Sep 2011 22:34:10 +0000 (16:34 -0600)]
maint: Prefer names over email in 'git shortlog'

Alex recently committed some patches with just an email instead
of a preferred name; this fixes things so 'git shortlog' gives
nicer output.

* .mailmap: Update.

13 years agovirsh: Add more human-friendly output of domblkstat command
Peter Krempa [Mon, 19 Sep 2011 12:23:12 +0000 (14:23 +0200)]
virsh: Add more human-friendly output of domblkstat command

Users of virsh complain that output of the domblkstat command
is not intuitive enough. This patch adds explanation of fields
returned by this command to the help section for domblkstat and
the man page of virsh. Also a switch --human is added for
domblkstat that prints the fields with more descriptive
texts.

This patch also changes sequence of the output fields and their
names back to the order and spelling established by previous
versions of virsh to maintain compatibility with scripts.

Example of ordered and "translated" output:

PRE-patch:

virsh # domblkstat 1 vda
vda wr_bytes 5170176
vda wr_operations 511
vda rd_bytes 82815488
vda rd_operations 3726

POST-patch:

virsh # domblkstat 1 vda
vda rd_req 3726
vda rd_bytes 82815488
vda wr_req 478
vda wr_bytes 4965376

Example of human readable output:

virsh # domblkstat 1 vda --human
Device: vda
 number of read operations:      3726
 number of read bytes:           82815488
 number of write operations:     478
 number of bytes written:        4965376

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

13 years agovmx: avoid memory leak
ajia@redhat.com [Mon, 19 Sep 2011 02:34:06 +0000 (10:34 +0800)]
vmx: avoid memory leak

* src/vmx/vmx.c: fix memory leak, 'def' has a initial value 'NULL', so
  'goto cleanup' is perfected instead of adding a virConfFree before
  'return NULL'.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoutil: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:13 +0000 (00:36 +0800)]
util: avoid memory leak

Leak in pciGetVirtualFunctionIndex present since commit 17d64ca.

* src/util/pci.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoremote: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:12 +0000 (00:36 +0800)]
remote: avoid memory leak

Leak present since introduction of remoteDomainBuildEventGraphics
in commit 987e31e.

* src/remote/remote_driver.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agoqemu: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:11 +0000 (00:36 +0800)]
qemu: avoid memory leak

Leak introduced in commit 036ad50, affects only error case.

* src/qemu/qemu_command.c: fix memory leak.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agodaemon: avoid memory leak
ajia@redhat.com [Sun, 18 Sep 2011 16:36:10 +0000 (00:36 +0800)]
daemon: avoid memory leak

Introduced in commit efa7fc9f.

* daemon/remote.c: fix memory leak in remoteDispatchDomainBlockStatsFlags

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agospec: silence warnings when installing in F16
Eric Blake [Fri, 16 Sep 2011 22:40:25 +0000 (16:40 -0600)]
spec: silence warnings when installing in F16

https://bugzilla.redhat.com/show_bug.cgi?id=738725 documents that
'yum install libvirt' in Fedora 16 is rather noisy.  This fixes
the problems.

* libvirt.spec.in (%post client): Silence chkconfig warning about
SysV services.
(%post) [with_cgconfig]: Drop for Fedora 15 and newer, where
systemd does this automatically.

13 years agosnapshot: allow disk snapshots of qcow2 disks
Eric Blake [Sat, 17 Sep 2011 12:16:08 +0000 (06:16 -0600)]
snapshot: allow disk snapshots of qcow2 disks

For all types of disks other than qcow2, we were requesting that
SELinux labeling visit the new file as if it were qcow2, which
means labeling would try to find the backing files of an empty file.
And for a pre-existing qcow2 disk, we were passing NULL, which meant
that labelling tried to probe the file type (and if probing is
disabled, per the default qemu.conf, this made snapshots fail).
What we really want is to make SELinux labeling visit the new
file as raw; it will later be converted to qcow2 if qemu successfully
made the snapshot.

* src/qemu/qemu_driver.c
(qemuDomainSnapshotCreateSingleDiskActive): Force SELinux labeling
to avoid probe of new file.

13 years agosnapshot: affect persistent xml after disk snapshot
Eric Blake [Sat, 17 Sep 2011 03:46:21 +0000 (21:46 -0600)]
snapshot: affect persistent xml after disk snapshot

For external snapshots to be useful on persistent domains, we must
alter the persistent definition alongside the running definition.
Thanks to the possibility of disk hotplug as well as of edits that
only affect the persistent xml, we can't assume that vm->def and
vm->newDef have the same disk at the same index, so we can only
update the persistent copy if the device destination matches up.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateDiskActive)
(qemuDomainSnapshotCreateSingleDiskActive): Also affect newDef, if
present.

13 years agobuild: work around lack of MacOS fdatasync
Eric Blake [Fri, 16 Sep 2011 15:12:07 +0000 (09:12 -0600)]
build: work around lack of MacOS fdatasync

Mingw lacks fsync, but gnulib provides that.  Meanwhile, gnulib does
not (yet) provide fdatasync, so this is a quick hack to fake that
function on MacOS X; we can revert this configure change once gnulib
gives us a real module.

We have been implicitly relying on gnulib's largefile module being
pulled in by other modules, but it's better to make that explicit.

* bootstrap.conf (gnulib_modules): Add fsync.  Make largefile use
explicit.
* configure.ac (AC_CHECK_FUNCS_ONCE): Check for fdatasync, and
fake it with fsync when not present.