mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemuDomainNamespaceTeardownHostdev: Unlink paths in one go
In my attempt to deduplicate the code, we can use qemuDomainSetupHostdev() to obtain the list of paths to unlink and then pass it to qemuDomainNamespaceUnlinkPaths() to unlink them in a single fork. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f7feac4ba8
commit
0983833ed9
@ -1450,20 +1450,18 @@ int
|
|||||||
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
|
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
|
||||||
virDomainHostdevDefPtr hostdev)
|
virDomainHostdevDefPtr hostdev)
|
||||||
{
|
{
|
||||||
g_autofree char *path = NULL;
|
VIR_AUTOSTRINGLIST paths = NULL;
|
||||||
|
|
||||||
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
|
if (qemuDomainSetupHostdev(vm,
|
||||||
|
hostdev,
|
||||||
|
true,
|
||||||
|
&paths) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (path && qemuNamespaceUnlinkPath(vm, path) < 0)
|
if (qemuNamespaceUnlinkPaths(vm, (const char **) paths) < 0)
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (qemuHostdevNeedsVFIO(hostdev) &&
|
|
||||||
!qemuDomainNeedsVFIO(vm->def) &&
|
|
||||||
qemuNamespaceUnlinkPath(vm, QEMU_DEV_VFIO) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user