]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virCPUDefCopy forgot to copy NUMA topology
authorJiri Denemark <jdenemar@redhat.com>
Mon, 19 Dec 2011 11:38:11 +0000 (12:38 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 3 Jan 2012 20:05:54 +0000 (21:05 +0100)
As a result of it, guest NUMA topology would be lost during migration.

src/conf/cpu_conf.c

index 28823893c4c79d0da60aa52a1346ea3e871612a2..348299b5fcd30e7a48e7a8480f70d7131aa8bfee 100644 (file)
@@ -108,6 +108,27 @@ virCPUDefCopy(const virCPUDefPtr cpu)
             goto no_memory;
     }
 
+    if (cpu->ncells) {
+        if (VIR_ALLOC_N(copy->cells, cpu->ncells) < 0)
+            goto no_memory;
+        copy->ncells_max = copy->ncells = cpu->ncells;
+
+        for (i = 0; i < cpu->ncells; i++) {
+            copy->cells[i].cellid = cpu->cells[i].cellid;
+            copy->cells[i].mem = cpu->cells[i].mem;
+
+            if (VIR_ALLOC_N(copy->cells[i].cpumask,
+                            VIR_DOMAIN_CPUMASK_LEN) < 0)
+                goto no_memory;
+            memcpy(copy->cells[i].cpumask, cpu->cells[i].cpumask,
+                   VIR_DOMAIN_CPUMASK_LEN);
+
+            if (!(copy->cells[i].cpustr = strdup(cpu->cells[i].cpustr)))
+                goto no_memory;
+        }
+        copy->cells_cpus = cpu->cells_cpus;
+    }
+
     return copy;
 
 no_memory: