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(a)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