]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Change minimum 3PAR API version for replication
authorAlex O'Rourke <alex.orourke@hpe.com>
Mon, 4 Jan 2016 21:03:52 +0000 (13:03 -0800)
committerAlex O'Rourke <alex.orourke@hpe.com>
Tue, 5 Jan 2016 17:17:12 +0000 (17:17 +0000)
Currently, the primary and all secondary 3PAR arrays must have an API
version of 1.4.2 or higher and all be on the same version. This is
changed to require version 1.5.0 or higher and does not force all
arrays to be on the same version.

Change-Id: Ie6cc19f3bc4939e1ad15b64140a21bab1bc27fc7

cinder/tests/unit/test_hpe3par.py
cinder/volume/drivers/hpe/hpe_3par_common.py

index 87b5f0af5d499f814c27228728866fbaf09291ae..ced41c7152e3449eed64edd4cc46714e1635d0b3 100644 (file)
@@ -546,8 +546,13 @@ class HPE3PARBaseDriver(object):
                                      'minor': 4,
                                      'revision': 2}
 
+    wsapi_version_for_remote_copy = {'major': 1,
+                                     'build': 30202290,
+                                     'minor': 5,
+                                     'revision': 0}
+
     # Use this to point to latest version of wsapi
-    wsapi_version_latest = wsapi_version_for_flash_cache
+    wsapi_version_latest = wsapi_version_for_remote_copy
 
     standard_login = [
         mock.call.login(HPE3PAR_USER_NAME, HPE3PAR_USER_PASS),
index 2d0963a59baae0260479b154f516a41332e22165..05f1f0c591e8f7caabe2bb7f4e027e8c861a9c01 100644 (file)
@@ -75,6 +75,7 @@ MIN_REP_CLIENT_VERSION = '4.0.2'
 DEDUP_API_VERSION = 30201120
 FLASH_CACHE_API_VERSION = 30201200
 SRSTATLD_API_VERSION = 30201200
+REMOTE_COPY_API_VERSION = 30202290
 
 hpe3par_opts = [
     cfg.StrOpt('hpe3par_api_url',
@@ -220,10 +221,11 @@ class HPE3PARCommon(object):
         3.0.6 - Adding manage/unmanage snapshot support
         3.0.7 - Enable standard capabilities based on 3PAR licenses
         3.0.8 - Optimize array ID retrieval
+        3.0.9 - Bump minimum API version for volume replication
 
     """
 
-    VERSION = "3.0.8"
+    VERSION = "3.0.9"
 
     stats = {}
 
@@ -395,6 +397,19 @@ class HPE3PARCommon(object):
             self.client = self._create_client(timeout=timeout)
             wsapi_version = self.client.getWsApiVersion()
             self.API_VERSION = wsapi_version['build']
+
+            # If replication is properly configured, the primary array's
+            # API version must meet the minimum requirements.
+            if self._replication_enabled and (
+               self.API_VERSION < REMOTE_COPY_API_VERSION):
+                self._replication_enabled = False
+                msg = (_LE("The primary array must have an API version of "
+                           "%(min_ver)s or higher, but is only on "
+                           "%(current_ver)s, therefore replication is not "
+                           "supported.") %
+                       {'min_ver': REMOTE_COPY_API_VERSION,
+                        'current_ver': self.API_VERSION})
+                LOG.error(msg)
         except hpeexceptions.UnsupportedVersion as ex:
             # In the event we cannot contact the configured primary array,
             # we want to allow a failover if replication is enabled.
@@ -2955,9 +2970,9 @@ class HPE3PARCommon(object):
                     dev.get('hpe3par_iscsi_chap_enabled') == 'True')
                 array_name = remote_array['target_device_id']
 
-                # Make sure we can log into the client, that it has been
-                # correctly configured, and it its version matches the
-                # primary arrarys version.
+                # Make sure we can log into the array, that it has been
+                # correctly configured, and its API version meets the
+                # minimum requirement.
                 cl = None
                 try:
                     cl = self._create_replication_client(remote_array)
@@ -2965,17 +2980,15 @@ class HPE3PARCommon(object):
                     remote_array['id'] = array_id
                     wsapi_version = cl.getWsApiVersion()['build']
 
-                    if self.client is not None and (
-                       wsapi_version != self.API_VERSION):
-                        msg = (_LW("The target array and all of its secondary "
-                                   "arrays must be on the same API version. "
-                                   "Array '%(target)s' is on %(target_ver)s "
-                                   "while the primary array is on "
-                                   "%(primary_ver)s, therefore it will not "
-                                   "be added as a valid replication target.") %
+                    if wsapi_version < REMOTE_COPY_API_VERSION:
+                        msg = (_LW("The secondary array must have an API "
+                                   "version of %(min_ver)s or higher. Array "
+                                   "'%(target)s' is on %(target_ver)s, "
+                                   "therefore it will not be added as a valid "
+                                   "replication target.") %
                                {'target': array_name,
-                                'target_ver': wsapi_version,
-                                'primary_ver': self.API_VERSION})
+                                'min_ver': REMOTE_COPY_API_VERSION,
+                                'target_ver': wsapi_version})
                         LOG.warning(msg)
                     elif not self._is_valid_replication_array(remote_array):
                         msg = (_LW("'%s' is not a valid replication array. "