cli: add --graphics listen=socket support

This is the new style socket support, where we request libvirt to
allocate a socket path for us. Plus this is the only way to enable
socket support for type=spice
This commit is contained in:
Cole Robinson 2016-06-11 16:51:33 -04:00
parent 4c0b761cfb
commit 14fd99255b
5 changed files with 24 additions and 3 deletions

View File

@ -975,6 +975,9 @@ Use 'none' to specify that the display server should not listen on any
port. The display server can be accessed only locally through
libvirt unix socket (virt-viewer with --attach for instance).
Use 'socket' to have the VM listen on a libvirt generated unix socket
path on the host filesystem.
This is used by 'vnc' and 'spice'
=item B<keymap>

View File

@ -219,6 +219,7 @@
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
<gl enable="yes"/>
<image compression="off"/>
<listen type="socket"/>
</graphics>
<graphics type="spice" autoport="no">
<gl enable="yes"/>

View File

@ -0,0 +1,13 @@
<device path="/dev/tzz"/>
</backend>
</tpm>
- <graphics type="vnc" port="-1" autoport="yes">
- <listen type="address"/>
+ <graphics type="vnc" autoport="no">
+ <listen type="none"/>
</graphics>
<sound model="sb16"/>
<sound model="es1370"/>
Domain 'test-for-virtxml' defined successfully.
Changes will take effect after the next domain shutdown.

View File

@ -477,7 +477,7 @@ c.add_compare(""" \
--graphics vnc,port=5950,listen=1.2.3.4,keymap=ja,password=foo \
--graphics spice,port=5950,tlsport=5950,listen=1.2.3.4,keymap=ja \
--graphics spice,image_compression=foo,streaming_mode=bar,clipboard_copypaste=yes,mouse_mode=client,filetransfer_enable=on \
--graphics spice,gl=yes \
--graphics spice,gl=yes,listen=socket \
--graphics spice,gl=yes,listen=none \
\
--controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 \
@ -528,7 +528,7 @@ c.add_compare(""" \
--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp \
\
--panic iobase=507 \
""", "many-devices", compare_check="1.3.1") # compare_check=rbd format output
""", "many-devices", compare_check="1.3.6") # compare_check=graphics listen=socket support
# Test the implied defaults for gl=yes setting virgl=on
c.add_compare(""" \
@ -841,7 +841,7 @@ c.add_compare("--disk /dev/zero,perms=ro,startup_policy=optional", "edit-simple-
c.add_compare("--disk path=", "edit-simple-disk-remove-path")
c.add_compare("--network source=br0,type=bridge,model=virtio,mac=", "edit-simple-network")
c.add_compare("--graphics tlsport=5902,keymap=ja", "edit-simple-graphics", compare_check="1.3.5") # compare_check=new graphics listen output
c.add_compare("--graphics listen=None", "edit-graphics-listen-none", compare_check="1.3.6") # compare_check=graphics listen=none support
c.add_compare("--graphics listen=none", "edit-graphics-listen-none", compare_check="1.3.6") # compare_check=graphics listen=none support
c.add_compare("--controller index=15,model=lsilogic", "edit-simple-controller")
c.add_compare("--controller index=15,model=lsilogic", "edit-simple-controller")
c.add_compare("--smartcard type=spicevmc", "edit-simple-smartcard")

View File

@ -1951,6 +1951,10 @@ class ParserGraphics(VirtCLIParser):
def set_listen_cb(opts, inst, cliname, val):
if val == "none":
inst.set_listen_none()
elif val == "socket":
inst.remove_all_listens()
obj = inst.add_listen()
obj.type = "socket"
else:
inst.listen = val