From: Ewan Mellor Date: Sun, 28 Jan 2007 18:37:42 +0000 (+0000) Subject: Fix the handling of MESSAGE_METHOD_UNKNOWN, MESSAGE_PARAMETER_COUNT_MISMATCH, X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15368^2~59 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1e382e1113925fb3e65b72de3013bea553855cc8;p=xen.git Fix the handling of MESSAGE_METHOD_UNKNOWN, MESSAGE_PARAMETER_COUNT_MISMATCH, through the AsyncProxy. Signed-off-by: Ewan Mellor --- diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index b11385036c..0cc1b9cabe 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -2019,19 +2019,22 @@ class XendAPIAsyncProxy: # Only deal with method names that start with "Async." if not method.startswith(self.method_prefix): - raise Exception('Method %s not supported' % method) - - # Require 'session' argument to be present. - if len(args) < 1: - raise Exception('Not enough arguments') + return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method]) # Lookup synchronous version of the method synchronous_method_name = method[len(self.method_prefix):] if synchronous_method_name not in self.method_map: - raise Exception('Method %s not supported' % method) + return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method]) method = self.method_map[synchronous_method_name] + # Check that we've got enough arguments before issuing a task ID. + needed = argcounts[method.api] + if len(args) != needed: + return xen_api_error(['MESSAGE_PARAMETER_COUNT_MISMATCH', + self.method_prefix + method.api, needed, + len(args)]) + # Validate the session before proceeding session = args[0] if not auth_manager().is_session_valid(session):