ia64/xen-unstable

changeset 13180:4e079a8496b7

Adjust the argument counts for a MESSAGE_PARAMETER_COUNT_MISMATCH to account for
the fact that XenAPI adds the session handle transparently.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Mon Dec 25 14:32:41 2006 +0000 (2006-12-25)
parents 367f0c6efe21
children ae3f3dd40df4
files tools/python/xen/xm/XenAPI.py
line diff
     1.1 --- a/tools/python/xen/xm/XenAPI.py	Sat Dec 23 21:32:05 2006 +0000
     1.2 +++ b/tools/python/xen/xm/XenAPI.py	Mon Dec 25 14:32:41 2006 +0000
     1.3 @@ -54,7 +54,17 @@ gettext.install('xen-xm')
     1.4  
     1.5  class Failure(Exception):
     1.6      def __init__(self, details):
     1.7 -        self.details = details
     1.8 +        try:
     1.9 +            # If this failure is MESSAGE_PARAMETER_COUNT_MISMATCH, then we
    1.10 +            # correct the return values here, to account for the fact that we
    1.11 +            # transparently add the session handle as the first argument.
    1.12 +            if details[0] == 'MESSAGE_PARAMETER_COUNT_MISMATCH':
    1.13 +                details[2] = str(int(details[2]) - 1)
    1.14 +                details[3] = str(int(details[3]) - 1)
    1.15 +
    1.16 +            self.details = details
    1.17 +        except Exception, exn:
    1.18 +            self.details = ['INTERNAL_ERROR', 'Client-side: ' + str(exn)]
    1.19  
    1.20      def __str__(self):
    1.21          try: