mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
hostdev: Stop early if unmanaged devices have not been detached
Unmanaged devices, as the name suggests, are not detached automatically from the host by libvirt before being attached to a guest: it's the user's responsability to detach them manually beforehand. If that preliminary step has not been performed, the attach operation can't complete successfully. Instead of relying on the lower layers to error out with cryptic messages such as error: Failed to attach device from /tmp/hostdev.xml error: Path '/dev/vfio/12' is not accessible: No such file or directory prevent the situation altogether and provide the user with a more useful error message.
This commit is contained in:
parent
df490e7c9b
commit
6da6bf2f30
@ -619,6 +619,12 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
|
||||
virPCIDeviceGetName(pci));
|
||||
if (virPCIDeviceListAddCopy(mgr->inactivePCIHostdevs, pci) < 0)
|
||||
goto reattachdevs;
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
_("Unmanaged PCI device %s must be manually "
|
||||
"detached from the host"),
|
||||
virPCIDeviceGetName(pci));
|
||||
goto reattachdevs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user