]> xenbits.xensource.com Git - libvirt.git/log
libvirt.git
13 years agoAdd "redirdev" redirection device
Marc-André Lureau [Fri, 2 Sep 2011 15:09:14 +0000 (23:09 +0800)]
Add "redirdev" redirection device

- create a new "redirdev" element for this purpose

13 years agoqemu: Don't append 0 at usb id, so that it is compatible with legacy -usb
Marc-André Lureau [Fri, 2 Sep 2011 14:49:42 +0000 (22:49 +0800)]
qemu: Don't append 0 at usb id, so that it is compatible with legacy -usb

QEMU uses USB bus name "usb.0" when using the legacy -usb argument.
If we want to allow USB devices to specify their addresses with legacy
-usb, we should either in case of legacy bus name drop the 0 from the
address bus, or just drop the 0 from device id. This patch does the
later.

Another solution would be to permit addressing on non-legacy USB
controllers only.

13 years agoqemu: don't reserve slot 1 if a PIIX3 USB controller is defined there
Marc-André Lureau [Fri, 2 Sep 2011 14:42:09 +0000 (22:42 +0800)]
qemu: don't reserve slot 1 if a PIIX3 USB controller is defined there

Applies only to piix3 and check if piix3 controller is on correct
address, or report error

13 years agoModify USB port to be defined as a port path
Marc-André Lureau [Fri, 2 Sep 2011 14:31:26 +0000 (22:31 +0800)]
Modify USB port to be defined as a port path

So that devices can be attached to hubs. Example, to attach to first
port of a usb-hub on port 1.

      <hub type='usb'>
         <address type='usb' bus='0' port='1'/>
      </hub>

      <input type='mouse' type='usb'>
         <address type='usb' bus='0' port='1.1'/>
      </hub>

also add a test entry

13 years agoAdd USB hub device
Marc-André Lureau [Fri, 2 Sep 2011 14:20:40 +0000 (22:20 +0800)]
Add USB hub device

domain parsing and serialization code, qemu driver backend and
a couple of test

13 years agoAdd USB companion controllers support
Marc-André Lureau [Fri, 2 Sep 2011 14:03:51 +0000 (22:03 +0800)]
Add USB companion controllers support

Companion controllers take an extra 'master' attribute to associate
them.

Also add tests for this

13 years agoUSB devices gain a new USB address child element
Marc-André Lureau [Fri, 2 Sep 2011 13:28:27 +0000 (21:28 +0800)]
USB devices gain a new USB address child element

Expand the domain and the QEmu driver code
Adds a couple of tests

13 years agotest: USB controller can have a PCI address child element
Marc-André Lureau [Fri, 2 Sep 2011 13:26:55 +0000 (21:26 +0800)]
test: USB controller can have a PCI address child element

add a few tests for the new constructs

13 years agoAdd a new controller type 'usb' with optionnal 'model'
Marc-André Lureau [Fri, 2 Sep 2011 13:21:23 +0000 (21:21 +0800)]
Add a new controller type 'usb' with optionnal 'model'

The model by default is piix3-uchi.

Example:
<controller type='usb' index='0' model='ich9-ehci'/>

13 years agoAdd USB controller models
Marc-André Lureau [Fri, 2 Sep 2011 13:14:29 +0000 (21:14 +0800)]
Add USB controller models

List is: piix3-uhci piix4-uhci ehci ich9-ehci1 ich9-uhci1 ich9-uhci2
ich9-uhci3 vt82c686b-uhci pci-ohci

13 years agoRename virDomainControllerModel to virDomainControllerModelSCSI
Marc-André Lureau [Fri, 2 Sep 2011 13:06:15 +0000 (21:06 +0800)]
Rename virDomainControllerModel to virDomainControllerModelSCSI

Since we are about to add USB controller support let's remove the
ambiguity

13 years agoAdd various USB devices QEMU_CAPS
Marc-André Lureau [Fri, 2 Sep 2011 12:56:50 +0000 (20:56 +0800)]
Add various USB devices QEMU_CAPS

13 years agosnapshot: fix corner case on OOM during creation
Eric Blake [Thu, 1 Sep 2011 21:22:02 +0000 (15:22 -0600)]
snapshot: fix corner case on OOM during creation

Commit 6766ff10 introduced a corner case bug with snapshot creation:
if a snapshot is created, but then we hit OOM while trying to
create the return value of the function, then we have polluted the
internal directory with the snapshot metadata with no way to clean
it up from the running libvirtd.

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Don't
write metadata file on OOM condition.

13 years agotests: add missing files
Eric Blake [Fri, 2 Sep 2011 14:42:54 +0000 (08:42 -0600)]
tests: add missing files

Created by copying from qemuxml2argv-disk-drive-v2-wb.*, then
s/writeback/directsync/.  Hopefully this matches Osier's intentions.

* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.args:
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-cache-directsync.xml:
Add missing files needed by 'make check'.

13 years agoAdd directsync cache mode support for disk driver
Osier Yang [Fri, 2 Sep 2011 13:36:58 +0000 (21:36 +0800)]
Add directsync cache mode support for disk driver

Newer QEMU introduced cache=directsync for -drive, this patchset
is to expose it in libvirt layer.

  * Introduced a new QEMU capability flag ($prefix_CACHE_DIRECTSYNC),
    As even $prefix_CACHE_V2 is set, we can't known if directsync
    is supported.

13 years agostorage: Add virsh support for fs pool formating
Osier Yang [Wed, 31 Aug 2011 13:55:32 +0000 (21:55 +0800)]
storage: Add virsh support for fs pool formating

13 years agostorage: Add fs pool formatting
Osier Yang [Wed, 31 Aug 2011 13:54:07 +0000 (21:54 +0800)]
storage: Add fs pool formatting

This patch adds the ability to make the filesystem for a filesystem
pool during a pool build.

The patch adds two new flags, no overwrite and overwrite, to control
when mkfs gets executed.  By default, the patch preserves the
current behavior, i.e., if no flags are specified, pool build on a
filesystem pool only makes the directory on which the filesystem
will be mounted.

If the no overwrite flag is specified, the target device is checked
to determine if a filesystem of the type specified in the pool is
present.  If a filesystem of that type is already present, mkfs is
not executed and the build call returns an error.  Otherwise, mkfs
is executed and any data present on the device is overwritten.

If the overwrite flag is specified, mkfs is always executed, and any
existing data on the target device is overwritten unconditionally.

13 years agostorage: Add mkfs and libblkid to build system
Osier Yang [Tue, 14 Jun 2011 08:16:39 +0000 (16:16 +0800)]
storage: Add mkfs and libblkid to build system

