mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Expose the method-listing call as host.list_methods.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
1 parent
3a7400aa86
commit
fccf5da0dd
6 files changed
+92
-11
No files matched your search
@@ -886,7 +886,8 @@ class XendAPI(object):
|
||||
('get_log', 'String'),
|
||||
('send_debug_keys', None)]
|
||||
|
||||
host_funcs = [('get_by_name_label', 'Set(host)')]
|
||||
host_funcs = [('get_by_name_label', None),
|
||||
('list_methods', None)]
|
||||
|
||||
# attributes
|
||||
def host_get_name_label(self, session, host_ref):
|
||||
@@ -1010,6 +1011,12 @@ class XendAPI(object):
|
||||
return xen_api_success((XendNode.instance().uuid,))
|
||||
return xen_api_success([])
|
||||
|
||||
def host_list_methods(self, _):
|
||||
def _funcs():
|
||||
return [getattr(XendAPI, x) for x in XendAPI.__dict__]
|
||||
|
||||
return xen_api_success([x.api for x in _funcs()
|
||||
if hasattr(x, 'api')])
|
||||
|
||||
# Xen API: Class host_CPU
|
||||
# ----------------------------------------------------------------
|
||||
@@ -2611,15 +2618,6 @@ class XendAPI(object):
|
||||
return xen_api_success({'uuid': debug_ref})
|
||||
|
||||
|
||||
def list_all_methods(self, _):
|
||||
def _funcs():
|
||||
return [getattr(XendAPI, x) for x in XendAPI.__dict__]
|
||||
|
||||
return xen_api_success([x.api for x in _funcs()
|
||||
if hasattr(x, 'api')])
|
||||
list_all_methods.api = '_UNSUPPORTED_list_all_methods'
|
||||
|
||||
|
||||
class XendAPIAsyncProxy:
|
||||
""" A redirector for Async.Class.function calls to XendAPI
|
||||
but wraps the call for use with the XendTaskManager.
|
||||
|
||||
@@ -591,7 +591,7 @@ class Shell(cmd.Cmd):
|
||||
self.prompt = "xm> "
|
||||
if serverType == SERVER_XEN_API:
|
||||
try:
|
||||
res = server.xenapi._UNSUPPORTED_list_all_methods()
|
||||
res = server.xenapi.host.list_methods()
|
||||
for f in res:
|
||||
setattr(Shell, 'do_' + f + ' ', self.default)
|
||||
except:
|
||||
|
||||