From: Michal Privoznik Date: Tue, 21 Jul 2020 13:09:30 +0000 (+0200) Subject: qemuDomainNamespaceTeardownMemory: Deduplicate code X-Git-Tag: v6.7.0-rc1~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e4dc63ca873379525ec94de2d6199c9352ebde9;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 6a1fececd7..4adfaa6ad6 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -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;