]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Set alias for memory cell in qemuBuildMemoryCellBackendStr
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 7 Nov 2017 14:12:33 +0000 (15:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 8 Nov 2017 09:17:08 +0000 (10:17 +0100)
Very soon qemuBuildMemoryBackendStr() is going to use memory cell
aliases. Therefore set one. At the same time, move it a bit
further - if virAsprintf() fails, there's no point in setting
rest of the members.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_command.c

index 03a8056d9ed1c33327766faa09975db7cb28bfc2..bf16d71f9a295c80a4528f6a7524d3e6d69e4766 100644 (file)
@@ -3486,12 +3486,13 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
     unsigned long long memsize = virDomainNumaGetNodeMemorySize(def->numa,
                                                                 cell);
 
+    if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
+        goto cleanup;
+
     *backendStr = NULL;
     mem.size = memsize;
     mem.targetNode = cell;
-
-    if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
-        goto cleanup;
+    mem.info.alias = alias;
 
     if ((rc = qemuBuildMemoryBackendStr(&props, &backendType, cfg, priv->qemuCaps,
                                         def, &mem, priv->autoNodeset, false)) < 0)