qemu_hotplug: remove qemuDomainAttachDeviceControllerLive

This function calls qemuDomainAttachControllerDevice for SCSI
controllers and reports an error for all other controllers.

Move the error inside qemuDomainAttachControllerDevice and delete this
wrapper.
This commit is contained in:
Ján Tomko 2015-12-09 17:27:12 +01:00
parent bec787ee9d
commit aaa42d905a
2 changed files with 8 additions and 22 deletions

View File

@ -7712,27 +7712,6 @@ qemuDomainUndefine(virDomainPtr dom)
return qemuDomainUndefineFlags(dom, 0);
}
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,
@ -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;

View File

@ -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"),