mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
@@ -1491,13 +1491,15 @@ int
|
|||||||
qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
|
qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
|
||||||
virDomainMemoryDefPtr mem)
|
virDomainMemoryDefPtr mem)
|
||||||
{
|
{
|
||||||
|
VIR_AUTOSTRINGLIST paths = NULL;
|
||||||
|
|
||||||
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM)
|
if (qemuDomainSetupMemory(mem, &paths) < 0)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
if (qemuNamespaceUnlinkPath(vm, mem->nvdimmPath) < 0)
|
if (qemuNamespaceUnlinkPaths(vm, (const char **) paths) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user