Skip to content
Snippets Groups Projects
Commit 2c97e81a authored by Anael Beutot's avatar Anael Beutot
Browse files

Report VNC tag only when valid.

When VM is not started, vnc port value is -1 in the libvirt domain XML config.
parent 3b61d09a
No related branches found
No related tags found
No related merge requests found
......@@ -92,11 +92,17 @@ def memmax(dom):
def vncport(dom):
"""VNC port for the VM console access."""
try:
return et.ElementTree().parse(
port = et.ElementTree().parse(
StringIO(dom.lv_dom.XMLDesc(0))
).find('devices/graphics').get('port')
except Exception:
logger.exception('VNCPort')
raise
if 0 < port < 65536:
return port
return
@ttl(10)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment