From 303e40121049cc88f462c990d0a53eea74cedb19 Mon Sep 17 00:00:00 2001 From: William Durairaj Date: Fri, 3 Feb 2017 14:44:07 +0530 Subject: [PATCH] 3PAR: Remove un-necessary snapshot in online copy operation While doing an online copy in the 3PAR, we create a temporary snapshot of source volume to do the data copy operation. Online copy is a feature in 3PAR whereby a copy initiated on a source volume , and when the data copy is in progress, the target volume of the copy is immediately available for volume attachment and performing I/O is allowed on that volume Resynching the source and the destination volume is done automatically by the 3PAR internally. Reasoning behind removing the temporary snapshot of the source volume is that, internally 3PAR creates a temporary snapshot and extra snapshot created by Cinder 3PAR Driver is un-necessary. Also this temporary snapshot is not cleaned up on the completion of online copy operation. The presence of the temporary snapshot during the volume copy operation is confirmed by running the "showtask" on the asynchronous task id. Change-Id: Ia2cb70e77211a372f73eaf577dbf57715c5a363f Closes-Bug: 1661541 --- .../unit/volume/drivers/hpe/test_hpe3par.py | 37 ++----------------- cinder/volume/drivers/hpe/hpe_3par_common.py | 9 +++-- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 77d055ac010..9a5d30e0e7a 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -1843,17 +1843,9 @@ class HPE3PARBaseDriver(object): model_update = self.driver.create_cloned_volume(volume, src_vref) self.assertIsNone(model_update) - common = hpecommon.HPE3PARCommon(None) - vol_name = common._get_3par_vol_name(src_vref['id']) - # snapshot name is random - snap_name = mock.ANY - optional = mock.ANY - expected = [ - mock.call.createSnapshot(snap_name, vol_name, optional), - mock.call.getVolume(snap_name), mock.call.copyVolume( - snap_name, + self.VOLUME_NAME_3PAR, 'osv-0DM4qZEVSKON-AAAAAAAAA', HPE3PAR_CPG2, {'snapCPG': 'OpenStackCPGSnap', 'tpvv': True, @@ -1888,17 +1880,9 @@ class HPE3PARBaseDriver(object): model_update = self.driver.create_cloned_volume(volume, src_vref) self.assertIsNone(model_update) - common = hpecommon.HPE3PARCommon(None) - vol_name = common._get_3par_vol_name(src_vref['id']) - # snapshot name is random - snap_name = mock.ANY - optional = mock.ANY - expected = [ - mock.call.createSnapshot(snap_name, vol_name, optional), - mock.call.getVolume(snap_name), mock.call.copyVolume( - snap_name, + self.VOLUME_NAME_3PAR, 'osv-0DM4qZEVSKON-AAAAAAAAA', HPE3PAR_CPG2, {'snapCPG': 'OpenStackCPGSnap', 'tpvv': True, @@ -1937,17 +1921,12 @@ class HPE3PARBaseDriver(object): common = hpecommon.HPE3PARCommon(None) vol_name = common._get_3par_vol_name(src_vref['id']) - # snapshot name is random - snap_name = mock.ANY - optional = mock.ANY expected = [ mock.call.getVolumeMetaData(vol_name, 'HPQ-cinder-CHAP-name'), - mock.call.createSnapshot(snap_name, vol_name, optional), - mock.call.getVolume(snap_name), mock.call.copyVolume( - snap_name, + self.VOLUME_NAME_3PAR, 'osv-0DM4qZEVSKON-AAAAAAAAA', HPE3PAR_CPG2, {'snapCPG': 'OpenStackCPGSnap', 'tpvv': True, @@ -2082,18 +2061,10 @@ class HPE3PARBaseDriver(object): model_update = self.driver.create_cloned_volume(volume, src_vref) self.assertIsNone(model_update) - # creation of the temp snapshot - common = hpecommon.HPE3PARCommon(None) - snap_name = mock.ANY - vol_name = common._get_3par_vol_name(src_vref['id']) - optional = mock.ANY - expected = [ - mock.call.createSnapshot(snap_name, vol_name, optional), - mock.call.getVolume(snap_name), mock.call.getCPG(expected_cpg), mock.call.copyVolume( - snap_name, + 'osv-0DM4qZEVSKON-AAAAAAAAA', self.VOLUME_3PAR_NAME, expected_cpg, {'snapCPG': 'OpenStackCPGSnap', 'tpvv': True, diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index a421e0645e5..59c612bdd0e 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -247,10 +247,13 @@ class HPE3PARCommon(object): 3.0.27 - Fix snapCPG error during backup of attached volume. Bug #1646396 and also ,Fix backup of attached ISCSI and CHAP enabled volume.bug #1644238. + 3.0.28 - Remove un-necessary snapshot creation of source volume + while doing online copy in create_cloned_volume call. + Bug #1661541 """ - VERSION = "3.0.27" + VERSION = "3.0.28" stats = {} @@ -2021,15 +2024,13 @@ class HPE3PARCommon(object): if volume['size'] == src_vref['size'] and not ( back_up_process and vol_chap_enabled): LOG.debug("Creating a clone of volume, using online copy.") - # create a temporary snapshot - snapshot = self._create_temp_snapshot(src_vref) type_info = self.get_volume_settings_from_type(volume) cpg = type_info['cpg'] # make the 3PAR copy the contents. # can't delete the original until the copy is done. - self._copy_volume(snapshot['name'], vol_name, cpg=cpg, + self._copy_volume(src_vol_name, vol_name, cpg=cpg, snap_cpg=type_info['snap_cpg'], tpvv=type_info['tpvv'], tdvv=type_info['tdvv'])