aboutsummaryrefslogtreecommitdiffstats
path: root/tools/python/scripts
diff options
context:
space:
mode:
authorAlastair Tse <atse@xensource.com>2007-01-24 15:50:02 +0000
committerAlastair Tse <atse@xensource.com>2007-01-24 15:50:02 +0000
commit673b964755ec3b9db057da57a3d47ff5601a03db (patch)
tree25e6bfab596411521573321baba1cae752d0aa76 /tools/python/scripts
parent464ed488c6af44ebffd089cc5ec91d5362557125 (diff)
downloadxen-673b964755ec3b9db057da57a3d47ff5601a03db.tar.gz
xen-673b964755ec3b9db057da57a3d47ff5601a03db.tar.bz2
xen-673b964755ec3b9db057da57a3d47ff5601a03db.zip
[XENAPI] Add vif-list to xapi.py script
Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r--tools/python/scripts/xapi.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py
index 82747fc1d5..74f467a1b1 100644
--- a/tools/python/scripts/xapi.py
+++ b/tools/python/scripts/xapi.py
@@ -76,7 +76,11 @@ OPTIONS = {
'vdi-list': [(('-l', '--long'),
{'action':'store_true',
'help':'List all properties of VDI'})
- ],
+ ],
+ 'vif-list': [(('-l', '--long'),
+ {'action':'store_true',
+ 'help':'List all properties of VIF'})
+ ],
'vm-list': [(('-l', '--long'),
{'action':'store_true',
'help':'List all properties of VMs'})
@@ -475,19 +479,28 @@ def xapi_vbd_list(args, async = False):
def xapi_vif_list(args, async = False):
server, session = connect()
+ opts, args = parse_args('vdi-list', args, set_defaults = True)
+ is_long = opts and opts.long
+
domname = args[0]
dom_uuid = resolve_vm(server, session, domname)
vifs = execute(server, 'VM.get_VIFs', (session, dom_uuid))
-
- print VIF_LIST_FORMAT % {'name': 'Name',
- 'device': 'Device',
- 'uuid' : 'UUID',
- 'MAC': 'MAC'}
-
- for vif in vifs:
- vif_struct = execute(server, 'VIF.get_record', (session, vif))
- print VIF_LIST_FORMAT % vif_struct
+
+ if not is_long:
+ print VIF_LIST_FORMAT % {'name': 'Name',
+ 'device': 'Device',
+ 'uuid' : 'UUID',
+ 'MAC': 'MAC'}
+
+ for vif in vifs:
+ vif_struct = execute(server, 'VIF.get_record', (session, vif))
+ print VIF_LIST_FORMAT % vif_struct
+ else:
+ for vif in vifs:
+ vif_struct = execute(server, 'VIF.get_record', (session, vif))
+ pprint(vif_struct)
+
def xapi_vdi_list(args, async = False):
opts, args = parse_args('vdi-list', args, set_defaults = True)