[libvirt] [PATCH 4/6] qemu: Probe canonicalized machine type

Andrea Bolognani abologna at redhat.com
Thu May 16 15:35:34 UTC 2019


Now that we have the list of machine types available when
probing machine type properties, we can list properties for
the canonicalized version of the "pseries" machine type
instead of having to go through "spapr-machine", which we
know to be the parent type for all "pseries-*-machine"
types. By doing this, we'll be able to find even properties
that are only available from a certain versioned machine
type forward, and can't thus be obtained when looking at
the parent type only.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
 src/qemu/qemu_capabilities.c                           | 9 +++++----
 tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies | 4 ++--
 tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies   | 2 +-
 tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies   | 4 ++--
 tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies    | 2 +-
 tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies    | 4 ++--
 tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies   | 4 ++--
 tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies    | 2 +-
 tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies   | 4 ++--
 tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies    | 2 +-
 tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies  | 4 ++--
 tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies    | 4 ++--
 tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies   | 4 ++--
 18 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 294d42b0e5..e12f076da8 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1400,15 +1400,15 @@ static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       QEMU_CAPS_OBJECT_MEMORY_MEMFD },
 };
 
-static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsSPAPR[] = {
+static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsPSeries[] = {
     { "cap-hpt-max-page-size", QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE },
     { "cap-htm", QEMU_CAPS_MACHINE_PSERIES_CAP_HTM },
     { "cap-nested-hv", QEMU_CAPS_MACHINE_PSERIES_CAP_NESTED_HV },
 };
 
 static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
-    { "spapr", virQEMUCapsMachinePropsSPAPR,
-      ARRAY_CARDINALITY(virQEMUCapsMachinePropsSPAPR),
+    { "pseries", virQEMUCapsMachinePropsPSeries,
+      ARRAY_CARDINALITY(virQEMUCapsMachinePropsPSeries),
       -1 },
 };
 
@@ -2358,11 +2358,12 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
 
     for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
         virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
+        const char *canon = virQEMUCapsGetCanonicalMachine(qemuCaps, props.type);
         VIR_AUTOFREE(char *) type = NULL;
 
         /* The QOM type for machine types is the machine type name
          * followed by the -machine suffix */
-        if (virAsprintf(&type, "%s-machine", props.type) < 0)
+        if (virAsprintf(&type, "%s-machine", canon) < 0)
             return -1;
 
         if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0)
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies
index 1eaa60f656..7b42e70d5d 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies
@@ -5635,7 +5635,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-32"
 }
@@ -5644,7 +5644,7 @@
   "id": "libvirt-32",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies
index 38d77aa19c..5c9ddbc178 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies
@@ -5531,7 +5531,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-2.12-machine"
   },
   "id": "libvirt-33"
 }
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies
index 59e699b8be..3cd62cd10a 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies
@@ -3811,7 +3811,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-32"
 }
@@ -3820,7 +3820,7 @@
   "id": "libvirt-32",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
index 5e4686c988..124be0cd71 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
@@ -4968,7 +4968,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
@@ -4977,7 +4977,7 @@
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
index 80c68de11a..fa370a39bd 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
@@ -5616,7 +5616,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-3.0-machine"
   },
   "id": "libvirt-33"
 }
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
index 995171fa56..ce6f554cfe 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
@@ -1700,7 +1700,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-28"
 }
@@ -1709,7 +1709,7 @@
   "id": "libvirt-28",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
index 4775ff260f..8884ca1c6e 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
@@ -1700,7 +1700,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-28"
 }
@@ -1709,7 +1709,7 @@
   "id": "libvirt-28",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies
index 1268924316..b385e27fa1 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies
@@ -3970,7 +3970,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
@@ -3979,7 +3979,7 @@
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
index c546944e8f..964759a50d 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
@@ -5109,7 +5109,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
@@ -5118,7 +5118,7 @@
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies
index e62c3cd3bb..c23f67e869 100644
--- a/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies
@@ -5696,7 +5696,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-3.1-machine"
   },
   "id": "libvirt-33"
 }
diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
index 856f588fd0..b562839794 100644
--- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
@@ -5182,7 +5182,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
@@ -5191,7 +5191,7 @@
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies
index 4891413490..043189d1ac 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies
@@ -6213,7 +6213,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
@@ -6222,7 +6222,7 @@
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies
index c51b06f9a2..38e4c254a4 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies
@@ -6079,7 +6079,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-4.0-machine"
   },
   "id": "libvirt-34"
 }
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies
index feb5c8fc4d..5205bda05c 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies
@@ -4082,7 +4082,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-34"
 }
@@ -4091,7 +4091,7 @@
   "id": "libvirt-34",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies
index e2588168a0..dfe5671a58 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies
@@ -4082,7 +4082,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-34"
 }
@@ -4091,7 +4091,7 @@
   "id": "libvirt-34",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies
index e806185863..6f74f107f7 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies
@@ -4283,7 +4283,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
@@ -4292,7 +4292,7 @@
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
index f89603d64d..6cfff8b7e0 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
@@ -5415,7 +5415,7 @@
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
@@ -5424,7 +5424,7 @@
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
-- 
2.21.0




More information about the libvir-list mailing list