Signed-off-by: Jon Ludlam <[email protected]>

 scripts/examples/python/XenAPI.py |  30 ++++--------------------------
 1 files changed, 4 insertions(+), 26 deletions(-)


# HG changeset patch
# User Jonathan Ludlam <[email protected]>
# Date 1265367290 0
# Node ID 81a608f76b7672569c20353f0366d4e57c9e3c39
# Parent  d33d0213f76021906ed41ab45004d9797e3a7ea9
CA-35286: Remove forward compatability code from the python XenAPI module in favour of the compatability layer in xapi

Signed-off-by: Jon Ludlam <[email protected]>

diff -r d33d0213f760 -r 81a608f76b76 scripts/examples/python/XenAPI.py
--- a/scripts/examples/python/XenAPI.py	Fri Feb 05 10:54:48 2010 +0000
+++ b/scripts/examples/python/XenAPI.py	Fri Feb 05 10:54:50 2010 +0000
@@ -54,18 +54,6 @@
 API_VERSION_1_1 = '1.1'
 API_VERSION_1_2 = '1.2'
 
-#
-# Methods that have different parameters between API versions 1.1 and 1.2, and
-# the number of parameters in 1.1.
-#
-COMPATIBILITY_METHODS_1_1 = [
-    ('SR.create'     , 8),
-    ('SR.introduce'  , 6),
-    ('SR.make'       , 7),
-    ('VDI.snapshot'  , 1),
-    ('VDI.clone'     , 1),
-    ]
-
 class Failure(Exception):
     def __init__(self, details):
         self.details = details
@@ -164,10 +152,7 @@
         self._session = result
         self.last_login_method = method
         self.last_login_params = params
-        if method.startswith("slave_local"):
-            self.API_version = API_VERSION_1_2
-        else:
-            self.API_version = self._get_api_version()
+        self.API_version = self._get_api_version()
 
     def _logout(self):
         try:
@@ -184,11 +169,9 @@
     def _get_api_version(self):
         pool = self.xenapi.pool.get_all()[0]
         host = self.xenapi.pool.get_master(pool)
-        if (self.xenapi.host.get_API_version_major(host) == "1" and
-            self.xenapi.host.get_API_version_minor(host) == "2"):
-            return API_VERSION_1_2
-        else:
-            return API_VERSION_1_1
+        major = self.xenapi.host.get_API_version_major(host)
+        minor = self.xenapi.host.get_API_version_minor(host)
+        return "%s.%s"%(major,minor)
 
     def __getattr__(self, name):
         if name == 'handle':
@@ -243,9 +226,4 @@
             return _Dispatcher(self.__API_version, self.__send, "%s.%s" % (self.__name, name))
 
     def __call__(self, *args):
-        if self.__API_version == API_VERSION_1_1:
-            for m in COMPATIBILITY_METHODS_1_1:
-                if self.__name == m[0]:
-                    return self.__send(self.__name, args[0:m[1]])
-
         return self.__send(self.__name, args)
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to