Merge "PowerMax Driver - Volume Retype Replication fix"
This commit is contained in:
commit
4bee77bedf
cinder
tests/unit/volume/drivers/dell_emc/powermax
volume/drivers/dell_emc/powermax
@ -1700,7 +1700,7 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
volume_name = self.data.test_attached_volume.name
|
volume_name = self.data.test_attached_volume.name
|
||||||
# Rep Config
|
# Rep Config
|
||||||
rep_mode = 'Synchronous'
|
rep_mode = 'Synchronous'
|
||||||
self.common.rep_config = {'mode': rep_mode}
|
self.common.rep_config = {'mode': rep_mode, 'metro_use_bias': True}
|
||||||
# Extra Specs
|
# Extra Specs
|
||||||
new_type = {'extra_specs': {}}
|
new_type = {'extra_specs': {}}
|
||||||
src_extra_specs = self.data.extra_specs_migrate
|
src_extra_specs = self.data.extra_specs_migrate
|
||||||
@ -1737,8 +1737,10 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
success = self.common._migrate_volume(
|
success = self.common._migrate_volume(
|
||||||
array, volume, device_id, srp, slo, workload, volume_name,
|
array, volume, device_id, srp, slo, workload, volume_name,
|
||||||
new_type, src_extra_specs)[0]
|
new_type, src_extra_specs)[0]
|
||||||
|
cleanup_specs = src_extra_specs
|
||||||
|
cleanup_specs['force_vol_add'] = True
|
||||||
mck_cleanup.assert_called_once_with(
|
mck_cleanup.assert_called_once_with(
|
||||||
volume, volume_name, device_id, src_extra_specs)
|
volume, volume_name, device_id, cleanup_specs)
|
||||||
mck_retype.assert_called_once_with(
|
mck_retype.assert_called_once_with(
|
||||||
array, srp, volume, device_id, src_extra_specs, slo, workload,
|
array, srp, volume, device_id, src_extra_specs, slo, workload,
|
||||||
tgt_extra_specs, False)
|
tgt_extra_specs, False)
|
||||||
@ -1753,8 +1755,11 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
success = self.common._migrate_volume(
|
success = self.common._migrate_volume(
|
||||||
array, volume, device_id, srp, slo, workload, volume_name,
|
array, volume, device_id, srp, slo, workload, volume_name,
|
||||||
new_type, src_extra_specs)[0]
|
new_type, src_extra_specs)[0]
|
||||||
|
mck_setup_specs = src_extra_specs
|
||||||
|
mck_setup_specs[utils.METROBIAS] = self.common.rep_config[
|
||||||
|
'metro_use_bias']
|
||||||
mck_setup.assert_called_once_with(
|
mck_setup.assert_called_once_with(
|
||||||
self.data.array, volume, device_id, src_extra_specs)
|
self.data.array, volume, device_id, mck_setup_specs)
|
||||||
mck_retype.assert_called_once_with(
|
mck_retype.assert_called_once_with(
|
||||||
array, srp, volume, device_id, src_extra_specs, slo,
|
array, srp, volume, device_id, src_extra_specs, slo,
|
||||||
workload, tgt_extra_specs, False)
|
workload, tgt_extra_specs, False)
|
||||||
@ -1779,6 +1784,8 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
mck_setup.assert_not_called()
|
mck_setup.assert_not_called()
|
||||||
self.assertTrue(success)
|
self.assertTrue(success)
|
||||||
|
|
||||||
|
@mock.patch.object(common.PowerMaxCommon, 'setup_volume_replication',
|
||||||
|
return_value=('Status', 'Data', 'Info'))
|
||||||
@mock.patch.object(common.PowerMaxCommon, '_retype_volume',
|
@mock.patch.object(common.PowerMaxCommon, '_retype_volume',
|
||||||
return_value=True)
|
return_value=True)
|
||||||
@mock.patch.object(common.PowerMaxCommon, 'cleanup_lun_replication')
|
@mock.patch.object(common.PowerMaxCommon, 'cleanup_lun_replication')
|
||||||
@ -1792,8 +1799,8 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
@mock.patch.object(common.PowerMaxCommon, 'get_volume_metadata',
|
@mock.patch.object(common.PowerMaxCommon, 'get_volume_metadata',
|
||||||
return_value='')
|
return_value='')
|
||||||
def test_migrate_volume_attachment_path(
|
def test_migrate_volume_attachment_path(
|
||||||
self, mck_meta, mck_remote_retype, mck_setup, mck_inuse_retype,
|
self, mck_meta, mck_remote_retype, mck_setup_use, mck_inuse_retype,
|
||||||
mck_cleanup, mck_retype):
|
mck_cleanup, mck_retype, mck_setup):
|
||||||
# Array/Volume info
|
# Array/Volume info
|
||||||
array = self.data.array
|
array = self.data.array
|
||||||
srp = self.data.srp
|
srp = self.data.srp
|
||||||
@ -1820,7 +1827,7 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
self.assertTrue(success)
|
self.assertTrue(success)
|
||||||
|
|
||||||
mck_cleanup.reset_mock()
|
mck_cleanup.reset_mock()
|
||||||
mck_setup.reset_mock()
|
mck_setup_use.reset_mock()
|
||||||
|
|
||||||
# Scenario 2: Volume not attached
|
# Scenario 2: Volume not attached
|
||||||
with mock.patch.object(self.utils, 'is_replication_enabled',
|
with mock.patch.object(self.utils, 'is_replication_enabled',
|
||||||
@ -1831,6 +1838,23 @@ class PowerMaxCommonTest(test.TestCase):
|
|||||||
mck_retype.assert_called_once()
|
mck_retype.assert_called_once()
|
||||||
self.assertTrue(success)
|
self.assertTrue(success)
|
||||||
|
|
||||||
|
# Scenario 3: Volume not attached, enable RDF
|
||||||
|
tgt_extra_specs = {
|
||||||
|
'srp': srp, 'array': array, 'slo': slo, 'workload': workload,
|
||||||
|
'interval': src_extra_specs['interval'],
|
||||||
|
'retries': src_extra_specs['retries'],
|
||||||
|
utils.METROBIAS: True}
|
||||||
|
self.common.rep_config[utils.METROBIAS] = True
|
||||||
|
with mock.patch.object(self.utils, 'is_replication_enabled',
|
||||||
|
side_effect=[False, True]):
|
||||||
|
success = self.common._migrate_volume(
|
||||||
|
array, volume_not_attached, device_id, srp, slo, workload,
|
||||||
|
volume_not_attached_name, new_type, src_extra_specs)[0]
|
||||||
|
mck_setup.assert_called_once_with(array, volume_not_attached,
|
||||||
|
device_id, tgt_extra_specs)
|
||||||
|
mck_retype.assert_called_once()
|
||||||
|
self.assertTrue(success)
|
||||||
|
|
||||||
@mock.patch.object(masking.PowerMaxMasking, 'remove_and_reset_members')
|
@mock.patch.object(masking.PowerMaxMasking, 'remove_and_reset_members')
|
||||||
def test_migrate_volume_failed_get_new_sg_failed(self, mock_remove):
|
def test_migrate_volume_failed_get_new_sg_failed(self, mock_remove):
|
||||||
device_id = self.data.device_id
|
device_id = self.data.device_id
|
||||||
|
@ -3154,6 +3154,9 @@ class PowerMaxCommon(object):
|
|||||||
# Scenario: Rep was enabled, target VT has rep disabled, need to
|
# Scenario: Rep was enabled, target VT has rep disabled, need to
|
||||||
# disable replication
|
# disable replication
|
||||||
if was_rep_enabled and not is_rep_enabled:
|
if was_rep_enabled and not is_rep_enabled:
|
||||||
|
# Add force to allow volume removal from RDF enabled
|
||||||
|
# storage groups
|
||||||
|
extra_specs['force_vol_remove'] = True
|
||||||
self.cleanup_lun_replication(volume, volume_name,
|
self.cleanup_lun_replication(volume, volume_name,
|
||||||
device_id, extra_specs)
|
device_id, extra_specs)
|
||||||
model_update = {
|
model_update = {
|
||||||
@ -3163,6 +3166,9 @@ class PowerMaxCommon(object):
|
|||||||
# Scenario: Rep was not enabled, target VT has rep enabled, need to
|
# Scenario: Rep was not enabled, target VT has rep enabled, need to
|
||||||
# enable replication
|
# enable replication
|
||||||
elif not was_rep_enabled and is_rep_enabled:
|
elif not was_rep_enabled and is_rep_enabled:
|
||||||
|
metro_bias = utils.METROBIAS
|
||||||
|
if metro_bias in self.rep_config:
|
||||||
|
extra_specs[metro_bias] = self.rep_config[metro_bias]
|
||||||
rep_status, rep_driver_data, rep_info_dict = (
|
rep_status, rep_driver_data, rep_info_dict = (
|
||||||
self.setup_inuse_volume_replication(
|
self.setup_inuse_volume_replication(
|
||||||
array, volume, device_id, extra_specs))
|
array, volume, device_id, extra_specs))
|
||||||
@ -3197,6 +3203,10 @@ class PowerMaxCommon(object):
|
|||||||
move_target = True
|
move_target = True
|
||||||
else:
|
else:
|
||||||
if is_rep_enabled:
|
if is_rep_enabled:
|
||||||
|
metro_bias = utils.METROBIAS
|
||||||
|
if metro_bias in self.rep_config:
|
||||||
|
target_extra_specs[
|
||||||
|
metro_bias] = self.rep_config[metro_bias]
|
||||||
# Setup_volume_replication will put volume in correct sg
|
# Setup_volume_replication will put volume in correct sg
|
||||||
rep_status, rdf_dict, __ = self.setup_volume_replication(
|
rep_status, rdf_dict, __ = self.setup_volume_replication(
|
||||||
array, volume, device_id, target_extra_specs)
|
array, volume, device_id, target_extra_specs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user