Re: [virt-manager PATCH 5/7] addhardware: Correctly calculate virtio-scsi controller index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/06/2017 07:52 AM, Lin Ma wrote:
> 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@xxxxxxxx>
> ---
>  virtManager/addhardware.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
> index c6402e0d..d661602d 100644
> --- a/virtManager/addhardware.py
> +++ b/virtManager/addhardware.py
> @@ -1457,7 +1457,8 @@ class vmmAddHardware(vmmGObjectUI):
>          # Save occupied places per controller
>          occupied = collections.defaultdict(int)
>          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)
>                  occupied[num / 7] += 1
>          for c in ctrls_scsi:
> 

Rebased on top of my change for patch #4 and pushed. Though maybe this
can be adapted to use the compare_controller function too

- Cole

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux