]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Probe canonicalized machine type
authorAndrea Bolognani <abologna@redhat.com>
Thu, 16 May 2019 08:34:01 +0000 (10:34 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 17 May 2019 12:59:34 +0000 (14:59 +0200)
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@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 files changed:
src/qemu/qemu_capabilities.c
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.replies
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies
tests/qemucapabilitiesdata/caps_2.12.0.s390x.replies
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies
tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
tests/qemucapabilitiesdata/caps_3.0.0.riscv32.replies
tests/qemucapabilitiesdata/caps_3.0.0.riscv64.replies
tests/qemucapabilitiesdata/caps_3.0.0.s390x.replies
tests/qemucapabilitiesdata/caps_3.0.0.x86_64.replies
tests/qemucapabilitiesdata/caps_3.1.0.ppc64.replies
tests/qemucapabilitiesdata/caps_3.1.0.x86_64.replies
tests/qemucapabilitiesdata/caps_4.0.0.aarch64.replies
tests/qemucapabilitiesdata/caps_4.0.0.ppc64.replies
tests/qemucapabilitiesdata/caps_4.0.0.riscv32.replies
tests/qemucapabilitiesdata/caps_4.0.0.riscv64.replies
tests/qemucapabilitiesdata/caps_4.0.0.s390x.replies
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies

index 89bedd7dc03dba9aaf43b2d7548115ba7478e396..56dfea1c33e3ddd550a96ec6e51801f8bdbbc269 100644 (file)
@@ -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 },
 };
 
@@ -2357,11 +2357,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)
index 1eaa60f656bf76da4891657f946231df1ed82bce..7b42e70d5dadaa11fee15f082f0b447fa3f376a6 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-32"
 }
   "id": "libvirt-32",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 38d77aa19ccfba230b4eccbb61b6ace37e3c1a10..5c9ddbc178113ded25859f9cb3d8f35916761d3d 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-2.12-machine"
   },
   "id": "libvirt-33"
 }
index 59e699b8be67263358d15987d54a4be049f8ec5c..3cd62cd10a2882610fab7907dce5fa0f3f1cce19 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-32"
 }
   "id": "libvirt-32",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 5e4686c9885d9e4e8fff6f050154ba04a19327c1..124be0cd71ad3fb790abe571852b47d8a73be48a 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 80c68de11af6e30127516e2de87c323f6bb816f1..fa370a39bdb9e77b3458ba28252ad1528567ccf7 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-3.0-machine"
   },
   "id": "libvirt-33"
 }
index 995171fa564ba1eb67cee307e49a719cf451f84c..ce6f554cfea3b621872ea8d82fd72768ddf7394c 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-28"
 }
   "id": "libvirt-28",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 4775ff260f20269dc6e8c7482a3dd5e16453bb13..8884ca1c6e64a4cc24333b25eeb0ea427092a170 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-28"
 }
   "id": "libvirt-28",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 126892431657ba1f0bb83ffa41c1baf371c126fb..b385e27fa11d494a5db051b62adbeb81a1e1b66f 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index c546944e8f8753afce6660898c8e5bba08b9f0d5..964759a50df1f0de572716c89c3250f1bf55ff0b 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index e62c3cd3bbfec95f349805b0349f7b5a1e056615..c23f67e86936550483df3f84c5c31fd889a1e992 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-3.1-machine"
   },
   "id": "libvirt-33"
 }
index 856f588fd0b171750e63b304c8e8629cd360d391..b56283979406f08be8c553a8b54e8373ee9549d4 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index 489141349045b7077c9c87f625ca8cf3085876b3..043189d1acea1e262c3ff7a0e35f06ac16c8ad1a 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index c51b06f9a26470bae37394154e444ddf3e564b75..38e4c254a44c29e0996d944a48eabd06b1f5cb3e 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-4.0-machine"
   },
   "id": "libvirt-34"
 }
index feb5c8fc4d26d72c347167e83eaccf84b8d3a65b..5205bda05cd694ee6b1b70b0f3b1e32f5acc1541 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-34"
 }
   "id": "libvirt-34",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index e2588168a062f508c6017c42bac6faef7e6585d6..dfe5671a5881e74f913bbf080144aebbc8c79f27 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-34"
 }
   "id": "libvirt-34",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index e806185863892bfd28a50a8a80d6cf749194bcd0..6f74f107f7f3ffd5eac6754c96d0b04cabe58a60 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-33"
 }
   "id": "libvirt-33",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }
 
index f89603d64d8684f3a738d0f6c1dde51de5ba066a..6cfff8b7e04dca72b11cfafdf0b22dc8aab9946f 100644 (file)
 {
   "execute": "qom-list-properties",
   "arguments": {
-    "typename": "spapr-machine"
+    "typename": "pseries-machine"
   },
   "id": "libvirt-38"
 }
   "id": "libvirt-38",
   "error": {
     "class": "DeviceNotFound",
-    "desc": "Class 'spapr-machine' not found"
+    "desc": "Class 'pseries-machine' not found"
   }
 }