[libvirt] Changing media on network disks (was Re: can't bot from scsi http cdrom)
by Paolo Bonzini
On 13/04/2015 14:34, Vasiliy Tolstov wrote:
> Thanks! This is works fine. Last question - does it possible to create
> empty cdrom with type='network'?
> I'm try this, but libvrit complains with error:
> <disk type='network' device='cdrom'>
> <driver name='qemu' type='raw'/>
> <target dev='sdb' bus='scsi' tray='open'/>
> <address type='drive' controller='0' target='1' bus='0' unit='1'/>
> <readonly/>
> </disk>
No, unfortunately not because "virsh change-media" wouldn't be able to
convert its argument to the required libvirt XML. I think you would
need a new virsh change-media option, e.g. --xml, that takes a <disk>
element instead of a source path + target path pair. However, I am not
a libvirt developer.
Paolo
9 years, 7 months
[libvirt] XML Parser failing due to cryptic Serial Number.
by Roz Fx
I set virt-manager in qemu:///system space and tried to add new VM but it didn't proceed. I figured out its duo to serial numbers is in cryptic form.
# cat /sys/devices/virtual/dmi/id/product_serial
ÿÿÿÿÿÿÿ
#virt-manager --debug
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 225, in _reparse_xml
self._xmlobj = self._build_xmlobj(self._get_raw_xml())
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 228, in _build_xmlobj
return self._parseclass(self.conn.get_backend(), parsexml=xml)
File "/usr/share/virt-manager/virtManager/nodedev.py", line 27, in _parse_convert
return NodeDevice.parse(conn, parsexml)
File "/usr/share/virt-manager/virtinst/nodedev.py", line 95, in parse
tmpdev = NodeDevice(conn, parsexml=xml, allow_node_instantiate=True)
File "/usr/share/virt-manager/virtinst/nodedev.py", line 106, in __init__
XMLBuilder.__init__(self, *args, **kwargs)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 777, in __init__
parent_xpath, relative_object_xpath)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 679, in __init__
self._parse(parsexml, parsexmlnode)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 692, in _parse
doc = libxml2.parseDoc(xml)
File "/usr/lib/python2.7/site-packages/libxml2.py", line 1327, in parseDoc
if ret is None:raise parserError('xmlParseDoc() failed')
libxml2.parserError: xmlParseDoc() failed
[Sun, 12 Apr 2015 06:06:16 virt-manager 4241] DEBUG (create:165) Showing new vm wizard
[Sun, 12 Apr 2015 06:06:16 virt-manager 4241] DEBUG (create:892) Guest type set to os_type=hvm, arch=x86_64, dom_type=kvm
[Sun, 12 Apr 2015 06:06:16 virt-manager 4241] DEBUG (xmlbuilder:694) Error parsing xml=
<device>
<name>computer</name>
<capability type='system'>
<product>Vostro</product>
<hardware>
<vendor>Dell Inc.</vendor>
<version>A10</version>
<serial>ÿÿÿÿÿÿÿ</serial>
<uuid>REMOVED</uuid>
</hardware>
<firmware>
<vendor>Dell Inc.</vendor>
<version>A10</version>
<release_date>05/18/2013</release_date>
</firmware>
</capability>
</device>
[Sun, 12 Apr 2015 06:06:16 virt-manager 4241] ERROR (create:346) Error setting create wizard conn state.
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/create.py", line 344, in reset_state
self.set_conn(activeconn, force_validate=True)
File "/usr/share/virt-manager/virtManager/create.py", line 225, in set_conn
self.set_conn_state()
File "/usr/share/virt-manager/virtManager/create.py", line 626, in set_conn_state
self.netlist.reset_state()
File "/usr/share/virt-manager/virtManager/netlist.py", line 405, in reset_state
self._populate_network_list()
File "/usr/share/virt-manager/virtManager/netlist.py", line 253, in _populate_network_list
vnet_bridges)
File "/usr/share/virt-manager/virtManager/netlist.py", line 185, in _find_physical_devices
for nodedev in self.conn.get_nodedevs("net"):
File "/usr/share/virt-manager/virtManager/connection.py", line 648, in get_nodedevs
xmlobj = dev.get_xmlobj()
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 160, in get_xmlobj
self._reparse_xml()
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 225, in _reparse_xml
self._xmlobj = self._build_xmlobj(self._get_raw_xml())
File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 228, in _build_xmlobj
return self._parseclass(self.conn.get_backend(), parsexml=xml)
File "/usr/share/virt-manager/virtManager/nodedev.py", line 27, in _parse_convert
return NodeDevice.parse(conn, parsexml)
File "/usr/share/virt-manager/virtinst/nodedev.py", line 95, in parse
tmpdev = NodeDevice(conn, parsexml=xml, allow_node_instantiate=True)
File "/usr/share/virt-manager/virtinst/nodedev.py", line 106, in __init__
XMLBuilder.__init__(self, *args, **kwargs)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 777, in __init__
parent_xpath, relative_object_xpath)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 679, in __init__
self._parse(parsexml, parsexmlnode)
File "/usr/share/virt-manager/virtinst/xmlbuilder.py", line 692, in _parse
doc = libxml2.parseDoc(xml)
File "/usr/lib/python2.7/site-packages/libxml2.py", line 1327, in parseDoc
if ret is None:raise parserError('xmlParseDoc() failed')
parserError: xmlParseDoc() failed
Regards
Roz
9 years, 7 months
[libvirt] [PATCH 1/2] virBitmap: Place virBitmapIsAllClear check after virBitmapParse calls
by Erik Skultety
This patch adds checks for empty bitmaps right after the calls of
virBitmapParse. These only include spots where set API's are called and
where domain's XML is parsed.
https://bugzilla.redhat.com/show_bug.cgi?id=1210545
---
src/conf/domain_conf.c | 35 +++++++++++++++++++++++++++++++----
src/conf/numa_conf.c | 23 +++++++++++++++++++----
src/qemu/qemu_driver.c | 5 +++--
src/xenconfig/xen_sxpr.c | 7 +++++++
4 files changed, 60 insertions(+), 10 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1763305..c9488cf 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11563,6 +11563,12 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
if (virBitmapParse(nodemask, 0, &def->sourceNodes,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
+
+ if (virBitmapIsAllClear(def->sourceNodes)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'nodemask': %s"), nodemask);
+ goto cleanup;
+ }
}
ret = 0;
@@ -13251,6 +13257,13 @@ virDomainVcpuPinDefParseXML(xmlNodePtr node,
if (virBitmapParse(tmp, 0, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
+ if (virBitmapIsAllClear(def->cpumask)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'cpuset': %s"),
+ tmp);
+ goto error;
+ }
+
cleanup:
VIR_FREE(tmp);
ctxt->node = oldnode;
@@ -13352,6 +13365,12 @@ virDomainHugepagesParseXML(xmlNodePtr node,
if (virBitmapParse(nodeset, 0, &hugepage->nodemask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
+
+ if (virBitmapIsAllClear(hugepage->nodemask)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'nodeset': %s"), nodeset);
+ goto cleanup;
+ }
}
ret = 0;
@@ -13473,13 +13492,14 @@ virDomainThreadSchedParse(xmlNodePtr node,
goto error;
}
- if (!virBitmapParse(tmp, 0, &sp->ids,
- VIR_DOMAIN_CPUMASK_LEN) ||
- virBitmapIsAllClear(sp->ids) ||
+ if (virBitmapParse(tmp, 0, &sp->ids, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto error;
+
+ if (virBitmapIsAllClear(sp->ids) ||
virBitmapNextSetBit(sp->ids, -1) < minid ||
virBitmapLastSetBit(sp->ids) > maxid) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid value of '%s': %s"),
name, tmp);
goto error;
@@ -13847,6 +13867,13 @@ virDomainDefParseXML(xmlDocPtr xml,
if (virBitmapParse(tmp, 0, &def->cpumask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
+
+ if (virBitmapIsAllClear(def->cpumask)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'cpuset': %s"), tmp);
+ goto error;
+ }
+
VIR_FREE(tmp);
}
}
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 8a0f686..7ad3f66 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -178,6 +178,12 @@ virDomainNumatuneNodeParseXML(virDomainNumaPtr numa,
if (virBitmapParse(tmp, 0, &mem_node->nodeset,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
+
+ if (virBitmapIsAllClear(mem_node->nodeset)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'nodeset': %s"), tmp);
+ goto cleanup;
+ }
VIR_FREE(tmp);
}
@@ -233,10 +239,19 @@ virDomainNumatuneParseXML(virDomainNumaPtr numa,
}
VIR_FREE(tmp);
- if ((tmp = virXMLPropString(node, "nodeset")) &&
- virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
- goto cleanup;
- VIR_FREE(tmp);
+ tmp = virXMLPropString(node, "nodeset");
+ if (tmp) {
+ if (virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ goto cleanup;
+
+ if (virBitmapIsAllClear(nodeset)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'nodeset': %s"), tmp);
+ goto cleanup;
+ }
+
+ VIR_FREE(tmp);
+ }
}
if (virDomainNumatuneSet(numa,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7eb5a7d..eae2809 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10106,8 +10106,9 @@ qemuDomainSetNumaParameters(virDomainPtr dom,
goto endjob;
if (virBitmapIsAllClear(nodeset)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Invalid nodeset for numatune"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("Invalid nodeset of 'numatune': %s"),
+ param->value.s);
goto endjob;
}
}
diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c
index 5a170d3..d77abf3 100644
--- a/src/xenconfig/xen_sxpr.c
+++ b/src/xenconfig/xen_sxpr.c
@@ -1165,6 +1165,13 @@ xenParseSxpr(const struct sexpr *root,
if (virBitmapParse(cpus, 0, &def->cpumask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
+
+ if (virBitmapIsAllClear(def->cpumask)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Invalid value of 'cpumask': %s"),
+ cpus);
+ goto error;
+ }
}
def->maxvcpus = sexpr_int(root, "domain/vcpus");
--
1.9.3
9 years, 7 months
[libvirt] [libvirt-glib] Support setting of compat XML node
by Richa Sehgal
This change adds support for setting of compat XML node in libvirt
gconfig storage volumes target
---
libvirt-gconfig/libvirt-gconfig-storage-vol-target.c | 13 +++++++++++++
libvirt-gconfig/libvirt-gconfig-storage-vol-target.h | 2 ++
libvirt-gconfig/libvirt-gconfig.sym | 5 +++++
libvirt-gconfig/tests/test-domain-create.c | 1 +
4 files changed, 21 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
index d3151d1..b72b304 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.c
@@ -99,3 +99,16 @@ void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget *
"permissions",
GVIR_CONFIG_OBJECT(perms));
}
+
+/**
+ * gvir_config_storage_vol_target_set_compat:
+ * @compat: (allow-none):
+ */
+void gvir_config_storage_vol_target_set_compat(GVirConfigStorageVolTarget *target,
+ const char *compat)
+{
+ g_return_if_fail(GVIR_CONFIG_IS_STORAGE_VOL_TARGET(target));
+
+ gvir_config_object_set_node_content(GVIR_CONFIG_OBJECT(target),
+ "compat", compat);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
index b572381..c165e2b 100644
--- a/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
+++ b/libvirt-gconfig/libvirt-gconfig-storage-vol-target.h
@@ -67,6 +67,8 @@ void gvir_config_storage_vol_target_set_format(GVirConfigStorageVolTarget *targe
const char *format);
void gvir_config_storage_vol_target_set_permissions(GVirConfigStorageVolTarget *target,
GVirConfigStoragePermissions *perms);
+void gvir_config_storage_vol_target_set_compat(GVirConfigStorageVolTarget *target,
+ const char *compat);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index 8614126..407a52f 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -714,4 +714,9 @@ global:
gvir_config_domain_cpu_set_model;
} LIBVIRT_GCONFIG_0.1.8;
+LIBVIRT_GCONFIG_0.2.0 {
+global:
+ gvir_config_storage_vol_target_set_compat;
+} LIBVIRT_GCONFIG_0.1.9;
+
# .... define new API here using predicted next version number ....
diff --git a/libvirt-gconfig/tests/test-domain-create.c b/libvirt-gconfig/tests/test-domain-create.c
index eb4b945..66f618b 100644
--- a/libvirt-gconfig/tests/test-domain-create.c
+++ b/libvirt-gconfig/tests/test-domain-create.c
@@ -482,6 +482,7 @@ int main(int argc, char **argv)
vol_target = gvir_config_storage_vol_target_new();
gvir_config_storage_vol_target_set_format(vol_target, "qcow2");
gvir_config_storage_vol_target_set_permissions(vol_target, perms);
+ gvir_config_storage_vol_target_set_compat(vol_target, "1.1");
g_object_unref(G_OBJECT(perms));
gvir_config_storage_vol_set_target(vol, vol_target);
g_object_unref(G_OBJECT(vol_target));
--
1.9.1
9 years, 7 months
[libvirt] luajit binding
by William Adams
Hello List,
I am new to libvirt, and this is my first query.
I have started a luajit language binding for libvirt. It can be found here:
https://github.com/Wiladams/LJIT2Virt
I searched the interwebs before I began, but didn't find any existing lua language bindings. Is this true? Did I just miss it?
If it doesn't exist already, I'd like to make this a regular thing, and get it listed on the language bindings page.
How can I go about that?
-- William
===============================
- Shaping clay is easier than digging it out of the ground.
9 years, 7 months
[libvirt] [PATCH v2 0/3] Honour sparse files on migration
by Michal Privoznik
When the storage is pre-created on the destination, it might have
been allocated as sparse on the source. Let's keep it that way if
we can.
diff to v1:
- in 3/3 I've reworked the handling of @allocation attribute as John suggested
Michal Privoznik (3):
qemuMigrationPrecreateStorage: Fix debug message
qemuMigrationCookieNBD: Turn some items into their own struct
qemuMigrationPrecreateDisk: Preserve sparse files
src/qemu/qemu_migration.c | 48 ++++++++++++++++++++++++++++++++++++-----------
1 file changed, 37 insertions(+), 11 deletions(-)
--
2.0.5
9 years, 7 months
[libvirt] [PATCH] conf: Don't output <cpu> tag if it contains no information.
by Andrea Bolognani
The tag is already marked as optional in the schema, so no changes
are needed there.
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1202606
---
Hi everyone,
this is my first contribution to libvirt so I wholeheartedly welcome
any criticism, suggestion or recommendation :)
Cheers.
src/conf/cpu_conf.c | 33 ++++++++++++++++------
tests/qemuxml2argvdata/qemuxml2argv-cpu-empty.xml | 23 +++++++++++++++
.../qemuxml2xmlout-cpu-empty.xml | 21 ++++++++++++++
tests/qemuxml2xmltest.c | 1 +
4 files changed, 69 insertions(+), 9 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-cpu-empty.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index cd3882d..8f65d55 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -435,13 +435,14 @@ virCPUDefFormatBufFull(virBufferPtr buf,
bool updateCPU)
{
int ret = -1;
+ virBuffer attributeBuf = VIR_BUFFER_INITIALIZER;
virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
int indent = virBufferGetIndent(buf, false);
if (!def)
return 0;
- virBufferAddLit(buf, "<cpu");
+ /* Format attributes */
if (def->type == VIR_CPU_TYPE_GUEST) {
const char *tmp;
@@ -451,7 +452,7 @@ virCPUDefFormatBufFull(virBufferPtr buf,
_("Unexpected CPU mode %d"), def->mode);
goto cleanup;
}
- virBufferAsprintf(buf, " mode='%s'", tmp);
+ virBufferAsprintf(&attributeBuf, " mode='%s'", tmp);
}
if (def->model &&
@@ -463,10 +464,11 @@ virCPUDefFormatBufFull(virBufferPtr buf,
def->match);
goto cleanup;
}
- virBufferAsprintf(buf, " match='%s'", tmp);
+ virBufferAsprintf(&attributeBuf, " match='%s'", tmp);
}
}
+ /* Format children */
virBufferAdjustIndent(&childrenBuf, indent + 2);
if (def->arch)
virBufferAsprintf(&childrenBuf, "<arch>%s</arch>\n",
@@ -477,16 +479,29 @@ virCPUDefFormatBufFull(virBufferPtr buf,
if (virDomainNumaDefCPUFormat(&childrenBuf, numa) < 0)
goto cleanup;
- if (virBufferUse(&childrenBuf)) {
- virBufferAddLit(buf, ">\n");
- virBufferAddBuffer(buf, &childrenBuf);
- virBufferAddLit(buf, "</cpu>\n");
- } else {
- virBufferAddLit(buf, "/>\n");
+ /* Put it all together */
+ if (virBufferUse(&attributeBuf) || virBufferUse(&childrenBuf)) {
+
+ /* Opening tag */
+ virBufferAddLit(buf, "<cpu");
+
+ /* Attributes (if any) */
+ if (virBufferUse(&attributeBuf))
+ virBufferAddBuffer(buf, &attributeBuf);
+
+ /* Children (if any) and closing tag */
+ if (virBufferUse(&childrenBuf)) {
+ virBufferAddLit(buf, ">\n");
+ virBufferAddBuffer(buf, &childrenBuf);
+ virBufferAddLit(buf, "</cpu>\n");
+ } else {
+ virBufferAddLit(buf, "/>\n");
+ }
}
ret = 0;
cleanup:
+ virBufferFreeAndReset(&attributeBuf);
virBufferFreeAndReset(&childrenBuf);
return ret;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-empty.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-empty.xml
new file mode 100644
index 0000000..2a79826
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-empty.xml
@@ -0,0 +1,23 @@
+<domain type='kvm'>
+ <name>cpu-empty</name>
+ <uuid>1aed4c39-ad6e-4a78-9264-4ce996290d17</uuid>
+ <memory unit='KiB'>4000768</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
new file mode 100644
index 0000000..e678607
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cpu-empty.xml
@@ -0,0 +1,21 @@
+<domain type='kvm'>
+ <name>cpu-empty</name>
+ <uuid>1aed4c39-ad6e-4a78-9264-4ce996290d17</uuid>
+ <memory unit='KiB'>4000768</memory>
+ <currentMemory unit='KiB'>1048576</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 817e408..cd0b280 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -361,6 +361,7 @@ mymain(void)
DO_TEST("clock-utc");
DO_TEST("clock-localtime");
+ DO_TEST_DIFFERENT("cpu-empty");
DO_TEST("cpu-kvmclock");
DO_TEST("cpu-host-kvmclock");
DO_TEST("cpu-host-passthrough-features");
--
2.1.0
9 years, 7 months
[libvirt] An implementation bug in qemuMigrationWaitForCompletion that introduces an unnecessary sleep of 50 ms when a migration completes
by Xing Lin
Hi,
It seems that I found a bug in the qemuMigrationWaitForCompletion(). It
will do a sleep of 50 ms, even when qemuMigrationUpdateJobStatus() detects
that a migration has completed.
Here is the original implementation of the while loop.
while (jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) {
/* Poll every 50ms for progress & to allow cancellation */
struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull
};
if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1)
break;
/* cancel migration if disk I/O error is emitted while migrating */
if (abort_on_error &&
virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("%s: %s"), job, _("failed due to I/O error"));
break;
}
if (dconn && virConnectIsAlive(dconn) <= 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Lost connection to destination host"));
break;
}
virObjectUnlock(vm);
nanosleep(&ts, NULL);
virObjectLock(vm);
}
Even when qemuMigrationUpdateJobStatus() detects a migration has completed,
the nanosleep() will be called again. When the while condition is checked,
then the program breaks from the while loop. This introduces an unnecessary
sleep of 50 ms which can be avoided by doing a sleep first. The code should
likely be structured as following.
while (jobInfo->type == VIR_DOMAIN_JOB_UNBOUNDED) {
/* Poll every 50ms for progress & to allow cancellation */
struct timespec ts = { .tv_sec = 0, .tv_nsec = 50 * 1000 * 1000ull
};
// do sleep here.
virObjectUnlock(vm);
nanosleep(&ts, NULL);
virObjectLock(vm);
if (qemuMigrationUpdateJobStatus(driver, vm, job, asyncJob) == -1)
break;
/* cancel migration if disk I/O error is emitted while migrating */
if (abort_on_error &&
virDomainObjGetState(vm, &pauseReason) == VIR_DOMAIN_PAUSED &&
pauseReason == VIR_DOMAIN_PAUSED_IOERROR) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("%s: %s"), job, _("failed due to I/O error"));
break;
}
if (dconn && virConnectIsAlive(dconn) <= 0) {
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Lost connection to destination host"));
break;
}
}
I have filed a bug report at redhat bugzilla, with a bug id 1210502. The
link is below.
https://bugzilla.redhat.com/show_bug.cgi?id=1210502
I also prepared a patch for fixing it. It is attached.
Any comments?
9 years, 7 months
[libvirt] [PATCH 0/3] Fix usb device version parsing in redir filters
by Ján Tomko
https://bugzilla.redhat.com/show_bug.cgi?id=1210650
Ján Tomko (3):
Do xml->xml test for usb-redir-filter
Fix usb device version parsing issues
Rewrite usb device version parsing
src/conf/domain_conf.c | 68 +++++++---------------
.../qemuxml2argv-usb-redir-filter-version.args | 19 ++++++
.../qemuxml2argv-usb-redir-filter-version.xml | 46 +++++++++++++++
tests/qemuxml2argvtest.c | 6 ++
.../qemuxml2xmlout-usb-redir-filter-version.xml | 46 +++++++++++++++
.../qemuxml2xmlout-usb-redir-filter.xml | 45 ++++++++++++++
tests/qemuxml2xmltest.c | 2 +
7 files changed, 185 insertions(+), 47 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-redir-filter-version.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter-version.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-usb-redir-filter.xml
--
2.0.5
9 years, 7 months
[libvirt] [PATCH 0/2] virsh vcpupin cleanups
by Ján Tomko
Ján Tomko (2):
Rewrite vshPrintPinInfo
Rewrite vshParseCPUList
tools/virsh-domain.c | 153 ++++++++++-----------------------------------------
1 file changed, 29 insertions(+), 124 deletions(-)
--
2.0.5
9 years, 7 months