From cfba8b358430e399d889918e954b9f4f6660a009 Mon Sep 17 00:00:00 2001 From: Helen Walsh Date: Wed, 18 Nov 2015 15:40:11 +0000 Subject: [PATCH] EMC VMAX - Changing PercentSynced to CopyState in isSynched 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 | 17 +++++++++++++++++ cinder/volume/drivers/emc/emc_vmax_fc.py | 1 + cinder/volume/drivers/emc/emc_vmax_iscsi.py | 1 + cinder/volume/drivers/emc/emc_vmax_utils.py | 13 +++++-------- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/cinder/tests/unit/test_emc_vmax.py b/cinder/tests/unit/test_emc_vmax.py index 23e024c34..678aa0552 100644 --- a/cinder/tests/unit/test_emc_vmax.py +++ b/cinder/tests/unit/test_emc_vmax.py @@ -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( diff --git a/cinder/volume/drivers/emc/emc_vmax_fc.py b/cinder/volume/drivers/emc/emc_vmax_fc.py index c6c612593..d64af926e 100644 --- a/cinder/volume/drivers/emc/emc_vmax_fc.py +++ b/cinder/volume/drivers/emc/emc_vmax_fc.py @@ -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" diff --git a/cinder/volume/drivers/emc/emc_vmax_iscsi.py b/cinder/volume/drivers/emc/emc_vmax_iscsi.py index e8edf4737..78fd1d1e1 100644 --- a/cinder/volume/drivers/emc/emc_vmax_iscsi.py +++ b/cinder/volume/drivers/emc/emc_vmax_iscsi.py @@ -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" diff --git a/cinder/volume/drivers/emc/emc_vmax_utils.py b/cinder/volume/drivers/emc/emc_vmax_utils.py index 7144d1d1b..a065a2505 100644 --- a/cinder/volume/drivers/emc/emc_vmax_utils.py +++ b/cinder/volume/drivers/emc/emc_vmax_utils.py @@ -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. -- 2.45.2