On Mon, Jun 27, 2016 at 04:43:46PM +0200, Marc Hartmayer wrote:
The commit "qemu: hot-plug: Assume support for -device in
qemuDomainAttachSCSIDisk" dropped the code for the automatic SCSI
controller creation used in SCSI disk hot-plugging. If we are
hot-plugging a SCSI disk to a domain and there is no proper SCSI
controller defined, it results in an "error: internal error: Could not
find scsi controller with index X required for device" error.
For that reason reverting a hunk of the commit
d4d32005d6e8b2cc0a2f26b483ca1de10171db6d.
This patch also adds an extra comment to the code to clarify the
loop.
Reviewed-by: Boris Fiuczynski <fiuczy(a)linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk(a)linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay(a)linux.vnet.ibm.com>
---
I just tested with the attached trivial script, which hot-plugs two SCSI
disks on the _second_ controller. With your patch, controlle 2, and all
the smaller ones below it (1, 0) are auto-generated:
$ sudo ./run ./tools/virsh start cvm1
$ sudo ./run ./tools/virsh list
Id Name State
----------------------------------------------------
6 cvm1 running
$ sudo ./run ./tools/virsh domblklist cvm1
Target Source
------------------------------------------------
vda /export/vmimages/sn1.qcow2
$ sudo ./run ./tools/virsh dumpxml cvm1 | grep controller.*scsi
$ echo $?
1
$ ./attach-scsi-device.bash
$ sudo ./run ./tools/virsh domblklist cvm1
Target Source
------------------------------------------------
vda /export/vmimages/sn1.qcow2
sdb /export/vmimages/b.raw
sdc /export/vmimages/c.raw
$ sudo ./run ./tools/virsh dumpxml cvm1 | grep controller.*scsi
<controller type='scsi' index='0'>
<controller type='scsi' index='1'>
<controller type='scsi' index='2'>
$ sudo ./run ./tools/virsh dumpxml cvm1 | grep scsi
<target dev='sdb' bus='scsi'/>
<alias name='scsi2-0-2'/>
<target dev='sdc' bus='scsi'/>
<alias name='scsi2-0-3'/>
<controller type='scsi' index='0'>
<alias name='scsi0'/>
<controller type='scsi' index='1'>
<alias name='scsi1'/>
<controller type='scsi' index='2'>
<alias name='scsi2'/>
So:
Tested-by: Kashyap Chamarthy <kchamart(a)redhat.com>
[...]
--
/kashyap