[libvirt] [PATCH 1/2] rename qemuDomainDetachSCSIDiskDevice to qemuDomainDetachDiskDevice

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@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

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> --- src/qemu/qemu_driver.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f4e52b1..2892dfe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4282,6 +4282,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom, } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); + } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) { + ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); } else { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- 1.7.1

On Mon, Mar 07, 2011 at 11:36:48AM +0800, Wen Congyang wrote:
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
--- src/qemu/qemu_driver.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f4e52b1..2892dfe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4282,6 +4282,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom, } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); + } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) { + ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); } else { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 03/07/2011 04:10 AM, Daniel P. Berrange wrote:
On Mon, Mar 07, 2011 at 11:36:48AM +0800, Wen Congyang wrote:
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
--- src/qemu/qemu_driver.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f4e52b1..2892dfe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4282,6 +4282,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom, } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) { ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); + } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) { + ret = qemuDomainDetachDiskDevice(driver, vm, dev, qemuCaps); } else { qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
ACK
I've pushed the series. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Mon, Mar 07, 2011 at 11:31:48AM +0800, Wen Congyang wrote:
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@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(-)
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Eric Blake
-
Wen Congyang