]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add fast format option for thick volume creation
authorXiaoqin Li <xiaoqin.li@hotmail.com>
Sun, 4 Oct 2015 17:59:37 +0000 (10:59 -0700)
committerxiaoqin <lixqin@cn.ibm.com>
Thu, 8 Oct 2015 09:08:27 +0000 (09:08 +0000)
Add option for user to disable fast format at thick
provisioned volume creation in IBM Storwize cinder.
The default value is False and clients who do not want
to do Fast Format for thick volume, they can set this
parameter to True.

DocImpact: Add fast format option
Change-Id: Ib627696b91c336d09de6066ee70ee518fca5a7a9
Closes-Bug: 1502404

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

index 73c0167071665d863f72f32280d50edef2d6e21d..8bf592aab0e7707b5d710645fbfd071a1ab52385 100644 (file)
@@ -223,6 +223,7 @@ class StorwizeSVCManagementSimulator(object):
             'compressed',
             'force',
             'nohdr',
+            'nofmtdisk'
         ]
         one_param_args = [
             'chapsecret',
@@ -622,6 +623,7 @@ port_speed!N/A
                 volume_info['easy_tier'] = 'off'
 
         if 'rsize' in kwargs:
+            volume_info['formatted'] = 'no'
             # Fake numbers
             volume_info['used_capacity'] = '786432'
             volume_info['real_capacity'] = '21474816'
@@ -650,6 +652,10 @@ port_speed!N/A
             volume_info['autoexpand'] = ''
             volume_info['grainsize'] = ''
             volume_info['compressed_copy'] = 'no'
+            volume_info['formatted'] = 'yes'
+            if 'nofmtdisk' in kwargs:
+                if kwargs['nofmtdisk']:
+                    volume_info['formatted'] = 'no'
 
         vol_cp = {'id': '0',
                   'status': 'online',
@@ -778,7 +784,7 @@ port_speed!N/A
             rows.append(['IO_group_name', vol['IO_group_name']])
             rows.append(['status', 'online'])
             rows.append(['capacity', cap])
-            rows.append(['formatted', 'no'])
+            rows.append(['formatted', vol['formatted']])
             rows.append(['mdisk_id', ''])
             rows.append(['mdisk_name', ''])
             rows.append(['FC_id', fcmap_info['fc_id']])
@@ -1840,6 +1846,12 @@ class StorwizeSVCDriverTestCase(test.TestCase):
                           self.driver.check_for_setup_error)
         self._reset_flags()
 
+        self._set_flag('storwize_svc_vol_rsize', 2)
+        self._set_flag('storwize_svc_vol_nofmtdisk', True)
+        self.assertRaises(exception.InvalidInput,
+                          self.driver.check_for_setup_error)
+        self._reset_flags()
+
         self._set_flag('storwize_svc_connection_protocol', 'foo')
         self.assertRaises(exception.InvalidInput,
                           self.driver.check_for_setup_error)
@@ -1940,7 +1952,8 @@ class StorwizeSVCDriverTestCase(test.TestCase):
                'iogrp': 0,
                'qos': None,
                'replication': False,
-               'stretched_cluster': None}
+               'stretched_cluster': None,
+               'nofmtdisk': False}
         return opt
 
     @mock.patch.object(helpers.StorwizeHelpers, 'add_vdisk_qos')
@@ -2186,12 +2199,21 @@ class StorwizeSVCDriverTestCase(test.TestCase):
         # easytier      False   2
         # iogrp         0       1
         # iogrp         1       2
+        # nofmtdisk     False   1
+        # nofmtdisk     True    1
 
         opts_list = []
         chck_list = []
         opts_list.append({'rsize': -1, 'easytier': True, 'iogrp': 0})
         chck_list.append({'free_capacity': '0', 'easy_tier': 'on',
                           'IO_group_id': '0'})
+
+        opts_list.append({'rsize': -1, 'nofmtdisk': False})
+        chck_list.append({'formatted': 'yes'})
+
+        opts_list.append({'rsize': -1, 'nofmtdisk': True})
+        chck_list.append({'formatted': 'no'})
+
         test_iogrp = 1 if self.USESIM else 0
         opts_list.append({'rsize': 2, 'compression': False, 'warning': 0,
                           'autoexpand': True, 'grainsize': 32,
index cf400ec42889e4b86422d62c709a93e7ea0407c4..e33c62aef129d8f4305359c80ee2a87d61f5252a 100644 (file)
@@ -124,6 +124,10 @@ storwize_svc_opts = [
                help='If operating in stretched cluster mode, specify the '
                     'name of the pool in which mirrored copies are stored.'
                     'Example: "pool2"'),
+    cfg.BoolOpt('storwize_svc_vol_nofmtdisk',
+                default=False,
+                help='Specifies that the volume not be formatted during '
+                     'creation.'),
 ]
 
 CONF = cfg.CONF
index 79326ccfe7cd4ed5df8ba549f3b96b98999a03b2..deef1fbf60db9beb58d5351d9dfeea6fb1f2d748 100644 (file)
@@ -399,7 +399,8 @@ class StorwizeHelpers(object):
                'iogrp': config.storwize_svc_vol_iogrp,
                'qos': None,
                'stretched_cluster': cluster_partner,
-               'replication': False}
+               'replication': False,
+               'nofmtdisk': config.storwize_svc_vol_nofmtdisk}
         return opt
 
     @staticmethod
@@ -439,6 +440,11 @@ class StorwizeHelpers(object):
                 % {'iogrp': opts['iogrp'],
                    'avail': avail_grps})
 
+        if opts['nofmtdisk'] and opts['rsize'] != -1:
+            raise exception.InvalidInput(
+                reason=_('If nofmtdisk is set to True, rsize must '
+                         'also be set to -1.'))
+
     def _get_opts_from_specs(self, opts, specs):
         qos = {}
         for k, value in specs.items():
@@ -594,9 +600,10 @@ class StorwizeHelpers(object):
     @staticmethod
     def _get_vdisk_create_params(opts):
         easytier = 'on' if opts['easytier'] else 'off'
-
         if opts['rsize'] == -1:
             params = []
+            if opts['nofmtdisk']:
+                params.append('-nofmtdisk')
         else:
             params = ['-rsize', '%s%%' % str(opts['rsize']),
                       '-autoexpand', '-warning',