[libvirt] [PATCH] virsh: Allow using domain and capabilities XMLs with cpu-compare
by Peter Krempa
This patch adds extraction of the <cpu> element from capabilities and
domain definition XML documents to improve user experience.
https://bugzilla.redhat.com/show_bug.cgi?id=731151
---
tools/virsh.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 3c6e65a..ddb61af 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11846,9 +11846,15 @@ static bool
cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
{
const char *from = NULL;
- bool ret = true;
+ bool ret = false;
char *buffer;
int result;
+ const char *snippet;
+
+ xmlDocPtr xml = NULL;
+ xmlXPathContextPtr ctxt = NULL;
+ xmlBufferPtr xml_buf = NULL;
+ xmlNodePtr node;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
@@ -11856,37 +11862,69 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptString(cmd, "file", &from) <= 0)
return false;
- if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
+ if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0) {
+ vshError(ctl, _("Failed to read file '%s' to compare."),
+ from);
return false;
+ }
- result = virConnectCompareCPU(ctl->conn, buffer, 0);
- VIR_FREE(buffer);
+ /* try to extract the CPU element from as it would appear in a domain XML*/
+ if (!(xml = virXMLParseStringCtxt(buffer, from, &ctxt)))
+ goto cleanup;
+
+ if ((node = virXPathNode("/cpu|"
+ "/domain/cpu|"
+ "/capabilities/host/cpu", ctxt))) {
+ if (!(xml_buf = xmlBufferCreate())) {
+ vshError(ctl, _("Can't create XML buffer to extract CPU element."));
+ goto cleanup;
+ }
+
+ if (xmlNodeDump(xml_buf, xml, node, 0, 0) < 0) {
+ vshError(ctl, _("Failed to extract CPU element snippet from domain XML."));
+ goto cleanup;
+ }
+
+ snippet = (const char *) xmlBufferContent(xml_buf);
+ } else {
+ vshError(ctl, _("File '%s' does not contain a <cpu> element or is not "
+ "a valid domain or capabilities XML"), from);
+ goto cleanup;
+ }
+
+ result = virConnectCompareCPU(ctl->conn, snippet, 0);
switch (result) {
case VIR_CPU_COMPARE_INCOMPATIBLE:
vshPrint(ctl, _("CPU described in %s is incompatible with host CPU\n"),
from);
- ret = false;
+ goto cleanup;
break;
case VIR_CPU_COMPARE_IDENTICAL:
vshPrint(ctl, _("CPU described in %s is identical to host CPU\n"),
from);
- ret = true;
break;
case VIR_CPU_COMPARE_SUPERSET:
vshPrint(ctl, _("Host CPU is a superset of CPU described in %s\n"),
from);
- ret = true;
break;
case VIR_CPU_COMPARE_ERROR:
default:
vshError(ctl, _("Failed to compare host CPU with %s"), from);
- ret = false;
+ goto cleanup;
}
+ ret = true;
+
+cleanup:
+ VIR_FREE(buffer);
+ xmlBufferFree(xml_buf);
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(xml);
+
return ret;
}
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH] virsh: Allow using complete <capabilities> elements with cpu-baseline
by Peter Krempa
This patch cleans the cpu baseline function using new libvirt helper
functions and fixes XPath expression that selects <cpu> elements from
the source file, that can contain concatenated <capabilities> XMLs,
domain XMLs and bare <cpu> elements. The fixed XPath expression ensures
not to select NUMA <cpu id=... elements.
https://bugzilla.redhat.com/show_bug.cgi?id=731645
---
tools/virsh.c | 88 ++++++++++++++++++++++++--------------------------------
1 files changed, 38 insertions(+), 50 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 3c6e65a..7ea5e1b 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11908,18 +11908,18 @@ static bool
cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
{
const char *from = NULL;
- bool ret = true;
+ bool ret = false;
char *buffer;
char *result = NULL;
const char **list = NULL;
- unsigned int count = 0;
- xmlDocPtr doc = NULL;
- xmlNodePtr node_list;
+ int count = 0;
+
+ xmlDocPtr xml = NULL;
+ xmlNodePtr *node_list = NULL;
xmlXPathContextPtr ctxt = NULL;
- xmlSaveCtxtPtr sctxt = NULL;
- xmlBufferPtr buf = NULL;
- xmlXPathObjectPtr obj = NULL;
- int res, i;
+ xmlBufferPtr xml_buf = NULL;
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+ int i;
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
@@ -11930,69 +11930,57 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd)
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
return false;
- doc = xmlNewDoc(NULL);
- if (doc == NULL)
+ /* add an separate container around the xml */
+ virBufferStrcat(&buf, "<container>", buffer, "</container>", NULL);
+ if (virBufferError(&buf))
goto no_memory;
- res = xmlParseBalancedChunkMemory(doc, NULL, NULL, 0,
- (const xmlChar *)buffer, &node_list);
- if (res != 0) {
- vshError(ctl, _("Failed to parse XML fragment %s"), from);
- ret = false;
+ VIR_FREE(buffer);
+ buffer = virBufferContentAndReset(&buf);
+
+
+ if (!(xml = virXMLParseStringCtxt(buffer, from, &ctxt)))
+ goto cleanup;
+
+ if ((count = virXPathNodeSet("//cpu[not(ancestor::cpus)]",
+ ctxt, &node_list)) == -1)
+ goto cleanup;
+
+ if (count == 0) {
+ vshError(ctl, _("No host CPU specified in '%s'"), from);
goto cleanup;
}
- xmlAddChildList((xmlNodePtr) doc, node_list);
+ list = vshCalloc(ctl, count, sizeof(const char *));
- ctxt = xmlXPathNewContext(doc);
- if (!ctxt)
+ if (!(xml_buf = xmlBufferCreate()))
goto no_memory;
- obj = xmlXPathEval(BAD_CAST "//cpu[not(ancestor::cpu)]", ctxt);
- if ((obj == NULL) || (obj->nodesetval == NULL) ||
- (obj->nodesetval->nodeTab == NULL))
- goto cleanup;
+ for (i = 0; i < count; i++) {
+ xmlBufferEmpty(xml_buf);
- for (i = 0;i < obj->nodesetval->nodeNr;i++) {
- buf = xmlBufferCreate();
- if (buf == NULL)
- goto no_memory;
- sctxt = xmlSaveToBuffer(buf, NULL, 0);
- if (sctxt == NULL) {
- xmlBufferFree(buf);
- goto no_memory;
+ if (xmlNodeDump(xml_buf, xml, node_list[i], 0, 0) < 0) {
+ vshError(ctl, _("Failed to extract <cpu> element"));
+ goto cleanup;
}
- xmlSaveTree(sctxt, obj->nodesetval->nodeTab[i]);
- xmlSaveClose(sctxt);
-
- list = vshRealloc(ctl, list, sizeof(char *) * (count + 1));
- list[count++] = (char *) buf->content;
- buf->content = NULL;
- xmlBufferFree(buf);
- buf = NULL;
- }
-
- if (count == 0) {
- vshError(ctl, _("No host CPU specified in '%s'"), from);
- ret = false;
- goto cleanup;
+ list[i] = vshStrdup(ctl, (const char *)xmlBufferContent(xml_buf));
}
result = virConnectBaselineCPU(ctl->conn, list, count, 0);
- if (result)
+ if (result) {
vshPrint(ctl, "%s", result);
- else
- ret = false;
+ ret = true;
+ }
cleanup:
- xmlXPathFreeObject(obj);
xmlXPathFreeContext(ctxt);
- xmlFreeDoc(doc);
+ xmlFreeDoc(xml);
+ xmlBufferFree(xml_buf);
VIR_FREE(result);
if ((list != NULL) && (count > 0)) {
- for (i = 0;i < count;i++)
+ for (i = 0; i < count; i++)
VIR_FREE(list[i]);
}
VIR_FREE(list);
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH] snapshot: fix man page typos
by Eric Blake
pod2man from perl-5.8.8 (RHEL 5) errors out on ill-formed POD:
*** ERROR: unterminated I<...> at line 1114 in file virsh.pod
*** ERROR: unterminated I<...> at line 1851 in file virsh.pod
Newer pod2man appears to be more tolerant (which is a shame,
because it meant that this error is harder to detect).
* tools/virsh.pod (undefine, snapshot-current): Add missing >.
---
Pushing under the build-breaker rule.
tools/virsh.pod | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 0e7acfa..a01d723 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -1111,7 +1111,7 @@ hypervisor.
Output the device used for the TTY console of the domain. If the information
is not available the processes will provide an exit code of 1.
-=item B<undefine> I<domain-id> [I<--managed-save>] [I<--snapshots-metadata]
+=item B<undefine> I<domain-id> [I<--managed-save>] [I<--snapshots-metadata>]
Undefine a domain. If the domain is running, this converts it to a
transient domain, without stopping it. If the domain is inactive,
@@ -1848,7 +1848,7 @@ treat the snapshot as current, and cannot revert to the snapshot
unless B<snapshot-create> is later used to teach libvirt about the
metadata again). This flag is incompatible with I<--print-xml>.
-=item B<snapshot-current> I<domain> {[I<--name>] | [I<--security-info]
+=item B<snapshot-current> I<domain> {[I<--name>] | [I<--security-info>]
| [I<snapshotname>]}
Without I<snapshotname>, this will output the snapshot XML for the domain's
--
1.7.4.4
13 years, 1 month
[libvirt] [PATCH] qemu: add ability to set PCI device "rombar" on or off
by Laine Stump
This patch was made in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=738095
In short, qemu's default for the rombar setting (which makes the
firmware ROM of a PCI device visible/not on the guest) was previously
0 (not visible), but they recently changed the default to 1
(visible). Unfortunately, there are some PCI devices that fail in the
guest when rombar is 1, so the setting must be exposed in libvirt to
prevent a regression in behavior (it will still require explicitly
setting <rom bar='off'/> in the guest XML).
rombar is forced on/off by adding:
<rom bar='on|off'/>
inside a <hostdev> element that defines a PCI device. It is currently
ignored for all other types of devices.
At the moment there is no clean method to determine whether or not the
rombar option is supported by QEMU - this patch uses the advice of a
QEMU developer to assume support for qemu-0.12+. There is currently a
patch in the works to put this information in the output of "qemu-kvm
-device pci-assign,?", but of course if we switch to keying off that,
we would lose support for setting rombar on all the versions of qemu
between 0.12 and whatever version gets that patch.
---
docs/formatdomain.html.in | 12 +++++++
docs/schemas/domaincommon.rng | 10 ++++++
src/conf/domain_conf.c | 32 ++++++++++++++++++++
src/conf/domain_conf.h | 10 ++++++
src/qemu/qemu_capabilities.c | 4 ++
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 19 ++++++++++++
tests/qemuhelptest.c | 15 ++++++---
.../qemuxml2argv-hostdev-pci-rombar.args | 5 +++
.../qemuxml2argv-hostdev-pci-rombar.xml | 29 ++++++++++++++++++
10 files changed, 132 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0a7abaf..7654abf 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1371,6 +1371,7 @@
<address bus='0x06' slot='0x02' function='0x0'/>
</source>
<boot order='1'/>
+ <rom bar='0'/>
</hostdev>
</devices>
...</pre>
@@ -1402,6 +1403,17 @@
used together with general boot elements in
<a href="#elementsOSBIOS">BIOS bootloader</a> section.
<span class="since">Since 0.8.8</span></dd>
+ <dt><code>rom</code></dt>
+ <dd>The <code>rom</code> element is used to change how a PCI
+ device's ROM is presented to the guest. The <code>bar</code>
+ attribute can be set to "on" or "off", and determines whether
+ or not the devices ROM will be visible in the guest's memory
+ map. (in PCI documentation, this is described as being
+ controlled by the "rombar" setting). If no rom bar is
+ specified, the qemu default will be used (older versions of
+ qemu used a default of "off", while newer qemus have a default
+ of "on"). <span class="since">Since 0.9.6</span>
+ </dd>
<dt><code>address</code></dt>
<dd>The <code>address</code> element for USB devices has a
<code>bus</code> and <code>device</code> attribute to specify the
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index d0da41c..0ba35ef 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2059,6 +2059,16 @@
<optional>
<ref name="address"/>
</optional>
+ <optional>
+ <element name="rom">
+ <attribute name="bar">
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
</element>
</define>
<define name="usbproduct">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7476447..d067415 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -442,6 +442,12 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST,
"usb",
"pci")
+VIR_ENUM_IMPL(virDomainPciRombarMode,
+ VIR_DOMAIN_PCI_ROMBAR_LAST,
+ "default",
+ "on",
+ "off")
+
VIR_ENUM_IMPL(virDomainHub, VIR_DOMAIN_HUB_TYPE_LAST,
"usb")
@@ -5485,6 +5491,20 @@ virDomainHostdevDefParseXML(const xmlNodePtr node,
if (virDomainDeviceBootParseXML(cur, &def->bootIndex,
bootMap))
goto error;
+ } else if (xmlStrEqual(cur->name, BAD_CAST "rom")) {
+ char *rombar = virXMLPropString(cur, "bar");
+ if (!rombar) {
+ virDomainReportError(VIR_ERR_XML_ERROR,
+ "%s", _("missing rom bar attribute"));
+ goto error;
+ }
+ if ((def->rombar = virDomainPciRombarModeTypeFromString(rombar)) <= 0) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown rom bar value '%s'"), rombar);
+ VIR_FREE(rombar);
+ goto error;
+ }
+ VIR_FREE(rombar);
} else {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown node %s"), cur->name);
@@ -10387,6 +10407,18 @@ virDomainHostdevDefFormat(virBufferPtr buf,
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
+ if (def->rombar) {
+ const char *rombar
+ = virDomainPciRombarModeTypeToString(def->rombar);
+ if (!rombar) {
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected rom bar value %d"),
+ def->rombar);
+ return -1;
+ }
+ virBufferAsprintf(buf, " <rom bar='%s'/>\n", rombar);
+ }
+
virBufferAddLit(buf, " </hostdev>\n");
return 0;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 371f270..262c970 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -936,6 +936,14 @@ enum virDomainHostdevSubsysType {
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
};
+enum virDomainPciRombarMode {
+ VIR_DOMAIN_PCI_ROMBAR_DEFAULT = 0,
+ VIR_DOMAIN_PCI_ROMBAR_ON,
+ VIR_DOMAIN_PCI_ROMBAR_OFF,
+
+ VIR_DOMAIN_PCI_ROMBAR_LAST
+};
+
typedef struct _virDomainHostdevDef virDomainHostdevDef;
typedef virDomainHostdevDef *virDomainHostdevDefPtr;
struct _virDomainHostdevDef {
@@ -964,6 +972,7 @@ struct _virDomainHostdevDef {
} source;
int bootIndex;
virDomainDeviceInfo info; /* Guest address */
+ int rombar; /* rombar on/off/unspecified */
};
enum virDomainRedirdevBus {
@@ -1855,6 +1864,7 @@ VIR_ENUM_DECL(virDomainWatchdogAction)
VIR_ENUM_DECL(virDomainVideo)
VIR_ENUM_DECL(virDomainHostdevMode)
VIR_ENUM_DECL(virDomainHostdevSubsys)
+VIR_ENUM_DECL(virDomainPciRombarMode)
VIR_ENUM_DECL(virDomainHub)
VIR_ENUM_DECL(virDomainRedirdevBus)
VIR_ENUM_DECL(virDomainInput)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 36f47a9..1b9260a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -136,6 +136,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"pci-ohci",
"usb-redir",
"usb-hub",
+ "rombar",
);
struct qemu_feature_flags {
@@ -1049,6 +1050,9 @@ qemuCapsComputeCmdFlags(const char *help,
if (version >= 13000)
qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
+
+ if (version >= 12000)
+ qemuCapsSet(flags, QEMU_CAPS_PCI_ROMBAR);
}
/* We parse the output of 'qemu -help' to get the QEMU
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 96b7a3b..3557bcb 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -110,6 +110,7 @@ enum qemuCapsFlags {
QEMU_CAPS_PCI_OHCI = 71, /* -device pci-ohci */
QEMU_CAPS_USB_REDIR = 72, /* -device usb-redir */
QEMU_CAPS_USB_HUB = 73, /* -device usb-hub */
+ QEMU_CAPS_PCI_ROMBAR = 74, /* -device rombar=0|1 */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e8b1157..056927b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2361,6 +2361,25 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
goto error;
+ if (dev->rombar) {
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("rombar not supported in this QEMU binary"));
+ goto error;
+ }
+
+ switch (dev->rombar) {
+ case VIR_DOMAIN_PCI_ROMBAR_OFF:
+ virBufferAddLit(&buf, ",rombar=0");
+ break;
+ case VIR_DOMAIN_PCI_ROMBAR_ON:
+ virBufferAddLit(&buf, ",rombar=1");
+ break;
+ default:
+ break;
+ }
+ }
+
if (virBufferError(&buf)) {
virReportOOMError();
goto error;
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index ffd30e2..17f160e 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -306,7 +306,8 @@ mymain(void)
QEMU_CAPS_SMBIOS_TYPE,
QEMU_CAPS_VGA_NONE,
QEMU_CAPS_MIGRATE_QEMU_FD,
- QEMU_CAPS_DRIVE_AIO);
+ QEMU_CAPS_DRIVE_AIO,
+ QEMU_CAPS_PCI_ROMBAR);
DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -350,7 +351,8 @@ mymain(void)
QEMU_CAPS_DEVICE_SPICEVMC,
QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_PIIX4_USB_UHCI,
- QEMU_CAPS_USB_HUB);
+ QEMU_CAPS_USB_HUB,
+ QEMU_CAPS_PCI_ROMBAR);
DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -387,7 +389,8 @@ mymain(void)
QEMU_CAPS_SMBIOS_TYPE,
QEMU_CAPS_VGA_NONE,
QEMU_CAPS_MIGRATE_QEMU_FD,
- QEMU_CAPS_DRIVE_AIO);
+ QEMU_CAPS_DRIVE_AIO,
+ QEMU_CAPS_PCI_ROMBAR);
DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -439,7 +442,8 @@ mymain(void)
QEMU_CAPS_PIIX4_USB_UHCI,
QEMU_CAPS_VT82C686B_USB_UHCI,
QEMU_CAPS_PCI_OHCI,
- QEMU_CAPS_USB_HUB);
+ QEMU_CAPS_USB_HUB,
+ QEMU_CAPS_PCI_ROMBAR);
DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
@@ -487,7 +491,8 @@ mymain(void)
QEMU_CAPS_VIRTIO_IOEVENTFD,
QEMU_CAPS_PIIX3_USB_UHCI,
QEMU_CAPS_PIIX4_USB_UHCI,
- QEMU_CAPS_USB_HUB);
+ QEMU_CAPS_USB_HUB,
+ QEMU_CAPS_PCI_ROMBAR);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.args
new file mode 100644
index 0000000..1a8b14e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.args
@@ -0,0 +1,5 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
+pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
+/dev/HostVG/QEMUGuest2 -usb -device pci-assign,host=06:12.5,id=hostdev0,\
+bus=pci.0,addr=0x3,rombar=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.xml
new file mode 100644
index 0000000..bf17cc4
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-pci-rombar.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest2</name>
+ <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+ <memory>219100</memory>
+ <currentMemory>219100</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' 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</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <hostdev mode='subsystem' type='pci' managed='yes'>
+ <source>
+ <address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
+ </source>
+ <rom bar='off'/>
+ </hostdev>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH 0/2] Allow to make disk optional on migration
by Michal Privoznik
If user wants to migrate a machine, it's all or nothing. Either he/she
has all storage accessible under same paths, or migration will fail.
But there are some cases, where allowing migration to drop some disks,
may be useful. E.g. when host gets itself to a state where domains need
to be migrated so host can be say rebooted. Therefore we might want to
give user possibility to mark some cdroms/floppy as optional, meaning
if destination cannot access them, they get ejected (on destination).
This idea is implemented via <migration> element, which basically says
what to do with (currently) disk on migration. Right now it contains
only one attribute 'optional' accepting values 'yes' and 'no'.
Then, if destination cannot access a path and corresponding disk
is mared as:
a) optional - it is ejected (source is free()'d)
b) non-optional - migration simply fails.
The default is understandably non-optional to all disks.
NB, setting optional is supported only on cdrom & floppy.
Michal Privoznik (2):
migration: Introduce <migration> element for cdrom and floppy
qemu: Implement migration optional disk
docs/schemas/domaincommon.rng | 16 ++++++++
src/conf/domain_conf.c | 85 ++++++++++++++++++++++++++++++++++++++++-
src/conf/domain_conf.h | 16 ++++++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_migration.c | 47 +++++++++++++++++++++-
5 files changed, 163 insertions(+), 3 deletions(-)
--
1.7.3.4
13 years, 1 month
[libvirt] [PATCH] spec: F15 still uses cgconfig
by Eric Blake
Commit ecd8725c dropped attempts to probe the cgconfig service on
new enough Fedora where systemd took over that aspect of the system,
but mistakenly used F14 instead of F15 as the cutoff point.
https://bugzilla.redhat.com/show_bug.cgi?id=741358
* libvirt.spec.in (with_cgconfig): Check cgconfig service in F15.
---
libvirt.spec.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index c0ea898..03d6f1f 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -894,9 +894,9 @@ done
%endif
%if %{with_cgconfig}
-# Starting with Fedora 15, systemd automounts all cgroups, and cgconfig is
+# Starting with Fedora 16, systemd automounts all cgroups, and cgconfig is
# no longer a necessary service.
-%if 0%{?fedora} <= 14 || 0%{?rhel} <= 6
+%if 0%{?fedora} <= 15 || 0%{?rhel} <= 6
if [ "$1" -eq "1" ]; then
/sbin/chkconfig cgconfig on
fi
--
1.7.4.4
13 years, 1 month
[libvirt] [PATCH] qemu: Relax -no-shutdown check to [0.14.0, 0.15.50)
by Jiri Denemark
SIGTERM handling for -no-shutdown is already fixed in qemu git and
libvirt can safely use it. The downside is that 0.15.50 version of qemu
can be any qemu compiled from git, even that without the fix for
SIGTERM. However, I think this patch is worth it since someone using
qemu from git should expect their data can get corrupted and excluding
0.15.50 from the check makes testing current qemu with libvirt much
easier.
---
src/qemu/qemu_capabilities.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8e20e3f..4325f77 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1017,9 +1017,9 @@ qemuCapsComputeCmdFlags(const char *help,
/* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling
* is most likely buggy when used with -no-shutdown (which applies for qemu
- * 0.14.* and 0.15.*)
+ * 0.14.* and <0.15.50)
*/
- if (strstr(help, "-no-shutdown") && (version < 14000 || version > 15999))
+ if (strstr(help, "-no-shutdown") && (version < 14000 || version >= 15050))
qemuCapsSet(flags, QEMU_CAPS_NO_SHUTDOWN);
/*
--
1.7.6.1
13 years, 1 month
[libvirt] [PATCH] virsh: Better document --copy-storage migrate options
by Jiri Denemark
Both --copy-storage-{all,inc} options require disk images to be present
on destination host.
---
tools/virsh.pod | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index fbde57f..0e7acfa 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -727,9 +727,12 @@ and I<--suspend> leaves the domain paused on the destination host.
I<--copy-storage-all> indicates migration with non-shared storage with full
disk copy, I<--copy-storage-inc> indicates migration with non-shared storage
with incremental copy (same base image shared between source and destination).
-I<--change-protection> enforces that no incompatible configuration changes
-will be made to the domain while the migration is underway; this flag is
-implicitly enabled when supported by the hypervisor, but can be explicitly
+In both cases the disk images have to exist on destination host, the
+I<--copy-storage-...> options only tell libvirt to transfer data from the
+images on source host to the images found at the same place on the destination
+host. I<--change-protection> enforces that no incompatible configuration
+changes will be made to the domain while the migration is underway; this flag
+is implicitly enabled when supported by the hypervisor, but can be explicitly
used to reject the migration if the hypervisor lacks change protection
support. I<--verbose> displays the progress of migration.
--
1.7.6.1
13 years, 1 month
[libvirt] [PATCH 00/14] snapshot: improve dumpxml output
by Eric Blake
This series fixes 'virsh snapshot-dumpxml' to use nicer formatting.
Patch 1 adds some nice helper routines, patches 2-13 are mostly
mechanical conversions to use the helpers and pass indentation
levels through the entire call chain, and patch 14 adds a test
which uncovered a couple minor issues in how formatting was done.
Eric Blake (14):
snapshot: indent domain xml when nesting, round 1
snapshot: indent domain xml when nesting, round 2
snapshot: indent domain xml when nesting, round 3
snapshot: indent domain xml when nesting, round 4
snapshot: indent domain xml when nesting, round 5
snapshot: indent domain xml when nesting, round 6
snapshot: indent domain xml when nesting, round 7
snapshot: indent domain xml when nesting, round 8
snapshot: indent domain xml when nesting, round 9
snapshot: indent domain xml when nesting, round 10
snapshot: indent domain xml when nesting, round 11
snapshot: indent domain xml when nesting, round 12
snapshot: indent domain xml when nesting, round 13
snapshot: test domainsnapshot indentation
.gitignore | 1 +
src/conf/capabilities.c | 6 +-
src/conf/capabilities.h | 6 +-
src/conf/cpu_conf.c | 43 +-
src/conf/cpu_conf.h | 7 +-
src/conf/domain_conf.c | 778 +++++++++++----------
src/conf/domain_conf.h | 6 +-
src/conf/network_conf.c | 8 +-
src/conf/nwfilter_conf.c | 16 +-
src/conf/nwfilter_params.c | 41 +-
src/conf/nwfilter_params.h | 8 +-
src/conf/storage_encryption_conf.c | 4 +-
src/cpu/cpu.c | 2 +-
src/libvirt_private.syms | 3 +
src/qemu/qemu_domain.c | 39 +-
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_migration.c | 23 +-
src/util/buf.c | 70 ++-
src/util/buf.h | 19 +-
src/util/network.c | 49 +-
src/util/network.h | 9 +-
src/util/sysinfo.c | 407 ++++-------
src/util/sysinfo.h | 4 +-
tests/Makefile.am | 14 +-
tests/cputest.c | 2 +-
tests/domainsnapshotxml2xmlout/all_parameters.xml | 2 +-
tests/domainsnapshotxml2xmlout/disk_snapshot.xml | 102 ++--
tests/domainsnapshotxml2xmlout/full_domain.xml | 52 +-
tests/domainsnapshotxml2xmltest.c | 128 ++++
tests/testutils.c | 2 +-
tests/virbuftest.c | 32 +-
31 files changed, 1033 insertions(+), 852 deletions(-)
create mode 100644 tests/domainsnapshotxml2xmltest.c
--
1.7.4.4
13 years, 1 month