1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

add views/instance/settings/vnc listen addresses

configures console listen addresses for instance

update webvirtcloud/settings.py QEMU_CONSOLE_LISTEN_ADDRESSES according to template, before use

instances/views.py remove include webvirtcloud.settings (duplicate)
This commit is contained in:
Ing. Jan KRCMAR 2018-06-15 14:13:50 +02:00
parent 6b444075b6
commit 22d03da60f
4 changed files with 71 additions and 3 deletions

View file

@ -455,6 +455,32 @@ class wvmInstance(wvmConnect):
return "127.0.0.1"
return listen_addr
def set_console_listen_addr(self, listen_addr):
xml = self._XMLDesc(VIR_DOMAIN_XML_SECURE)
root = ElementTree.fromstring(xml)
console_type = self.get_console_type()
try:
graphic = root.find("devices/graphics[@type='%s']" % console_type)
except SyntaxError:
# Little fix for old version ElementTree
graphic = root.find("devices/graphics")
if graphic is None:
return False
listen = graphic.find("listen[@type='address']")
if listen is None:
return False
if listen_addr:
graphic.set("listen", listen_addr)
listen.set("address", listen_addr)
else:
try:
graphic.attrib.pop("listen")
listen.attrib.pop("address")
except:
pass
newxml = ElementTree.tostring(root)
return self._defineXML(newxml)
def get_console_socket(self):
socket = util.get_xml_path(self._XMLDesc(0),
"/domain/devices/graphics/@socket")