The way to detach a USB disk is the same as that to detach a SCSI
disk. Rename this function and we can use it to detach a USB disk.
Signed-off-by: Wen Congyang <wency(a)cn.fujitsu.com>
---
src/qemu/qemu_driver.c | 3 +--
src/qemu/qemu_hotplug.c | 13 +++++++------
src/qemu/qemu_hotplug.h | 8 ++++----
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0e891e8..f4e52b1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4281,8 +4281,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
ret = qemuDomainDetachPciDiskDevice(driver, vm, dev, qemuCaps);
}
else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
- ret = qemuDomainDetachSCSIDiskDevice(driver, vm, dev,
- qemuCaps);
+ ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps);
}
else {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index da07c29..0b822bf 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1221,10 +1221,10 @@ cleanup:
return ret;
}
-int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
- virDomainObjPtr vm,
- virDomainDeviceDefPtr dev,
- virBitmapPtr qemuCaps)
+int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
+ virDomainObjPtr vm,
+ virDomainDeviceDefPtr dev,
+ virBitmapPtr qemuCaps)
{
int i, ret = -1;
virDomainDiskDefPtr detach = NULL;
@@ -1241,8 +1241,9 @@ int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
}
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
- qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Underlying qemu does not support SCSI disk
removal"));
+ qemuReportError(VIR_ERR_OPERATION_FAILED,
+ _("Underlying qemu does not support %s disk removal"),
+ virDomainDiskBusTypeToString(dev->data.disk->bus));
goto cleanup;
}
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index c84d496..db3970c 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -77,10 +77,10 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
virBitmapPtr qemuCaps);
-int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
- virDomainObjPtr vm,
- virDomainDeviceDefPtr dev,
- virBitmapPtr qemuCaps);
+int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
+ virDomainObjPtr vm,
+ virDomainDeviceDefPtr dev,
+ virBitmapPtr qemuCaps);
int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
--
1.7.1