[SVf] As part of Flashcopy 2.0 adding config parameter to support volumegroup
[Spectrum Virtualize family] As part of Flashcopy 2.0 implementation, added configuration parameter 'storwize_volume_group' to support volume group feature. Implements: blueprint ibm-svf-volumegroup Change-Id: If9ee94815bb257fb24bfcfca2bee9e64dd499636
This commit is contained in:
parent
1a2b0796a2
commit
b17b830668
|
@ -7229,6 +7229,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
|||
def test_storwize_create_and_delete_volumegroup(self, delete_volumegroup,
|
||||
create_volumegroup):
|
||||
"""Test volume group creation and deletion"""
|
||||
# Seting the storwize_volume_group to True
|
||||
self._set_flag('storwize_volume_group', True)
|
||||
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'get_system_info') as get_system_info:
|
||||
fake_system_info = {'code_level': (8, 5, 1, 0),
|
||||
|
@ -7260,6 +7262,45 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
|||
self.assertEqual(fields.GroupStatus.DELETED,
|
||||
model_update[0]['status'])
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'create_volumegroup')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'delete_volumegroup')
|
||||
def test_storwize_volume_group_flag_false(self, delete_volumegroup,
|
||||
create_volumegroup):
|
||||
"""Test volume group creation with storwize_volume_group as False"""
|
||||
# Setting the storwize_volume_group to False
|
||||
self._set_flag('storwize_volume_group', False)
|
||||
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'get_system_info') as get_system_info:
|
||||
fake_system_info = {'code_level': (8, 5, 1, 0),
|
||||
'system_name': 'storwize-svc-sim',
|
||||
'system_id': '0123456789ABCDEF'}
|
||||
get_system_info.return_value = fake_system_info
|
||||
self.driver.do_setup(None)
|
||||
|
||||
volumegroup_spec = {'volume_group_enabled': '<is> True'}
|
||||
volumegroup_type_ref = group_types.create(self.ctxt,
|
||||
'volumegroup_type',
|
||||
volumegroup_spec)
|
||||
volumegroup_type = objects.GroupType.get_by_id(
|
||||
self.ctxt, volumegroup_type_ref['id'])
|
||||
|
||||
vol_type_ref = volume_types.create(self.ctxt, 'non_rep_type', {})
|
||||
volumegroup = testutils.create_group(
|
||||
self.ctxt, group_type_id=volumegroup_type.id,
|
||||
volume_type_ids=[vol_type_ref['id']])
|
||||
|
||||
# Create Volume Group
|
||||
model_update = self.driver.create_group(self.ctxt, volumegroup)
|
||||
self.assertEqual(fields.GroupStatus.ERROR,
|
||||
model_update['status'])
|
||||
# Delete Volume Group
|
||||
model_update = self.driver.delete_group(self.ctxt, volumegroup, [])
|
||||
self.assertTrue(delete_volumegroup.called)
|
||||
self.assertEqual(fields.GroupStatus.DELETED,
|
||||
model_update[0]['status'])
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'create_volumegroup')
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
|
@ -7267,6 +7308,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
|||
def test_storwize_update_volumegroup(self, delete_volumegroup,
|
||||
create_volumegroup):
|
||||
"""Test volume group updation"""
|
||||
# Seting the storwize_volume_group to True
|
||||
self._set_flag('storwize_volume_group', True)
|
||||
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'get_system_info') as get_system_info:
|
||||
fake_system_info = {'code_level': (8, 5, 1, 0),
|
||||
|
@ -7341,6 +7384,8 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
|||
def test_storwize_create_and_delete_volumegroup_snapshot(
|
||||
self, get_system_info):
|
||||
"""Test creation and deletion of volumegroup snapshot"""
|
||||
# Seting the storwize_volume_group to True
|
||||
self._set_flag('storwize_volume_group', True)
|
||||
fake_system_info = {'code_level': (8, 5, 1, 0),
|
||||
'system_name': 'storwize-svc-sim',
|
||||
'system_id': '0123456789ABCDEF'}
|
||||
|
|
|
@ -173,6 +173,10 @@ storwize_svc_opts = [
|
|||
'or moving the primary volume from mirror to non-mirror '
|
||||
'with replication enabled. This option is valid for '
|
||||
'Storage Virtualize Family.'),
|
||||
cfg.BoolOpt('storwize_volume_group',
|
||||
default=False,
|
||||
help='Parameter to enable or disable Volume Group'
|
||||
'(True/False)'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
@ -3410,9 +3414,10 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
2.1 - Added replication V2 support to the global/metro mirror
|
||||
mode
|
||||
2.1.1 - Update replication to version 2.1
|
||||
2.1.2 - Added support volume_group (Flash copy)
|
||||
"""
|
||||
|
||||
VERSION = "2.1.1"
|
||||
VERSION = "2.1.2"
|
||||
VDISKCOPYOPS_INTERVAL = 600
|
||||
DEFAULT_GR_SLEEP = random.randint(20, 500) / 100.0
|
||||
|
||||
|
@ -6283,16 +6288,49 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
model_update = {'status': fields.GroupStatus.ERROR}
|
||||
return model_update
|
||||
|
||||
storwize_volume_group = self.configuration.safe_get(
|
||||
'storwize_volume_group')
|
||||
LOG.info('CONFIG:value of storwize_volume_group'
|
||||
' is %s', storwize_volume_group)
|
||||
|
||||
if volume_utils.is_group_a_type(group, "volume_group_enabled"):
|
||||
try:
|
||||
self._helpers.check_codelevel_for_volumegroup(
|
||||
self._state['code_level'])
|
||||
volumegroup_name = self._get_volumegroup_name(group)
|
||||
self._helpers.create_volumegroup(volumegroup_name)
|
||||
except exception.VolumeBackendAPIException as err:
|
||||
LOG.error("Failed to create volume group %(volumegroup)s. "
|
||||
"Exception: %(exception)s.",
|
||||
{'volumegroup': volumegroup_name, 'exception': err})
|
||||
if storwize_volume_group:
|
||||
try:
|
||||
self._helpers.check_codelevel_for_volumegroup(
|
||||
self._state['code_level'])
|
||||
for vol_type_id in group.volume_type_ids:
|
||||
replication_type = self._get_volume_replicated_type(
|
||||
context, None, vol_type_id)
|
||||
if replication_type:
|
||||
# An unsupported configuration
|
||||
LOG.error('Unable to create group: '
|
||||
'volume_group_enabled group with '
|
||||
'replication volume type is '
|
||||
'not supported.')
|
||||
model_update = {'status': fields.GroupStatus.ERROR}
|
||||
return model_update
|
||||
opts = self._get_vdisk_params(vol_type_id)
|
||||
if opts['volume_topology']:
|
||||
# An unsupported configuration
|
||||
LOG.error('Unable to create group: '
|
||||
'volume_group_enabled group with a '
|
||||
'hyperswap volume type is '
|
||||
'not supported.')
|
||||
model_update = {'status': fields.GroupStatus.ERROR}
|
||||
return model_update
|
||||
volumegroup_name = self._get_volumegroup_name(group)
|
||||
self._helpers.create_volumegroup(volumegroup_name)
|
||||
except exception.VolumeBackendAPIException as err:
|
||||
LOG.error("Failed to create volume group %(volumegroup)s. "
|
||||
"Exception: %(exception)s.",
|
||||
{'volumegroup': volumegroup_name,
|
||||
'exception': err})
|
||||
model_update = {'status': fields.GroupStatus.ERROR}
|
||||
return model_update
|
||||
else:
|
||||
LOG.error('Unable to create group: Error creating volume group'
|
||||
' with storwize_volume_group value set to False'
|
||||
' in the configuration.')
|
||||
model_update = {'status': fields.GroupStatus.ERROR}
|
||||
return model_update
|
||||
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
IBM Spectrum Virtualize Family driver: Added `storwize_volume_group`
|
||||
parameter in the cinder configuration to support volume group
|
||||
feature.
|
Loading…
Reference in New Issue