qemu_process: Drop needless check in qemuProcessNeedMemoryBackingPath()

The aim of this function is to return whether domain definition
and/or memory device that user intents to hotplug needs a private
path inside cfg->memoryBackingDir. The rule for the memory device
that's being hotplug includes checking whether corresponding
guest NUMA node needs memoryBackingDir. Well, while the rationale
behind makes sense it is not necessary to check for that really -
just a few lines above every guest NUMA node was checked exactly
for that.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2021-02-05 13:54:26 +01:00
parent 4d779874ef
commit 655f67c68a

View File

@ -3938,13 +3938,25 @@ qemuProcessNeedMemoryBackingPath(virDomainDef *def,
return true;
}
if (mem &&
mem->model == VIR_DOMAIN_MEMORY_MODEL_DIMM &&
(mem->access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT ||
(mem->targetNode >= 0 &&
virDomainNumaGetNodeMemoryAccessMode(def->numa, mem->targetNode)
!= VIR_DOMAIN_MEMORY_ACCESS_DEFAULT)))
return true;
if (mem) {
switch (mem->model) {
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
if (mem->access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT) {
/* No need to check for access mode on the target node,
* it was checked for in the previous loop. */
return true;
}
break;
case VIR_DOMAIN_MEMORY_MODEL_NONE:
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
case VIR_DOMAIN_MEMORY_MODEL_LAST:
/* Backed by user provided path. Not stored in memory
* backing dir anyway. */
break;
}
}
return false;
}