addhardware: Correctly calculate virtio-scsi controller index
Because sata, usb and scsi use same device prefix: sd*, They will be included into occupied list while we add virtio-scsi disks, This is wrong and may cause adding additional virtio-scsi controller. How to reproduce: 1. fresh install a qemu guest. 2. add 6 virtual USB disks. 3. add disk A on scsi bus. (then a virtio-scsi controller 0 will be added automatically) 4. add disk B on scsi bus. 5. observe. Expected: disk A and disk B should be connected to virtio-scsi controller 0 because controller 0 has enough available slots. Actual: disk A was connected to virtio-scsi controller 0. An additional virtio-scsi controller 1 was added and disk B was connected to it because virt-manager thought the virtio-scsi controller 0 doesn't have available slot. Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
parent
7fc7e94f21
commit
2eb455c97f
|
@ -1456,7 +1456,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|||
# Save occupied places per controller
|
||||
occupied = {}
|
||||
for d in used_disks:
|
||||
if d.get_target_prefix() == disk.get_target_prefix():
|
||||
if (d.get_target_prefix() == disk.get_target_prefix() and
|
||||
d.bus == "scsi"):
|
||||
num = virtinst.VirtualDisk.target_to_num(d.target)
|
||||
idx = num // 7
|
||||
if idx not in occupied:
|
||||
|
|
Loading…
Reference in New Issue