1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-13 17:18:01 +03:00

qemuDomainNamespaceTeardownMemory: Deduplicate code

We can use qemuDomainSetupMemory() to obtain the path that we
need to unlink() from within domain's namespace.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2020-07-21 15:09:30 +02:00
parent 0983833ed9
commit 4e4dc63ca8

View File

@ -1491,13 +1491,15 @@ int
qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
virDomainMemoryDefPtr mem)
{
VIR_AUTOSTRINGLIST paths = NULL;
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
return 0;
if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM)
return 0;
if (qemuDomainSetupMemory(mem, &paths) < 0)
return -1;
if (qemuNamespaceUnlinkPath(vm, mem->nvdimmPath) < 0)
if (qemuNamespaceUnlinkPaths(vm, (const char **) paths) < 0)
return -1;
return 0;