aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2006-12-15 17:18:02 +0000
committerEwan Mellor <ewan@xensource.com>2006-12-15 17:18:02 +0000
commit539d271eff540d736d83aa66659518b872bd96c5 (patch)
tree04cbeab525938290a5e824d2b4c7c8d6788f6e94
parenta090ca495e7f6b2bd44d3a5422f17ff4563fae8a (diff)
downloadxen-539d271eff540d736d83aa66659518b872bd96c5.tar.gz
xen-539d271eff540d736d83aa66659518b872bd96c5.tar.bz2
xen-539d271eff540d736d83aa66659518b872bd96c5.zip
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>
-rw-r--r--tools/python/xen/xm/XenAPI.py8
-rw-r--r--tools/python/xen/xm/main.py2
2 files changed, 7 insertions, 3 deletions
diff --git a/tools/python/xen/xm/XenAPI.py b/tools/python/xen/xm/XenAPI.py
index a7835c0ebc..1c1bc41e94 100644
--- a/tools/python/xen/xm/XenAPI.py
+++ b/tools/python/xen/xm/XenAPI.py
@@ -83,8 +83,12 @@ class Session(xen.util.xmlrpclib2.ServerProxy):
def xenapi_request(self, methodname, params):
- full_params = (self._session,) + params
- return _parse_result(getattr(self, methodname)(*full_params))
+ if methodname.startswith('login'):
+ self._login(methodname, *params)
+ return None
+ else:
+ full_params = (self._session,) + params
+ return _parse_result(getattr(self, methodname)(*full_params))
def _login(self, method, username, password):
diff --git a/tools/python/xen/xm/main.py b/tools/python/xen/xm/main.py
index 059bbd46b2..a503835cf5 100644
--- a/tools/python/xen/xm/main.py
+++ b/tools/python/xen/xm/main.py
@@ -558,7 +558,7 @@ class Shell(cmd.Cmd):
ok, res = _run_cmd(lambda x: server.xenapi_request(words[0],
tuple(x)),
words[0], words[1:])
- if ok and res != '':
+ if ok and res is not None and res != '':
pprint.pprint(res)
else:
print '*** Unknown command: %s' % words[0]