mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
addhardware: Fix backtrace when controller.index is None
When creating a new VM, in the customize wizard we can't depend on index= value being set (virtinst doesn't do it for example). For example, this causes a backtrace when adding two virtio-scsi controllers via the Customize wizard, or adding an extra virtio-scsi controller to an aarch64 CDROM install. Reported-by: Charles Arnold <carnold@suse.com> Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
75a25e3766
commit
67832d3097
@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
controller_num = [x for x in controllers if
|
||||
(x.type == controller_type)]
|
||||
if len(controller_num) > 0:
|
||||
index_new = max(x.index for x in controller_num) + 1
|
||||
index_new = max(int(x.index or 0) for x in controller_num) + 1
|
||||
dev.index = index_new
|
||||
|
||||
dev.type = controller_type
|
||||
|
Loading…
Reference in New Issue
Block a user