From: Gerald McBrearty Date: Fri, 20 Nov 2015 21:15:29 +0000 (-0600) Subject: Storwize: add config option to control flash copy rate X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=08c839511ca539072ae52500c1bb540a61803ff9;p=openstack-build%2Fcinder-build.git Storwize: add config option to control flash copy rate When creating a flash copy of a vdisk during a clone or a snapshot operation the svcinfo mkfcmap operation allows the specification of a copy rate for the flash copy. The default copy rate is 50. The issue with 50 is it not always an acceptable default copy rate for a particular operator. Some operators want it slower but some want to increase the default copy rate. Adding a configuration option storwize_svc_flashcopy_rate to allow an operator to specify the default flash copy rate to be used when starting a vdisk flash copy on a clone or snapshot operation. DocImpact Change-Id: Iffa50cf934f5d340a1f24ed3cfea8381b6dd6630 Closes-Bug: 1517185 --- diff --git a/cinder/tests/unit/test_storwize_svc.py b/cinder/tests/unit/test_storwize_svc.py index 76af4863a..19ffb10d1 100644 --- a/cinder/tests/unit/test_storwize_svc.py +++ b/cinder/tests/unit/test_storwize_svc.py @@ -1743,6 +1743,7 @@ class StorwizeSVCDriverTestCase(test.TestCase): 'san_password': 'pass', 'storwize_svc_volpool_name': 'openstack', 'storwize_svc_flashcopy_timeout': 20, + 'storwize_svc_flashcopy_rate': 49, # Test ignore capitalization 'storwize_svc_connection_protocol': 'iScSi', 'storwize_svc_multipath_enabled': False, @@ -2073,6 +2074,11 @@ class StorwizeSVCDriverTestCase(test.TestCase): if self.USESIM: self.sim.error_injection('lsfcmap', 'speed_up') self.driver.create_cloned_volume(vol3, vol2) + if self.USESIM: + # validate copyrate was set on the flash copy + for i, fcmap in self.sim._fcmappings_list.items(): + if fcmap['target'] == vol2['name']: + self.assertEqual('49', fcmap['copyrate']) self._assert_vol_exists(vol3['name'], True) # Delete in the 'opposite' order to make sure it works diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index 9c3e62066..21da320ac 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -119,6 +119,12 @@ storwize_svc_opts = [ default=False, help='Specifies that the volume not be formatted during ' 'creation.'), + cfg.IntOpt('storwize_svc_flashcopy_rate', + default=50, + min=1, max=100, + help='Specifies the Storwize FlashCopy copy rate to be used ' + 'when creating a full volume copy. The default is rate ' + 'is 50, and the valid rates are 1-100.'), ] CONF = cfg.CONF diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index c7050967d..00a63cdcb 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -259,11 +259,13 @@ class StorwizeSSH(object): '-unit', 'gb', vdisk]) self.run_ssh_assert_no_output(ssh_cmd) - def mkfcmap(self, source, target, full_copy, consistgrp=None): + def mkfcmap(self, source, target, full_copy, copy_rate, consistgrp=None): ssh_cmd = ['svctask', 'mkfcmap', '-source', source, '-target', target, '-autodelete'] if not full_copy: ssh_cmd.extend(['-copyrate', '0']) + else: + ssh_cmd.extend(['-copyrate', six.text_type(copy_rate)]) if consistgrp: ssh_cmd.extend(['-consistgrp', consistgrp]) out, err = self._ssh(ssh_cmd, check_exit_code=False) @@ -1127,13 +1129,14 @@ class StorwizeHelpers(object): return mapping_ready self._wait_for_a_condition(prepare_fc_consistgrp_success, timeout) - def run_flashcopy(self, source, target, timeout, full_copy=True): + def run_flashcopy(self, source, target, timeout, copy_rate, + full_copy=True): """Create a FlashCopy mapping from the source to the target.""" LOG.debug('Enter: run_flashcopy: execute FlashCopy from source ' '%(source)s to target %(target)s.', {'source': source, 'target': target}) - fc_map_id = self.ssh.mkfcmap(source, target, full_copy) + fc_map_id = self.ssh.mkfcmap(source, target, full_copy, copy_rate) self._prepare_fc_map(fc_map_id, timeout) self.ssh.startfcmap(fc_map_id) @@ -1163,7 +1166,9 @@ class StorwizeHelpers(object): pool = config.storwize_svc_volpool_name self.create_vdisk(target, src_size, 'b', pool, opts) - self.ssh.mkfcmap(source, target, full_copy, consistgrp) + self.ssh.mkfcmap(source, target, full_copy, + config.storwize_svc_flashcopy_rate, + consistgrp=consistgrp) LOG.debug('Leave: create_flashcopy_to_consistgrp: ' 'FlashCopy started from %(source)s to %(target)s.', @@ -1286,7 +1291,9 @@ class StorwizeHelpers(object): self.create_vdisk(tgt, src_size, 'b', pool, opts) timeout = config.storwize_svc_flashcopy_timeout try: - self.run_flashcopy(src, tgt, timeout, full_copy=full_copy) + self.run_flashcopy(src, tgt, timeout, + config.storwize_svc_flashcopy_rate, + full_copy=full_copy) except Exception: with excutils.save_and_reraise_exception(): self.delete_vdisk(tgt, True)