ia64/xen-unstable

changeset 13709:a7fc9cc9a51f

Fix the handling of MESSAGE_METHOD_UNKNOWN, MESSAGE_PARAMETER_COUNT_MISMATCH,
through the AsyncProxy.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Sun Jan 28 18:37:42 2007 +0000 (2007-01-28)
parents 58344c358aa0
children 5b973d94bc00
files tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/tools/python/xen/xend/XendAPI.py	Sun Jan 28 18:05:13 2007 +0000
     1.2 +++ b/tools/python/xen/xend/XendAPI.py	Sun Jan 28 18:37:42 2007 +0000
     1.3 @@ -2019,19 +2019,22 @@ class XendAPIAsyncProxy:
     1.4  
     1.5          # Only deal with method names that start with "Async."
     1.6          if not method.startswith(self.method_prefix):
     1.7 -            raise Exception('Method %s not supported' % method)
     1.8 -
     1.9 -        # Require 'session' argument to be present.
    1.10 -        if len(args) < 1:
    1.11 -            raise Exception('Not enough arguments')
    1.12 +            return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method])
    1.13  
    1.14          # Lookup synchronous version of the method
    1.15          synchronous_method_name = method[len(self.method_prefix):]
    1.16          if synchronous_method_name not in self.method_map:
    1.17 -            raise Exception('Method %s not supported' % method)
    1.18 +            return xen_api_error(['MESSAGE_METHOD_UNKNOWN', method])
    1.19          
    1.20          method = self.method_map[synchronous_method_name]
    1.21  
    1.22 +        # Check that we've got enough arguments before issuing a task ID.
    1.23 +        needed = argcounts[method.api]
    1.24 +        if len(args) != needed:
    1.25 +            return xen_api_error(['MESSAGE_PARAMETER_COUNT_MISMATCH',
    1.26 +                                  self.method_prefix + method.api, needed,
    1.27 +                                  len(args)])
    1.28 +
    1.29          # Validate the session before proceeding
    1.30          session = args[0]
    1.31          if not auth_manager().is_session_valid(session):