From: Xing Yang Date: Fri, 27 Mar 2015 21:07:58 +0000 (-0400) Subject: Fix the format of the system name in VMAX driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=5490b47660382c867b42a4c7a589e65b61341755;p=openstack-build%2Fcinder-build.git Fix the format of the system name in VMAX driver There is a change in the format for system name in SMI-S for VMAX V3. It was "SYMMETRIX+xxxxxx" previously and now it is changed to "SYMMETRIX-+-xxxxxx". In this patch, the VMAX driver was modified accordingly to support this format. Change-Id: Ie7e349db13d6ad2562a296d3d0cb66089a54b800 Closes-Bug: #1437490 --- diff --git a/cinder/tests/test_emc_vmax.py b/cinder/tests/test_emc_vmax.py index 34643d9d2..d390ed4ff 100644 --- a/cinder/tests/test_emc_vmax.py +++ b/cinder/tests/test_emc_vmax.py @@ -1611,6 +1611,19 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): def fake_is_v3(self, conn, serialNumber): return False + def test_format_system_name(self): + v2array = ['SYMMETRIX', '000195900551', 'U', 'gold'] + systemnameV2 = self.driver.utils._format_system_name(v2array[0], + v2array[1], + '+') + self.assertEqual('SYMMETRIX+000195900551', systemnameV2) + + v3array = ['SYMMETRIX', '000197200056', 'SRP_1'] + systemnameV3 = self.driver.utils._format_system_name(v3array[0], + v3array[1], + '-+-') + self.assertEqual('SYMMETRIX-+-000197200056', systemnameV3) + def test_wait_for_job_complete(self): myjob = SE_ConcreteJob() myjob.classname = 'SE_ConcreteJob' diff --git a/cinder/volume/drivers/emc/emc_vmax_utils.py b/cinder/volume/drivers/emc/emc_vmax_utils.py index 9afe209b2..481f2f32e 100644 --- a/cinder/volume/drivers/emc/emc_vmax_utils.py +++ b/cinder/volume/drivers/emc/emc_vmax_utils.py @@ -869,21 +869,23 @@ class EMCVMAXUtils(object): idarray = poolInstanceId.split('+') if len(idarray) > 2: - systemName = self._format_system_name(idarray[0], idarray[1]) + systemName = self._format_system_name(idarray[0], idarray[1], '+') LOG.debug("Pool name: %(poolName)s System name: %(systemName)s.", {'poolName': poolName, 'systemName': systemName}) return poolName, systemName - def _format_system_name(self, part1, part2): + def _format_system_name(self, part1, part2, sep): """Join to make up system name :param part1: the prefix + :param sep: the separator :param part2: the postfix :returns: systemName """ - return ("%(part1)s+%(part2)s" + return ("%(part1)s%(sep)s%(part2)s" % {'part1': part1, + 'sep': sep, 'part2': part2}) def parse_pool_instance_id_v3(self, poolInstanceId): @@ -903,7 +905,8 @@ class EMCVMAXUtils(object): idarray = poolInstanceId.split('-+-') if len(idarray) > 2: - systemName = self._format_system_name(idarray[0], idarray[1]) + systemName = ( + self._format_system_name(idarray[0], idarray[1], '-+-')) LOG.debug("Pool name: %(poolName)s System name: %(systemName)s.", {'poolName': poolName, 'systemName': systemName})