Only probe for CPU models if required

* src/qemu/qemu_conf.c: CPU models should be probed only if the
  a guest's XML contains CPU model, not each time a qemu command line
  is generated.
This commit is contained in:
Jiri Denemark 2009-12-22 12:23:56 +01:00 committed by Daniel Veillard
parent 5dbb208a4f
commit 8153c72b97

View File

@ -1778,17 +1778,18 @@ qemudBuildCommandLineCPU(virConnectPtr conn,
{ {
const virCPUDefPtr host = driver->caps->host.cpu; const virCPUDefPtr host = driver->caps->host.cpu;
virCPUDefPtr guest = NULL; virCPUDefPtr guest = NULL;
unsigned int ncpus; unsigned int ncpus = 0;
const char **cpus = NULL; const char **cpus = NULL;
union cpuData *data = NULL; union cpuData *data = NULL;
int ret = -1; int ret = -1;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
int i; int i;
if (qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0) if (def->cpu && def->cpu->model
&& qemudProbeCPUModels(emulator, ut->machine, &ncpus, &cpus) < 0)
goto cleanup; goto cleanup;
if (ncpus > 0 && host && def->cpu && def->cpu->model) { if (ncpus > 0 && host) {
virCPUCompareResult cmp; virCPUCompareResult cmp;
cmp = cpuGuestData(conn, host, def->cpu, &data); cmp = cpuGuestData(conn, host, def->cpu, &data);