Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit fcd8ba7

Browse files
elmarcocrobinso
authored andcommitted
A few spice tweaks to simplify setup
If Spice is enabled: - use QXL video device - add a spicevmc char device for the agent channel Updated since v1: - added some blurb in virt-install.pod.in that --graphics spice will add --video qxl and --channel spicevmc - fixed the test_cli after the virtio port name got a default value - check that spicevmc is supported before using it crobinso edit: shortened some long lines
1 parent be80b24 commit fcd8ba7

4 files changed

Lines changed: 36 additions & 3 deletions

File tree

man/en/virt-install.pod.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ Export the guest's console using the Spice protocol. Spice allows advanced
592592
features like audio and USB device streaming, as well as improved graphical
593593
performance.
594594

595+
Using spice graphic type will work as if those arguments were given:
596+
597+
--video qxl --channel spicevmc
598+
595599
none
596600

597601
No graphical console will be allocated for the guest. Fully virtualized guests

tests/cli-test-xml/compare/kvm-machine.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
<input type='tablet' bus='usb'/>
2626
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'/>
2727
<console type='pty'/>
28+
<channel type='spicevmc'>
29+
<target type='virtio' name='com.redhat.spice.0'/>
30+
</channel>
2831
<video>
29-
<model type='cirrus'/>
32+
<model type='qxl'/>
3033
</video>
3134
</devices>
3235
</domain>

tests/xmlconfig-xml/boot-many-devices.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<model type='cirrus' vram='10240' heads='3'/>
7070
</video>
7171
<video>
72-
<model type='cirrus'/>
72+
<model type='qxl'/>
7373
</video>
7474
<video>
7575
<model type='qxl'/>

virtinst/Guest.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,8 @@ def _set_defaults(self, devlist_func, remove_func):
14121412
soundtype = VirtualDevice.VIRTUAL_DEV_AUDIO
14131413
videotype = VirtualDevice.VIRTUAL_DEV_VIDEO
14141414
inputtype = VirtualDevice.VIRTUAL_DEV_INPUT
1415+
gfxtype = VirtualDevice.VIRTUAL_DEV_GRAPHICS
1416+
channeltype = VirtualDevice.VIRTUAL_DEV_CHANNEL
14151417

14161418
# Set default input values
14171419
input_type = self._lookup_device_param(inputtype, "type")
@@ -1442,11 +1444,35 @@ def _set_defaults(self, devlist_func, remove_func):
14421444
sound.model = sound_model
14431445

14441446
# Set video device model
1445-
video_model = self._lookup_device_param(videotype, "model_type")
1447+
# QXL device (only if we use spice) - safe even if guest is VGA only
1448+
def has_spice():
1449+
for gfx in devlist_func(gfxtype):
1450+
if gfx.type == gfx.TYPE_SPICE:
1451+
return True
1452+
if has_spice():
1453+
video_model = "qxl"
1454+
else:
1455+
video_model = self._lookup_device_param(videotype, "model_type")
1456+
14461457
for video in devlist_func(videotype):
14471458
if video.model_type == video.MODEL_DEFAULT:
14481459
video.model_type = video_model
14491460

1461+
# Spice agent channel (only if we use spice)
1462+
def has_spice_agent():
1463+
for chn in devlist_func(channeltype):
1464+
if chn.char_type == chn.CHAR_SPICEVMC:
1465+
return True
1466+
1467+
if (has_spice() and
1468+
not has_spice_agent() and
1469+
support.check_conn_support(self.conn,
1470+
support.SUPPORT_CONN_HV_CHAR_SPICEVMC)):
1471+
agentdev = VirtualCharDevice.get_dev_instance(self.conn,
1472+
VirtualCharDevice.DEV_CHANNEL,
1473+
VirtualCharDevice.CHAR_SPICEVMC)
1474+
self.add_device(agentdev)
1475+
14501476
# Generate UUID
14511477
if self.uuid is None:
14521478
found = False

0 commit comments

Comments
 (0)