diff options
author | Alastair Tse <atse@xensource.com> | 2006-10-19 15:37:16 +0100 |
---|---|---|
committer | Alastair Tse <atse@xensource.com> | 2006-10-19 15:37:16 +0100 |
commit | 03e7cd14f36b5faa254360411eaca9fc047155f2 (patch) | |
tree | 1cd5fae3ed050cb8e8dbfb8b3b1551d09dda4558 /tools/python/scripts | |
parent | 4b1bbbba6ce14f7030e147c07373746dd27c5248 (diff) | |
download | xen-03e7cd14f36b5faa254360411eaca9fc047155f2.tar.gz xen-03e7cd14f36b5faa254360411eaca9fc047155f2.tar.bz2 xen-03e7cd14f36b5faa254360411eaca9fc047155f2.zip |
[XEND] Switch to PAM authentication for login sessions
[XENAPI] Fix case difference in API for Host.* functions
Signed-off-by: Alastair Tse <atse@xensource.com>
Diffstat (limited to 'tools/python/scripts')
-rw-r--r-- | tools/python/scripts/xapi.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/python/scripts/xapi.py b/tools/python/scripts/xapi.py index 8ba8659314..4b7b8d382b 100644 --- a/tools/python/scripts/xapi.py +++ b/tools/python/scripts/xapi.py @@ -20,6 +20,7 @@ from xen.util.xmlrpclib2 import ServerProxy from optparse import * from pprint import pprint from types import DictType +from getpass import getpass MB = 1024 * 1024 @@ -30,7 +31,6 @@ SR_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(physical_size)-10s' \ '%(type)-10s' VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s '\ '%(sector_size)-8s' -LOGIN = ('atse', 'passwd') COMMANDS = { 'host-info': ('', 'Get Xen Host Info'), @@ -132,8 +132,11 @@ def execute(fn, *args): def _connect(*args): - server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock') - session = execute(server.session.login_with_password, *LOGIN) + server = ServerProxy('httpu:///var/run/xend/xmlrpc.sock') + login = raw_input("Login: ") + password = getpass() + creds = (login, password) + session = execute(server.session.login_with_password, *creds) host = execute(server.session.get_this_host, session) return (server, session) @@ -158,9 +161,9 @@ def resolve_vm(server, session, vm_name): def xapi_host_info(*args): server, session = _connect() - hosts = execute(server.Host.get_all, session) + hosts = execute(server.host.get_all, session) for host in hosts: # there is only one, but .. - hostinfo = execute(server.Host.get_record, session, host) + hostinfo = execute(server.host.get_record, session, host) print HOST_INFO_FORMAT % ('Name', hostinfo['name_label']) print HOST_INFO_FORMAT % ('Version', hostinfo['software_version']) print HOST_INFO_FORMAT % ('CPUs', len(hostinfo['host_CPUs'])) |