提交 e4d96324 编写于 作者: L Laine Stump

qemu_hotplug: remove extra function in middle of DetachController call chain

qemuDomainDetachDeviceControllerLive() just checks if the controller
type is SCSI, and then either returns failure, or calls
qemuDomainDetachControllerDevice().

Instead, lets just check for type != SCSI at the top of the latter
function, and call it directly.
Signed-off-by: NLaine Stump <laine@laine.org>
ACKed-by: NPeter Krempa <pkrempa@redhat.com>
上级 6a9c3fba
...@@ -5528,6 +5528,13 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver, ...@@ -5528,6 +5528,13 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
int idx, ret = -1; int idx, ret = -1;
virDomainControllerDefPtr detach = NULL; virDomainControllerDefPtr detach = NULL;
if (dev->data.controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("'%s' controller cannot be hot unplugged."),
virDomainControllerTypeToString(dev->data.controller->type));
return -1;
}
if ((idx = virDomainControllerFind(vm->def, if ((idx = virDomainControllerFind(vm->def,
dev->data.controller->type, dev->data.controller->type,
dev->data.controller->idx)) < 0) { dev->data.controller->idx)) < 0) {
...@@ -6170,27 +6177,6 @@ qemuDomainDetachLease(virQEMUDriverPtr driver, ...@@ -6170,27 +6177,6 @@ qemuDomainDetachLease(virQEMUDriverPtr driver,
} }
static int
qemuDomainDetachDeviceControllerLive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
bool async)
{
virDomainControllerDefPtr cont = dev->data.controller;
int ret = -1;
switch (cont->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
ret = qemuDomainDetachControllerDevice(driver, vm, dev, async);
break;
default :
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("'%s' controller cannot be hot unplugged."),
virDomainControllerTypeToString(cont->type));
}
return ret;
}
int int
qemuDomainDetachDeviceLive(virDomainObjPtr vm, qemuDomainDetachDeviceLive(virDomainObjPtr vm,
virDomainDeviceDefPtr dev, virDomainDeviceDefPtr dev,
...@@ -6204,7 +6190,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm, ...@@ -6204,7 +6190,7 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev, async); ret = qemuDomainDetachDeviceDiskLive(driver, vm, dev, async);
break; break;
case VIR_DOMAIN_DEVICE_CONTROLLER: case VIR_DOMAIN_DEVICE_CONTROLLER:
ret = qemuDomainDetachDeviceControllerLive(driver, vm, dev, async); ret = qemuDomainDetachControllerDevice(driver, vm, dev, async);
break; break;
case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_LEASE:
ret = qemuDomainDetachLease(driver, vm, dev->data.lease); ret = qemuDomainDetachLease(driver, vm, dev->data.lease);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册