mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
qemuDomainNamespaceSetupHostdev: Create paths in one go
While qemuDomainNamespaceMknodPaths() doesn't actually create files in the namespace in one go (it forks for each path), it a few commits time it will. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c467b07e27
commit
9d8d42137a
@ -1655,6 +1655,8 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
|
||||
virDomainHostdevDefPtr hostdev)
|
||||
{
|
||||
g_autofree char *path = NULL;
|
||||
VIR_AUTOSTRINGLIST paths = NULL;
|
||||
size_t npaths = 0;
|
||||
|
||||
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
||||
return 0;
|
||||
@ -1662,12 +1664,16 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
|
||||
if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (path && qemuDomainNamespaceMknodPath(vm, path) < 0)
|
||||
if (path && virStringListAdd(&paths, path) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuHostdevNeedsVFIO(hostdev) &&
|
||||
!qemuDomainNeedsVFIO(vm->def) &&
|
||||
qemuDomainNamespaceMknodPath(vm, QEMU_DEV_VFIO) < 0)
|
||||
virStringListAdd(&paths, QEMU_DEV_VFIO) < 0)
|
||||
return -1;
|
||||
|
||||
npaths = virStringListLength((const char **) paths);
|
||||
if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths, npaths) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user