提交 f3f9d8e3 编写于 作者: A Andrea Bolognani

qemu: Add -machine suffix automatically

The QOM type for machine types is the machine type name
followed by the -machine suffix. Since this is always the
case, we can make virQEMUCapsMachineProps more readable
and avoid repetition by not including the suffix there and
adding it automatically while processing the data; moreover,
when later on we will start figuring out which specific
versioned machine type to probe at runtime instead of doing
so statically, adding the suffix dynamically will become
necessary.
Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NPavel Hrdina <phrdina@redhat.com>
上级 295a42e1
......@@ -1407,7 +1407,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsSPAPR[] = {
};
static virQEMUCapsObjectTypeProps virQEMUCapsMachineProps[] = {
{ "spapr-machine", virQEMUCapsMachinePropsSPAPR,
{ "spapr", virQEMUCapsMachinePropsSPAPR,
ARRAY_CARDINALITY(virQEMUCapsMachinePropsSPAPR),
-1 },
};
......@@ -2357,7 +2357,12 @@ virQEMUCapsProbeQMPMachineProps(virQEMUCapsPtr qemuCaps,
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsMachineProps); i++) {
virQEMUCapsObjectTypeProps props = virQEMUCapsMachineProps[i];
const char *type = 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)
return -1;
if ((nvalues = qemuMonitorGetObjectProps(mon, type, &values)) < 0)
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册