[libvirt] [PATCH 0/6] Use fd: protocol for migration
by Jiri Denemark
Since qemu doesn't give us any reasonable errors when migration fails because
of connection issues, we now create a connection to destination qemu ourselves
and just pass the created socket to qemu.
Daniel P. Berrange (1):
Add API for duplicating a socket/client file descriptor
Jiri Denemark (5):
Add backlog parameter to virNetSocketListen
Support changing UNIX socket owner in virNetSocketNewListenUNIX
qemu: Refactor do{Tunnel,Native}Migrate functions
qemu: Use virNetSocket for tunneled migration
qemu: Use fd: protocol for migration
src/qemu/qemu_migration.c | 541 +++++++++++++++++++++--------------------
src/rpc/virnetclient.c | 20 ++
src/rpc/virnetclient.h | 3 +
src/rpc/virnetserverservice.c | 6 +-
src/rpc/virnetsocket.c | 29 ++-
src/rpc/virnetsocket.h | 5 +-
tests/virnetsockettest.c | 10 +-
7 files changed, 336 insertions(+), 278 deletions(-)
--
1.7.6
13 years, 2 months
[libvirt] [PATCH v2 0/5] Virtual interface link state modification
by Peter Krempa
This patchset adds the ability for libvirt users to control interface
link state of the virtual network devices provided by hypervisors.
Modification of the link state is accomplished by adding a new XML
element <link state"up"> or "down" to the domain XML. The corresponding
network interface is thereafter initialised with the desired state.
Live modification of the link state is achieved by calling
virDomainUpdateDeviceFlags containing a modified interface configuration.
Yet, users may modify only link state of an interface.
This feature allows propagation of network topology changes to guests,
testing scenarios in complex virtual networks, etc ...
Future upgrade:
- add support for VirtualBox
Modifications to v1:
- use virUpdateDeviceFlags instead of dedicated API
- incorporate helpful comments by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=643373
Peter Krempa (5):
link-state: util: Add equality comparision functions for structures
link-state: conf: Add element to XML for controling link state
link-state: qemu: Add monitor handling for link state modification
link-state: qemu: Add net intf modification to virUpdateDeviceFlags
link-state: virsh: Add wrapper commands for changing link state
docs/formatdomain.html.in | 21 +++
docs/schemas/domain.rng | 11 ++
src/conf/domain_conf.c | 24 ++++
src/conf/domain_conf.h | 11 ++
src/qemu/qemu_driver.c | 24 ++++
src/qemu/qemu_hotplug.c | 176 ++++++++++++++++++++++++++
src/qemu/qemu_hotplug.h | 8 ++
src/qemu/qemu_monitor.c | 19 +++
src/qemu/qemu_monitor.h | 4 +
src/qemu/qemu_monitor_json.c | 23 ++++
src/qemu/qemu_monitor_json.h | 4 +
src/qemu/qemu_monitor_text.c | 46 +++++++
src/qemu/qemu_monitor_text.h | 4 +
src/qemu/qemu_process.c | 47 +++++++-
src/util/network.c | 62 +++++++++
src/util/network.h | 5 +
tools/virsh.c | 286 ++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 11 ++
18 files changed, 785 insertions(+), 1 deletions(-)
--
1.7.3.4
13 years, 2 months
[libvirt] Could Libvirt detect the guest's media change and report it?
by Wayne Xia
There is some request in the management of VMs:
If a guest OS give a "eject" command to reject its media, could this
action be reported by libvirt? Is this possible or is there any plan to
enable this in libvirt?
--
Best Regards
Wayne Xia
mail:xiawenc@linux.vnet.ibm.com
tel:86-010-82450803
13 years, 2 months
[libvirt] The design choice for how to enable block I/O throttling function in libvirt
by Zhi Yong Wu
HI, folks,
I am trying to enable block I/O throttling function in libvirt. But
currently i met some design questions, and don't make sure if we
should extend blkiotune to support block I/O throttling or introduce
one new libvirt command "blkiothrottle" to cover it or not. If you
have some better idea, pls don't hesitate to drop your comments.
If one new libvirt command "blkiothrottle" is introduced, I plan to
design its usage syntax as below:
virsh # help blkiothrottle
NAME
blkiothrottle - Set or display a block disk I/O throttle setting.
SYNOPSIS
blkiothrottle <domain> <device> [--bps <number>] [--bps_rd
<number>] [--bps_wr <number>] [--iops <number>] [--iops_rd <number>]
[--iops_wr <number>]
DESCRIPTION
Set or display a block disk I/O throttle setting.
OPTIONS
[--domain] <string> domain name, id or uuid
[--device] <string> block device
--bps <number> total throughput limits in bytes/s
--bps_rd <number> read throughput limits in bytes/s
--bps_wr <number> write throughput limits in bytes/s
--iops <number> total operation limits in numbers/s
--iops_rd <number> read operation limits in numbers/s
--iops_wr <number> write operation limits in numbers/s
virsh #
2.) If blkiotune command is extended to enable block I/O throttling function.
virsh # help blkiotune
NAME
blkiotune - Get or set blkio parameters
SYNOPSIS
blkiotune <domain> [--weight <number>] [--config] [--live]
[--current] [--bps <number>] [--bps_rd <number>] [--bps_wr <number>]
[--iops <number>] [--iops_rd <number>] [--iops_wr <number>]
DESCRIPTION
Get or set the current blkio parameters for a guest domain.
To get the blkio parameters use following command:
virsh # blkiotune <domain>
OPTIONS
[--domain] <string> domain name, id or uuid
--weight <number> IO Weight in range [100, 1000]
--config affect next boot
--live affect running domain
--current affect current domain
Welcome to your suggestions or comments about how to choose it. thanks.
--
Regards,
Zhi Yong Wu
13 years, 2 months
[libvirt] [v2 0/4] python-virtinst USB improvements
by Marc-André Lureau
Hi,
Here are a few patches that go with the libvirt series to improve
USB support. It adds --controller and --usbredir, as well as providing
some new API for virt-manager.
The last patch default USB controller to ich9/usb2 on Windows 7 guest.
More OS probably support it, since it's been around since early 2007.
v2 adds support for USB redirection over Spice.
Marc-André Lureau (4):
Fix typo s/type/managed
Add advanced --controller support, augmenting VirtualController
Add --usbredir device
RFC: Default to ICH9 USB2 controller for Win7
man/en/virt-clone.1 | 6 ++-
man/en/virt-image.1 | 45 ++++++-------
man/en/virt-install.1 | 51 +++++++++++++++-
man/en/virt-install.pod.in | 59 +++++++++++++++++-
tests/cli-test-xml/compare/many-devices.xml | 30 +++++++++
tests/clitest.py | 52 ++++++++++++++++
tests/utils.py | 8 +-
tests/xmlparse-xml/change-controllers-in.xml | 4 +
tests/xmlparse-xml/change-controllers-out.xml | 4 +
tests/xmlparse.py | 9 +++
virt-install | 2 +
virtinst/Guest.py | 26 ++++++++
virtinst/VirtualController.py | 78 ++++++++++++++++++++++--
virtinst/VirtualDevice.py | 49 ++++++++++++++-
virtinst/VirtualHostDevice.py | 72 +++++++++++++++++++++-
virtinst/XMLBuilderDomain.py | 10 +++
virtinst/__init__.py | 5 +-
virtinst/cli.py | 82 +++++++++++++++++++++++++
virtinst/osdict.py | 3 +
virtinst/support.py | 6 ++
20 files changed, 557 insertions(+), 44 deletions(-)
--
1.7.6
13 years, 2 months
[libvirt] [v2 0/3] virt-manager USB improvements
by Marc-André Lureau
Hi,
This is an update of the patch series sent earlier.
v2 adds support for USB redirection over Spice channel.
Marc-André Lureau (3):
virt-manager: Add controller model in details
virt-manager: Add redirected devices details
virt-manager: Learn to add USB redirection devices
src/virtManager/addhardware.py | 66 ++++++++++-
src/virtManager/details.py | 33 +++++-
src/virtManager/uihelpers.py | 19 +++
src/vmm-add-hardware.glade | 254 +++++++++++++++++++++++++++++++++++++++-
src/vmm-details.glade | 118 +++++++++++++++++++
5 files changed, 482 insertions(+), 8 deletions(-)
--
1.7.6
13 years, 2 months
[libvirt] [PATCH] Learn to use spicevmc as a redirection type for usb-redir
by Marc-André Lureau
This patch should be applied on top of "Add usb-redir device"
https://www.redhat.com/archives/libvir-list/2011-August/msg01294.html
---
src/conf/domain_conf.c | 31 ++++++++++++++++---
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args | 2 +
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml | 1 +
tests/qemuxml2argvtest.c | 3 +-
5 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 31330a5..1bf893e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -288,7 +288,8 @@ VIR_ENUM_IMPL(virDomainChrTcpProtocol, VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST,
VIR_ENUM_IMPL(virDomainChrSpicevmc, VIR_DOMAIN_CHR_SPICEVMC_LAST,
"vdagent",
- "smartcard")
+ "smartcard",
+ "usbredir")
VIR_ENUM_IMPL(virDomainSmartcard, VIR_DOMAIN_SMARTCARD_TYPE_LAST,
"host",
@@ -5396,11 +5397,16 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
redirection);
goto error;
}
+
if (def->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("only usb redirection is supported"));
goto error;
}
+
+ if (def->source.subsys.u.chr.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
+ def->source.subsys.u.chr.data.spicevmc = VIR_DOMAIN_CHR_SPICEVMC_USBREDIR;
+ }
}
cur = node->children;
@@ -10159,13 +10165,28 @@ virDomainHostdevDefFormat(virBufferPtr buf,
mode, type, def->managed ? "yes" : "no");
if (redirection != NULL) {
virBufferAsprintf(buf, " redirection='%s'", redirection);
+
+ if (def->source.subsys.u.chr.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
+ virBufferAddLit(buf, "/>\n");
+ return 0;
+ }
}
+
virBufferAddLit(buf, ">\n");
+
virBufferAddLit(buf, " <source");
- if (def->redirection) {
- virBufferAsprintf(buf, " mode='connect' host='%s' service='%s'/",
- def->source.subsys.u.chr.data.tcp.host,
- def->source.subsys.u.chr.data.tcp.service);
+ if (def->redirection)
+ switch (def->source.subsys.u.chr.type) {
+ case VIR_DOMAIN_CHR_TYPE_TCP:
+ virBufferAsprintf(buf, " mode='connect' host='%s' service='%s'/",
+ def->source.subsys.u.chr.data.tcp.host,
+ def->source.subsys.u.chr.data.tcp.service);
+ break;
+ default:
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported redirection type %s"),
+ redirection);
+ return -1;
}
virBufferAddLit(buf, ">\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ff25743..379332d 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -538,6 +538,7 @@ enum virDomainChrTcpProtocol {
enum virDomainChrSpicevmcName {
VIR_DOMAIN_CHR_SPICEVMC_VDAGENT,
VIR_DOMAIN_CHR_SPICEVMC_SMARTCARD,
+ VIR_DOMAIN_CHR_SPICEVMC_USBREDIR,
VIR_DOMAIN_CHR_SPICEVMC_LAST,
};
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
index 0949585..585ae53 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args
@@ -5,4 +5,6 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc
-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,multifunction=on,addr=0x4.0x2 \
-chardev socket,id=charusbredir0,host=localhost,port=4000 \
-device usb-redir,chardev=charusbredir0,id=usbredir0 \
+-chardev spicevmc,id=charusbredir1,name=usbredir \
+-device usb-redir,chardev=charusbredir1,id=usbredir1 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x3.0x0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
index bb50b81..a67facc 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-redir.xml
@@ -28,6 +28,7 @@
<hostdev mode='subsystem' type='usb' redirection='tcp'>
<source mode='connect' host='localhost' service='4000'/>
</hostdev>
+ <hostdev mode='subsystem' type='usb' redirection='spicevmc'/>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 35e6d27..090ec7a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -511,7 +511,8 @@ mymain(void)
DO_TEST("usb-redir", false,
QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
- QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR);
+ QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
+ QEMU_CAPS_SPICE, QEMU_CAPS_CHARDEV_SPICEVMC);
DO_TEST("smbios", false, QEMU_CAPS_SMBIOS_TYPE);
--
1.7.6
13 years, 2 months
[libvirt] [PATCH] rpc: fix a typo in debugging log in virNetServerProgramSendStreamData
by Guannan Ren
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.
---
src/rpc/virnetserverprogram.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/rpc/virnetserverprogram.c b/src/rpc/virnetserverprogram.c
index ac3f0fd..2e9e3f7 100644
--- a/src/rpc/virnetserverprogram.c
+++ b/src/rpc/virnetserverprogram.c
@@ -468,7 +468,7 @@ int virNetServerProgramSendStreamData(virNetServerProgramPtr prog,
if (virNetMessageEncodePayloadEmpty(msg) < 0)
return -1;
}
- VIR_DEBUG("Total %zu", msg->bufferOffset);
+ VIR_DEBUG("Total %zu", msg->bufferLength);
return virNetServerClientSendMessage(client, msg);
}
--
1.7.1
13 years, 2 months
[libvirt] [PATCH] virsh: Add more human-friendly output of domblkstat command
by Peter Krempa
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.
https://bugzilla.redhat.com/show_bug.cgi?id=731656
---
tools/virsh.c | 52 +++++++++++++++++++++++++++++++++++++++++-----------
tools/virsh.pod | 11 ++++++++++-
2 files changed, 51 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 15b9bdd..41ba1e4 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1054,13 +1054,21 @@ cleanup:
*/
static const vshCmdInfo info_domblkstat[] = {
{"help", N_("get device block stats for a domain")},
- {"desc", N_("Get device block stats for a running domain.")},
+ {"desc", N_("Get device block stats for a running domain.\n\n"
+ " Explanation of fields:\n"
+ " rd_req - count of read requests\n"
+ " rd_bytes - count of read bytes\n"
+ " wr_req - count of write requests\n"
+ " wr_bytes - count of written bytes\n"
+ " errs - error count")},
{NULL,NULL}
};
static const vshCmdOptDef opts_domblkstat[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"device", VSH_OT_DATA, VSH_OFLAG_REQ, N_("block device")},
+ {"human", VSH_OT_BOOL, 0, N_("print a more human readable output")},
+
{NULL, 0, 0, NULL}
};
@@ -1070,6 +1078,7 @@ cmdDomblkstat (vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
const char *name = NULL, *device = NULL;
struct _virDomainBlockStats stats;
+ int humanReadable = vshCommandOptBool(cmd, "human");
if (!vshConnectionUsability (ctl, ctl->conn))
return false;
@@ -1088,20 +1097,41 @@ cmdDomblkstat (vshControl *ctl, const vshCmd *cmd)
return false;
}
- if (stats.rd_req >= 0)
- vshPrint (ctl, "%s rd_req %lld\n", device, stats.rd_req);
+ if (humanReadable) {
+ /* human friendly output */
+ vshPrint(ctl, N_("Device: %s\n"), device);
+
+ if (stats.rd_req >= 0)
+ vshPrint (ctl, N_("read request count: %lld\n"), stats.rd_req);
+
+ if (stats.rd_bytes >= 0)
+ vshPrint (ctl, N_("number of read bytes: %lld\n"), stats.rd_bytes);
+
+ if (stats.wr_req >= 0)
+ vshPrint (ctl, N_("write request count: %lld\n"), stats.wr_req);
- if (stats.rd_bytes >= 0)
- vshPrint (ctl, "%s rd_bytes %lld\n", device, stats.rd_bytes);
+ if (stats.wr_bytes >= 0)
+ vshPrint (ctl, N_("number of written bytes: %lld\n"), stats.wr_bytes);
- if (stats.wr_req >= 0)
- vshPrint (ctl, "%s wr_req %lld\n", device, stats.wr_req);
+ if (stats.errs >= 0)
+ vshPrint (ctl, N_("error count: %lld\n"), stats.errs);
+ } else {
+ /* script friendly output */
+ if (stats.rd_req >= 0)
+ vshPrint (ctl, "%s rd_req %lld\n", device, stats.rd_req);
+
+ if (stats.rd_bytes >= 0)
+ vshPrint (ctl, "%s rd_bytes %lld\n", device, stats.rd_bytes);
- if (stats.wr_bytes >= 0)
- vshPrint (ctl, "%s wr_bytes %lld\n", device, stats.wr_bytes);
+ if (stats.wr_req >= 0)
+ vshPrint (ctl, "%s wr_req %lld\n", device, stats.wr_req);
- if (stats.errs >= 0)
- vshPrint (ctl, "%s errs %lld\n", device, stats.errs);
+ if (stats.wr_bytes >= 0)
+ vshPrint (ctl, "%s wr_bytes %lld\n", device, stats.wr_bytes);
+
+ if (stats.errs >= 0)
+ vshPrint (ctl, "%s errs %lld\n", device, stats.errs);
+ }
virDomainFree(dom);
return true;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 81d7a1e..620097d 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -419,10 +419,19 @@ the B<shutdown> command instead. However, this does not delete any
storage volumes used by the guest, and if the domain is persistent, it
can be restarted later.
-=item B<domblkstat> I<domain> I<block-device>
+=item B<domblkstat> I<domain> I<block-device> [I<--human>]
Get device block stats for a running domain.
+Use I<--human> for a more human readable output.
+
+B<Explanation of fields:>
+ rd_req - count of read requests
+ rd_bytes - count of read bytes
+ wr_req - count of write requests
+ wr_bytes - count of written bytes
+ errs - error count
+
=item B<domifstat> I<domain> I<interface-device>
Get network interface stats for a running domain.
--
1.7.3.4
13 years, 2 months
[libvirt] [BUGFIX][PATCH] remove saved garbages after persistent migration
by KAMEZAWA Hiroyuki
>From e1e8d5ceb4a9f7c59e20dfb8c168b781435c1613 Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
Date: Fri, 26 Aug 2011 12:08:11 +0900
Subject: [PATCH] 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 garbages.
<domain type='kvm' id='50'>
^^^^^^^^
...
<console type='pty' tty='/dev/pts/5'>
^^^^^^^^^^^^^^^^^
Avoid saving unnecessary things by saving persistent vm definition.
---
src/qemu/qemu_migration.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a38c0d9..524b8bf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2484,11 +2484,12 @@ qemuMigrationFinish(struct qemud_driver *driver,
qemuMigrationVPAssociatePortProfiles(vm->def);
if (flags & VIR_MIGRATE_PERSIST_DEST) {
+ virDomainDefPtr vmdef;
if (vm->persistent)
newVM = 0;
vm->persistent = 1;
-
- if (virDomainSaveConfig(driver->configDir, vm->def) < 0) {
+ vmdef = virDomainObjGetPersistentDef(driver->caps, vm);
+ if (virDomainSaveConfig(driver->configDir, vmdef) < 0) {
/* Hmpf. Migration was successful, but making it persistent
* was not. If we report successful, then when this domain
* shuts down, management tools are in for a surprise. On the
--
1.7.4.1
13 years, 2 months