qemu: Probe canonicalized machine type

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>
This commit is contained in:
Andrea Bolognani 2019-05-16 10:34:01 +02:00
parent f3f9d8e376
commit d22c6221fc
18 changed files with 35 additions and 34 deletions

View 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)

View File

@ -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"
}
}

View File

@ -5531,7 +5531,7 @@
{
"execute": "qom-list-properties",
"arguments": {
"typename": "spapr-machine"
"typename": "pseries-2.12-machine"
},
"id": "libvirt-33"
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -5616,7 +5616,7 @@
{
"execute": "qom-list-properties",
"arguments": {
"typename": "spapr-machine"
"typename": "pseries-3.0-machine"
},
"id": "libvirt-33"
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -5696,7 +5696,7 @@
{
"execute": "qom-list-properties",
"arguments": {
"typename": "spapr-machine"
"typename": "pseries-3.1-machine"
},
"id": "libvirt-33"
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -6079,7 +6079,7 @@
{
"execute": "qom-list-properties",
"arguments": {
"typename": "spapr-machine"
"typename": "pseries-4.0-machine"
},
"id": "libvirt-34"
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}

View File

@ -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"
}
}