]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
EMC VMAX - Changing PercentSynced to CopyState in isSynched
authorHelen Walsh <helen.walsh@emc.com>
Wed, 18 Nov 2015 15:40:11 +0000 (15:40 +0000)
committerHelen Walsh <helen.walsh@emc.com>
Fri, 26 Feb 2016 22:18:23 +0000 (22:18 +0000)
In SE 8.x PercentSynced no longer works for VMAX3 as a criteria to
determine whether a device is synched or not. Luckily 'CopyState'
works for both VMAX2 and VMAX3 and is backward compatible with 7.6.x.

Change-Id: I443e5f17f3c0e779ebdfd868bcd05cb85b52f525
Closes-Bug: #1517103

cinder/tests/unit/test_emc_vmax.py
cinder/volume/drivers/emc/emc_vmax_fc.py
cinder/volume/drivers/emc/emc_vmax_iscsi.py
cinder/volume/drivers/emc/emc_vmax_utils.py

index 23e024c34c22d4332ddb579498979eb379cc0861..678aa0552308e87bece7f13d429d8e5a8c692b6d 100644 (file)
@@ -494,6 +494,8 @@ class EMCVMAXCommonData(object):
                    'isV3': True,
                    'portgroupname': u'OS-portgroup-PG'}
     remainingSLOCapacity = '123456789'
+    SYNCHRONIZED = 4
+    UNSYNCHRONIZED = 3
 
 
 class FakeLookupService(object):
@@ -1174,6 +1176,12 @@ class FakeEcomConnection(object):
         svInstance['SyncedElement'] = 'SyncedElement'
         svInstance['SystemElement'] = 'SystemElement'
         svInstance['PercentSynced'] = 100
+        if 'PercentSynced' in objectpath and objectpath['PercentSynced'] < 100:
+            svInstance['PercentSynced'] = 50
+        svInstance['CopyState'] = self.data.SYNCHRONIZED
+        if 'CopyState' in objectpath and (
+                objectpath['CopyState'] != self.data.SYNCHRONIZED):
+            svInstance['CopyState'] = self.data.UNSYNCHRONIZED
         return svInstance
 
     def _getinstance_replicationServCapabilities(self, objectpath):
@@ -1623,6 +1631,7 @@ class FakeEcomConnection(object):
         svInstance['SystemElement'] = sourceInstanceName
         svInstance['CreationClassName'] = 'SE_StorageSynchronized_SV_SV'
         svInstance['PercentSynced'] = 100
+        svInstance['CopyState'] = self.data.UNSYNCHRONIZED
         svInstances.append(svInstance)
         return svInstances
 
@@ -2036,6 +2045,14 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
             storageGroupName, volumeInstance, volumeName,
             storageSystemInstanceName, False, extraSpecs)
 
+    def test_is_sync_complete(self):
+        conn = self.fake_ecom_connection()
+        syncname = SE_ConcreteJob()
+        syncname.classname = 'SE_StorageSynchronized_SV_SV'
+        syncname['CopyState'] = self.data.UNSYNCHRONIZED
+        issynched = self.driver.common.utils._is_sync_complete(conn, syncname)
+        self.assertFalse(issynched)
+
     def test_generate_unique_trunc_pool(self):
         pool_under_16_chars = 'pool_under_16'
         pool1 = self.driver.utils.generate_unique_trunc_pool(
index c6c612593d5600217fc284fff6c62462032e6432..d64af926e49b7f49b17165fafba1dfc0accac5eb 100644 (file)
@@ -57,6 +57,7 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
               - _remove_last_vol_and_delete_sg is not being called
                 for VMAX3 (bug #1520549)
               - necessary updates for CG changes (#1534616)
+              - Changing PercentSynced to CopyState (bug #1517103)
     """
 
     VERSION = "2.3.0"
index e8edf4737d5218c677bebb9ad7ee610540526703..78fd1d1e145bec4a285bd22f89120ae7d785715e 100644 (file)
@@ -63,6 +63,7 @@ class EMCVMAXISCSIDriver(driver.ISCSIDriver):
               - _remove_last_vol_and_delete_sg is not being called
                 for VMAX3 (bug #1520549)
               - necessary updates for CG changes (#1534616)
+              - Changing PercentSynced to CopyState (bug #1517103)
     """
 
     VERSION = "2.3.0"
index 7144d1d1bf01caf5c78956738bc92d4fc95ae23b..a065a2505433aa9ac303470ad5305ca1f3540293 100644 (file)
@@ -53,6 +53,7 @@ INTERVAL = 'storagetype:interval'
 RETRIES = 'storagetype:retries'
 CIM_ERR_NOT_FOUND = 6
 VOLUME_ELEMENT_NAME_PREFIX = 'OS-'
+SYNCHRONIZED = 4
 
 
 class EMCVMAXUtils(object):
@@ -439,15 +440,11 @@ class EMCVMAXUtils(object):
         """
         syncInstance = conn.GetInstance(syncName,
                                         LocalOnly=False)
-        percentSynced = syncInstance['PercentSynced']
+        copyState = syncInstance['CopyState']
+        LOG.debug("CopyState is %(copyState)lu.",
+                  {'copyState': copyState})
 
-        LOG.debug("Percent synced is %(percentSynced)lu.",
-                  {'percentSynced': percentSynced})
-
-        if percentSynced < 100:
-            return False
-        else:
-            return True
+        return copyState == SYNCHRONIZED
 
     def get_num(self, numStr, datatype):
         """Get the ecom int from the number.