Blame SOURCES/libvirt-qemu-Set-alias-for-memory-cell-in-qemuBuildMemoryCellBackendStr.patch

404507
From 5d839559bfdaf17dd1c550eb451c64fcac7079b3 Mon Sep 17 00:00:00 2001
404507
Message-Id: <5d839559bfdaf17dd1c550eb451c64fcac7079b3@dist-git>
404507
From: Michal Privoznik <mprivozn@redhat.com>
404507
Date: Thu, 9 Nov 2017 16:06:44 +0100
404507
Subject: [PATCH] qemu: Set alias for memory cell in
404507
 qemuBuildMemoryCellBackendStr
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1461214
404507
404507
Very soon qemuBuildMemoryBackendStr() is going to use memory cell
404507
aliases. Therefore set one. At the same time, move it a bit
404507
further - if virAsprintf() fails, there's no point in setting
404507
rest of the members.
404507
404507
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
404507
Reviewed-by: John Ferlan <jferlan@redhat.com>
404507
(cherry picked from commit d52e6043bc5b19484ce5489345f9b9be61d95c1c)
404507
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 src/qemu/qemu_command.c | 7 ++++---
404507
 1 file changed, 4 insertions(+), 3 deletions(-)
404507
404507
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
404507
index 9f346c3649..57c855c047 100644
404507
--- a/src/qemu/qemu_command.c
404507
+++ b/src/qemu/qemu_command.c
404507
@@ -3542,12 +3542,13 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
404507
     unsigned long long memsize = virDomainNumaGetNodeMemorySize(def->numa,
404507
                                                                 cell);
404507
 
404507
+    if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
404507
+        goto cleanup;
404507
+
404507
     *backendStr = NULL;
404507
     mem.size = memsize;
404507
     mem.targetNode = cell;
404507
-
404507
-    if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
404507
-        goto cleanup;
404507
+    mem.info.alias = alias;
404507
 
404507
     if ((rc = qemuBuildMemoryBackendStr(&props, &backendType, cfg, priv->qemuCaps,
404507
                                         def, &mem, priv->autoNodeset, false)) < 0)
404507
-- 
404507
2.15.0
404507