13 years agoAPI: Init conn in case of it might be used uninitialized
Osier Yang [Fri, 2 Sep 2011 04:49:24 +0000 (12:49 +0800)]
API: Init conn in case of it might be used uninitialized

There is a goto before "conn" is initialized.

13 years agoqemu: detect incomplete save files
Eric Blake [Tue, 30 Aug 2011 19:53:45 +0000 (13:53 -0600)]
qemu: detect incomplete save files

Several users have reported problems with 'virsh start' failing because
it was encountering a managed save situation where the managed save file
was incomplete.  Be more robust to this by using two different magic
numbers, so that newer libvirt can gracefully handle an incomplete file
differently than a complete one, while older libvirt will at least fail
up front rather than trying to load only to have qemu fail at the end.

Managed save is a convenience - it exists to preserve as much state
as possible; if the state was not preserved, it is reasonable to just
log that fact, then proceed with a fresh boot.  On the other hand,
user saves are under user control, so we must fail, but by making
the failure message distinct, the user can better decide how to handle
the situation of an incomplete save file.

* src/qemu/qemu_driver.c (QEMUD_SAVE_PARTIAL): New define.
(qemuDomainSaveInternal): Use it to mark incomplete images.
(qemuDomainSaveImageOpen, qemuDomainObjRestore): Add parameter
that controls what to do with partial images.
(qemuDomainRestoreFlags, qemuDomainSaveImageGetXMLDesc)
(qemuDomainSaveImageDefineXML, qemuDomainObjStart): Update callers.
Based on an initial idea by Osier Yang.

13 years agoqemu: refactor file opening
Eric Blake [Tue, 23 Aug 2011 20:01:51 +0000 (14:01 -0600)]
qemu: refactor file opening

In a SELinux or root-squashing NFS environment, libvirt has to go
through some hoops to create a new file that qemu can then open()
by name.  Snapshots are a case where we want to guarantee an empty
file that qemu can open; also, reopening a save file to convert it
from being marked partial to complete requires a reopen to avoid
O_DIRECT headaches.  Refactor some existing code to make it easier
to reuse in later patches.

* src/qemu/qemu_migration.h (qemuMigrationToFile): Drop parameter.
* src/qemu/qemu_migration.c (qemuMigrationToFile): Let cgroup do
the stat, rather than asking caller to do it and pass info down.
* src/qemu/qemu_driver.c (qemuOpenFile): New function, pulled from...
(qemuDomainSaveInternal): ...here.
(doCoreDump, qemuDomainSaveImageOpen): Use it here as well.

13 years agoreserve slot 1 on pci bus0
Wen Congyang [Wed, 24 Aug 2011 02:47:39 +0000 (10:47 +0800)]
reserve slot 1 on pci bus0

After supporting multi function pci device, we only reserve function 1 on slot 1.
The user can use the other function on slot 1 in the xml config file. We should
detect this wrong usage.

13 years agolibvirtd: create run dir when running at non-root user
Xu He Jie [Mon, 29 Aug 2011 02:52:23 +0000 (10:52 +0800)]
libvirtd: create run dir when running at non-root user

When libvirtd is running at non-root user, it won't create ${HOME}/.libvirt.

It will show error message:
17:44:16.838: 7035: error : virPidFileAcquirePath:322 : Failed to open pid file

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agolxc: do not require 'ifconfig' or 'ipconfig' in container
Scott Moser [Tue, 23 Aug 2011 20:36:00 +0000 (16:36 -0400)]
lxc: do not require 'ifconfig' or 'ipconfig' in container

Currently, the lxc implementation invokes 'ip' and 'ifconfig' commands
inside a container using 'virRun'.  That has the side effect of requiring
those commands to be present and to function in a manner consistent with
the usage.  Some small roots (such as ttylinux) may not have 'ip' or
'ifconfig'.

This patch replaces the use of these commands with usage of
netdevice.  The result is that lxc containers do not have to implement
those commands, and lxc in libvirt is only dependent on the netdevice
interface.

I've tested this patch locally against the ubuntu libvirt version enough
to verify its generally sane.  I attempted to build upstream today, but
failed with:
  /usr/bin/ld:
    ../src/.libs/libvirt_driver_qemu.a(libvirt_driver_qemu_la-qemu_domain.o):
   undefined reference to symbol 'xmlXPathRegisterNs@@LIBXML2_2.4.30

Thats probably a local issue only, but I wanted to get this patch up and
see what others thought of it.  This is ubuntu bug
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/828211 .

13 years agoCreate ptmx as a device
Serge Hallyn [Wed, 31 Aug 2011 18:18:33 +0000 (13:18 -0500)]
Create ptmx as a device

Hi,

I'm seeing an issue with udev and libvirt-lxc.  Libvirt-lxc creates
/dev/ptmx as a symlink to /dev/pts/ptmx.  When udev starts up, it
checks the device type, sees ptmx is 'not right', and replaces it
with a 'proper' ptmx.

In lxc, /dev/ptmx is bind-mounted from /dev/pts/ptmx instead of being
symlinked, so udev sees the right device type and leaves it alone.

A patch like the following seems to work for me.  Would there be
any objections to this?

>From 4c5035de52de7e06a0de9c5d0bab8c87a806cba7 Mon Sep 17 00:00:00 2001
From: Ubuntu <ubuntu@domU-12-31-39-14-F0-B3.compute-1.internal>
Date: Wed, 31 Aug 2011 18:15:54 +0000
Subject: [PATCH 1/1] make ptmx a bind mount rather than symlink

udev on some systems checks the device type of /dev/ptmx, and replaces it if
not as expected.  The symlink created by libvirt-lxc therefore gets replaced.
By creating it as a bind mount, the device type is correct and udev leaves it
alone.

Signed-off-by: Serge Hallyn <serge.hallyn@canonical.com>
13 years agoBlockPull: Set initial bandwidth limit if specified
Adam Litke [Thu, 1 Sep 2011 22:35:36 +0000 (17:35 -0500)]
BlockPull: Set initial bandwidth limit if specified

The libvirt BlockPull API supports the use of an initial bandwidth limit but the
qemu block_stream API does not.  To get the desired behavior we use the two APIs
strung together: first BlockPull, then BlockJobSetSpeed.  We can do this at the
driver level to avoid duplicated code in each monitor path.

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agoBlockJob: Bandwidth parameter is in MB when using text monitor
Adam Litke [Wed, 31 Aug 2011 22:15:43 +0000 (17:15 -0500)]
BlockJob: Bandwidth parameter is in MB when using text monitor

Due to an unfortunate precedent in qemu, the units for the bandwidth parameter
to block_job_set_speed are different between the text monitor and the qmp
monitor.  While the qmp monitor uses bytes/s, the text monitor expects MB/s.

