1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

libxl: Fix node device detach when driver unspecified

Commit 887dd0d331 caused a small regression in NodeDeviceDetach in the libxl
driver when the 'driver' parameter is not specified. E.g.

# virsh nodedev-detach pci_0000_0a_10_0
error: Failed to detach device pci_0000_0a_10_0
error: An error occurred, but the cause is unknown

If the driver name is not specified, NULL is passed to
virDomainDriverNodeDeviceDetachFlags, in which case virPCIDeviceSetStubDriver
is never called to set the stub to pciback. Fix it by setting the driver to
"xen" if it is not specified when invoking NodeDeviceDetach.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Jim Fehlig 2021-03-01 15:41:44 -07:00
parent b0ec72d764
commit ee3dc2c2c8

View File

@ -5776,7 +5776,10 @@ libxlNodeDeviceDetachFlags(virNodeDevicePtr dev,
virCheckFlags(0, -1);
if (driverName && STRNEQ(driverName, "xen")) {
if (!driverName)
driverName = "xen";
if (STRNEQ(driverName, "xen")) {
virReportError(VIR_ERR_INVALID_ARG,
_("unsupported driver name '%s'"), driverName);
return -1;