We can use qemuDomainSetupRNG() to obtain the path that we
need to unlink() from within domain's namespace.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain_namespace.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namespace.c
index 7a329c0c4a..89d73b26ef 100644
--- a/src/qemu/qemu_domain_namespace.c
+++ b/src/qemu/qemu_domain_namespace.c
@@ -1568,23 +1568,15 @@ int
qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
virDomainRNGDefPtr rng)
{
- const char *path = NULL;
+ VIR_AUTOSTRINGLIST paths = NULL;
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
return 0;
- switch ((virDomainRNGBackend) rng->backend) {
- case VIR_DOMAIN_RNG_BACKEND_RANDOM:
- path = rng->source.file;
- break;
+ if (qemuDomainSetupRNG(rng, &paths) < 0)
+ return -1;
- case VIR_DOMAIN_RNG_BACKEND_EGD:
- case VIR_DOMAIN_RNG_BACKEND_BUILTIN:
- case VIR_DOMAIN_RNG_BACKEND_LAST:
- break;
- }
-
- if (path && qemuDomainNamespaceUnlinkPath(vm, path) < 0)
+ if (qemuDomainNamespaceUnlinkPaths(vm, (const char **) paths) < 0)
return -1;
return 0;
--
2.26.2