diff --git a/cinder/tests/unit/volume/drivers/ibm/test_ds8k_proxy.py b/cinder/tests/unit/volume/drivers/ibm/test_ds8k_proxy.py index 32866279c2e..2a79fac1cea 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_ds8k_proxy.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_ds8k_proxy.py @@ -535,7 +535,7 @@ FAKE_GET_SYSTEM_RESPONSE_1 = { "name": "", "state": "online", "release": "7.5.1", - "bundle": "87.51.9.0", + "bundle": "87.51.63.0", "MTM": "2421-961", "sn": "1300741", "wwnn": TEST_SOURCE_WWNN, @@ -563,7 +563,7 @@ FAKE_GET_SYSTEM_RESPONSE_2 = { "name": "", "state": "online", "release": "7.5.1", - "bundle": "87.51.9.0", + "bundle": "87.51.63.0", "MTM": "2421-962", "sn": "1300742", "wwnn": TEST_TARGET_WWNN, @@ -989,7 +989,7 @@ class FakeDS8KCommonHelper(helper.DS8KCommonHelper): self._get_value('san_login'), self._get_value('san_password'), None, True) - self.backend['rest_version'] = self._get_version()['bundle_version'] + self.backend['rest_version'] = self._get_version()['bundle'] class FakeDS8KECKDHelper(FakeDS8KCommonHelper, helper.DS8KECKDHelper): @@ -1167,7 +1167,7 @@ class DS8KProxyTest(test.TestCase): def test_verify_rest_version_for_5_7_fb(self, mock_get_version): """test the min version of REST for fb volume in 7.x.""" mock_get_version.return_value = { - "bundle_version": "5.7.50.0" + "bundle": "87.50.38.0" } self.assertRaises(exception.VolumeDriverException, FakeDS8KCommonHelper, self.configuration, None) @@ -1176,7 +1176,7 @@ class DS8KProxyTest(test.TestCase): def test_verify_rest_version_for_5_8_fb(self, mock_get_version): """test the min version of REST for fb volume in 8.1.""" mock_get_version.return_value = { - "bundle_version": "5.8.10.0" + "bundle": "88.10.112.0" } FakeDS8KCommonHelper(self.configuration, None) @@ -1189,7 +1189,7 @@ class DS8KProxyTest(test.TestCase): self.configuration.ds8k_ssid_prefix = 'FF' self.configuration.san_clustername = TEST_ECKD_POOL_ID mock_get_version.return_value = { - "bundle_version": "5.7.50.0" + "bundle": "87.50.22.0" } self.assertRaises(exception.VolumeDriverException, FakeDS8KECKDHelper, self.configuration, None) @@ -1203,7 +1203,7 @@ class DS8KProxyTest(test.TestCase): self.configuration.ds8k_ssid_prefix = 'FF' self.configuration.san_clustername = TEST_ECKD_POOL_ID mock_get_version.return_value = { - "bundle_version": "5.8.10.0" + "bundle": "88.10.112.0" } self.assertRaises(exception.VolumeDriverException, FakeDS8KECKDHelper, self.configuration, None) @@ -1217,7 +1217,7 @@ class DS8KProxyTest(test.TestCase): self.configuration.ds8k_ssid_prefix = 'FF' self.configuration.san_clustername = TEST_ECKD_POOL_ID mock_get_version.return_value = { - "bundle_version": "5.8.20.0" + "bundle": "88.20.40.0" } self.assertRaises(exception.VolumeDriverException, FakeDS8KECKDHelper, self.configuration, None) @@ -3214,8 +3214,8 @@ class DS8KProxyTest(test.TestCase): self.driver.create_group, self.ctxt, group) - @ddt.data({'bundle_version': "5.7.51.1067"}, - {'bundle_version': "5.8.20.1058"}) + @ddt.data({'bundle': "87.51.60.0"}, + {'bundle': "88.20.47.0"}) @mock.patch.object(helper.DS8KCommonHelper, '_get_version') def test_create_replication_consisgroup_should_verify_rest_version( self, rest_version, mock_get_version): diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py index 871993c7cb8..13738401366 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py @@ -61,10 +61,10 @@ class DS8KCommonHelper(object): OPTIONAL_PARAMS = ['ds8k_host_type', 'lss_range_for_cg'] # if use new REST API, please update the version below - VALID_REST_VERSION_5_7_MIN = '5.7.51.1047' + VALID_REST_VERSION_87_51_MIN = '87.51.52.0' INVALID_STORAGE_VERSION = '8.0.1' - REST_VERSION_5_7_MIN_PPRC_CG = '5.7.51.1068' - REST_VERSION_5_8_MIN_PPRC_CG = '5.8.20.1059' + REST_VERSION_87_51_MIN_PPRC_CG = '87.51.63.0' + REST_VERSION_88_20_MIN_PPRC_CG = '88.20.112.0' def __init__(self, conf, HTTPConnectorObject=None): self.conf = conf @@ -148,7 +148,7 @@ class DS8KCommonHelper(object): except restclient.TimeoutException: raise restclient.APIException( data=(_("Can't connect to %(host)s") % {'host': san_ip})) - self.backend['rest_version'] = self._get_version()['bundle_version'] + self.backend['rest_version'] = self._get_version()['bundle'] LOG.info("Connection to DS8K storage system %(host)s has been " "established successfully, the version of REST is %(rest)s.", {'host': self._get_value('san_ip'), @@ -224,14 +224,15 @@ class DS8KCommonHelper(object): "if you want to use this version of driver, " "please upgrade the CCL.") % self.INVALID_STORAGE_VERSION)) - if ('5.7' in self.backend['rest_version'] and + rest_ver = self.backend['rest_version'][0:2] + if ('87' == rest_ver and dist_version.LooseVersion(self.backend['rest_version']) < - dist_version.LooseVersion(self.VALID_REST_VERSION_5_7_MIN)): + dist_version.LooseVersion(self.VALID_REST_VERSION_87_51_MIN)): raise exception.VolumeDriverException( message=(_("REST version %(invalid)s is lower than " "%(valid)s, please upgrade it in DS8K.") % {'invalid': self.backend['rest_version'], - 'valid': self.VALID_REST_VERSION_5_7_MIN})) + 'valid': self.VALID_REST_VERSION_87_51_MIN})) def verify_rest_version_for_pprc_cg(self): if '8.1' in self.backend['rest_version']: @@ -239,14 +240,15 @@ class DS8KCommonHelper(object): message=_("REST for DS8K 8.1 does not support PPRC " "consistency group, please upgrade the CCL.")) valid_rest_version = None - if ('5.7' in self.backend['rest_version'] and + rest_ver = self.backend['rest_version'][0:2] + if ('87' == rest_ver and dist_version.LooseVersion(self.backend['rest_version']) < - dist_version.LooseVersion(self.REST_VERSION_5_7_MIN_PPRC_CG)): - valid_rest_version = self.REST_VERSION_5_7_MIN_PPRC_CG - elif ('5.8' in self.backend['rest_version'] and + dist_version.LooseVersion(self.REST_VERSION_87_51_MIN_PPRC_CG)): + valid_rest_version = self.REST_VERSION_87_51_MIN_PPRC_CG + elif ('88' == rest_ver and dist_version.LooseVersion(self.backend['rest_version']) < - dist_version.LooseVersion(self.REST_VERSION_5_8_MIN_PPRC_CG)): - valid_rest_version = self.REST_VERSION_5_8_MIN_PPRC_CG + dist_version.LooseVersion(self.REST_VERSION_88_20_MIN_PPRC_CG)): + valid_rest_version = self.REST_VERSION_88_20_MIN_PPRC_CG if valid_rest_version: raise exception.VolumeDriverException( @@ -760,7 +762,7 @@ class DS8KCommonHelper(object): self._client.send('DELETE', '/volumes/%s' % lun_id) def _get_version(self): - return self._client.fetchone('GET', '') + return self._client.fetchone('GET', '/systems') @proxy.logger def _create_lun(self, volData): @@ -1042,8 +1044,8 @@ class DS8KECKDHelper(DS8KCommonHelper): OPTIONAL_PARAMS = ['ds8k_host_type', 'port_pairs', 'ds8k_ssid_prefix', 'lss_range_for_cg'] # if use new REST API, please update the version below - VALID_REST_VERSION_5_7_MIN = '5.7.51.1068' - VALID_REST_VERSION_5_8_MIN = '5.8.20.1059' + VALID_REST_VERSION_87_51_MIN = '87.51.63.0' + VALID_REST_VERSION_88_20_MIN = '88.20.112.0' MIN_VALID_STORAGE_VERSION = '8.1' INVALID_STORAGE_VERSION = '8.0.1' @@ -1094,19 +1096,20 @@ class DS8KECKDHelper(DS8KCommonHelper): dist_version.LooseVersion(self.MIN_VALID_STORAGE_VERSION)): self._disable_thin_provision = True - if (('5.7' in self.backend['rest_version'] and + rest_ver = self.backend['rest_version'][0:2] + if (('87' == rest_ver and dist_version.LooseVersion(self.backend['rest_version']) < - dist_version.LooseVersion(self.VALID_REST_VERSION_5_7_MIN)) or - ('5.8' in self.backend['rest_version'] and + dist_version.LooseVersion(self.VALID_REST_VERSION_87_51_MIN)) or + ('88' == rest_ver and dist_version.LooseVersion(self.backend['rest_version']) < - dist_version.LooseVersion(self.VALID_REST_VERSION_5_8_MIN))): + dist_version.LooseVersion(self.VALID_REST_VERSION_88_20_MIN))): raise exception.VolumeDriverException( message=(_("REST version %(invalid)s is lower than " "%(valid)s, please upgrade it in DS8K.") % {'invalid': self.backend['rest_version'], - 'valid': (self.VALID_REST_VERSION_5_7_MIN if '5.7' - in self.backend['rest_version'] else - self.VALID_REST_VERSION_5_8_MIN)})) + 'valid': (self.VALID_REST_VERSION_87_51_MIN + if '87' == rest_ver else + self.VALID_REST_VERSION_88_20_MIN)})) @proxy.logger def _get_device_mapping(self): diff --git a/releasenotes/notes/bug-1895510-REST-API-issue-to-get-bundle-198a3b89255759bb.yaml b/releasenotes/notes/bug-1895510-REST-API-issue-to-get-bundle-198a3b89255759bb.yaml new file mode 100644 index 00000000000..7aa84798cd0 --- /dev/null +++ b/releasenotes/notes/bug-1895510-REST-API-issue-to-get-bundle-198a3b89255759bb.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + `Bug #1895510 `_: + IBM DS8K: Fixed compatability issue when using the IBM DS8K driver + with storage version R9 and later.