From: Alex O'Rourke Date: Mon, 4 Jan 2016 21:03:52 +0000 (-0800) Subject: Change minimum 3PAR API version for replication X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ef99b73f2abf758400671eba4095ac31031fbae6;p=openstack-build%2Fcinder-build.git Change minimum 3PAR API version for replication 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 --- diff --git a/cinder/tests/unit/test_hpe3par.py b/cinder/tests/unit/test_hpe3par.py index 87b5f0af5..ced41c715 100644 --- a/cinder/tests/unit/test_hpe3par.py +++ b/cinder/tests/unit/test_hpe3par.py @@ -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), diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 2d0963a59..05f1f0c59 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -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. "