qemu: Set alias for memory cell in qemuBuildMemoryCellBackendStr

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>
This commit is contained in:
Michal Privoznik 2017-11-07 15:12:33 +01:00
parent ef7e6ee281
commit d52e6043bc

View File

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