Changeset 232 for trunk/vnc/vnc_server
- Timestamp:
- Nov 11, 2007, 11:18:17 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/vnc/vnc_server/get_port.py
r115 r232 6 6 import xen.xm.XenAPI 7 7 import xen.xend.XendClient 8 import time 9 import xmlrpclib 8 10 11 prefix = "d_" 9 12 server = xen.xm.XenAPI.Session(xen.xend.XendClient.uri) 10 13 11 14 def findPort(name): 12 states = server.xend.domains_with_state(True, 'all', 1) 13 for state in states: 14 if dict(state[1:])['name'] == name: 15 for (key,value) in state[1:]: 16 if key == 'device' and value[0] == 'vfb': 17 location=dict(value[1:]).get('location') 18 return location 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 19 23 20 24 if __name__ == '__main__': 21 print findPort( "moo3")25 print findPort(sys.argv[1])
Note: See TracChangeset
for help on using the changeset viewer.