source: trunk/vnc/vnc_server/get_port.py @ 241

Last change on this file since 241 was 232, checked in by quentin, 17 years ago

Resync get_port.py from disk.

File size: 630 bytes
RevLine 
[115]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
[232]8import time
9import xmlrpclib
[115]10
[232]11prefix = "d_"
[115]12server = xen.xm.XenAPI.Session(xen.xend.XendClient.uri)
13
14def findPort(name):
[232]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
[115]23
24if __name__ == '__main__':
[232]25    print findPort(sys.argv[1])
Note: See TracBrowser for help on using the repository browser.