mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
qemuDomainNamespaceTeardownRNG: Deduplicate code
We can use qemuDomainSetupRNG() 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:
parent
3d74d6e283
commit
b9338334d5
@ -1567,23 +1567,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 && qemuNamespaceUnlinkPath(vm, path) < 0)
|
||||
if (qemuNamespaceUnlinkPaths(vm, (const char **) paths) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user