This function calls qemuDomainAttachControllerDevice for SCSI
controllers and reports an error for all other controllers.
Move the error inside qemuDomainAttachControllerDevice and delete this
wrapper.
---
src/qemu/qemu_driver.c | 23 +----------------------
src/qemu/qemu_hotplug.c | 7 +++++++
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 783a7cd..991fff5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7713,27 +7713,6 @@ qemuDomainUndefine(virDomainPtr dom)
}
static int
-qemuDomainAttachDeviceControllerLive(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- virDomainDeviceDefPtr dev)
-{
- virDomainControllerDefPtr cont = dev->data.controller;
- int ret = -1;
-
- switch (cont->type) {
- case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
- ret = qemuDomainAttachControllerDevice(driver, vm, cont);
- break;
- default:
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("'%s' controller cannot be hot plugged."),
- virDomainControllerTypeToString(cont->type));
- break;
- }
- return ret;
-}
-
-static int
qemuDomainAttachDeviceLive(virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
virDomainPtr dom)
@@ -7753,7 +7732,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
break;
case VIR_DOMAIN_DEVICE_CONTROLLER:
- ret = qemuDomainAttachDeviceControllerLive(driver, vm, dev);
+ ret = qemuDomainAttachControllerDevice(driver, vm, dev->data.controller);
if (!ret) {
alias = dev->data.controller->info.alias;
dev->data.controller = NULL;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1a61701..eae5418 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -444,6 +444,13 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
bool releaseaddr = false;
bool addedToAddrSet = false;
+ if (controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("'%s' controller cannot be hot plugged."),
+ virDomainControllerTypeToString(controller->type));
+ return -1;
+ }
+
if (virDomainControllerFind(vm->def, controller->type, controller->idx)
>= 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("target %s:%d already exists"),
--
2.4.6