diff options
author | Alastair Tse <atse@xensource.com> | 2007-01-24 15:52:26 +0000 |
---|---|---|
committer | Alastair Tse <atse@xensource.com> | 2007-01-24 15:52:26 +0000 |
commit | 2478f46117a96ad0e52d738d611fa3f834ca0563 (patch) | |
tree | 20c4700baafc9f537670b82a1d802bb14ccdae77 /tools/python/scripts | |
parent | 64444f844e6894f6d1a764542ce9f9d0e06a48be (diff) | |
download | xen-2478f46117a96ad0e52d738d611fa3f834ca0563.tar.gz xen-2478f46117a96ad0e52d738d611fa3f834ca0563.tar.bz2 xen-2478f46117a96ad0e52d738d611fa3f834ca0563.zip |
[XENAPI] Make test script attempt to login with blank credentials
before prompting for passwords.
Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r-- | tools/python/scripts/xapi.py | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py index 74f467a1b1..8e17354597 100644 --- a/tools/python/scripts/xapi.py +++ b/tools/python/scripts/xapi.py @@ -170,12 +170,21 @@ _server = None _session = None def connect(*args): global _server, _session, _initialised + if not _initialised: - _server = ServerProxy('http://localhost:9363/') - login = raw_input("Login: ") - password = getpass() - creds = (login, password) - _session = execute(_server.session, 'login_with_password', creds) + # try without password + try: + _server = ServerProxy('http://localhost:9363/') + _session = execute(_server.session, 'login_with_password', + ('','')) + except: + login = raw_input("Login: ") + password = getpass() + creds = (login, password) + _server = ServerProxy('http://localhost:9363/') + _session = execute(_server.session, 'login_with_password', + creds) + _initialised = True return (_server, _session) @@ -476,6 +485,15 @@ def xapi_vbd_list(args, async = False): for vbd in vbds: vbd_struct = execute(server, 'VBD.get_record', (session, vbd)) print VBD_LIST_FORMAT % vbd_struct + +def xapi_vbd_stats(args, async = False): + server, session = connect() + domname = args[0] + dom_uuid = resolve_vm(server, session, domname) + + vbds = execute(server, 'VM.get_VBDs', (session, dom_uuid)) + for vbd_uuid in vbds: + print execute(server, 'VBD.get_io_read_kbs', (session, vbd_uuid)) def xapi_vif_list(args, async = False): server, session = connect() |