From 8aead7619c8d6ba3ae518068c67bc061015146c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 28 Apr 2016 14:22:09 +0200 Subject: [PATCH] virtinst: add listen=none graphics option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- man/virt-install.pod | 9 +++++++-- .../compare/virt-install-many-devices.xml | 4 ++++ tests/clitest.py | 1 + virtinst/cli.py | 11 ++++++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/man/virt-install.pod b/man/virt-install.pod index 0bc3d8c27..05376936c 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -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 diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml index 77c72a3d0..29ff54f60 100644 --- a/tests/cli-test-xml/compare/virt-install-many-devices.xml +++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml @@ -214,6 +214,10 @@ + + + + diff --git a/tests/clitest.py b/tests/clitest.py index 54ad0c348..01ce4bac3 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -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 \ diff --git a/virtinst/cli.py b/virtinst/cli.py index 170f0b637..6b7310d83 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -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")