From ae832f0b254ef532b81b257790ecc2d5dd012199 Mon Sep 17 00:00:00 2001 From: whoami-rajat Date: Wed, 10 Oct 2018 10:46:51 +0530 Subject: [PATCH] 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 --- cinder/volume/drivers/dell_emc/vmax/utils.py | 4 ++-- cinder/volume/manager.py | 2 +- cinder/volume/utils.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cinder/volume/drivers/dell_emc/vmax/utils.py b/cinder/volume/drivers/dell_emc/vmax/utils.py index 7543d358335..52b1773b0f7 100644 --- a/cinder/volume/drivers/dell_emc/vmax/utils.py +++ b/cinder/volume/drivers/dell_emc/vmax/utils.py @@ -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 diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 8a01bd20097..00e8ad609b6 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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: diff --git a/cinder/volume/utils.py b/cinder/volume/utils.py index 078d1781641..03d4dd65cf6 100644 --- a/cinder/volume/utils.py +++ b/cinder/volume/utils.py @@ -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] == '' 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):