virtinst: graphics: Add listen=none support

Not strictly needed for spice, but now available for vnc if
people want it
This commit is contained in:
Cole Robinson 2016-06-11 16:44:54 -04:00
parent 2b34831b26
commit 4c0b761cfb
6 changed files with 29 additions and 9 deletions

View File

@ -223,6 +223,7 @@
<graphics type="spice" autoport="no">
<gl enable="yes"/>
<image compression="off"/>
<listen type="none"/>
</graphics>
<serial type="tcp">
<source mode="bind" host="127.0.0.1" service="2222"/>

View File

@ -5,6 +5,7 @@
- <listen type="address"/>
+ <graphics type="spice" autoport="no">
+ <gl enable="yes"/>
+ <listen type="none"/>
</graphics>
<sound model="sb16"/>
<sound model="es1370"/>

View File

@ -530,7 +530,7 @@ c.add_compare(""" \
--panic iobase=507 \
""", "many-devices", compare_check="1.3.1") # compare_check=rbd format output
# Test the implied defaults for gl=yes setting virgl=on
c.add_compare(""" \
--memory 1024 \
--disk none \
@ -841,6 +841,8 @@ 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("--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")
c.add_compare("--redirdev type=spicevmc,server=example.com:12345", "edit-simple-redirdev")
@ -873,7 +875,7 @@ c.add_compare("--edit --disk path=/foo/bar,target=fda,bus=fdc,device=floppy,clea
c.add_compare("--edit --cpu host-passthrough,clearxml=yes", "edit-clear-cpu")
c.add_compare("--edit --clock offset=utc,clearxml=yes", "edit-clear-clock")
c.add_compare("--edit --video clearxml=yes,model=virtio,accel3d=yes", "edit-video-virtio")
c.add_compare("--edit --graphics clearxml=yes,type=spice,gl=on,listen=none", "edit-graphics-spice-gl", compare_check="1.3.5") # compare_check=new graphics listen output
c.add_compare("--edit --graphics clearxml=yes,type=spice,gl=on,listen=none", "edit-graphics-spice-gl", compare_check="1.3.6") # compare_check=graphics listen=none support
c = vixml.add_category("add/rm devices", "test-for-virtxml --print-diff --define", compare_check="1.2.2") # compare_check=input type=keyboard output
c.add_valid("--add-device --security model=dac") # --add-device works for seclabel

View File

@ -1950,10 +1950,7 @@ class ParserGraphics(VirtCLIParser):
def set_listen_cb(opts, inst, cliname, val):
if val == "none":
inst.port = None
inst.tlsPort = None
inst.listen = None
inst.autoport = False
inst.set_listen_none()
else:
inst.listen = val

View File

@ -199,7 +199,7 @@ class VirtualGraphics(VirtualDevice):
(l.type == "address" and l.address == self.listen)]
if find_listen:
if val is None:
self.remove_listen(find_listen[0])
self.remove_child(find_listen[0])
else:
find_listen[0].address = val
return val
@ -215,8 +215,26 @@ class VirtualGraphics(VirtualDevice):
defaultMode = XMLProperty("./@defaultMode")
listens = XMLChildProperty(_GraphicsListen)
def remove_listen(self, obj):
self.remove_child(obj)
def remove_all_listens(self):
for listen in self.listens:
self.remove_child(listen)
def add_listen(self):
obj = _GraphicsListen(self.conn)
self.add_child(obj)
return obj
def set_listen_none(self):
self.remove_all_listens()
self.port = None
self.tlsPort = None
self.autoport = False
self.socket = None
if self.conn.check_support(
self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE):
obj = self.add_listen()
obj.type = "none"
# Spice bits
image_compression = XMLProperty("./image/@compression")

View File

@ -315,6 +315,7 @@ SUPPORT_CONN_SPICE_GL = _make(version="1.3.3",
hv_version={"qemu": "2.7.92", "test": 0})
SUPPORT_CONN_VIDEO_VIRTIO_ACCEL3D = _make(version="1.3.0",
hv_version={"qemu": "2.7.0", "test": 0})
SUPPORT_CONN_GRAPHICS_LISTEN_NONE = _make(version="1.3.6")
# This is for disk <driver name=qemu>. xen supports this, but it's