mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 09:17:52 +03:00
qemu: Introduce virQEMUCapsProbeQMPMachineProps()
Up until now we've probed machine type properties, along with properties for other types, in virQEMUCapsProbeQMPDevices(), but soon we're going to need some logic that is specific to machine types and as such wouldn't quite fit into that function. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
4d8cc5a07a
commit
4ad8d620cc
@ -1391,12 +1391,6 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMemfd[]
|
||||
{ "hugetlb", QEMU_CAPS_OBJECT_MEMORY_MEMFD_HUGETLB },
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSPAPRMachine[] = {
|
||||
{ "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 virQEMUCapsObjectProps[] = {
|
||||
{ "memory-backend-file", virQEMUCapsObjectPropsMemoryBackendFile,
|
||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendFile),
|
||||
@ -1404,8 +1398,17 @@ static virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
|
||||
{ "memory-backend-memfd", virQEMUCapsObjectPropsMemoryBackendMemfd,
|
||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsMemoryBackendMemfd),
|
||||
QEMU_CAPS_OBJECT_MEMORY_MEMFD },
|
||||
{ "spapr-machine", virQEMUCapsObjectPropsSPAPRMachine,
|
||||
ARRAY_CARDINALITY(virQEMUCapsObjectPropsSPAPRMachine),
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsSPAPR[] = {
|
||||
{ "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-machine", virQEMUCapsMachinePropsSPAPR,
|
||||
ARRAY_CARDINALITY(virQEMUCapsMachinePropsSPAPR),
|
||||
-1 },
|
||||
};
|
||||
|
||||
@ -2341,6 +2344,36 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
|
||||
qemuMonitorPtr mon)
|
||||
{
|
||||
char **values;
|
||||
int nvalues;
|
||||
size_t i;
|
||||
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
|
||||
virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
|
||||
const char *type = props.type;
|
||||
|
||||
if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0)
|
||||
return -1;
|
||||
|
||||
virQEMUCapsProcessStringFlags(qemuCaps,
|
||||
props.nprops,
|
||||
props.props,
|
||||
nvalues, values);
|
||||
|
||||
virStringListFreeCount(values, nvalues);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
virDomainCapsCPUModelsPtr
|
||||
virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon)
|
||||
{
|
||||
@ -4355,6 +4388,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
|
||||
return -1;
|
||||
if (virQEMUCapsProbeQMPDevices(qemuCaps, mon) < 0)
|
||||
return -1;
|
||||
if (virQEMUCapsProbeQMPMachineProps(qemuCaps, mon) < 0)
|
||||
return -1;
|
||||
if (virQEMUCapsProbeQMPMachineTypes(qemuCaps, mon) < 0)
|
||||
return -1;
|
||||
if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, mon, false) < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user