[virt-tools-list] [PATCH] A few spice tweaks to simplify setup
Cole Robinson
crobinso at redhat.com
Thu Mar 17 15:58:25 UTC 2011
On 03/15/2011 08:48 AM, Marc-André Lureau wrote:
> If Spice is enabled:
> - use QXL video device
> - add a spicevmc char device for the agent channel
I think the test XML needs to be updated, since spicevmc has a default
virtio port name in your latest patch.
I also added a support test for spicevmc:
http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=01aebd7722a7def6e1f1331920ed77eb6703fb1a
Please use that before adding the spicevmc by default, otherwise
--graphics spice will fail for libvirt 0.8.6 and 0.8.7 when it should be
able to work.
Please also add a note in virt-install.pod.in that --graphics spice will
add --video qxl and --channel spicevmc
Thanks,
Cole
> ---
> 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
More information about the virt-tools-list
mailing list