[libvirt] [PATCH] virsh: domdisplay: if listen is 0.0.0.0 or [::] print address from URI
by Pavel Hrdina
Currently if a guest has listen address 0.0.0.0 or [::] and you run
"virsh domdisplay $domain" you always get "spice://localhost:$port".
We want to print better address if someone is connected from a different
computer using "virsh -c qemu+ssh://some.host/system". This patch fixes the
behavior of virsh to print in this case "spice://some.host:$port".
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1332446
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tools/virsh-domain.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 8d7ff61..93c7050 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -57,6 +57,7 @@
#include "virtypedparam.h"
#include "virxml.h"
#include "virsh-nodedev.h"
+#include "viruri.h"
/* Gnulib doesn't guarantee SA_SIGINFO support. */
#ifndef SA_SIGINFO
@@ -10617,6 +10618,23 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
VIR_FREE(xpath);
}
+ /* If listen_addr is 0.0.0.0 or [::] we should try to parse URI and set
+ * listen_addr based on current URI. */
+ if (listen_addr) {
+ if (virSocketAddrParse(&addr, listen_addr, AF_UNSPEC) > 0 &&
+ virSocketAddrIsWildcard(&addr)) {
+
+ virURIPtr uri = virURIParse(ctl->connname);
+
+ /* It's safe to free the listen_addr even if parsing of URI
+ * fails, if there is no listen_addr we will print "localhost". */
+ VIR_FREE(listen_addr);
+
+ if (uri && VIR_STRDUP(listen_addr, uri->server) < 0)
+ goto cleanup;
+ }
+ }
+
/* We can query this info for all the graphics types since we'll
* get nothing for the unsupported ones (just rdp for now).
* Also the parameter '--include-password' was already taken
@@ -10638,9 +10656,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
virBufferAsprintf(&buf, ":%s@", passwd);
/* Then host name or IP */
- if (!listen_addr ||
- (virSocketAddrParse(&addr, listen_addr, AF_UNSPEC) > 0 &&
- virSocketAddrIsWildcard(&addr)))
+ if (!listen_addr)
virBufferAddLit(&buf, "localhost");
else if (strchr(listen_addr, ':'))
virBufferAsprintf(&buf, "[%s]", listen_addr);
--
2.8.3
8 years, 6 months
[libvirt] [PATCH] qemu_process: print generic error if qemu exit without printing any error
by Pavel Hrdina
In this case we would print only the libvirt part of error message without any
explanation what happened:
"error: internal error: process exited while connecting to monitor:"
Let's print a generic error if this happens.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1335617
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_process.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e847cd1..86701da 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1808,6 +1808,13 @@ qemuProcessReportLogError(qemuDomainLogContextPtr logCtxt,
if (qemuProcessReadLog(logCtxt, &logmsg) < 0)
return -1;
+ if (virStringIsEmpty(logmsg)) {
+ VIR_FREE(logmsg);
+ if (VIR_STRDUP(logmsg, _("qemu process exited without any "
+ "error printed out")) < 0)
+ return -1;
+ }
+
virResetLastError();
virReportError(VIR_ERR_INTERNAL_ERROR,
_("%s: %s"), msgprefix, logmsg);
--
2.8.3
8 years, 6 months
[libvirt] [PATCH] xen: Also add sub-type for driver=tap2 in xen-xm
by Philipp Hahn
tap2 only handles 'aio', but not 'raw', which must be explicitly given:
| $ virsh domxml-to-native yyy.xml > yyy.xm
| $ xm new yyy.xm
| Error: tap:/srv/xen/xxx.img not a valid disk type
| $ sed -i -e 's/tap2:/&aio:/' yyy.xm
| $ xm new yyy.xm
Fix reading and writing "xen-xm" format for "tap2" by handling it the
same as "tap".
---
src/xenconfig/xen_xm.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/xenconfig/xen_xm.c b/src/xenconfig/xen_xm.c
index e09d97e..6556886 100644
--- a/src/xenconfig/xen_xm.c
+++ b/src/xenconfig/xen_xm.c
@@ -196,7 +196,8 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def)
}
/* And the sub-type for tap:XXX: type */
- if (STREQ_NULLABLE(virDomainDiskGetDriver(disk), "tap")) {
+ if (STREQ_NULLABLE(virDomainDiskGetDriver(disk), "tap") ||
+ STREQ_NULLABLE(virDomainDiskGetDriver(disk), "tap2")) {
char *driverType;
if (!(tmp = strchr(src, ':')))
@@ -298,7 +299,7 @@ xenFormatXMDisk(virConfValuePtr list,
else
type = virStorageFileFormatTypeToString(format);
virBufferAsprintf(&buf, "%s:", driver);
- if (STREQ(driver, "tap"))
+ if (STREQ(driver, "tap") || STREQ(driver, "tap2"))
virBufferAsprintf(&buf, "%s:", type);
} else {
switch (virDomainDiskGetType(disk)) {
--
2.1.4
8 years, 6 months
[libvirt] [PATCH] spec: Advertise nvram paths of official fedora edk2 builds
by Cole Robinson
Fedora now ships edk2 firmware in its official repos, so adapt
the nvram path list to match. Eventually we can remove the nightly
links as well once some integration kinks have been worked out,
and documentation updated.
Move the macro building into the %build target, which lets us
build up a shell variable and make things a bit more readable
https://bugzilla.redhat.com/show_bug.cgi?id=1335395
---
libvirt.spec.in | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index c7fcf85..8b88eef 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -192,12 +192,6 @@
%define qemu_group qemu
-# Advertise OVMF and AAVMF from nightly firmware repo
-%if 0%{?fedora}
- %define arg_loader_nvram --with-loader-nvram="/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd:/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2.git/aarch64/vars-template-pflash.raw"
-%endif
-
-
%if 0%{?fedora} || 0%{?rhel} >= 7
%define with_systemd_macros 1
%else
@@ -1097,6 +1091,18 @@ rm -rf .git
%define arg_selinux_mount --with-selinux-mount="/selinux"
%endif
+%if 0%{?fedora}
+ # Nightly firmware repo x86/OVMF
+ LOADERS="/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd:/usr/share/edk2.git/ovmf-x64/OVMF_VARS-pure-efi.fd"
+ # Nightly firmware repo aarch64/AAVMF
+ LOADERS="$LOADERS:/usr/share/edk2.git/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2.git/aarch64/vars-template-pflash.raw"
+ # Fedora official x86/OVMF
+ LOADERS="$LOADERS:/usr/share/edk2/ovmf/OVMF_CODE.fd:/usr/share/edk2/ovmf/OVMF_VARS.fd"
+ # Fedora official aarch64/AAVMF
+ LOADERS="$LOADERS:/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw:/usr/share/edk2/aarch64/vars-template-pflash.raw"
+ %define arg_loader_nvram --with-loader-nvram="$LOADERS"
+%endif
+
# place macros above and build commands below this comment
%if 0%{?enable_autotools}
--
2.7.4
8 years, 6 months
[libvirt] [PATCH v2 00/10] Add domain config validation infrastructure
by Peter Krempa
Similarly to post parse callbacks let's add infrastructure that will allow us
to introduce checks that will reject configrations that were previously valid.
This is achieved by flagging all the entry points to the config parser that need
to ignore invadid configurations and adding a callback infrastructure for
driver specific checks.
Peter Krempa (10):
conf: Rename VIR_DOMAIN_DEF_PARSE_VALIDATE to
VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA
conf: Add infrastructure for adding configuration validation
conf: drop 'def' from struct virDomainDefPostParseDeviceIteratorData
conf: Add device def validation callback
qemu: process: Unexport qemuProcessStartValidate
qemu: process: Convert multiple boolean args to a single flag
qemu: process: Call the domain config validator when starting a new VM
conf: Move disk info validator to the domain conf validator
conf: Move validation of disk LUN device to the appropriate place
qemu: Move check that validates 'min_guarantee' to
qemuDomainDefValidate
src/bhyve/bhyve_driver.c | 4 +-
src/conf/domain_conf.c | 225 ++++++++++++++++++++++++++++++++++--------
src/conf/domain_conf.h | 31 +++++-
src/conf/snapshot_conf.c | 3 +-
src/conf/virdomainobjlist.c | 6 +-
src/esx/esx_driver.c | 2 +-
src/libvirt_private.syms | 2 +-
src/libxl/libxl_domain.c | 3 +-
src/libxl/libxl_driver.c | 10 +-
src/libxl/libxl_migration.c | 6 +-
src/lxc/lxc_driver.c | 7 +-
src/openvz/openvz_driver.c | 7 +-
src/phyp/phyp_driver.c | 2 +-
src/qemu/qemu_domain.c | 20 +++-
src/qemu/qemu_driver.c | 15 +--
src/qemu/qemu_migration.c | 14 ++-
src/qemu/qemu_process.c | 42 ++++----
src/qemu/qemu_process.h | 9 +-
src/security/virt-aa-helper.c | 3 +-
src/test/test_driver.c | 4 +-
src/uml/uml_driver.c | 7 +-
src/vbox/vbox_common.c | 5 +-
src/vmware/vmware_driver.c | 4 +-
src/vz/vz_driver.c | 6 +-
src/xen/xen_driver.c | 4 +-
src/xen/xend_internal.c | 3 +-
src/xen/xm_internal.c | 3 +-
src/xenapi/xenapi_driver.c | 4 +-
tests/qemuxml2argvtest.c | 6 +-
29 files changed, 325 insertions(+), 132 deletions(-)
--
2.8.3
8 years, 6 months
[libvirt] [PATCH 0/3] Fix 'make rpm' failure with systemd 230
by Andrea Bolognani
Turns out the libsystemd-daemon library, which we've been
using for the sd_notify() feature, has been deprecated for
a long time and has finally been removed as of systemd 230.
This means 'make rpm' no longer works on Fedora rawhide,
and that other distributions such as Debian sid are silently
disabling the sd_notify() feature.
Switch from libsystemd-daemon to libsystemd.
Andrea Bolognani (3):
maint: Use libsystemd instead of libsystemd-daemon
spec: Enable libsystemd on Fedora >= 21, RHEL >= 7
systemd: Guard the call to sd_notify() properly
configure.ac | 4 ++--
libvirt.spec.in | 18 +++++++++++-------
m4/{virt-systemd-daemon.m4 => virt-libsystemd.m4} | 14 +++++++-------
src/Makefile.am | 4 ++--
src/util/virsystemd.c | 4 ++--
5 files changed, 24 insertions(+), 20 deletions(-)
rename m4/{virt-systemd-daemon.m4 => virt-libsystemd.m4} (73%)
--
2.5.5
8 years, 6 months
[libvirt] [PATCH v5 0/6] [REPOST] introduce new listen types for graphics
by Pavel Hrdina
There is no change since v4 [1], I've only rebased patches that are still
waiting for review and removed the ones that are already pushed.
[1] <https://www.redhat.com/archives/libvir-list/2016-May/msg01438.html>
Pavel Hrdina (6):
graphics: introduce listen type socket and use it for VNC
qemu_capabilites: add QEMU_CAPS_SPICE_UNIX
spice: add support for listen type socket
spice: introduce spice_auto_unix_socket config option
spice: introduce listen type none
vnc: add support for listen type none
docs/formatdomain.html.in | 28 +++
docs/schemas/domaincommon.rng | 15 ++
src/conf/domain_conf.c | 245 ++++++++++++++++++---
src/conf/domain_conf.h | 8 +-
src/libvirt_private.syms | 1 +
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 17 +-
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 3 +
src/qemu/qemu_command.c | 130 ++++++-----
src/qemu/qemu_conf.c | 1 +
src/qemu/qemu_conf.h | 1 +
src/qemu/qemu_domain.c | 28 ++-
src/qemu/qemu_hotplug.c | 9 +
src/qemu/qemu_migration.c | 47 +++-
src/qemu/qemu_parse_command.c | 2 +-
src/qemu/qemu_process.c | 46 +++-
src/qemu/test_libvirtd_qemu.aug.in | 1 +
src/security/virt-aa-helper.c | 15 +-
...ric-graphics-vnc-socket-attr-listen-address.xml | 30 +++
...hics-vnc-socket-attr-listen-socket-mismatch.xml | 30 +++
...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 +++
...ric-graphics-vnc-socket-attr-listen-address.xml | 30 +++
...eric-graphics-vnc-socket-attr-listen-socket.xml | 30 +++
.../generic-graphics-vnc-socket-listen.xml | 4 +-
.../generic-graphics-vnc-socket.xml | 4 +-
tests/genericxml2xmltest.c | 4 +
.../qemuargv2xml-graphics-vnc-socket.xml | 4 +-
tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 +
...emuxml2argv-graphics-spice-auto-socket-cfg.args | 20 ++
...qemuxml2argv-graphics-spice-auto-socket-cfg.xml | 30 +++
.../qemuxml2argv-graphics-spice-auto-socket.args | 20 ++
.../qemuxml2argv-graphics-spice-auto-socket.xml | 30 +++
.../qemuxml2argv-graphics-spice-socket.args | 20 ++
.../qemuxml2argv-graphics-spice-socket.xml | 30 +++
.../qemuxml2argv-graphics-vnc-auto-socket.args | 20 ++
.../qemuxml2argv-graphics-vnc-auto-socket.xml | 30 +++
.../qemuxml2argv-graphics-vnc-none.args | 20 ++
.../qemuxml2argv-graphics-vnc-none.xml | 30 +++
.../qemuxml2argv-graphics-vnc-socket.args | 4 +-
.../qemuxml2argv-graphics-vnc-socket.xml | 10 +-
.../qemuxml2argv-video-virtio-gpu-spice-gl.args | 2 +-
tests/qemuxml2argvtest.c | 14 ++
...muxml2xmlout-graphics-spice-auto-socket-cfg.xml | 35 +++
.../qemuxml2xmlout-graphics-spice-auto-socket.xml | 35 +++
.../qemuxml2xmlout-graphics-spice-socket.xml | 35 +++
.../qemuxml2xmlout-graphics-vnc-auto-socket.xml | 35 +++
...graphics-vnc-remove-generated-socket-active.xml | 4 +-
.../qemuxml2xmlout-graphics-vnc-socket.xml | 35 +++
.../qemuxml2xmlout-video-virtio-gpu-spice-gl.xml | 4 +-
tests/qemuxml2xmltest.c | 8 +
53 files changed, 1096 insertions(+), 145 deletions(-)
create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-address.xml
create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket-mismatch.xml
create mode 100644 tests/genericxml2xmlindata/generic-graphics-vnc-socket-attr-listen-socket.xml
create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-address.xml
create mode 100644 tests/genericxml2xmloutdata/generic-graphics-vnc-socket-attr-listen-socket.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket-cfg.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-auto-socket.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-socket.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-auto-socket.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-none.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-none.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket-cfg.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-auto-socket.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-socket.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-auto-socket.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-socket.xml
--
2.8.3
8 years, 6 months
[libvirt] [PATCH] conf: always format os.bootloaderArgs if set
by Fabian Freyer
At the moment the bootloader arguments never get formatted if the bootloader is unset. However, in cases where the bootloader defaults to a default value when unset, specifying bootloader arguments does make sense.
---
src/conf/domain_conf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 568c699..66bba6e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -22608,6 +22608,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->os.bootloader) {
virBufferEscapeString(buf, "<bootloader>%s</bootloader>\n",
def->os.bootloader);
+ }
+ if (def->os.bootloaderArgs) {
virBufferEscapeString(buf,
"<bootloader_args>%s</bootloader_args>\n",
def->os.bootloaderArgs);
--
2.7.0
8 years, 6 months
[libvirt] [PATCH 0/9] Add runnability info to query-cpu-definitions
by Eduardo Habkost
This series extends query-cpu-definitions to include two extra
fields: "runnable", and "unavailable-features".
This will return information based on the current machine and
accelerator only. In the future we may extend these mechanisms to
allow querying other machines and other accelerators without
restarting QEMU, but it will require some reorganization of
QEMU's main code.
This series is based on my 'x86-next' branch, at:
git://github.com/ehabkost/qemu.git x86-next
Cc: David Hildenbrand <dahi(a)linux.vnet.ibm.com>
Cc: Michael Mueller <mimu(a)linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger(a)de.ibm.com>
Cc: Cornelia Huck <cornelia.huck(a)de.ibm.com>
Cc: Jiri Denemark <jdenemar(a)redhat.com>
Cc: libvir-list(a)redhat.com
Eduardo Habkost (9):
target-i386: Move TCG initialization check to tcg_x86_init()
target-i386: Move TCG initialization to realize time
target-i386: Call cpu_exec_init() on realize
target-i386: List CPU models using subclass list
target-i386: Move warning code outside x86_cpu_filter_features()
target-i386: Define CPUID filtering functions before x86_cpu_list()
qmp: Add runnability information to query-cpu-definitions
target-i386: Use "-" instead of "_" on all feature names
target-i386: Return runnability information on query-cpu-definitions
qapi-schema.json | 10 +-
target-i386/cpu-qom.h | 4 +
target-i386/cpu.c | 275 +++++++++++++++++++++++++++++++++---------------
target-i386/translate.c | 6 ++
4 files changed, 207 insertions(+), 88 deletions(-)
--
2.5.5
8 years, 6 months
[libvirt] [PATCH] storage: Adjust qemu-img switches check
by John Ferlan
Since we support QEMU 0.12 and later, checking for support of specific flags
added prior to that isn't necessary.
Thus start with the base of having the "-o options" available for the
qemu-img create option and then determine whether we have the compat
option for qcow2 files (which would be necessary up through qemu 2.0
where the default changes to compat 0.11).
NOTE: Keeping old tests around since it's still possible to create in
the old format.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_backend.c | 66 ++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 42 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 3a23cd7..eaa6f65 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -869,9 +869,19 @@ virStoragePloopResize(virStorageVolDefPtr vol,
return ret;
}
+/* Flag values shared w/ storagevolxml2argvtest.c.
+ * Since it's still possible to provide the old format args, just
+ * keep them; however, prefix with an "X_" (similar to qemu_capabilities.c)
+ * to indicate the are older.
+ *
+ * QEMU_IMG_BACKING_FORMAT_OPTIONS (added in qemu 0.11)
+ * QEMU_IMG_BACKING_FORMAT_OPTIONS_COMPAT
+ * was made necessary due to 2.0 change to change the default
+ * qcow2 file format from 0.10 to 1.1.
+ */
enum {
- QEMU_IMG_BACKING_FORMAT_NONE = 0,
- QEMU_IMG_BACKING_FORMAT_FLAG,
+ X_QEMU_IMG_BACKING_FORMAT_NONE = 0,
+ X_QEMU_IMG_BACKING_FORMAT_FLAG,
QEMU_IMG_BACKING_FORMAT_OPTIONS,
QEMU_IMG_BACKING_FORMAT_OPTIONS_COMPAT,
};
@@ -904,46 +914,18 @@ virStorageBackendQemuImgSupportsCompat(const char *qemuimg)
static int
virStorageBackendQEMUImgBackingFormat(const char *qemuimg)
{
- char *help = NULL;
- char *start;
- char *end;
- char *tmp;
- int ret = -1;
- int exitstatus;
- virCommandPtr cmd = virCommandNewArgList(qemuimg, "-h", NULL);
-
- virCommandAddEnvString(cmd, "LC_ALL=C");
- virCommandSetOutputBuffer(cmd, &help);
- virCommandClearCaps(cmd);
-
- /* qemuimg doesn't return zero exit status on -h,
- * therefore we need to provide pointer for storing
- * exit status, although we don't parse it any later */
- if (virCommandRun(cmd, &exitstatus) < 0)
- goto cleanup;
+ /* As of QEMU 0.11 the [-o options] support was added via qemu
+ * commit id '9ea2ea71', so we start with that base and figure
+ * out what else we have */
+ int ret = QEMU_IMG_BACKING_FORMAT_OPTIONS;
+
+ /* QEMU 2.0 changed to using a format that only QEMU 1.1 and newer
+ * understands. Since we still support QEMU 0.12 and newer, we need
+ * to be able to handle the previous format as can be set via a
+ * compat=0.10 option. */
+ if (virStorageBackendQemuImgSupportsCompat(qemuimg))
+ ret = QEMU_IMG_BACKING_FORMAT_OPTIONS_COMPAT;
- if ((start = strstr(help, " create ")) == NULL ||
- (end = strstr(start, "\n")) == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("unable to parse qemu-img output '%s'"),
- help);
- goto cleanup;
- }
- if (((tmp = strstr(start, "-F fmt")) && tmp < end) ||
- ((tmp = strstr(start, "-F backing_fmt")) && tmp < end)) {
- ret = QEMU_IMG_BACKING_FORMAT_FLAG;
- } else if ((tmp = strstr(start, "[-o options]")) && tmp < end) {
- if (virStorageBackendQemuImgSupportsCompat(qemuimg))
- ret = QEMU_IMG_BACKING_FORMAT_OPTIONS_COMPAT;
- else
- ret = QEMU_IMG_BACKING_FORMAT_OPTIONS;
- } else {
- ret = QEMU_IMG_BACKING_FORMAT_NONE;
- }
-
- cleanup:
- virCommandFree(cmd);
- VIR_FREE(help);
return ret;
}
@@ -1196,7 +1178,7 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
VIR_FREE(opts);
} else {
if (info.backingPath) {
- if (imgformat == QEMU_IMG_BACKING_FORMAT_FLAG)
+ if (imgformat == X_QEMU_IMG_BACKING_FORMAT_FLAG)
virCommandAddArgList(cmd, "-F", backingType, NULL);
else
VIR_DEBUG("Unable to set backing store format for %s with %s",
--
2.5.5
8 years, 6 months