Typecast the controller type variable to the appropriate type and add
the missing controller types for future extension.
Note that we currently allow only unplug of
VIR_DOMAIN_CONTROLLER_TYPE_SCSI thus the other controller types which
are not implemented return false now.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 124f60912f..2c12ef60af 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5392,20 +5392,28 @@ static bool
qemuDomainControllerIsBusy(virDomainObjPtr vm,
virDomainControllerDefPtr detach)
{
- switch (detach->type) {
+ switch ((virDomainControllerType) detach->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
case VIR_DOMAIN_CONTROLLER_TYPE_FDC:
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
+ case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
return qemuDomainDiskControllerIsBusy(vm, detach);
- case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL:
case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
+ case VIR_DOMAIN_CONTROLLER_TYPE_USB:
+ case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
+ case VIR_DOMAIN_CONTROLLER_TYPE_ISA:
+ /* detach of the controller types above is not yet supported */
+ return false;
+
+ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS:
+ /* qemu driver doesn't support xenbus */
+ return false;
+
+ case VIR_DOMAIN_CONTROLLER_TYPE_LAST:
default:
- /* libvirt does not support sata controller, and does not support to
- * detach virtio and smart card controller.
- */
- return true;
+ return false;
}
}
--
2.28.0