提交 aaa42d90 编写于 作者: J Ján Tomko

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.
上级 bec787ee
......@@ -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;
......
......@@ -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"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册