Merge "PowerMax Driver - Remove mandatory failover BID"

This commit is contained in:
Zuul 2020-09-24 14:33:27 +00:00 committed by Gerrit Code Review
commit cda14d8f08
3 changed files with 3 additions and 68 deletions

View File

@ -1476,52 +1476,6 @@ class PowerMaxUtilsTest(test.TestCase):
'parameter with a valid backend id.')
self.assertEqual(expected_msg, msg)
def test_validate_failover_request_no_backend_id_multi_rep(self):
is_failed_over = False
is_promoted = False
failover_backend_id = None
rep_configs = self.data.multi_rep_config_list
primary_array = self.data.array
array_list = [self.data.array]
is_valid, msg = self.utils.validate_failover_request(
is_failed_over, failover_backend_id, rep_configs,
primary_array, array_list, is_promoted)
self.assertFalse(is_valid)
expected_msg = ('Cannot failover, no backend_id provided while '
'multiple replication devices are defined in '
'cinder.conf, please provide a backend_id '
'which will act as new primary array by '
'appending --backend_id <id> to your command.')
self.assertEqual(expected_msg, msg)
def test_validate_failover_request_incorrect_backend_id_multi_rep(self):
is_failed_over = False
is_promoted = False
failover_backend_id = 'invalid_id'
rep_configs = self.data.multi_rep_config_list
primary_array = self.data.array
array_list = [self.data.array]
self.assertRaises(exception.InvalidInput,
self.utils.validate_failover_request,
is_failed_over, failover_backend_id, rep_configs,
primary_array, array_list, is_promoted)
def test_validate_failover_request_promotion_before_failover(self):
is_failed_over = False
is_promoted = False
failover_backend_id = utils.PMAX_FAILOVER_START_ARRAY_PROMOTION
rep_configs = self.data.multi_rep_config_list
primary_array = self.data.array
array_list = [self.data.array]
is_valid, msg = self.utils.validate_failover_request(
is_failed_over, failover_backend_id, rep_configs,
primary_array, array_list, is_promoted)
self.assertFalse(is_valid)
expected_msg = ('Cannot start failover promotion. The backend must '
'already be in a failover state to perform this'
'action.')
self.assertEqual(expected_msg, msg)
def test_validate_replication_group_config_success(self):
rep_configs = deepcopy(self.data.multi_rep_config_list)
extra_specs = deepcopy(

View File

@ -1344,8 +1344,7 @@ class PowerMaxCommon(object):
already_queried = False
for array_info in array_info_list:
if self.failover:
rep_config = self.utils.get_rep_config(
self.active_backend_id, self.rep_configs, True)
rep_config = self.rep_configs[0]
array_info = self.get_secondary_stats_info(
rep_config, array_info)
# Add both SLO & Workload name in the pool name
@ -5220,7 +5219,8 @@ class PowerMaxCommon(object):
group_fo = None
if not self.failover:
self.failover = True
self.active_backend_id = secondary_id if secondary_id else None
if not secondary_id:
secondary_id = utils.RDF_FAILEDOVER_STATE
elif secondary_id == 'default':
self.failover = False
group_fo = 'default'

View File

@ -1922,25 +1922,6 @@ class PowerMaxUtils(object):
'state. If you meant to failover, please either omit '
'the --backend_id parameter or use the --backend_id '
'parameter with a valid backend id.')
elif failover_backend_id == PMAX_FAILOVER_START_ARRAY_PROMOTION:
is_valid = False
msg = _('Cannot start failover promotion. The backend must '
'already be in a failover state to perform this'
'action.')
elif len(rep_configs) > 1:
if failover_backend_id is None:
is_valid = False
msg = _('Cannot failover, no backend_id provided while '
'multiple replication devices are defined in '
'cinder.conf, please provide a backend_id '
'which will act as new primary array by '
'appending --backend_id <id> to your command.')
else:
rc = self.get_rep_config(failover_backend_id, rep_configs)
if rc is None:
is_valid = False
msg = _('Can not find replication device with '
'backend_id of %s') % failover_backend_id
return is_valid, msg
def validate_replication_group_config(self, rep_configs, extra_specs_list):