virtinst: add listen=none graphics option

Add a special listen value to disable any extra display server listening
socket. This is necessary now that qemu prevents starting a spice+virgl
VM with listening sockets (until spice allows remoting with virgl).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2016-04-28 14:22:09 +02:00 committed by Cole Robinson
parent 4506d49ff5
commit 8aead7619c
4 changed files with 22 additions and 3 deletions

View File

@ -964,8 +964,13 @@ Specify the spice tlsport.
Address to listen on for VNC/Spice connections. Default is typically 127.0.0.1
(localhost only), but some hypervisors allow changing this globally (for
example, the qemu driver default can be changed in /etc/libvirt/qemu.conf).
Use 0.0.0.0 to allow access from other machines. This is use by 'vnc' and
'spice'
Use 0.0.0.0 to allow access from other machines.
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).
This is used by 'vnc' and 'spice'
=item B<keymap>

View File

@ -214,6 +214,10 @@
<gl enable="yes"/>
<image compression="off"/>
</graphics>
<graphics type="spice" autoport="no">
<gl enable="yes"/>
<image compression="off"/>
</graphics>
<serial type="tcp">
<source mode="bind" host="127.0.0.1" service="2222"/>
<protocol type="telnet"/>

View File

@ -477,6 +477,7 @@ c.add_compare(""" \
--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=none \
\
--controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 \
--controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 \

View File

@ -1880,10 +1880,19 @@ class ParserGraphics(VirtCLIParser):
return
inst.type = val
def set_listen_cb(opts, inst, cliname, val):
if val == "none":
inst.port = None
inst.tlsPort = None
inst.listen = None
inst.autoport = False
else:
inst.listen = val
self.set_param(None, "type", setter_cb=set_type_cb)
self.set_param("port", "port")
self.set_param("tlsPort", "tlsport")
self.set_param("listen", "listen")
self.set_param("listen", "listen", setter_cb=set_listen_cb)
self.set_param(None, "keymap", setter_cb=set_keymap_cb)
self.set_param("passwd", "password")
self.set_param("passwdValidTo", "passwordvalidto")