[PATCH virt-manager] Fix uninitialized controller index
Charles Arnold
carnold at suse.com
Wed Dec 7 22:20:09 UTC 2022
Subject: Fix uninitialized controller index
From: Charles Arnold carnold at suse.com 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 at suse.com>
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
More information about the virt-tools-list
mailing list