Subject: Fix uninitialized controller index
From: Charles Arnold carnold@xxxxxxxx Tue Nov 15 08:17:23 2022 -0700
Date: Tue Nov 15 08:17:23 2022 -0700:
Git: fc8f0027a54ab8405e584398ca6d31d7c2108065
When adding a second virtio-scsi controller to a guest from the
Add Hardware dialog an exception is thrown.
Error building device XML: unsupported operand type(s) for +: 'NoneType'
and 'int'
This happens because the index for the first controller created
was not initialized to zero.
Signed-off-by: Charles Arnold <carnold@xxxxxxxx>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 0a8e33d3..fd576839 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -1562,6 +1562,8 @@ class vmmAddHardware(vmmGObjectUI):
if len(controller_num) > 0:
index_new = max([x.index for x in controller_num]) + 1
dev.index = index_new
+ else:
+ dev.index = 0
dev.type = controller_type