Commit 7fd823b1 authored by Antoine Millet's avatar Antoine Millet

Implemented spiceport vm tag

parent 6ab212f8
......@@ -161,6 +161,26 @@ def vncport(dom):
return
@_vir_tag
def spiceport(dom):
"""Spice port for the VM console access."""
try:
port = et.ElementTree().parse(
StringIO(dom.lv_dom.XMLDesc(0))
).find('devices/graphics[@type="spice"]').get('port')
except Exception:
logger.exception('SpicePort')
raise
try:
if 0 < int(port) < 65536:
return port
except (TypeError, ValueError):
pass
return
@ttl(10)
@refresh(10)
@_vir_tag
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment