source: trunk/packages/invirt-vnc-server/python/vnc/get_port.py @ 2305

Last change on this file since 2305 was 1386, checked in by broder, 16 years ago

sipb-xen-vnc-server -> invirt-vnc-server

File size: 630 bytes
Line 
1#!/usr/bin/python
2import sys
3import glob
4sys.path.append('/usr/lib/xen-default/lib/python/')
5import xen.xm
6import xen.xm.XenAPI
7import xen.xend.XendClient
8import time
9import xmlrpclib
10
11prefix = "d_"
12server = xen.xm.XenAPI.Session(xen.xend.XendClient.uri)
13
14def findPort(name):
15    try:
16        state = server.xend.domain(prefix + name, True)
17        for (key,value) in state[1:]:
18            if key == 'device' and value[0] == 'vfb':
19                location=dict(value[1:]).get('location')
20                return location
21    except xmlrpclib.Fault:
22        return None
23
24if __name__ == '__main__':
25    print findPort(sys.argv[1])
Note: See TracBrowser for help on using the repository browser.