2021-03-10 19:42:14 +01:00
|
|
|
commit ee3dc2c2c8e5b2d3976e43dde95bc0aeeafbef4f
|
2021-03-02 01:57:27 +01:00
|
|
|
Author: Jim Fehlig <jfehlig@suse.com>
|
|
|
|
Date: Mon Mar 1 15:41:44 2021 -0700
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2021-03-10 19:42:14 +01:00
|
|
|
# virsh nodedev-detach pci_0000_0a_10_0
|
2021-03-02 01:57:27 +01:00
|
|
|
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>
|
2021-03-10 19:42:14 +01:00
|
|
|
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
2021-03-02 01:57:27 +01:00
|
|
|
|
2021-03-10 19:42:14 +01:00
|
|
|
Index: libvirt-7.1.0/src/libxl/libxl_driver.c
|
|
|
|
===================================================================
|
|
|
|
--- libvirt-7.1.0.orig/src/libxl/libxl_driver.c
|
|
|
|
+++ libvirt-7.1.0/src/libxl/libxl_driver.c
|
|
|
|
@@ -5777,7 +5777,10 @@ libxlNodeDeviceDetachFlags(virNodeDevice
|
2021-03-02 01:57:27 +01:00
|
|
|
|
|
|
|
virCheckFlags(0, -1);
|
|
|
|
|
2021-03-10 19:42:14 +01:00
|
|
|
- if (driverName && STRNEQ(driverName, "xen")) {
|
2021-03-02 01:57:27 +01:00
|
|
|
+ if (!driverName)
|
|
|
|
+ driverName = "xen";
|
|
|
|
+
|
2021-03-10 19:42:14 +01:00
|
|
|
+ if (STRNEQ(driverName, "xen")) {
|
2021-03-02 01:57:27 +01:00
|
|
|
virReportError(VIR_ERR_INVALID_ARG,
|
|
|
|
_("unsupported driver name '%s'"), driverName);
|
2021-03-10 19:42:14 +01:00
|
|
|
return -1;
|