[virt-tools-list] [virt-manager PATCH] disable adding virtio disk with device type 'LUN'

Cole Robinson crobinso at redhat.com
Mon Jan 20 15:34:21 UTC 2014


On 01/20/2014 07:33 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> 
> We should not encourage user use device type 'LUN'
> with virtio bus.
> This patch will disable device type combobox
> if user selected virtio bus.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  virtManager/addhardware.py | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
> index d7ee161..2114d1b 100644
> --- a/virtManager/addhardware.py
> +++ b/virtManager/addhardware.py
> @@ -577,6 +577,8 @@ class vmmAddHardware(vmmGObjectUI):
>          cdrom_buses = ["ide", "scsi"]
>          lun_buses = ["virtio", "virtio-scsi"]
>  
> +        self.widget("config-storage-devtype").set_sensitive(True)
> +
>          if bus in disk_buses:
>              model.append([virtinst.VirtualDisk.DEVICE_DISK,
>                            "drive-harddisk", _("Disk device")])
> @@ -587,6 +589,8 @@ class vmmAddHardware(vmmGObjectUI):
>              model.append([virtinst.VirtualDisk.DEVICE_CDROM,
>                            "media-cdrom", _("CDROM device")])
>          if bus in lun_buses:
> +            if bus == "virtio":
> +                self.widget("config-storage-devtype").set_sensitive(False)
>              model.append([virtinst.VirtualDisk.DEVICE_LUN,
>                            "drive-harddisk", _("LUN device")])
>  
> 

I would just remove "virtio" from the lun_buses list, that will do it.

Though the idea of disabling the 'device' combo if there's only one available
option isn't a bad idea, it should just be a separate patch, and applied
equally to all device types. And rather than disable the combo box I'd replace
it with a label in that case. (You don't need to do this, I'm just throwing an
idea out there).

Thanks,
Cole




More information about the virt-tools-list mailing list