Commit 1ef113a0 authored by Thibault VINCENT's avatar Thibault VINCENT
Browse files

added vncport vm tag

parent 8a30ff53
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ class NodeHandler(RpcHandler):
            'h'         : self._tag_map_direct('get_name', 24*3600),
            # one hour
            # one minute
            #'cpuremain' : self._tag_map_direct('get_cpu_remain', -1),
            'memfree'   : self._tag_map_direct('get_mem_free', 60),
            'memused'   : self._tag_map_direct('get_mem_used', 60),
            'sto'       : ( lambda o: hasattr(o, 'storage'),
@@ -128,6 +127,7 @@ class NodeHandler(RpcHandler):
            # one hour
            'cpu'       : self._tag_map_direct('get_cpu_core', 3600),
            'mem'       : self._tag_map_direct('get_mem', 3600),
            'vncport'   : self._tag_map_direct('get_vnc_port', 3600),
            # one minute
            # 5 seconds
            'status'    : ( lambda o: True,
+16 −0
Original line number Diff line number Diff line
@@ -663,6 +663,22 @@ class LibvirtVm(VM):
        '''
        return (self.get_mem() - self.get_mem_used()) * KILOBYTE_DIV
    
    def get_vnc_port(self):
        '''
        '''
        port = None
        try:
            xroot = xml.dom.minidom.parseString(
                        self._domain.XMLDesc(libvirt.VIR_DOMAIN_XML_INACTIVE))
            xdomain = xroot.getElementsByTagName('domain').pop()
            xgraphics = xdomain.getElementsByTagName('graphics').pop()
            data = xgraphics.getAttribute('port')
            if data > 0 and data <= 65535:
                port = data
        except:
            pass
        return port
    
    def get_volumes(self):
        '''
        '''