Correct the units for the text interface.

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agoIncrease size of buffer for xend response
Jim Fehlig [Thu, 1 Sep 2011 22:40:46 +0000 (16:40 -0600)]
Increase size of buffer for xend response

On systems with many pcpus, the sexpr returned by xend can be quite
large for dom0 when it is configured to have #vcpus = #pcpus (default).
E.g. on a 80 pcpu system, where dom0 had 80 vcpus, the sexpr details
for dom0 was 73817 bytes!  Increase maximum buffer size to 256k.

13 years agoDon't overwrite errors from xend_{get,req}
Jim Fehlig [Thu, 1 Sep 2011 22:22:38 +0000 (16:22 -0600)]
Don't overwrite errors from xend_{get,req}

xenDaemonDomainFetch() was overwriting errors reported by
xend_get() and xend_req().  E.g. without patch

error: failed Xen syscall xenDaemonDomainFetch failed to find this domain

with patch

error: internal error Xend returned HTTP Content-Length of 73817, which exceeds
maximum of 65536

13 years agoChange my email domain
Jim Fehlig [Thu, 1 Sep 2011 22:13:34 +0000 (16:13 -0600)]
Change my email domain

I'd like to change my primary email address to jfehlig@suse.com.
This patch changes it in AUTHORS and .mailmap.

13 years agovirsh: improve send-key documentation
Eric Blake [Wed, 31 Aug 2011 14:47:48 +0000 (08:47 -0600)]
virsh: improve send-key documentation

The 'virsh man' description of send-key was incomplete and used the
old style (literal 'optional name' instead of '[name]' metasyntax).
Meanwhile, none of the other virsh help texts include examples, so
I moved it out of virsh help and into the man page.

* tools/virsh.pod (send-key): Give better details.
* tools/virsh.c (info_send_key): Drop example from here.

13 years agovirsh: support 'virsh start --force-boot' on older servers
Eric Blake [Tue, 30 Aug 2011 15:51:25 +0000 (09:51 -0600)]
virsh: support 'virsh start --force-boot' on older servers

Managed save was added in 0.8.0, virDomainCreateWithFlags in 0.8.2,
and FORCE_BOOT in 0.9.5.  The virsh flag is more useful if we
emulate it for all older servers (note that if a hypervisor fails
the query for a managed save image, then it does not have one to
be removed, so the flag can be safely ignored).

* tools/virsh.c (cmdStart): Add emulation for new flag.

13 years agovirsh: avoid memory leak on cmdVolCreateAs
Alex Jia [Thu, 1 Sep 2011 17:12:00 +0000 (01:12 +0800)]
virsh: avoid memory leak on cmdVolCreateAs

* tools/virsh.c: fix memory leak on cmdVolCreateAs function.

* Detected in valgrind run:

