[virt-tools-list] [virt-manager PATCH 3/5] details: Disallow removing virtio-serial controller if devices attach to it

Cole Robinson crobinso at redhat.com
Tue Jul 31 14:59:39 UTC 2018


On 07/18/2018 06:00 AM, Lin Ma wrote:
> Signed-off-by: Lin Ma <lma at suse.com>
> ---
>   virtManager/details.py | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/virtManager/details.py b/virtManager/details.py
> index e3edbe86..00e18949 100644
> --- a/virtManager/details.py
> +++ b/virtManager/details.py
> @@ -3041,6 +3041,19 @@ class vmmDetails(vmmGObjectUI):
>                       model.append([infoStr])
>               uiutil.set_grid_row_visible(self.widget("device-list-label"), True)
>               uiutil.set_grid_row_visible(self.widget("controller-device-box"), True)
> +        elif controller.type == "virtio-serial":
> +            for dev in self.vm.xmlobj.devices.channel:
> +                if dev.address.compare_controller(controller, dev.address.type):
> +                    can_remove = False
> +                    break
> +            for dev in self.vm.xmlobj.devices.console:
> +                '''
> +                From libvirt's perspective, So far the console only works well
> +                on virtio-serial controller 0
> +                '''

We don't use this style of comment in the middle of functions (and most 
of the code uses """ style anyways). I tweaked it and pushed

Thanks,
Cole

> +                if controller.index == 0 and dev.target_type == "virtio":
> +                    can_remove = False
> +                    break
>   
>           self.widget("config-remove").set_sensitive(can_remove)
>   
> 




More information about the virt-tools-list mailing list