[virt-tools-list] [PATCH 3/5] virtinst: add listen=none graphics option

Marc-André Lureau marcandre.lureau at redhat.com
Thu Apr 28 12:22:09 UTC 2016


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 at redhat.com>
---
 man/virt-install.pod                                     |  9 +++++++--
 tests/cli-test-xml/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 0bc3d8c..0537693 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<keymap>
 
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 e771cd3..d268cd9 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 @@
       <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"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index e67379a..ef96fe7 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 8a3f6ae..d6d8c4f 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1875,10 +1875,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")
-- 
2.7.4




More information about the virt-tools-list mailing list