mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
qemu: detect -machine mem-merge capability
* src/qemu/qemu_capabilities.h: New capability bit. * src/qemu/qemu_capabilities.c (virQEMUCapsProbeQMPCommandLine): New function, based on qemuMonitorGetCommandLineOptionParameters, which was introduced by commit bd56d0d813; use it to set new capability bit. (virQEMUCapsInitQMP): Use new function.
This commit is contained in:
parent
9615ca59c6
commit
d12bbd6a7d
@ -227,6 +227,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
"scsi-generic",
|
||||
|
||||
"scsi-generic.bootindex", /* 145 */
|
||||
"mem-merge",
|
||||
);
|
||||
|
||||
struct _virQEMUCaps {
|
||||
@ -2234,6 +2235,40 @@ virQEMUCapsProbeQMPKVMState(virQEMUCapsPtr qemuCaps,
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct virQEMUCapsCommandLineProps {
|
||||
const char *option;
|
||||
const char *param;
|
||||
int flag;
|
||||
};
|
||||
|
||||
static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
|
||||
{ "machine", "mem-merge", QEMU_CAPS_MEM_MERGE },
|
||||
};
|
||||
|
||||
static int
|
||||
virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps,
|
||||
qemuMonitorPtr mon)
|
||||
{
|
||||
int nvalues;
|
||||
char **values;
|
||||
size_t i, j;
|
||||
|
||||
for (i = 0; i < ARRAY_CARDINALITY(virQEMUCapsCommandLine); i++) {
|
||||
if ((nvalues = qemuMonitorGetCommandLineOptionParameters(mon,
|
||||
virQEMUCapsCommandLine[i].option,
|
||||
&values)) < 0)
|
||||
return -1;
|
||||
for (j = 0; j < nvalues; j++) {
|
||||
if (STREQ(virQEMUCapsCommandLine[i].param, values[j])) {
|
||||
virQEMUCapsSet(qemuCaps, virQEMUCapsCommandLine[i].flag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
virStringFreeList(values);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps,
|
||||
qemuMonitorPtr mon)
|
||||
@ -2581,6 +2616,8 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
|
||||
goto cleanup;
|
||||
if (virQEMUCapsProbeQMPTPM(qemuCaps, mon) < 0)
|
||||
goto cleanup;
|
||||
if (virQEMUCapsProbeQMPCommandLine(qemuCaps, mon) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
@ -184,6 +184,7 @@ enum virQEMUCapsFlags {
|
||||
QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci device */
|
||||
QEMU_CAPS_DEVICE_SCSI_GENERIC = 144, /* -device scsi-generic */
|
||||
QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX = 145, /* -device scsi-generic.bootindex */
|
||||
QEMU_CAPS_MEM_MERGE = 146, /* -machine mem-merge */
|
||||
|
||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user