Remove cyclical import in dell_emc powerstore driver

driver and utils modules were importing each other,
move POWERSTORE_PP_KEY constant to utils module to break the cycle.

Change-Id: I19ebd9dff36ba2f84bae56227efc868a5686420a
This commit is contained in:
Pavlo Shchelokovskyy 2024-04-03 21:05:07 +03:00
parent c0d824dd0e
commit 182060467e
2 changed files with 3 additions and 4 deletions

View File

@ -34,7 +34,6 @@ POWERSTORE_OPTS = options.POWERSTORE_OPTS
CONF = cfg.CONF
CONF.register_opts(POWERSTORE_OPTS, group=configuration.SHARED_CONF_GROUP)
LOG = logging.getLogger(__name__)
POWERSTORE_PP_KEY = "powerstore:protection_policy"
@interface.volumedriver
@ -75,7 +74,7 @@ class PowerStoreDriver(driver.VolumeDriver):
properties = {}
self._set_property(
properties,
POWERSTORE_PP_KEY,
utils.POWERSTORE_PP_KEY,
"PowerStore Protection Policy.",
_("Specifies the PowerStore Protection Policy for a "
"volume type. Protection Policy is assigned to a volume during "

View File

@ -26,7 +26,6 @@ from cinder.common import constants
from cinder import exception
from cinder.i18n import _
from cinder.objects import fields
from cinder.volume.drivers.dell_emc.powerstore import driver
from cinder.volume import volume_utils
@ -36,6 +35,7 @@ CHAP_DEFAULT_SECRET_LENGTH = 60
PROTOCOL_FC = constants.FC
PROTOCOL_ISCSI = constants.ISCSI
PROTOCOL_NVME = "NVMe"
POWERSTORE_PP_KEY = "powerstore:protection_policy"
def bytes_to_gib(size_in_bytes):
@ -167,7 +167,7 @@ def get_protection_policy_from_volume(volume):
:return: Protection policy name
"""
return volume.volume_type.extra_specs.get(driver.POWERSTORE_PP_KEY)
return volume.volume_type.extra_specs.get(POWERSTORE_PP_KEY)
def is_group_a_cg_snapshot_type(func):