mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: Fix command line generation with faked host CPU
The code expected that host CPU architecture matches the architecture on which libvirt runs. This is normally true but not in tests, where host CPU is faked to produce consistent results.
This commit is contained in:
parent
aa3b2e40f5
commit
453d05dab9
@ -2440,7 +2440,8 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
*hasHwVirt = false;
|
*hasHwVirt = false;
|
||||||
|
|
||||||
if (def->cpu && def->cpu->model) {
|
if (def->cpu && def->cpu->model) {
|
||||||
if (qemuCapsProbeCPUModels(emulator, qemuCmdFlags, ut->machine,
|
if (host &&
|
||||||
|
qemuCapsProbeCPUModels(emulator, qemuCmdFlags, host->arch,
|
||||||
&ncpus, &cpus) < 0)
|
&ncpus, &cpus) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -2469,7 +2470,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine)))
|
if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(host->arch)))
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
if (def->cpu->match == VIR_CPU_MATCH_MINIMUM)
|
if (def->cpu->match == VIR_CPU_MATCH_MINIMUM)
|
||||||
@ -2528,8 +2529,9 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
if (guest)
|
||||||
|
cpuDataFree(guest->arch, data);
|
||||||
virCPUDefFree(guest);
|
virCPUDefFree(guest);
|
||||||
cpuDataFree(ut->machine, data);
|
|
||||||
|
|
||||||
if (cpus) {
|
if (cpus) {
|
||||||
for (i = 0; i < ncpus; i++)
|
for (i = 0; i < ncpus; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user