[libvirt] [PATCH] start: allow discarding managed save
by Eric Blake
There have been several instances of people having problems with
a broken managed save file causing 'virsh start' to fail, and not
being 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.
---
include/libvirt/libvirt.h.in | 1 +
src/libvirt.c | 3 ++
src/qemu/qemu_driver.c | 50 +++++++++++++++++++++++++----------------
tools/virsh.c | 7 +++++-
tools/virsh.pod | 5 ++-
5 files changed, 43 insertions(+), 23 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 53a2f7d..c51a5b9 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -236,6 +236,7 @@ typedef enum {
VIR_DOMAIN_START_PAUSED = 1 << 0, /* Launch guest in paused state */
VIR_DOMAIN_START_AUTODESTROY = 1 << 1, /* Automatically kill guest when virConnectPtr is closed */
VIR_DOMAIN_START_BYPASS_CACHE = 1 << 2, /* Avoid file system cache pollution */
+ VIR_DOMAIN_START_FORCE_BOOT = 1 << 3, /* Boot, discarding any managed save */
} virDomainCreateFlags;
diff --git a/src/libvirt.c b/src/libvirt.c
index 65a099b..80c8b7c 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -7081,6 +7081,9 @@ error:
* the file, or fail if it cannot do so for the given system; this can allow
* less pressure on file system cache, but also risks slowing loads from NFS.
*
+ * If the VIR_DOMAIN_START_FORCE_BOOT flag is set, then any managed save
+ * file for this domain is discarded, and the domain boots from scratch.
+ *
* Returns 0 in case of success, -1 in case of error
*/
int
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f21122d..5033998 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -120,9 +120,7 @@ static int qemudShutdown(void);
static int qemuDomainObjStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
- bool start_paused,
- bool autodestroy,
- bool bypass_cache);
+ unsigned int flags);
static int qemudDomainGetMaxVcpus(virDomainPtr dom);
@@ -135,11 +133,16 @@ struct qemuAutostartData {
};
static void
-qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaque)
+qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED,
+ void *opaque)
{
virDomainObjPtr vm = payload;
struct qemuAutostartData *data = opaque;
virErrorPtr err;
+ int flags = 0;
+
+ if (data->driver->autoStartBypassCache)
+ flags |= VIR_DOMAIN_START_BYPASS_CACHE;
virDomainObjLock(vm);
virResetLastError();
@@ -152,9 +155,7 @@ qemuAutostartDomain(void *payload, const void *name ATTRIBUTE_UNUSED, void *opaq
} else {
if (vm->autostart &&
!virDomainObjIsActive(vm) &&
- qemuDomainObjStart(data->conn, data->driver, vm,
- false, false,
- data->driver->autoStartBypassCache) < 0) {
+ qemuDomainObjStart(data->conn, data->driver, vm, flags) < 0) {
err = virGetLastError();
VIR_ERROR(_("Failed to autostart VM '%s': %s"),
vm->def->name,
@@ -4441,12 +4442,14 @@ static int
qemuDomainObjStart(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
- bool start_paused,
- bool autodestroy,
- bool bypass_cache)
+ unsigned int flags)
{
int ret = -1;
char *managed_save;
+ bool start_paused = (flags & VIR_DOMAIN_START_PAUSED) != 0;
+ bool autodestroy = (flags & VIR_DOMAIN_START_AUTODESTROY) != 0;
+ bool bypass_cache = (flags & VIR_DOMAIN_START_BYPASS_CACHE) != 0;
+ bool force_boot = (flags & VIR_DOMAIN_START_FORCE_BOOT) != 0;
/*
* If there is a managed saved state restore it instead of starting
@@ -4458,13 +4461,22 @@ qemuDomainObjStart(virConnectPtr conn,
goto cleanup;
if (virFileExists(managed_save)) {
- ret = qemuDomainObjRestore(conn, driver, vm, managed_save,
- bypass_cache);
+ if (force_boot) {
+ if (unlink(managed_save) < 0) {
+ virReportSystemError(errno,
+ _("cannot remove managed save file %s"),
+ managed_save);
+ goto cleanup;
+ }
+ } else {
+ ret = qemuDomainObjRestore(conn, driver, vm, managed_save,
+ bypass_cache);
- if ((ret == 0) && (unlink(managed_save) < 0))
- VIR_WARN("Failed to remove the managed state %s", managed_save);
+ if ((ret == 0) && (unlink(managed_save) < 0))
+ VIR_WARN("Failed to remove the managed state %s", managed_save);
- goto cleanup;
+ goto cleanup;
+ }
}
ret = qemuProcessStart(conn, driver, vm, NULL, start_paused,
@@ -4493,7 +4505,8 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
virCheckFlags(VIR_DOMAIN_START_PAUSED |
VIR_DOMAIN_START_AUTODESTROY |
- VIR_DOMAIN_START_BYPASS_CACHE, -1);
+ VIR_DOMAIN_START_BYPASS_CACHE |
+ VIR_DOMAIN_START_FORCE_BOOT, -1);
qemuDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
@@ -4515,10 +4528,7 @@ qemuDomainStartWithFlags(virDomainPtr dom, unsigned int flags)
goto endjob;
}
- if (qemuDomainObjStart(dom->conn, driver, vm,
- (flags & VIR_DOMAIN_START_PAUSED) != 0,
- (flags & VIR_DOMAIN_START_AUTODESTROY) != 0,
- (flags & VIR_DOMAIN_START_BYPASS_CACHE) != 0) < 0)
+ if (qemuDomainObjStart(dom->conn, driver, vm, flags) < 0)
goto endjob;
ret = 0;
diff --git a/tools/virsh.c b/tools/virsh.c
index 15b9bdd..49034ae 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1537,9 +1537,12 @@ static const vshCmdOptDef opts_start[] = {
{"console", VSH_OT_BOOL, 0, N_("attach to console after creation")},
#endif
{"paused", VSH_OT_BOOL, 0, N_("leave the guest paused after creation")},
- {"autodestroy", VSH_OT_BOOL, 0, N_("automatically destroy the guest when virsh disconnects")},
+ {"autodestroy", VSH_OT_BOOL, 0,
+ N_("automatically destroy the guest when virsh disconnects")},
{"bypass-cache", VSH_OT_BOOL, 0,
N_("avoid file system cache when loading")},
+ {"force-boot", VSH_OT_BOOL, 0,
+ N_("force fresh boot by discarding any managed save")},
{NULL, 0, 0, NULL}
};
@@ -1572,6 +1575,8 @@ cmdStart(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_START_AUTODESTROY;
if (vshCommandOptBool(cmd, "bypass-cache"))
flags |= VIR_DOMAIN_START_BYPASS_CACHE;
+ if (vshCommandOptBool(cmd, "force-boot"))
+ flags |= VIR_DOMAIN_START_FORCE_BOOT;
/* Prefer older API unless we have to pass a flag. */
if ((flags ? virDomainCreateWithFlags(dom, flags)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 81d7a1e..2cd0f73 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -890,7 +890,7 @@ The exact behavior of a domain when it shuts down is set by the
I<on_shutdown> parameter in the domain's XML definition.
=item B<start> I<domain-name> [I<--console>] [I<--paused>] [I<--autodestroy>]
-[I<--bypass-cache>]
+[I<--bypass-cache>] [I<--force-boot>]
Start a (previously defined) inactive domain, either from the last
B<managedsave> state, or via a fresh boot if no managedsave state is
@@ -901,7 +901,8 @@ If I<--autodestroy> is requested, then the guest will be automatically
destroyed when virsh closes its connection to libvirt, or otherwise
exits. If I<--bypass-cache> is specified, and managedsave state exists,
the restore will avoid the file system cache, although this may slow
-down the operation.
+down the operation. If I<--force-boot> is specified, then any
+managedsave state is discarded and a fresh boot occurs.
=item B<suspend> I<domain-id>
--
1.7.4.4
13 years, 3 months
[libvirt] [PATCH] reserve slot 1 on pci bus0
by Wen Congyang
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.
---
src/qemu/qemu_command.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 287ad8d..4b5734c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1072,6 +1072,7 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
int i;
bool reservedIDE = false;
bool reservedVGA = false;
+ int function;
/* Host bridge */
if (qemuDomainPCIAddressReserveSlot(addrs, 0) < 0)
@@ -1107,9 +1108,14 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
/* PIIX3 (ISA bridge, IDE controller, something else unknown, USB controller)
* hardcoded slot=1, multifunction device
*/
- if (!reservedIDE &&
- qemuDomainPCIAddressReserveSlot(addrs, 1) < 0)
- goto error;
+ for (function = 0; function <= QEMU_PCI_ADDRESS_LAST_FUNCTION; function++) {
+ if (function == 1 && reservedIDE)
+ /* we have reserved this pci address */
+ continue;
+
+ if (qemuDomainPCIAddressReserveFunction(addrs, 1, function) < 0)
+ goto error;
+ }
/* First VGA is hardcoded slot=2 */
if (def->nvideos > 0) {
--
1.7.1
13 years, 3 months
[libvirt] [PATCH] lxc: do not require 'ifconfig' or 'ipconfig' in container
by Scott Moser
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@(a)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 .
diff --git a/src/lxc/veth.c b/src/lxc/veth.c
index 34cb804..c24df91 100644
--- a/src/lxc/veth.c
+++ b/src/lxc/veth.c
@@ -12,8 +12,11 @@
#include <config.h>
+#include <linux/sockios.h>
+#include <net/if.h>
#include <string.h>
#include <stdio.h>
+#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -186,41 +189,49 @@ int vethDelete(const char *veth)
* @veth: name of veth device
* @upOrDown: 0 => down, 1 => up
*
- * Enables a veth device using the ifconfig command. A NULL inetAddress
- * will cause it to be left off the command line.
+ * Enables a veth device using SIOCSIFFLAGS
*
- * Returns 0 on success or -1 in case of error
+ * Returns 0 on success, -1 on failure, with errno set
*/
int vethInterfaceUpOrDown(const char* veth, int upOrDown)
{
- int rc;
- const char *argv[] = {"ifconfig", veth, NULL, NULL};
- int cmdResult = 0;
+ struct ifreq ifr;
+ int fd, ret;
- if (0 == upOrDown)
- argv[2] = "down";
- else
- argv[2] = "up";
+ if ((fd = socket(PF_PACKET, SOCK_DGRAM, 0)) == -1)
+ return(-1);
- rc = virRun(argv, &cmdResult);
+ memset(&ifr, 0, sizeof(struct ifreq));
- if (rc != 0 ||
- (WIFEXITED(cmdResult) && WEXITSTATUS(cmdResult) != 0)) {
- if (0 == upOrDown)
+ if (virStrcpyStatic(ifr.ifr_name, veth) == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if ((ret = ioctl(fd, SIOCGIFFLAGS, &ifr)) == 0) {
+ if (upOrDown)
+ ifr.ifr_flags |= IFF_UP;
+ else
+ ifr.ifr_flags &= ~(IFF_UP | IFF_RUNNING);
+
+ ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
+ }
+
+ close(fd);
+ if (ret == -1)
+ if (upOrDown == 0)
/*
* Prevent overwriting an error log which may be set
* where an actual failure occurs.
*/
- VIR_DEBUG("Failed to disable '%s' (%d)",
- veth, WEXITSTATUS(cmdResult));
+ VIR_DEBUG("Failed to disable '%s'", veth);
else
vethError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to enable '%s' (%d)"),
- veth, WEXITSTATUS(cmdResult));
- rc = -1;
- }
+ _("Failed to enable '%s'"), veth);
+ else
+ ret = 0;
- return rc;
+ return(ret);
}
/**
@@ -279,17 +290,29 @@ int setMacAddr(const char* iface, const char* macaddr)
* @iface: name of device
* @new: new name of @iface
*
- * Changes the name of the given device with the
- * given new name using this command:
- * ip link set @iface name @new
+ * Changes the name of the given device.
*
- * Returns 0 on success or -1 in case of error
+ * Returns 0 on success, -1 on failure with errno set.
*/
int setInterfaceName(const char* iface, const char* new)
{
- const char *argv[] = {
- "ip", "link", "set", iface, "name", new, NULL
- };
+ struct ifreq ifr;
+ int fd = socket(PF_PACKET, SOCK_DGRAM, 0);
- return virRun(argv, NULL);
+ memset(&ifr, 0, sizeof(struct ifreq));
+
+ if (virStrcpyStatic(ifr.ifr_name, iface) == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (virStrcpyStatic(ifr.ifr_newname, new) == NULL) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ioctl(fd, SIOCSIFNAME, &ifr))
+ return -1;
+
+ return 0;
}
13 years, 3 months
[libvirt] [RFC] Create ptmx as a device
by Serge Hallyn
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(a)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(a)canonical.com>
---
src/lxc/lxc_container.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e425328..6991aec 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -543,18 +543,18 @@ static int lxcContainerPopulateDevices(void)
}
}
+ dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
+ if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
+ chmod("/dev/ptmx", 0666)) {
+ virReportSystemError(errno, "%s",
+ _("Failed to make device /dev/ptmx"));
+ return -1;
+ }
+
if (access("/dev/pts/ptmx", W_OK) == 0) {
- if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) {
- virReportSystemError(errno, "%s",
- _("Failed to create symlink /dev/ptmx to /dev/pts/ptmx"));
- return -1;
- }
- } else {
- dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
- if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
- chmod("/dev/ptmx", 0666)) {
+ if (mount("/dev/pts/ptmx", "/dev/ptmx", "ptmx", MS_BIND, NULL) < 0) {
virReportSystemError(errno, "%s",
- _("Failed to make device /dev/ptmx"));
+ _("Failed to bind-mount /dev/ptmx to /dev/pts/ptmx"));
return -1;
}
}
--
1.7.5.4
13 years, 3 months
[libvirt] [PATCH 1/2] BlockJob: Bandwidth parameter is in MB when using text monitor
by Adam Litke
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(a)us.ibm.com>
---
src/qemu/qemu_monitor_text.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index f37c98c..854ee7f 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -3067,8 +3067,7 @@ int qemuMonitorTextBlockJob(qemuMonitorPtr mon,
ret = virAsprintf(&cmd, "%s", cmd_name);
} else if (mode == BLOCK_JOB_SPEED) {
cmd_name = "block_job_set_speed";
- ret = virAsprintf(&cmd, "%s %s %llu", cmd_name, device,
- bandwidth * 1024ULL * 1024ULL);
+ ret = virAsprintf(&cmd, "%s %s %luM", cmd_name, device, bandwidth);
} else if (mode == BLOCK_JOB_PULL) {
cmd_name = "block_stream";
ret = virAsprintf(&cmd, "%s %s", cmd_name, device);
--
1.7.3
13 years, 3 months
[libvirt] [PATCHv3 00/43] cleaned up snapshot series
by Eric Blake
As promised, here is my v3, which includes all the self-replies
I was scattering throughout v2:
https://www.redhat.com/archives/libvir-list/2011-August/msg00620.html
Also available here:
git fetch git://repo.or.cz/libvirt/ericb.git snapshot
or browse online at:
http://repo.or.cz/w/libvirt/ericb.git/shortlog/refs/heads/snapshot
I've tested that this can create external disk snapshots with
SELinux running using the qemu snapshot_blkdev monitor command,
then deleting the metadata for those snapshots.
Other things from my RFC still remain to be coded:
https://www.redhat.com/archives/libvir-list/2011-August/msg00361.html
support for offline external disk snapshots
support for more flags (such as starting an offline snapshot on revert)
support for revert and delete of disk snapshots
new apis for easier manipulation of snapshot hierarchies
Eric Blake (43):
snapshot: better event when reverting qemu to paused snapshot
snapshot: improve reverting to qemu paused snapshots
snapshot: properly revert qemu to offline snapshots
snapshot: don't leak resources on qemu snapshot failure
snapshot: only pass snapshot to qemu command line when reverting
snapshot: track current snapshot across restarts
snapshot: allow deletion of just snapshot metadata
snapshot: avoid crash when deleting qemu snapshots
snapshot: simplify acting on just children
snapshot: let qemu discard only snapshot metadata
snapshot: identify which snapshots have metadata
snapshot: identify qemu snapshot roots
snapshot: prevent stranding snapshot data on domain destruction
snapshot: refactor some qemu code
snapshot: cache qemu-img location
snapshot: support new undefine flags in qemu
snapshot: teach virsh about new undefine flags
snapshot: prevent migration from stranding snapshot data
snapshot: refactor domain xml output
snapshot: allow full domain xml in snapshot
snapshot: correctly escape generated xml
snapshot: update rng to support full domain in xml
snapshot: store qemu domain details in xml
snapshot: additions to domain xml for disks
snapshot: reject transient disks where code is not ready
snapshot: reflect recent options in virsh
snapshot: introduce new deletion flag
snapshot: expose new delete flag in virsh
snapshot: allow halting after snapshot
snapshot: refactor virsh snapshot creation
snapshot: expose halt-after-creation in virsh
snapshot: wire up new qemu monitor command
snapshot: support extra state in snapshots
snapshot: add <disks> to snapshot xml
snapshot: also support disks by path
snapshot: add virsh domblklist command
snapshot: add flag for requesting disk snapshot
snapshot: reject unimplemented disk snapshot features
snapshot: make it possible to audit external snapshot
snapshot: wire up disk-only flag to snapshot-create
snapshot: wire up live qemu disk snapshots
snapshot: refactor qemu file opening
snapshot: use SELinux and lock manager with external snapshots
docs/formatdomain.html.in | 40 +-
docs/formatsnapshot.html.in | 253 ++-
docs/schemas/Makefile.am | 1 +
docs/schemas/domain.rng | 2555 +-------------------
docs/schemas/{domain.rng => domaincommon.rng} | 32 +-
docs/schemas/domainsnapshot.rng | 89 +-
include/libvirt/libvirt.h.in | 62 +-
src/conf/domain_audit.c | 12 +-
src/conf/domain_audit.h | 4 +-
src/conf/domain_conf.c | 861 ++++++--
src/conf/domain_conf.h | 75 +-
src/esx/esx_driver.c | 41 +-
src/libvirt.c | 132 +-
src/libvirt_private.syms | 8 +
src/libxl/libxl_conf.c | 5 +
src/libxl/libxl_driver.c | 11 +-
src/qemu/qemu_command.c | 12 +-
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_driver.c | 1611 +++++++++----
src/qemu/qemu_hotplug.c | 18 +-
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_monitor.c | 24 +
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 33 +
src/qemu/qemu_monitor_json.h | 4 +
src/qemu/qemu_monitor_text.c | 40 +
src/qemu/qemu_monitor_text.h | 4 +
src/qemu/qemu_process.c | 21 +-
src/qemu/qemu_process.h | 1 +
src/uml/uml_driver.c | 56 +-
src/vbox/vbox_tmpl.c | 46 +-
src/xen/xend_internal.c | 12 +-
src/xenxs/xen_sxpr.c | 5 +
src/xenxs/xen_xm.c | 5 +
tests/domainsnapshotxml2xmlin/disk_snapshot.xml | 16 +
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 77 +
tests/domainsnapshotxml2xmlout/full_domain.xml | 35 +
.../qemuxml2argv-disk-snapshot.args | 7 +
.../qemuxml2argv-disk-snapshot.xml | 39 +
.../qemuxml2argv-disk-transient.xml | 27 +
tests/qemuxml2argvtest.c | 2 +
tools/virsh.c | 755 +++++-
tools/virsh.pod | 111 +-
43 files changed, 3616 insertions(+), 3533 deletions(-)
copy docs/schemas/{domain.rng => domaincommon.rng} (98%)
create mode 100644 tests/domainsnapshotxml2xmlin/disk_snapshot.xml
create mode 100644 tests/domainsnapshotxml2xmlout/disk_snapshot.xml
create mode 100644 tests/domainsnapshotxml2xmlout/full_domain.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-snapshot.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-transient.xml
--
1.7.4.4
13 years, 3 months
[libvirt] [PATCH] virsh: improve send-key documentation
by Eric Blake
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.
---
Red Hat QE found this: https://bugzilla.redhat.com/show_bug.cgi?id=699847
tools/virsh.c | 13 ++++---------
tools/virsh.pod | 20 +++++++++++++++++---
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 49034ae..8500a03 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3718,21 +3718,16 @@ cmdInjectNMI(vshControl *ctl, const vshCmd *cmd)
*/
static const vshCmdInfo info_send_key[] = {
{"help", N_("Send keycodes to the guest")},
- {"desc", N_("Send keycodes to the guest, the keycodes must be integers\n"
- " Examples:\n\n"
- " virsh # send-key <domain> 37 18 21\n"
- " virsh # send-key <domain> KEY_RIGHTCTRL KEY_C\n"
- " virsh # send-key <domain> --codeset xt 37 18 21\n"
- " virsh # send-key <domain> --holdtime 1000 0x15 18 0xf\n"
- )},
+ {"desc", N_("Send keycodes (integers or symbolic names) to the guest")},
{NULL, NULL}
};
static const vshCmdOptDef opts_send_key[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
- {"codeset", VSH_OT_STRING, VSH_OFLAG_REQ_OPT, N_("the codeset of keycodes, default:linux")},
+ {"codeset", VSH_OT_STRING, VSH_OFLAG_REQ_OPT,
+ N_("the codeset of keycodes, default:linux")},
{"holdtime", VSH_OT_INT, VSH_OFLAG_REQ_OPT,
- N_("the time (in millsecond) how long the keys will be held")},
+ N_("the time (in millseconds) how long the keys will be held")},
{"keycode", VSH_OT_ARGV, VSH_OFLAG_REQ, N_("the key code")},
{NULL, 0, 0, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 2cd0f73..5c417f9 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -310,9 +310,23 @@ running B<virsh suspend>. When in a paused state the domain will still
consume allocated resources like memory, but will not be eligible for
scheduling by the hypervisor.
-=item B<send-key> I<domain-id> optional I<--codeset> B<codeset> optional I<--holdtime> B<holdtime> B<keycode>...
-
-Send keys to the guest
+=item B<send-key> I<domain-id> [I<--codeset> B<codeset>]
+[I<--holdtime> B<holdtime>] I<keycode>...
+
+Parse the I<keycode> sequence as keystrokes to send to I<domain-id>.
+Each I<keycode> can either be a numeric value or a symbolic name from
+the corresponding codeset. The default code set is B<linux>, but
+use of I<--codeset> can specify B<xt>, B<atset1>, B<atset2>, B<atset3>,
+B<os_x>, B<xt_kbd>, B<usb>, B<win32>, or B<rfb> instead. If I<--holdtime>
+is given, each keystroke will be held for that many milliseconds.
+
+B<Examples>
+ # send three strokes 'k', 'e', 'y', using xt codeset
+ virsh send-key dom --codeset xt 37 18 21
+ # send one stroke 'right-ctrl+C'
+ virsh send-key dom KEY_RIGHTCTRL KEY_C
+ # send a tab, held for 1 second
+ virsh send-key --holdtime 1000 0xf
=item B<shutdown>
--
1.7.4.4
13 years, 3 months
[libvirt] [PATCH 0/6] Support online block resizing
by Osier Yang
Upstream QEMU introduced online block resizing to resize the
block device when domain is running since commit 6d4a2b3a4795.
It simply reuses existing "bdrv_truncate" method which is used
by "qemu-img" to resize the images. This means it supports to
resize all the format that "qemu-img resize" supports. E.g.
qcow2, raw, qed, qcow, etc. (NB, it doesn't support to shrink
size of qcow2 image, and QEMU reports "An undefined error
has ocurred" in this case).
For block device of virtio bus, the guest can update the device
size automatically, needs kernel support, since kernel-2.6.32-117:
http://patchwork.usersys.redhat.com/patch/33040/
For block device of SCSI bus, one needs to execute command like
below in the guest (linux) to update the size:
% echo > /sys/class/scsi_device/0:0:0:0/device/rescan
For block device of IDE bus, seems there is no way to let guest
update the size after resizing.
The new API is defined as:
int virDomainBlockResize (virDomainPtr dom,
const char *device,
unsigned long long size,
unsigned int flags)
* @device is the name of block device, E.g. vda, vdb.
* Units for @size is KB.
[PATCH 1/6] block_resize: Define the new API
[PATCH 2/6] block_resize: Implemente the public API
[PATCH 3/6] block_resize: Wire up the remote protocol
[PATCH 4/6] block_resize: Implemente the qemu monitor functions
[PATCH 5/6] block_resize: Implemente the internal API for qemu
[PATCH 6/6] block_resize: Expose the new API in virsh
Regards,
Osier
13 years, 3 months
[libvirt] [v2 00/13] various USB support improvements
by Marc-André Lureau
Hola,
This is the second version of the patch set which should address
most of the comments I recieved.
It should be good enough to let virt-manager & co support USB2 &
usb-redirection. Some of the auto-assign of USB addresses etc..
are leftover for future improvements. It should not introduce
regressions.
Marc-André Lureau (13):
Add various USB devices QEMU_CAPS
Split virDomainControllerModel to virDomainControllerModelSCSI
Add USB controller models
Add a new controller type 'usb' with optionnal 'model'
USB controller can have a PCI address child element
USB devices gain a new USB address child element
Add USB companion controllers support
Add USB hub device
Modify USB port to be defined as a port path
qemu: don't reserve slot 1 if a PIIX3 USB controller is defined there
qemu: Don't append 0 at usb id, so that it is compatible with legacy
-usb
Add a usb1 & usb2 qemuxml2argv test
Add usb-redir device
docs/formatdomain.html.in | 81 ++++-
docs/schemas/domain.rng | 122 +++++--
src/conf/domain_conf.c | 369 +++++++++++++++++++-
src/conf/domain_conf.h | 82 ++++-
src/esx/esx_driver.c | 8 +-
src/libvirt_private.syms | 8 +-
src/qemu/qemu_capabilities.c | 28 ++
src/qemu/qemu_capabilities.h | 9 +
src/qemu/qemu_cgroup.c | 3 +-
src/qemu/qemu_command.c | 284 ++++++++++++++--
src/qemu/qemu_command.h | 10 +-
src/qemu/qemu_hostdev.c | 2 +
src/qemu/qemu_hotplug.c | 66 ++++-
src/qemu/qemu_hotplug.h | 3 +
src/security/security_dac.c | 6 +
src/security/security_selinux.c | 6 +
src/vmx/vmx.c | 32 +-
tests/qemuhelptest.c | 17 +-
.../qemuxml2argv-input-usbmouse-addr.args | 1 +
.../qemuxml2argv-input-usbmouse-addr.xml | 27 ++
.../qemuxml2argv-usb-controller.args | 1 +
.../qemuxml2argv-usb-controller.xml | 16 +
tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args | 1 +
tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml | 19 +
.../qemuxml2argv-usb-ich9-companion.args | 6 +
.../qemuxml2argv-usb-ich9-companion.xml | 30 ++
.../qemuxml2argv-usb-ich9-ehci-addr.args | 1 +
.../qemuxml2argv-usb-ich9-ehci-addr.xml | 18 +
.../qemuxml2argv-usb-piix3-controller.args | 1 +
.../qemuxml2argv-usb-piix3-controller.xml | 16 +
tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args | 1 +
tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml | 31 ++
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args | 8 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 33 ++
tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args | 15 +
tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml | 74 ++++
tests/qemuxml2argvtest.c | 29 ++
tests/xml2vmxtest.c | 2 +-
38 files changed, 1350 insertions(+), 116 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-input-usbmouse-addr.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-controller.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-companion.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-ehci-addr.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-piix3-controller.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ports.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ports.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb1-usb2.xml
--
1.7.6
13 years, 3 months
[libvirt] [PATCH 0/8] Cleanup improper VIR_ERR_NO_SUPPORT use
by Osier Yang
Error code VIR_ERR_NO_SUPPORT will be translated to "this function
is not supported by the connection driver", however, it's used
across the whole projects, this patch is trying to cleanup all
the improper use in the source tree.
The modification can be grouped to 3 following groups:
1) The error intends to tell user it's invalid operation.
s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID.
2) The error intends to tell the configuration of domain
is not supported.
s/VIR_ERR_NO_SUPPORT/VIR_ERR_CONFIG_UNSUPPORTED/
3) The error intends to tell the function is not implemented
on some platform.
* s/VIR_ERR_NO_SUPPORT/VIR_ERR_OPERATION_INVALID/
* and add error strings
e.g.
static int
lxcDomainInterfaceStats(virDomainPtr dom,
const char *path ATTRIBUTE_UNUSED,
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
-lxcError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+lxcError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("interface stats not implemented on this platform"));
return -1;
}
[PATCH 1/8] conf: Cleanup improper use of VIR_ERR_NO_SUPPORT in
[PATCH 2/8] lxc: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 3/8] nodeinfo: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 4/8] qemu: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 5/8] remote: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 6/8] storage: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 7/8] test: Cleanup improper VIR_ERR_NO_SUPPORT use
[PATCH 8/8] xen: Cleanup improper VIR_ERR_NO_SUPPORT use
Regards
Osier
13 years, 3 months