[PATCH virt-manager] Fix uninitialized controller index
Cole Robinson
crobinso at redhat.com
Tue Dec 13 19:22:16 UTC 2022
On 12/7/22 5:20 PM, Charles Arnold wrote:
> 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
>
>
Thanks for the patch. I commented on your PR, let's follow up there:
https://github.com/virt-manager/virt-manager/pull/459
- Cole
More information about the virt-tools-list
mailing list