==4746==
==4746== 48 (40 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 26 of 52
==4746==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==4746==    by 0x4C76E51: virAlloc (memory.c:101)
==4746==    by 0x4CD9418: virGetStoragePool (datatypes.c:592)
==4746==    by 0x4D21367: remoteStoragePoolLookupByName (remote_driver.c:4126)
==4746==    by 0x4CE42B0: virStoragePoolLookupByName (libvirt.c:10232)
==4746==    by 0x40C276: vshCommandOptPoolBy (virsh.c:13660)
==4746==    by 0x40CA37: cmdVolCreateAs (virsh.c:8094)
==4746==    by 0x412AF2: vshCommandRun (virsh.c:13770)
==4746==    by 0x422F11: main (virsh.c:15127)
==4746==
==4746== 1,011 bytes in 1 blocks are definitely lost in loss record 45 of 52
==4746==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==4746==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
==4746==    by 0x4C76ECB: virReallocN (memory.c:161)
==4746==    by 0x4C60319: virBufferGrow (buf.c:72)
==4746==    by 0x4C606AA: virBufferAdd (buf.c:106)
==4746==    by 0x40CB37: cmdVolCreateAs (virsh.c:8118)
==4746==    by 0x412AF2: vshCommandRun (virsh.c:13770)
==4746==    by 0x422F11: main (virsh.c:15127)
==4746==
==4746== LEAK SUMMARY:
==4746==    definitely lost: 1,051 bytes in 2 blocks
==4746==    indirectly lost: 8 bytes in 1 blocks
==4746==      possibly lost: 0 bytes in 0 blocks
==4746==    still reachable: 390,767 bytes in 1,373 blocks
==4746==         suppressed: 0 bytes in 0 blocks

* How to reproduce?

% valgrind -v --leak-check=full virsh vol-create-as default foo.img 10M \
  --allocation 0 --format qcow2 --backing-vol bar.img

Notes: bar.img doesn't exist.

Signed-off-by: Alex Jia <ajia@redhat.com>
13 years agobuild: fix 'make check' with pdwtags
Eric Blake [Thu, 1 Sep 2011 18:33:46 +0000 (12:33 -0600)]
build: fix 'make check' with pdwtags

Problem introduced by commit b12354b.

* src/remote_protocol-structs: Remove spurious blank line.

13 years agovirsh: Expose virDomainMigrateGetMaxSpeed API
Jim Fehlig [Fri, 26 Aug 2011 18:10:24 +0000 (12:10 -0600)]
virsh: Expose virDomainMigrateGetMaxSpeed API

13 years agoAdd public API for getting migration speed
Jim Fehlig [Fri, 26 Aug 2011 18:10:21 +0000 (12:10 -0600)]
Add public API for getting migration speed

Includes impl of python binding since the generator was not
able to cope.

Note: Requires gendispatch.pl patch from Matthias Bolte

https://www.redhat.com/archives/libvir-list/2011-August/msg01367.html

13 years agovirsh: prefer unsigned flags
Eric Blake [Thu, 1 Sep 2011 03:11:23 +0000 (21:11 -0600)]
virsh: prefer unsigned flags

virsh had some leftover 'int flags', and even an 'int flag'
declaration, compared to our preferred style of 'unsigned int flags'.

* tools/virsh.c (cmdUndefine, cmdSave, cmdSaveImageDumpxml)
(cmdSaveImageEdit, cmdManagedSave, cmdRestore, cmdDump)
(cmdVcpuPin, cmdSetvcpus, cmdSetmem, cmdSetmaxmem, cmdDumpXML)
(cmdDomXMLFromNative, cmdDomXMLToNative, doMigrate)
(cmdInterfaceEdit, cmdInterfaceDumpXML, cmdEdit): Match coding
style for flags.
(struct vshComdOptDef): Rename field member.
(vshCmddefOptParse, vshCmddefHelp): Adjust clients.

13 years agoFix tracking of RPC messages wrt streams
Daniel P. Berrange [Wed, 31 Aug 2011 16:42:58 +0000 (17:42 +0100)]
Fix tracking of RPC messages wrt streams

Commit 2c85644b0b51fbe5b6244e6773531af29933a727 attempted to
fix a problem with tracking RPC messages from streams by doing

-            if (msg->header.type == VIR_NET_REPLY) {
+            if (msg->header.type == VIR_NET_REPLY ||
+                (msg->header.type == VIR_NET_STREAM &&
+                 msg->header.status != VIR_NET_CONTINUE)) {
                 client->nrequests--;

In other words any stream packet, with status NET_OK or NET_ERROR
would cause nrequests to be decremented. This is great if the
packet from from a synchronous virStreamFinish or virStreamAbort
API call, but wildly wrong if from a server initiated abort.
The latter resulted in 'nrequests' being decremented below zero.
This then causes all I/O for that client to be stopped.

Instead of trying to infer whether we need to decrement the
nrequests field, from the message type/status, introduce an
explicit 'bool tracked' field to mark whether the virNetMessagePtr
object is subject to tracking.

Also add a virNetMessageClear function to allow a message
contents to be cleared out, without adversely impacting the
'tracked' field as a naive memset() would do

* src/rpc/virnetmessage.c, src/rpc/virnetmessage.h: Add
  a 'bool tracked' field and virNetMessageClear() API
* daemon/remote.c, daemon/stream.c, src/rpc/virnetclientprogram.c,
  src/rpc/virnetclientstream.c, src/rpc/virnetserverclient.c,
  src/rpc/virnetserverprogram.c: Switch over to use
  virNetMessageClear() and pass in the 'bool tracked' value
  when creating messages.

13 years agoAvoid use-after-free on streams, due to message callbacks
Daniel P. Berrange [Wed, 31 Aug 2011 16:01:01 +0000 (17:01 +0100)]
Avoid use-after-free on streams, due to message callbacks

When sending outbound stream RPC messages, a callback is
used to re-enable stream data transmission. If the stream
aborts while one of these messages is outstanding, the
stream may have been free'd by the time it is invoked. This
results in a use-after-free error

* daemon/stream.c: Ref-count streams to avoid use-after-free

13 years agoFix parted sector size assumption
Daniel P. Berrange [Tue, 23 Aug 2011 14:25:28 +0000 (15:25 +0100)]
Fix parted sector size assumption

Parted does not report disk size in 512 byte units, but
rather the disks' logical sector size, which with modern
drives might be 4k.

* src/storage/parthelper.c: Remove hardcoded 512 byte sector
  size

13 years agoqemu: Fix a regression of domain save
Osier Yang [Thu, 1 Sep 2011 08:11:51 +0000 (16:11 +0800)]
qemu: Fix a regression of domain save

* src/qemu/qemu_driver.c - qemuDomainSaveInternal: Return directly
will keep the domain object locked, introduced by 173015bec6a.

13 years agoRevert "test: Cleanup improper VIR_ERR_NO_SUPPORT use"
Osier Yang [Thu, 1 Sep 2011 07:35:56 +0000 (15:35 +0800)]
Revert "test: Cleanup improper VIR_ERR_NO_SUPPORT use"

This reverts commit 172214bd304ff958160307be2efd6614e9868946.

13 years agostorage: Fix incorrect error codes
Osier Yang [Thu, 1 Sep 2011 07:24:59 +0000 (15:24 +0800)]
storage: Fix incorrect error codes

Commit 0376f4a69b intended to fix incorrect use of VIR_ERR_NO_SUPPORT,
but replacing it with VIR_ERR_OPERATION_INVALID is not proper either.

13 years agoremote: Fix incorrect error codes
Osier Yang [Thu, 1 Sep 2011 07:15:17 +0000 (15:15 +0800)]
remote: Fix incorrect error codes

Introduced by d4b53ef6c. For "no internalFlags support", the
error code is changed into INTERNAL_ERROR.

13 years agonodeinfo: Fix incorrect error codes
Osier Yang [Thu, 1 Sep 2011 06:43:03 +0000 (14:43 +0800)]
nodeinfo: Fix incorrect error codes

Introduced by 5e495c8b, except the ones for checking if numa
is supported by host, all the NO_SUPPORT are changed back. For
the ones about numa checking, change them into INTERNAL_ERROR.

13 years agolxc: Fix incorrect changes on error codes.
Osier Yang [Thu, 1 Sep 2011 06:25:37 +0000 (14:25 +0800)]
lxc: Fix incorrect changes on error codes.

Fix incorrect changes introduced by commit 6ac47762bb9.

13 years agoconf: Substitute OPERATION_INVALID with INTERNAL_ERROR
Osier Yang [Thu, 1 Sep 2011 09:31:24 +0000 (17:31 +0800)]
conf: Substitute OPERATION_INVALID with INTERNAL_ERROR

13 years agoStop libxl driver polluting logs on non-Xen hosts
Daniel P. Berrange [Wed, 31 Aug 2011 15:53:09 +0000 (16:53 +0100)]
Stop libxl driver polluting logs on non-Xen hosts

If the libxl driver is compiled in, then everytime libvirtd
starts up on a non-Xen Dom0 host, it logs a error message.
Since this is an expected condition, we should not log at
'error' level, only 'info'.

* src/libxl/libxl_driver.c: Lower log level for certain
  expected errors during driver init

13 years agoFix memory leak parsing 'relabel' attribute in domain security XML
Daniel P. Berrange [Wed, 31 Aug 2011 15:52:25 +0000 (16:52 +0100)]
Fix memory leak parsing 'relabel' attribute in domain security XML

* src/conf/domain_conf.c: Free the 'relabel' attribute

13 years agoFix memory leak dispatching domain events
Daniel P. Berrange [Wed, 31 Aug 2011 15:50:09 +0000 (16:50 +0100)]
Fix memory leak dispatching domain events

When dispatching domain events we will create an XDR struct
containing the event info. Some of this data may be allocated
on the heap and so must be freed. The graphics event dispatcher
had a broken attempt to free one field, but missed others. All
the events have a dom->name string that needs freeing. The code
should have used the xdr_free() procedure for doing all this

* daemon/remote.c: Use xdr_free after dispatching events

13 years agoDon't leak memory if a cgroup is mounted multiple times
Daniel P. Berrange [Wed, 31 Aug 2011 15:46:13 +0000 (16:46 +0100)]
Don't leak memory if a cgroup is mounted multiple times

It is possible (expected/likely in Fedora 15) for a cgroup controller
to be mounted in multiple locations at the same time, due to bind
mounts. Currently we leak memory if this happens, because we overwrite
the previous 'mountPoint' string. Instead just accept the first match
we find.

* src/util/cgroup.c: Only accept first match for a cgroup
  controller mount

13 years agosecurity: fix build
Eric Blake [Wed, 31 Aug 2011 14:33:17 +0000 (08:33 -0600)]
security: fix build

Regression introduced in commit 183383889.

* src/libvirt_private.syms (security_manager.h): Drop deleted
symbol. Detected by build-bot.

13 years agostream: remove redundant reference to client while sending stream data
Guannan Ren [Sun, 28 Aug 2011 13:43:58 +0000 (21:43 +0800)]
stream: remove redundant reference to client while sending stream data

    *daemon/stream.c: remove virNetServerClientRef()

13 years agoRemove bogus virSecurityManagerSetProcessFDLabel method
Daniel P. Berrange [Tue, 30 Aug 2011 16:31:03 +0000 (12:31 -0400)]
Remove bogus virSecurityManagerSetProcessFDLabel method

The virSecurityManagerSetProcessFDLabel method was introduced
after a mis-understanding from a conversation about SELinux
socket labelling. The virSecurityManagerSetSocketLabel method
should have been used for all such scenarios.

* src/security/security_apparmor.c, src/security/security_apparmor.c,
  src/security/security_driver.h, src/security/security_manager.c,
  src/security/security_manager.h, src/security/security_selinux.c,
  src/security/security_stack.c: Remove SetProcessFDLabel driver

13 years agoFix sanlock socket security labelling
Daniel P. Berrange [Fri, 26 Aug 2011 15:06:31 +0000 (16:06 +0100)]
Fix sanlock socket security labelling

It is not possible to change the label of a TCP socket once it
has been opened. When creating a TCP socket care must be taken
to ensure the socket creation label is set & then cleared.
Remove the bogus call to virSecurityManagerSetProcessFDLabel
from the lock driver guest setup code and instead make use of
virSecurityManagerSetSocketLabel

13 years agoFix incorrect path length check in sanlock lockspace setup
Daniel P. Berrange [Tue, 30 Aug 2011 16:24:06 +0000 (12:24 -0400)]
Fix incorrect path length check in sanlock lockspace setup

The code for creating a sanlock lockspace accidentally used
SANLK_NAME_LEN instead of SANLK_PATH_LEN for a size check.
This meant disk paths were limited to 48 bytes !

* src/locking/lock_driver_sanlock.c: Fix disk path length
  check

13 years agosnapshot: forbid snapshot on autodestroy domain
Eric Blake [Fri, 26 Aug 2011 23:29:18 +0000 (17:29 -0600)]
snapshot: forbid snapshot on autodestroy domain

There is no reason to forbid pausing an autodestroy domain
(not to mention that 'virsh start --paused --autodestroy'
succeeds in creating a paused autodestroy domain).

Meanwhile, qemu was failing to enforce the API documentation that
autodestroy domains cannot be saved.  And while the original
documentation only mentioned save/restore, snapshots are another
form of saving that are close enough in semantics as to make no
sense on one-shot domains.

* src/qemu/qemu_driver.c (qemudDomainSuspend): Drop bogus check.
(qemuDomainSaveInternal, qemuDomainSnapshotCreateXML): Forbid
saves of autodestroy domains.
* src/libvirt.c (virDomainCreateWithFlags, virDomainCreateXML):
Document snapshot interaction.

13 years agoFix error detection in device change
Philipp Hahn [Tue, 30 Aug 2011 14:59:24 +0000 (16:59 +0200)]
Fix error detection in device change

According to qemu-kvm/qerror.c all messages start with a capital
"Device ", but the current code only scans for the lower case "device ".
This results in "virDomainUpdateDeviceFlags()" to not detect locked
CD-ROMs and reporting success even in the case of a failure:
# virsh qemu-monitor-command "$VM" change\ drive-ide0-0-0\ \"/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso\"
Device 'drive-ide0-0-0' is locked
# virsh update-device "$VM" /dev/stdin <<<"<disk type='file' device='cdrom'><driver name='qemu' type='raw'/><source file='/var/lib/libvirt/images/ucs_2.4-0-sec4-20110714145916-dvd-amd64.iso'/><target dev='hda' bus='ide'/><readonly/><alias name='ide0-0-0'/><address type='drive' controller='0' bus='0' unit='0'/></disk>"
Device updated successfully

Signed-off-by: Philipp Hahn <hahn@univention.de>
13 years agostart: allow discarding managed save
Eric Blake [Sat, 27 Aug 2011 23:07:18 +0000 (17:07 -0600)]
start: allow discarding managed save

There have been several instances of people having problems with
a broken managed save file, and not aware that they could use
'virsh managedsave-remove dom' to fix things.  Making it possible
to do this as part of starting a domain makes the same functionality
easier to find, and one less API call.

* include/libvirt/libvirt.h.in (VIR_DOMAIN_START_FORCE_BOOT): New
flag.
* src/libvirt.c (virDomainCreateWithFlags): Document it.
* src/qemu/qemu_driver.c (qemuDomainObjStart): Alter signature.
(qemuAutostartDomain, qemuDomainStartWithFlags): Update callers.
* tools/virsh.c (cmdStart): Expose it in virsh.
* tools/virsh.pod (start): Document it.

13 years agobuild: simplify use of verify
Eric Blake [Fri, 26 Aug 2011 16:17:48 +0000 (10:17 -0600)]
build: simplify use of verify

Back in 2008 when this line of util.h was written, gnulib's verify
module didn't allow the use of multiple verify() in one file
in combination with our choice of gcc -W options.  But that has
since been fixed in gnulib, and newer gnulib even maps verify()
to the C1x feature of _Static_assert, which gives even nicer
diagnostics with a new enough compiler, so we might as well go
with the simpler verify().

* src/util/util.h (VIR_ENUM_IMPL): Use simpler verify, now that
gnulib module is smarter.

13 years agoqemu: properly label outgoing pipe for tunneled migration
Eric Blake [Mon, 29 Aug 2011 23:31:42 +0000 (17:31 -0600)]
qemu: properly label outgoing pipe for tunneled migration

Commit 3261761 made it possible to use pipes instead of sockets
for outgoing tunneled migration; however, it caused a regression
because the pipe was never given a SELinux label.

* src/qemu/qemu_migration.c (doTunnelMigrate): Label outgoing pipe.

13 years agorpc: fix a typo in debugging log in virNetServerProgramSendStreamData
Guannan Ren [Sun, 28 Aug 2011 05:46:52 +0000 (13:46 +0800)]
rpc: fix a typo in debugging log in virNetServerProgramSendStreamData

The bufferOffset has been initialized to zero in virNetMessageEncodePayloadRaw(),
so, we use bufferLength to represent the length of message which is going to be
sent to client side.

13 years agomaint: fix spelling errors on lose
Eric Blake [Fri, 26 Aug 2011 22:48:24 +0000 (16:48 -0600)]
maint: fix spelling errors on lose

* docs/drvqemu.html.in: Fix typo.
* src/libvirt.c (virDomainCreateXML, virDomainCreateWithFlags):
Likewise.

13 years agoFix generator to cope with call-by-ref long types
Jim Fehlig [Fri, 26 Aug 2011 17:46:41 +0000 (11:46 -0600)]
Fix generator to cope with call-by-ref long types

From: Matthias Bolte <matthias.bolte@googlemail.com>
Tested-by: Jim Fehlig <jfehlig@novell.com>
Matthias provided this patch to fix an issue I encountered in the
generator with APIs containing call-by-ref long type, e.g.

int virDomainMigrateGetMaxSpeed(virDomainPtr domain,
                                unsigned long *bandwidth,
                                unsigned int flags);

13 years agohyperv: Add basic documentation
Matthias Bolte [Wed, 13 Jul 2011 15:13:42 +0000 (17:13 +0200)]
hyperv: Add basic documentation

13 years agohyperv: Add basic driver for Microsoft Hyper-V
Matthias Bolte [Wed, 13 Jul 2011 15:16:47 +0000 (17:16 +0200)]
hyperv: Add basic driver for Microsoft Hyper-V

Domain listing, basic information retrieval and domain life cycle
management is implemented. But currently the domain XML output
lacks the complete devices section.

The driver uses OpenWSMAN to directly communicate with a Hyper-V
server over its WS-Management interface exposed via Microsoft WinRM.

The driver is based on the work of Michael Sievers. This started in
the same master program project group at the University of Paderborn
as the ESX driver.

See Michael's blog for details: http://hyperv4libvirt.wordpress.com/

13 years agohyperv: Add OpenWSMAN based client for the Hyper-V WMI API
Matthias Bolte [Wed, 13 Jul 2011 15:05:19 +0000 (17:05 +0200)]
hyperv: Add OpenWSMAN based client for the Hyper-V WMI API

Add a generator script to generate the structs and serialization
information for OpenWSMAN.

openwsman.h collects workarounds for problems in OpenWSMAN <= 2.2.6.
There are also disabled sections that would use ws_serializer_free_mem
but can't because it's broken in OpenWSMAN <= 2.2.6. Patches to fix
this have been posted upstream.

13 years agohyperv: Add driver skeleton
Matthias Bolte [Wed, 13 Jul 2011 14:47:01 +0000 (16:47 +0200)]
hyperv: Add driver skeleton

13 years agohyperv: Add configure check for OpenWSMAN
Matthias Bolte [Wed, 13 Jul 2011 14:05:18 +0000 (16:05 +0200)]
hyperv: Add configure check for OpenWSMAN

13 years agoschedinfo: update man page about virsh schedinfo command
Taku Izumi [Fri, 26 Aug 2011 06:48:27 +0000 (15:48 +0900)]
schedinfo: update man page about virsh schedinfo command

This patch updates the man page about virsh schedinfo command.

 - fix typo: 1844674407370955 -> 18446744073709551
 - describe the value 0 of vcpu_period and vcpu_quota parameters

Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
13 years agoFix persistent migration config save
KAMEZAWA Hiroyuki [Fri, 26 Aug 2011 03:08:11 +0000 (12:08 +0900)]
Fix persistent migration config save

When a user migrates a domain by command as

libvirt saves vm's domain XML config in destination host after migration.
But it saves vm->def. Then, the saved XML contains some garbage.

  <domain type='kvm' id='50'>
                     ^^^^^^^^
  ...
   <console type='pty' tty='/dev/pts/5'>
                       ^^^^^^^^^^^^^^^^^

Avoid saving unnecessary things by saving persistent vm definition.

13 years agorpc: Don't close connection if program is unknown
Jiri Denemark [Fri, 26 Aug 2011 15:11:03 +0000 (17:11 +0200)]
rpc: Don't close connection if program is unknown

In case we add a new program in the future (we did that in the past and
we are going to do it again soon) current daemon will behave badly with
new client that wants to use the new program. Before the RPC rewrite we
used to just send an error reply to any request with unknown program.
With the RPC rewrite in 0.9.3 the daemon just closes the connection
through which such request was sent. This patch fixes this regression.

13 years agoremote: Refuse connecting to remote socket
Michal Privoznik [Mon, 22 Aug 2011 13:48:52 +0000 (15:48 +0200)]
remote: Refuse connecting to remote socket

If users wants to connect to remote unix socket, e.g.
'qemu+unix://<remote>/system' currently the <remote> part is ignored,
ending up connecting to localhost. Connecting to remote socket is not
supported and user should have used TLS/TCP/SSH instead.

13 years agovirterror: Fix error message for VIR_ERR_INVALID_ARG
Michal Privoznik [Fri, 26 Aug 2011 09:44:05 +0000 (11:44 +0200)]
virterror: Fix error message for VIR_ERR_INVALID_ARG

When a detail message is presented, nobody expects prefix 'invalid
argument in' but something more general, like 'invalid argument:'.

13 years agoDetect errors from the 'sendkey' command
Daniel P. Berrange [Thu, 25 Aug 2011 16:48:25 +0000 (17:48 +0100)]
Detect errors from the 'sendkey' command

On success, the 'sendkey' command does not return any data, so
any data in the reply should be considered to be an error
message

* src/qemu/qemu_monitor_text.c: Treat non-"" reply data as an
  error message for 'sendkey' command

13 years agoFix keymap used to talk with QEMU
Daniel P. Berrange [Thu, 25 Aug 2011 16:45:49 +0000 (17:45 +0100)]
Fix keymap used to talk with QEMU

The QEMU 'sendkey' command expects keys to be encoded in the same
way as the RFB extended keycode set. Specifically it wants extended
keys to have the high bit of the first byte set, while the Linux
XT KBD driver codeset uses the low bit of the second byte. To deal
with this we introduce a new keymap 'RFB' and use that in the QEMU
driver

* include/libvirt/libvirt.h.in: Add VIR_KEYCODE_SET_RFB
* src/qemu/qemu_driver.c: Use RFB keycode set instead of XT KBD
* src/util/virkeycode-mapgen.py: Auto-generate the RFB keycode
  set from the XT KBD set
* src/util/virkeycode.c: Add RFB keycode entry to table. Add a
  verify check on cardinality of the codeOffset table

13 years agovirsh: Clarify documentation of -d option
Jiri Denemark [Fri, 26 Aug 2011 09:02:10 +0000 (11:02 +0200)]
virsh: Clarify documentation of -d option

The default is 4, not 0.

13 years agoqemu: Correctly label migration TCP socket
Jiri Denemark [Wed, 17 Aug 2011 11:26:09 +0000 (13:26 +0200)]
qemu: Correctly label migration TCP socket

13 years agosecurity: Introduce SetSocketLabel
Jiri Denemark [Fri, 26 Aug 2011 07:39:32 +0000 (09:39 +0200)]
security: Introduce SetSocketLabel

This API labels all sockets created until ClearSocketLabel is called in
a way that a vm can access them (i.e., they are labeled with svirt_t
based label in SELinux).

13 years agosecurity: Rename SetSocketLabel APIs to SetDaemonSocketLabel
Jiri Denemark [Fri, 26 Aug 2011 07:05:57 +0000 (09:05 +0200)]
security: Rename SetSocketLabel APIs to SetDaemonSocketLabel

The APIs are designed to label a socket in a way that the libvirt daemon
itself is able to access it (i.e., in SELinux the label is virtd_t based
as opposed to svirt_* we use for labeling resources that need to be
accessed by a vm). The new name reflects this.

13 years agoIgnore unused streams in virStreamAbort
Jiri Denemark [Mon, 15 Aug 2011 09:28:53 +0000 (11:28 +0200)]
Ignore unused streams in virStreamAbort

When virStreamAbort is called on a stream that has not been used yet,
quite confusing error is returned: "this function is not supported by
the connection driver". Let's just ignore such streams as there's
nothing to abort anyway.

13 years agoDo not try to cancel non-existent migration on source
Jiri Denemark [Fri, 12 Aug 2011 18:46:07 +0000 (20:46 +0200)]
Do not try to cancel non-existent migration on source

If migration failed on source daemon, the migration is automatically
canceled by the daemon itself. Thus we don't need to call
virDomainMigrateConfirm3(cancelled=1). Calling it doesn't cause any harm
but the resulting error message printed in logs may confuse people.

13 years agosnapshot: track current snapshot across restarts
Eric Blake [Thu, 25 Aug 2011 21:11:03 +0000 (15:11 -0600)]
snapshot: track current snapshot across restarts

Audit all changes to the qemu vm->current_snapshot, and make them
update the saved xml file for both the previous and the new
snapshot, so that there is always at most one snapshot with
<active>1</active> in the xml, and that snapshot is used as the
current snapshot even across libvirtd restarts.

This patch does not fix the case of virDomainSnapshotDelete(,CHILDREN)
where one of the children is the current snapshot; that will be later.

* src/conf/domain_conf.h (_virDomainSnapshotDef): Alter member
type and name.
* src/conf/domain_conf.c (virDomainSnapshotDefParseString)
(virDomainSnapshotDefFormat): Update clients.
* docs/schemas/domainsnapshot.rng: Tighten rng.
* src/qemu/qemu_driver.c (qemuDomainSnapshotLoad): Reload current
snapshot.
(qemuDomainSnapshotCreateXML, qemuDomainRevertToSnapshot)
(qemuDomainSnapshotDiscard): Track current snapshot.

13 years agosnapshot: only pass snapshot to qemu command line when reverting
Eric Blake [Thu, 25 Aug 2011 20:44:48 +0000 (14:44 -0600)]
snapshot: only pass snapshot to qemu command line when reverting

Changing the current vm, and writing that change to the file
system, all before a new qemu starts, is risky; it's hard to
roll back if starting the new qemu fails for some reason.
Instead of abusing vm->current_snapshot and making the command
line generator decide whether the current snapshot warrants
using -loadvm, it is better to just directly pass a snapshot all
the way through the call chain if it is to be loaded.

This frees up the last use of snapshot->def->active for qemu's
use, so the next patch can repurpose that field for tracking
which snapshot is current.

* src/qemu/qemu_command.c (qemuBuildCommandLine): Don't use active
field of snapshot.
* src/qemu/qemu_process.c (qemuProcessStart): Add a parameter.
* src/qemu/qemu_process.h (qemuProcessStart): Update prototype.
* src/qemu/qemu_migration.c (qemuMigrationPrepareAny): Update
callers.
* src/qemu/qemu_driver.c (qemudDomainCreate)
(qemuDomainSaveImageStartVM, qemuDomainObjStart)
(qemuDomainRevertToSnapshot): Likewise.
(qemuDomainSnapshotSetCurrentActive)
(qemuDomainSnapshotSetCurrentInactive): Delete unused functions.

13 years agosnapshot: don't leak resources on qemu snapshot failure
Eric Blake [Fri, 12 Aug 2011 20:45:39 +0000 (14:45 -0600)]
snapshot: don't leak resources on qemu snapshot failure

https://bugzilla.redhat.com/show_bug.cgi?id=727709
mentions that if qemu fails to create the snapshot (such as what
happens on Fedora 15 qemu, which has qmp but where savevm is only
in hmp, and where libvirt is old enough to not try the hmp fallback),
then 'virsh snapshot-list dom' will show a garbage snapshot entry,
and the libvirt internal directory for storing snapshot metadata
will have a bogus file.

This fixes the fallout bug of polluting the snapshot-list with
garbage on failure (the root cause of the F15 bug of not having
fallback to hmp has already been fixed in newer libvirt releases).

* src/qemu/qemu_driver.c (qemuDomainSnapshotCreateXML): Allocate
memory before making snapshot, and cleanup on failure.  Don't
dereference NULL if transient domain exited during snapshot creation.

13 years agolibvirt: avoid dead store in virDomainMigrateVersion3
Alex Jia [Tue, 16 Aug 2011 09:24:26 +0000 (17:24 +0800)]
libvirt: avoid dead store in virDomainMigrateVersion3

* src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
  clang warning.

Detected by ccc-analyzer:

libvirt.c:4277:5: warning: Value stored to 'ret' is never read
    ret = domain->conn->driver->domainMigrateConfirm3
    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

13 years agoqemu: avoid dead store in doPeer2PeerMigrate3
Alex Jia [Tue, 16 Aug 2011 09:24:25 +0000 (17:24 +0800)]
qemu: avoid dead store in doPeer2PeerMigrate3

* src/qemu/qemu_migration.c: avoid dead 'ret' assignment and silence
  clang warning.

Detected by ccc-analyzer:

  CC     libvirt_driver_qemu_la-qemu_migration.lo
qemu/qemu_migration.c:2046:5: warning: Value stored to 'ret' is never read
    ret = qemuMigrationConfirm(driver, sconn, vm,
    ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

13 years agoFix command test wrt gnutls initialize & fix debugging
Daniel P. Berrange [Thu, 25 Aug 2011 11:05:54 +0000 (12:05 +0100)]
Fix command test wrt gnutls initialize & fix debugging

The VIR_TEST_DEBUG and VIR_TEST_VERBOSE env vars did not work
because we replaced 'environ' with 'newenv'. Simply calling
virTestGetDebug/Verbose() before replacing the 'environ' ensures
we have processed the env variables.

The gnutls initialization code opens /dev/urandom and keeps that
FD around for later use. We have code which kills off FDs 3-5
to avoid interfereing with our test case. Move the virInitialize
call before this point, so it kills off the gnutls /dev/urandom
FD which is irrelevant for testing purposes

* tests/commandtest.c: Fix test debugging & make it robust against
  opened FDs

13 years agodaemon: Move TLS initialization to virInitialize
Michal Privoznik [Wed, 24 Aug 2011 14:16:45 +0000 (16:16 +0200)]
daemon: Move TLS initialization to virInitialize

My previous patch 74c75671331d284e1f777f9692b72e9737520bf0
introduced a regression by removing TLS initialization from client.

13 years agoutil: only fchown newly created files in virFileOpenAs
Laine Stump [Wed, 24 Aug 2011 08:50:49 +0000 (04:50 -0400)]
util: only fchown newly created files in virFileOpenAs

virFileOpenAs takes desired uid:gid as arguments, and not only uses
them for a fork/setuid/setgid when retrying failed open operations,
but additionally always forces the opened file to be owned by the
given uid:gid.

One example of the problems this causes is that, when restoring a
domain from a file that is owned by the qemu user, opening the file
chowns it to root. if dynamic_ownership=1 this is coincidentally
expected, but if dynamic_ownership=0, no existing file should ever
have its ownership changed.

This patch adds an extra check before calling fchown() - it only does
it if O_CREAT was passed to virFileOpenAs() in the openflags.

13 years agoqemu: fix off-by-one in pci slot reservation
Shradha Shah [Wed, 24 Aug 2011 15:31:48 +0000 (16:31 +0100)]
qemu: fix off-by-one in pci slot reservation

Signed-off-by: Steve Hodgson <shodgson@solarflare.com>
13 years agomaint: attribute second author of previous patch
Steve Hodgson [Wed, 24 Aug 2011 16:48:20 +0000 (10:48 -0600)]
maint: attribute second author of previous patch

Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agopci: fix pciDeviceListSteal on multiple devices
Shradha Shah [Wed, 24 Aug 2011 15:30:51 +0000 (16:30 +0100)]
pci: fix pciDeviceListSteal on multiple devices

pciDeviceListSteal(pcidevs, dev) removes dev from pcidevs reducing
the length of pcidevs, so moving onto what was the next dev is wrong.

Instead callers should pop entry 0 repeatedly until pcidevs is empty.

Signed-off-by: Steve Hodgson <shodgson@solarflare.com>
Signed-off-by: Shradha Shah <sshah@solarflare.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
13 years agolibvirt: log all flags parameters
Eric Blake [Tue, 16 Aug 2011 20:24:12 +0000 (14:24 -0600)]
libvirt: log all flags parameters

I was testing a virsh patch, and wanted to see if I had passed the
flags I thought.  But with LIBVIRT_DEBUG in the environment, I just
saw:

14:24:52.359: 15022: debug : virDomainSnapshotNum:15586 : dom=0xc9c180, (VM: name=rhel_6-64, uuid=48f8e8e7-e14f-0e14-02f0-ce71997bdcab),

including a trailing space.  This fixes the issues.

* src/libvirt.c: Log flag parameters, even if currently unused.
(VIR_DOMAIN_DEBUG_0): Drop trailing comma in log.
(VIR_DOMAIN_DEBUG_1): Split guts into...
(VIR_DOMAIN_DEBUG_2): ...new macro.

13 years agovirsh: add list --managed-save
Eric Blake [Fri, 19 Aug 2011 00:09:14 +0000 (18:09 -0600)]
virsh: add list --managed-save

Knowing whether 'virsh start' will resume a saved image or do
a fresh boot is useful enough to expose via 'virsh list'.

Also, translate the state column.

* tools/virsh.c (cmdList): add --managed-save flag
* tools/virsh.pod (list): Document it.
Based on a suggestion by Miklos Vajna.

13 years agoesx: Use $(PYTHON) instead of the shebang to run the generator
Matthias Bolte [Tue, 23 Aug 2011 21:40:40 +0000 (23:40 +0200)]
esx: Use $(PYTHON) instead of the shebang to run the generator

13 years agoqemu: Report error if qemu monitor command not found for BlockJob
Osier Yang [Wed, 24 Aug 2011 06:39:42 +0000 (14:39 +0800)]
qemu: Report error if qemu monitor command not found for BlockJob

* src/qemu/qemu_monitor_json.c: Handle error "CommandNotFound" and
  report the error.

* src/qemu/qemu_monitor_text.c: If a sub info command is not found,
  it prints the output of "help info", for other commands,
  "unknown command" is printed.

Without this patch, libvirt always report:

  An error occurred, but the cause is unknown

This patch was adapted from a patch by Osier Yang <jyang@redhat.com> to
break out detection of unrecognized text monitor commands into a separate
function.

Signed-off-by: Adam Litke <agl@us.ibm.com>
13 years agoesx: Refactor a repeated string in the generator
Matthias Bolte [Tue, 23 Aug 2011 21:15:21 +0000 (23:15 +0200)]
esx: Refactor a repeated string in the generator

13 years agomaint: fix comment typos
Eric Blake [Tue, 23 Aug 2011 17:02:02 +0000 (11:02 -0600)]
maint: fix comment typos

* src/qemu/qemu_driver.c (qemuDomainSaveInternal): Fix typo.
* src/conf/domain_event.c (virDomainEventDispatchMatchCallback):
Likewise.
* daemon/libvirtd.c (daemonRunStateInit): Likewise.
* src/lxc/lxc_container.c (lxcContainerChildMountSort): Likewise.
* src/util/virterror.c (virCopyError, virRaiseErrorFull): Likewise.
* src/xenxs/xen_sxpr.c (xenParseSxprSound): Likewise.

13 years agovirsh: Substitute goto label out with cleanup
Osier Yang [Tue, 23 Aug 2011 14:22:51 +0000 (22:22 +0800)]
virsh: Substitute goto label out with cleanup

Introduced by 241cbc13a, pushed under urgent rule.