ia64/xen-unstable

changeset 13072:9fd958cc5122

Allow the XenAPI Session object to have login_with_password called as a
methodname, to re-login through the same object (say when the server is
restarted).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Dec 15 17:18:02 2006 +0000 (2006-12-15)
parents 040093fa1f9e
children 7cf33c0856d4
files tools/python/xen/xm/XenAPI.py tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/XenAPI.py	Fri Dec 15 17:33:31 2006 +0000
     1.2 +++ b/tools/python/xen/xm/XenAPI.py	Fri Dec 15 17:18:02 2006 +0000
     1.3 @@ -83,8 +83,12 @@ class Session(xen.util.xmlrpclib2.Server
     1.4  
     1.5  
     1.6      def xenapi_request(self, methodname, params):
     1.7 -        full_params = (self._session,) + params
     1.8 -        return _parse_result(getattr(self, methodname)(*full_params))
     1.9 +        if methodname.startswith('login'):
    1.10 +            self._login(methodname, *params)
    1.11 +            return None
    1.12 +        else:
    1.13 +            full_params = (self._session,) + params
    1.14 +            return _parse_result(getattr(self, methodname)(*full_params))
    1.15  
    1.16  
    1.17      def _login(self, method, username, password):
     2.1 --- a/tools/python/xen/xm/main.py	Fri Dec 15 17:33:31 2006 +0000
     2.2 +++ b/tools/python/xen/xm/main.py	Fri Dec 15 17:18:02 2006 +0000
     2.3 @@ -558,7 +558,7 @@ class Shell(cmd.Cmd):
     2.4                  ok, res = _run_cmd(lambda x: server.xenapi_request(words[0],
     2.5                                                                     tuple(x)),
     2.6                                     words[0], words[1:])
     2.7 -                if ok and res != '':
     2.8 +                if ok and res is not None and res != '':
     2.9                      pprint.pprint(res)
    2.10              else:
    2.11                  print '*** Unknown command: %s' % words[0]