WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XENAPI] Add vif-list to xapi.py script

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENAPI] Add vif-list to xapi.py script
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Jan 2007 08:55:28 -0800
Delivery-date: Thu, 25 Jan 2007 09:50:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alastair Tse <atse@xxxxxxxxxxxxx>
# Date 1169653802 0
# Node ID f000f963bbfdb27c4f289227d0183cb00bab6672
# Parent  85250ca1df569cc14f5f3d553f5f103e0bb4f0d1
[XENAPI] Add vif-list to xapi.py script

Signed-off-by: Alastair Tse <atse@xxxxxxxxxxxxx>
---
 tools/python/scripts/xapi.py |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff -r 85250ca1df56 -r f000f963bbfd tools/python/scripts/xapi.py
--- a/tools/python/scripts/xapi.py      Wed Jan 24 15:49:32 2007 +0000
+++ b/tools/python/scripts/xapi.py      Wed Jan 24 15:50:02 2007 +0000
@@ -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)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XENAPI] Add vif-list to xapi.py script, Xen patchbot-unstable <=