[virt-tools-list] [virt-manager PATCH] VirtualCharDevice: Enable channels with char devices other than spicevmc

Cole Robinson crobinso at redhat.com
Thu Aug 8 18:35:45 UTC 2013


On 08/07/2013 07:04 PM, Tomoki Sekiyama wrote:
> Currently, virt-manager supports adding spicevmc channel, and cannot add
> channels with char device backends like pty or unix, which is often used by
> guest agents. On the other hand, spicevmc shows up for serial and parallel
> devices, that causes an error if chosen.
> 
> This enables virt-manager to add channels with a char device backend other
> than spicevmc, and hides spicevmc from non-channel devices.
> 
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama at hds.com>
> ---
>  virtinst/VirtualCharDevice.py |   12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/virtinst/VirtualCharDevice.py b/virtinst/VirtualCharDevice.py
> index 4f4dcdd..95b4166 100644
> --- a/virtinst/VirtualCharDevice.py
> +++ b/virtinst/VirtualCharDevice.py
> @@ -38,9 +38,10 @@ class _VirtualCharDevice(VirtualDevice):
>      TYPE_UDP      = "udp"
>      TYPE_UNIX     = "unix"
>      TYPE_SPICEVMC = "spicevmc"
> -    TYPES  = [TYPE_PTY, TYPE_DEV, TYPE_STDIO, TYPE_FILE, TYPE_VC,
> -              TYPE_PIPE, TYPE_NULL, TYPE_TCP, TYPE_UDP, TYPE_UNIX,
> -              TYPE_SPICEVMC]
> +    _TYPES_FOR_ALL = [TYPE_PTY, TYPE_DEV, TYPE_STDIO, TYPE_FILE, TYPE_VC,
> +                      TYPE_PIPE, TYPE_NULL, TYPE_TCP, TYPE_UDP, TYPE_UNIX]
> +    _TYPES_FOR_CHANNEL = [TYPE_SPICEVMC]
> +    TYPES = _TYPES_FOR_ALL
>  
>      MODE_CONNECT = "connect"
>      MODE_BIND = "bind"
> @@ -232,7 +233,7 @@ class _VirtualCharDevice(VirtualDevice):
>                             default_cb=_get_default_protocol)
>  
>      def _get_default_target_type(self):
> -        if self.type == self.TYPE_SPICEVMC:
> +        if self.virtual_device_type == "channel":
>              return self.CHANNEL_TARGET_VIRTIO
>          return None
>      target_type = XMLProperty(xpath="./target/@type",
> @@ -268,7 +269,8 @@ class VirtualParallelDevice(_VirtualCharDevice):
>  
>  class VirtualChannelDevice(_VirtualCharDevice):
>      virtual_device_type = "channel"
> -    TYPES = [_VirtualCharDevice.TYPE_SPICEVMC]
> +    TYPES = _VirtualCharDevice._TYPES_FOR_CHANNEL + \
> +            _VirtualCharDevice._TYPES_FOR_ALL
>  
>  
>  VirtualConsoleDevice.register_type()
> 

Thanks, pushed now.

- Cole




More information about the virt-tools-list mailing list