[virt-tools-list] [PATCH] A few spice tweaks to simplify setup

Andrew Cathrow acathrow at redhat.com
Tue Mar 15 13:12:57 UTC 2011



Marc,

are you doing the same for virt-manager?

Aic


----- Original Message -----
> From: "Marc-André Lureau" <marcandre.lureau at redhat.com>
> To: virt-tools-list at redhat.com
> Sent: Tuesday, March 15, 2011 8:48:41 AM
> Subject: [virt-tools-list] [PATCH] A few spice tweaks to simplify setup
> If Spice is enabled:
> - use QXL video device
> - add a spicevmc char device for the agent channel
> ---
> tests/cli-test-xml/compare/kvm-machine.xml | 5 ++++-
> tests/xmlconfig-xml/boot-many-devices.xml | 2 +-
> virtinst/Guest.py | 24 +++++++++++++++++++++++-
> 3 files changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/cli-test-xml/compare/kvm-machine.xml
> b/tests/cli-test-xml/compare/kvm-machine.xml
> index 12196d7..09e6181 100644
> --- a/tests/cli-test-xml/compare/kvm-machine.xml
> +++ b/tests/cli-test-xml/compare/kvm-machine.xml
> @@ -25,8 +25,11 @@
> <input type='tablet' bus='usb'/>
> <graphics type='spice' port='-1' tlsPort='-1' autoport='yes'/>
> <console type='pty'/>
> + <channel type='spicevmc'>
> + <target type='virtio'/>
> + </channel>
> <video>
> - <model type='cirrus'/>
> + <model type='qxl'/>
> </video>
> </devices>
> </domain>
> diff --git a/tests/xmlconfig-xml/boot-many-devices.xml
> b/tests/xmlconfig-xml/boot-many-devices.xml
> index 65e83f6..5f057d8 100644
> --- a/tests/xmlconfig-xml/boot-many-devices.xml
> +++ b/tests/xmlconfig-xml/boot-many-devices.xml
> @@ -69,7 +69,7 @@
> <model type='cirrus' vram='10240' heads='3'/>
> </video>
> <video>
> - <model type='cirrus'/>
> + <model type='qxl'/>
> </video>
> <video>
> <model type='qxl'/>
> diff --git a/virtinst/Guest.py b/virtinst/Guest.py
> index de251e1..8755668 100644
> --- a/virtinst/Guest.py
> +++ b/virtinst/Guest.py
> @@ -1412,6 +1412,8 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
> soundtype = VirtualDevice.VIRTUAL_DEV_AUDIO
> videotype = VirtualDevice.VIRTUAL_DEV_VIDEO
> inputtype = VirtualDevice.VIRTUAL_DEV_INPUT
> + gfxtype = VirtualDevice.VIRTUAL_DEV_GRAPHICS
> + channeltype = VirtualDevice.VIRTUAL_DEV_CHANNEL
> 
> # Set default input values
> input_type = self._lookup_device_param(inputtype, "type")
> @@ -1442,11 +1444,31 @@ class
> Guest(XMLBuilderDomain.XMLBuilderDomain):
> sound.model = sound_model
> 
> # Set video device model
> - video_model = self._lookup_device_param(videotype, "model_type")
> + # QXL device (only if we use spice) - safe even if guest is VGA only
> + def has_spice():
> + for gfx in devlist_func(gfxtype):
> + if gfx.type == gfx.TYPE_SPICE:
> + return True
> + if has_spice():
> + video_model = "qxl"
> + else:
> + video_model = self._lookup_device_param(videotype, "model_type")
> for video in devlist_func(videotype):
> if video.model_type == video.MODEL_DEFAULT:
> video.model_type = video_model
> 
> + # Spice agent channel (only if we use spice)
> + def has_spice_agent():
> + for chn in devlist_func(channeltype):
> + if chn.char_type == chn.CHAR_SPICEVMC:
> + return True
> +
> + if has_spice() and not has_spice_agent():
> + agentdev = VirtualCharDevice.get_dev_instance(self.conn,
> + VirtualCharDevice.DEV_CHANNEL,
> + VirtualCharDevice.CHAR_SPICEVMC)
> + self.add_device(agentdev)
> +
> # Generate UUID
> if self.uuid is None:
> found = False
> --
> 1.7.4
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list




More information about the virt-tools-list mailing list