Follow Up: Generalizing is_replicated_str to is_boolean_str

Addressing the comment on the
commit Ic6c19414738367aa794522aaa0c1a963abcac723, the method
is_replicated_str consists the functionality of checking if the
string is valid boolean type or not which is being used for purposes
other than checking for replicated string.
This patch generalizes the name of the method.

Change-Id: Id299aeeea06a54d97fef2d8b0cabb83b7a518e19
This commit is contained in:
whoami-rajat 2018-10-10 10:46:51 +05:30
parent 23cfc4fdea
commit ae832f0b25
3 changed files with 6 additions and 6 deletions

View File

@ -783,9 +783,9 @@ class VMAXUtils(object):
:param new_type_extra_specs: the target type extra specs
:return: bool
"""
is_src_multiattach = vol_utils.is_replicated_str(
is_src_multiattach = vol_utils.is_boolean_str(
extra_specs.get('multiattach'))
is_tgt_multiattach = vol_utils.is_replicated_str(
is_tgt_multiattach = vol_utils.is_boolean_str(
new_type_extra_specs.get('multiattach'))
return is_src_multiattach != is_tgt_multiattach

View File

@ -2833,7 +2833,7 @@ class VolumeManager(manager.CleanableManager,
replication_diff = diff_specs.get('replication_enabled')
if replication_diff:
is_replicated = vol_utils.is_replicated_str(replication_diff[1])
is_replicated = vol_utils.is_boolean_str(replication_diff[1])
if is_replicated:
replication_status = fields.ReplicationStatus.ENABLED
else:

View File

@ -956,7 +956,7 @@ def clone_encryption_key(context, key_manager, encryption_key_id):
return clone_key_id
def is_replicated_str(str):
def is_boolean_str(str):
spec = (str or '').split()
return (len(spec) == 2 and
spec[0] == '<is>' and strutils.bool_from_string(spec[1]))
@ -964,12 +964,12 @@ def is_replicated_str(str):
def is_replicated_spec(extra_specs):
return (extra_specs and
is_replicated_str(extra_specs.get('replication_enabled')))
is_boolean_str(extra_specs.get('replication_enabled')))
def is_multiattach_spec(extra_specs):
return (extra_specs and
is_replicated_str(extra_specs.get('multiattach')))
is_boolean_str(extra_specs.get('multiattach')))
def group_get_by_id(group_id):