]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Only probe for CPU models if required
authorJiri Denemark <jdenemar@redhat.com>
Tue, 22 Dec 2009 11:23:56 +0000 (12:23 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 22 Dec 2009 11:23:56 +0000 (12:23 +0100)
* 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.

src/qemu/qemu_conf.c

index 36bf9a273f51d114a6533fdb98b33b5d17dc9494..3f6c79b124fe0f334463f95e383c43da065e0a70 100644 (file)
@@ -1778,17 +1778,18 @@ qemudBuildCommandLineCPU(virConnectPtr conn,
 {
     const virCPUDefPtr host = driver->caps->host.cpu;
     virCPUDefPtr guest = NULL;
-    unsigned int ncpus;
+    unsigned int ncpus = 0;
     const char **cpus = NULL;
     union cpuData *data = NULL;
     int ret = -1;
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     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;
 
-    if (ncpus > 0 && host && def->cpu && def->cpu->model) {
+    if (ncpus > 0 && host) {
         virCPUCompareResult cmp;
 
         cmp = cpuGuestData(conn, host, def->cpu, &data);