Add fast format option for thick volume creation

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
This commit is contained in:
Xiaoqin Li 2015-10-04 10:59:37 -07:00 committed by xiaoqin
parent be7374b32e
commit a75b6f3da3
3 changed files with 37 additions and 4 deletions

View 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,

View 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

View 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',