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
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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)