We already do this when parsing the help string (QEMU versions
between 0.12.0 and 1.2.0), but not when using QMP.
Stop checking the QMP data, and enable it unconditionally even
when using QMP instead.
The QMP check was never accurate anyway, since it was based on
the availability of the 'rombar' property for the {kvm-}pci-assign
device, ignoring the fact that the same property exists and can be
used for devices such as virtio-net-pci.
Since a few other capabilities are enabled based on a version
check, but the version in question is older than 0.12.0, move
those to a new virQEMUCapsInitHelpBasic() function and get rid
of the version checks altogether.
---
src/qemu/qemu_capabilities.c | 46 ++++++++++++----------
tests/qemucapabilitiesdata/caps_1.2.2-1.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_2.6.0-1.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_2.6.0-1.ppc64le.xml | 1 +
.../qemucapabilitiesdata/caps_2.6.0-2.aarch64.xml | 1 +
5 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1bddf43..a6cce30 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1110,6 +1110,29 @@ virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
}
+/* Capabilities that we assume are always enabled
+ * for QEMU >= 0.12.0 */
+static void
+virQEMUCapsInitHelpBasic(virQEMUCapsPtr qemuCaps)
+{
+
+ /* Although very new versions of qemu advertise the presence of
+ * the rombar option in the output of "qemu -device pci-assign,?",
+ * this advertisement was added to the code long after the option
+ * itself. According to qemu developers, though, rombar is
+ * available in all qemu binaries from release 0.12 onward.
+ * Setting the capability this way makes it available in more
+ * cases where it might be needed, and shouldn't cause any false
+ * positives (in the case that it did, qemu would produce an error
+ * log and refuse to start, so it would be immediately obvious).
+ */
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
+
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
+}
+
+
static int
virQEMUCapsComputeCmdFlags(const char *help,
unsigned int version,
@@ -1257,9 +1280,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (strstr(help, "-machine"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
- if (version >= 11000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
-
/* While JSON mode was available in 0.12.0, it was too
* incomplete to contemplate using. The 0.13.0 release
* is good enough to use, even though it lacks one or
@@ -1301,22 +1321,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (version >= 13000)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION);
- /* Although very new versions of qemu advertise the presence of
- * the rombar option in the output of "qemu -device pci-assign,?",
- * this advertisement was added to the code long after the option
- * itself. According to qemu developers, though, rombar is
- * available in all qemu binaries from release 0.12 onward.
- * Setting the capability this way makes it available in more
- * cases where it might be needed, and shouldn't cause any false
- * positives (in the case that it did, qemu would produce an error
- * log and refuse to start, so it would be immediately obvious).
- */
- if (version >= 12000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
-
- if (version >= 11000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
-
if (version >= 1001000) {
virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY);
@@ -1436,6 +1440,8 @@ int virQEMUCapsParseHelpStr(const char *qemu,
goto cleanup;
}
+ virQEMUCapsInitHelpBasic(qemuCaps);
+
if (virQEMUCapsComputeCmdFlags(help, *version,
qemuCaps, check_yajl) < 0)
goto cleanup;
@@ -1612,7 +1618,6 @@ static struct virQEMUCapsStringFlags
virQEMUCapsObjectPropsVirtioSCSI[] = {
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPCIAssign[] = {
- { "rombar", QEMU_CAPS_PCI_ROMBAR },
{ "configfd", QEMU_CAPS_PCI_CONFIGFD },
{ "bootindex", QEMU_CAPS_PCI_BOOTINDEX },
};
@@ -3415,6 +3420,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_SHARE_POLICY);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_ROMBAR);
}
/* Capabilities that are architecture depending
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.x86_64.xml
b/tests/qemucapabilitiesdata/caps_1.2.2-1.x86_64.xml
index 257a123..715bc5a 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2-1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.x86_64.xml
@@ -49,6 +49,7 @@
<flag name='usb-hub'/>
<flag name='no-shutdown'/>
<flag name='cache-unsafe'/>
+ <flag name='rombar'/>
<flag name='ich9-ahci'/>
<flag name='no-acpi'/>
<flag name='fsdev-readonly'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.aarch64.xml
b/tests/qemucapabilitiesdata/caps_2.6.0-1.aarch64.xml
index f4e6db1..37670a5 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-1.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.aarch64.xml
@@ -43,6 +43,7 @@
<flag name='usb-hub'/>
<flag name='no-shutdown'/>
<flag name='cache-unsafe'/>
+ <flag name='rombar'/>
<flag name='ich9-ahci'/>
<flag name='fsdev-readonly'/>
<flag name='virtio-blk-pci.scsi'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.ppc64le.xml
b/tests/qemucapabilitiesdata/caps_2.6.0-1.ppc64le.xml
index 96a02a5..59af475 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-1.ppc64le.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.ppc64le.xml
@@ -41,6 +41,7 @@
<flag name='usb-hub'/>
<flag name='no-shutdown'/>
<flag name='cache-unsafe'/>
+ <flag name='rombar'/>
<flag name='ich9-ahci'/>
<flag name='fsdev-readonly'/>
<flag name='virtio-blk-pci.scsi'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-2.aarch64.xml
b/tests/qemucapabilitiesdata/caps_2.6.0-2.aarch64.xml
index f4d60d1..8823363 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-2.aarch64.xml
@@ -43,6 +43,7 @@
<flag name='usb-hub'/>
<flag name='no-shutdown'/>
<flag name='cache-unsafe'/>
+ <flag name='rombar'/>
<flag name='ich9-ahci'/>
<flag name='fsdev-readonly'/>
<flag name='virtio-blk-pci.scsi'/>
--
2.5.5