mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: allow hypervisor-cpu-baseline with single cpu
When executing the hypervisor-cpu-baseline command and if there is only a single CPU definition present in the XML file, then the baseline handler will exit early and libvirt will print an unhelpful message: "error: An error occurred, but the cause is unknown" This is due to no CPU definition ever being "baselined", since the handler expects at least two CPU models. Let's fix this by performing a CPU model expansion on the single CPU definition and returning the result to the caller. This will also ensure the CPU model's feature set is sane if any were provided in the file. Signed-off-by: Collin Walling <walling@linux.ibm.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
c5ed1fdee2
commit
d1e00f84c0
@ -12423,6 +12423,7 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
|
||||
g_autoptr(qemuProcessQMP) proc = NULL;
|
||||
g_autoptr(virCPUDef) baseline = NULL;
|
||||
qemuMonitorCPUModelInfoPtr result = NULL;
|
||||
qemuMonitorCPUModelExpansionType expansion_type;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ncpus; i++) {
|
||||
@ -12466,9 +12467,11 @@ qemuConnectCPUModelBaseline(virQEMUCapsPtr qemuCaps,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (expand_features) {
|
||||
if (qemuMonitorGetCPUModelExpansion(proc->mon,
|
||||
QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
|
||||
if (expand_features || ncpus == 1) {
|
||||
expansion_type = expand_features ? QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL
|
||||
: QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC;
|
||||
|
||||
if (qemuMonitorGetCPUModelExpansion(proc->mon, expansion_type,
|
||||
baseline, true, false, &result) < 0)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user