ia64/xen-unstable

changeset 13605:f9eceb9c52d7

[XENAPI] Make test script attempt to login with blank credentials
before prompting for passwords.

Signed-off-by: Alastair Tse <atse@xensource.com>
author Alastair Tse <atse@xensource.com>
date Wed Jan 24 15:52:26 2007 +0000 (2007-01-24)
parents e4d415692ba5
children da23e1b616b0
files tools/python/scripts/xapi.py
line diff
     1.1 --- a/tools/python/scripts/xapi.py	Wed Jan 24 15:50:58 2007 +0000
     1.2 +++ b/tools/python/scripts/xapi.py	Wed Jan 24 15:52:26 2007 +0000
     1.3 @@ -170,12 +170,21 @@ def execute(server, fn, args, async = Fa
     1.4  _session = None
     1.5  def connect(*args):
     1.6      global _server, _session, _initialised
     1.7 +    
     1.8      if not _initialised:
     1.9 -        _server = ServerProxy('http://localhost:9363/')
    1.10 -        login = raw_input("Login: ")
    1.11 -        password = getpass()
    1.12 -        creds = (login, password)
    1.13 -        _session = execute(_server.session, 'login_with_password', creds)
    1.14 +        # try without password
    1.15 +        try:
    1.16 +            _server = ServerProxy('http://localhost:9363/')
    1.17 +            _session = execute(_server.session, 'login_with_password',
    1.18 +                               ('',''))
    1.19 +        except:
    1.20 +            login = raw_input("Login: ")
    1.21 +            password = getpass()
    1.22 +            creds = (login, password)            
    1.23 +            _server = ServerProxy('http://localhost:9363/')
    1.24 +            _session = execute(_server.session, 'login_with_password',
    1.25 +                               creds)
    1.26 +
    1.27          _initialised = True
    1.28      return (_server, _session)
    1.29  
    1.30 @@ -476,6 +485,15 @@ def xapi_vbd_list(args, async = False):
    1.31      for vbd in vbds:
    1.32          vbd_struct = execute(server, 'VBD.get_record', (session, vbd))
    1.33          print VBD_LIST_FORMAT % vbd_struct
    1.34 +
    1.35 +def xapi_vbd_stats(args, async = False):
    1.36 +    server, session = connect()
    1.37 +    domname = args[0]
    1.38 +    dom_uuid = resolve_vm(server, session, domname)
    1.39 +
    1.40 +    vbds = execute(server, 'VM.get_VBDs', (session, dom_uuid))
    1.41 +    for vbd_uuid in vbds:
    1.42 +        print execute(server, 'VBD.get_io_read_kbs', (session, vbd_uuid))
    1.43   
    1.44  def xapi_vif_list(args, async = False):
    1.45      server, session = connect()