| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | import sys |
|---|
| 3 | import glob |
|---|
| 4 | sys.path.append('/usr/lib/xen-default/lib/python/') |
|---|
| 5 | import xen.xm |
|---|
| 6 | import xen.xm.XenAPI |
|---|
| 7 | import xen.xend.XendClient |
|---|
| 8 | |
|---|
| 9 | server = xen.xm.XenAPI.Session(xen.xend.XendClient.uri) |
|---|
| 10 | |
|---|
| 11 | 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 |
|---|
| 19 | |
|---|
| 20 | if __name__ == '__main__': |
|---|
| 21 | print findPort("moo3") |
|---|
Note: See
TracBrowser
for help on using the repository browser.