]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainNamespaceTeardownMemory: Deduplicate code
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 21 Jul 2020 13:09:30 +0000 (15:09 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 3 Aug 2020 17:59:42 +0000 (19:59 +0200)
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>
src/qemu/qemu_namespace.c

index 6a1fececd7d2225264f44ff957efb78ddf633220..4adfaa6ad6b52492c4de790639999a57955d9287 100644 (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;