]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Storwize: add config option to control flash copy rate
authorGerald McBrearty <gfm@us.ibm.com>
Fri, 20 Nov 2015 21:15:29 +0000 (15:15 -0600)
committerGerald McBrearty <gfm@us.ibm.com>
Thu, 3 Dec 2015 15:49:50 +0000 (09:49 -0600)
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

cinder/tests/unit/test_storwize_svc.py
cinder/volume/drivers/ibm/storwize_svc/__init__.py
cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py

index 76af4863ad7d3f87e90418135344ed053da6f632..19ffb10d1f2c8006b920e123baa7974b8d106609 100644 (file)
@@ -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
index 9c3e6206654e6a7301e1532337aa664e6fa70c20..21da320acaac95ae7c4d79bbd0b8e68d05fa6e12 100644 (file)
@@ -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
index c7050967d3a1eb0ed1e0282972941dbb2bcaa790..00a63cdcbba75529670f0356d91ed84373867fc3 100644 (file)
@@ -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)