]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix the format of the system name in VMAX driver
authorXing Yang <xing.yang@emc.com>
Fri, 27 Mar 2015 21:07:58 +0000 (17:07 -0400)
committerXing Yang <xing.yang@emc.com>
Fri, 27 Mar 2015 21:07:58 +0000 (17:07 -0400)
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

cinder/tests/test_emc_vmax.py
cinder/volume/drivers/emc/emc_vmax_utils.py

index 34643d9d2da9afc80dcf221c796325e5f1edb982..d390ed4fff21784e1beaaba8a925480c578b0615 100644 (file)
@@ -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'
index 9afe209b27e597ca5d75c3a34133ce035a2cef1e..481f2f32e585901b7559118fb83d7510c09a12aa 100644 (file)
@@ -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})