In case qemu supports -nodefconfig, libvirt adds uses it when launching new guests. Since this option may affect CPU models supported by qemu, we need to use it when probing for available models. --- src/qemu/qemu_conf.c | 16 ++++++++++++---- src/qemu/qemu_conf.h | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 988220b..1d0bd88 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -718,11 +718,17 @@ error: int qemudProbeCPUModels(const char *qemu, + unsigned long long qemuCmdFlags, const char *arch, unsigned int *count, const char ***cpus) { - const char *const qemuarg[] = { qemu, "-cpu", "?", NULL }; + const char *const qemuarg[] = { + qemu, + "-cpu", "?", + (qemuCmdFlags & QEMUD_CMD_FLAG_NODEFCONFIG) ? "-nodefconfig" : NULL, + NULL + }; const char *const qemuenv[] = { "LC_ALL=C", NULL }; enum { MAX_MACHINES_OUTPUT_SIZE = 1024*4 }; char *output = NULL; @@ -916,7 +922,7 @@ qemudCapsInitGuest(virCapsPtr caps, guest->arch.defaultInfo.emulator_mtime = binary_mtime; if (caps->host.cpu && - qemudProbeCPUModels(binary, info->arch, &ncpus, NULL) == 0 && + qemudProbeCPUModels(binary, 0, info->arch, &ncpus, NULL) == 0 && ncpus > 0 && !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0)) goto error; @@ -3365,6 +3371,7 @@ static int qemuBuildCpuArgStr(const struct qemud_driver *driver, const virDomainDefPtr def, const char *emulator, + unsigned long long qemuCmdFlags, const struct utsname *ut, char **opt) { @@ -3378,7 +3385,8 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver, int i; if (def->cpu && def->cpu->model) { - if (qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0) + if (qemudProbeCPUModels(emulator, qemuCmdFlags, ut->machine, + &ncpus, &cpus) < 0) goto cleanup; if (!ncpus || !host) { @@ -3706,7 +3714,7 @@ int qemudBuildCommandLine(virConnectPtr conn, ADD_ARG_LIT(def->os.machine); } - if (qemuBuildCpuArgStr(driver, def, emulator, &ut, &cpu) < 0) + if (qemuBuildCpuArgStr(driver, def, emulator, qemuCmdFlags, &ut, &cpu) < 0) goto error; if (cpu) { diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index ab5f158..dfdc0bb 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -289,6 +289,7 @@ int qemudProbeMachineTypes (const char *binary, int *nmachines); int qemudProbeCPUModels (const char *qemu, + unsigned long long qemuCmdFlags, const char *arch, unsigned int *count, const char ***cpus); -- 1.7.1.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list