summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2016-06-11 16:51:33 -0400
committerCole Robinson <crobinso@redhat.com>2016-06-11 16:56:41 -0400
commit14fd99255b6960ca54a84696ac25731d7357337c (patch)
treea3664359102bfa10c229423f0d1a0ef8204157b2
parent4c0b761cfb6fcd9e310b238f274e0a07e2c4be2d (diff)
downloadvirt-manager-14fd99255b6960ca54a84696ac25731d7357337c.tar.gz
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
-rw-r--r--man/virt-install.pod3
-rw-r--r--tests/cli-test-xml/compare/virt-install-many-devices.xml1
-rw-r--r--tests/cli-test-xml/compare/virt-xml-edit-graphics-listen-none.xml13
-rw-r--r--tests/clitest.py6
-rw-r--r--virtinst/cli.py4
5 files changed, 24 insertions, 3 deletions
diff --git a/man/virt-install.pod b/man/virt-install.pod
index 1595f49d..dfbac82f 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -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>
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 4369e94b..713ae13a 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -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"/>
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-graphics-listen-none.xml b/tests/cli-test-xml/compare/virt-xml-edit-graphics-listen-none.xml
new file mode 100644
index 00000000..c86e45b4
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-edit-graphics-listen-none.xml
@@ -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. \ No newline at end of file
diff --git a/tests/clitest.py b/tests/clitest.py
index 46270a3d..1621ed02 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -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")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index c0daf7be..16eac565 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -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