[libvirt] [PATCH] init cont->idx correctly

Steps to reproduce this bug: 1. # virsh attach-disk --target sdb ... 2. # virsh attach-disk --target sdh ... error: Failed to attach disk error: operation failed: target scsi:0 already exists sdh uses scsi:1, rather than scsi:0. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> --- src/qemu/qemu_hotplug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c334f52..670e7d3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -321,7 +321,7 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver, return NULL; } cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI; - cont->idx = 0; + cont->idx = controller; cont->model = -1; VIR_INFO0("No SCSI controller present, hotplugging one"); -- 1.7.1

On Mon, Jan 31, 2011 at 02:15:41PM +0800, Wen Congyang wrote:
Steps to reproduce this bug: 1. # virsh attach-disk --target sdb ... 2. # virsh attach-disk --target sdh ... error: Failed to attach disk error: operation failed: target scsi:0 already exists
sdh uses scsi:1, rather than scsi:0.
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
--- src/qemu/qemu_hotplug.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c334f52..670e7d3 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -321,7 +321,7 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver, return NULL; } cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI; - cont->idx = 0; + cont->idx = controller; cont->model = -1;
VIR_INFO0("No SCSI controller present, hotplugging one");
Okay, based on the earlier lookup code in that function that looks like the obvious fix, ACK, and pushed, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (2)
-
Daniel Veillard
-
Wen Congyang