On Fri, Mar 17, 2017 at 10:05:45AM +0100, Jiri Denemark wrote:
> On Thu, Mar 16, 2017 at 12:22:05 +0100, Guido Günther wrote:
> > This unbreaks emulators that don't support this command such as
> > qemu-system-mips*.
> >
> > Reference: http://bugs.debian.org/854125
>
> ACK
Pushed. Thanks. To to the merge of the PCIe code I had to shift things
slightly so I'm including the pushed version for completeness.
-- Guido
>From 009c07b9f22a8937c2035b7f27ef80b1b83b0b33 Mon Sep 17 00:00:00 2001
Message-Id:
<009c07b9f22a8937c2035b7f27ef80b1b83b0b33.1489744468.git@sigxcpu.org>
From: =?UTF-8?q?Guido=20G=C3=BCnther?=
Date: Thu, 16 Mar 2017 09:19:02 +0100
Subject: [PATCH] qemu: skip QMP probing of CPU definitions when missing
To: libvir-list@redhat.com
This unbreaks emulators that don't support this command such as
qemu-system-mips*.
Reference: http://bugs.debian.org/854125
---
src/qemu/qemu_capabilities.c| 6 ++
src/qemu/qemu_capabilities.h| 3 +++
tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml| 1 +
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-gicv2.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 +
tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml| 1 +
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml| 1 +
20 files changed, 27 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b85ca71d1..60ed31ef9 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -361,6 +361,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"spice-rendernode",
"nvdimm",
"pcie-root-port",
+
+ "query-cpu-definitions", /* 250 */
);
@@ -1518,6 +1520,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
{ "query-hotpluggable-cpus", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS },
{ "query-qmp-schema", QEMU_CAPS_QUERY_QMP_SCHEMA },
{ "query-cpu-model-expansion", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION},
+{ "query-cpu-definitions", QEMU_CAPS_QUERY_CPU_DEFINITIONS},
};
struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
@@ -2796,6 +2799,9 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
int ret = -1;
size_t i;
+if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
+return 0;
+
if ((ncpus = qemuMonitorGetCPUDefinitions(mon, &cpus)) < 0)
return -1;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index ca8a5173c..55777f979 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -397,6 +397,9 @@ typedef enum {
QEMU_CAPS_DEVICE_NVDIMM, /* -device nvdimm */
QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, /* -device pcie-root-port */
+/* 250 */
+QEMU_CAPS_QUERY_CPU_DEFINITIONS, /* qmp query-cpu-definitions */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
index f258c5fd3..5ad406ce1 100644
--- a/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml
@@ -109,6 +109,7 @@
+
1002002
0
diff --git a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
index bc76818d4..4ec731d65 100644
--- a/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml
@@ -127,6 +127,7 @@
+
1003001
0
diff --git a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
index ef4840003..601c62e65 100644
--- a/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml
@@ -128,6 +128,7 @@
+
1004002
0
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
index 96b6fdb45..a68c13bbd 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml
@@ -