From 64dd6475f5a99a24f6b6458f39ba94bc98e4c6ce Mon Sep 17 00:00:00 2001 From: Tom Swanson Date: Tue, 8 May 2018 11:45:41 -0500 Subject: [PATCH] Dell EMC: Added excluded_domain_ips ListOpt to SC driver Added an excluded_domain_ips option to the Dell EMC SC driver. This is identical to the excluded_domain_ip option only comma separated rather than multiple entry. This is concatenated with the excluded_domain_ip option. Change-Id: Ib3ab11e776970a850a96fd4e6907b4064396ec3f --- .../volume/drivers/dell_emc/sc/test_fc.py | 2 + .../volume/drivers/dell_emc/sc/test_sc.py | 2 + .../volume/drivers/dell_emc/sc/test_scapi.py | 106 ++++++++++++++++++ .../drivers/dell_emc/sc/storagecenter_api.py | 17 ++- .../dell_emc/sc/storagecenter_common.py | 11 +- .../drivers/dell_emc/sc/storagecenter_fc.py | 3 +- .../dell_emc/sc/storagecenter_iscsi.py | 3 +- .../drivers/dell-storagecenter-driver.rst | 19 ++-- ...d_domain_ips_ListOpt-51bacddee199ce83.yaml | 18 +++ 9 files changed, 165 insertions(+), 16 deletions(-) create mode 100644 releasenotes/notes/Dell-SC-excluded_domain_ips_ListOpt-51bacddee199ce83.yaml diff --git a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_fc.py b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_fc.py index b0f63a8b9f4..d0169a4f95d 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_fc.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_fc.py @@ -143,6 +143,8 @@ class DellSCSanFCDriverTestCase(test.TestCase): self.configuration.dell_sc_server_folder = 'opnstktst' self.configuration.dell_sc_volume_folder = 'opnstktst' self.configuration.dell_sc_api_port = 3033 + self.configuration.excluded_domain_ip = None + self.configuration.excluded_domain_ips = [] self._context = context.get_admin_context() self.driver = storagecenter_fc.SCFCDriver( diff --git a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py index e12166fd027..82354fb9848 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_sc.py @@ -226,6 +226,8 @@ class DellSCSanISCSIDriverTestCase(test.TestCase): self.configuration.dell_sc_api_port = 3033 self.configuration.target_ip_address = '192.168.1.1' self.configuration.target_port = 3260 + self.configuration.excluded_domain_ip = None + self.configuration.excluded_domain_ips = [] self._context = context.get_admin_context() self.driver = storagecenter_iscsi.SCISCSIDriver( diff --git a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_scapi.py b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_scapi.py index 524dff3fcad..f963624b184 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/sc/test_scapi.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/sc/test_scapi.py @@ -9027,6 +9027,112 @@ class DellStorageCenterApiHelperTestCase(test.TestCase): self.assertEqual('FibreChannel', ret.protocol) mock_open_connection.assert_called_once_with() + @mock.patch.object(storagecenter_api.SCApi, + 'open_connection') + def test_setup_connection_excluded1(self, + mock_open_connection): + config = mock.MagicMock() + config.dell_sc_ssn = 12345 + config.san_ip = '192.168.0.101' + config.san_login = 'username' + config.san_password = 'password' + config.dell_sc_volume_folder = 'a' + config.dell_sc_server_folder = 'a' + config.dell_sc_verify_cert = False + config.san_port = 3033 + config.excluded_domain_ip = ['192.168.0.1'] + config.excluded_domain_ips = ['192.168.0.2', '192.168.0.3'] + helper = storagecenter_api.SCApiHelper(config, None, 'FC') + ret = helper._setup_connection() + self.assertEqual(set(ret.excluded_domain_ips), set(['192.168.0.2', + '192.168.0.3', '192.168.0.1'])) + self.assertEqual(12345, ret.primaryssn) + self.assertEqual(12345, ret.ssn) + self.assertEqual('FibreChannel', ret.protocol) + mock_open_connection.assert_called_once_with() + + @mock.patch.object(storagecenter_api.SCApi, + 'open_connection') + def test_setup_connection_excluded2(self, + mock_open_connection): + config = mock.MagicMock() + config.dell_sc_ssn = 12345 + config.san_ip = '192.168.0.101' + config.san_login = 'username' + config.san_password = 'password' + config.dell_sc_volume_folder = 'a' + config.dell_sc_server_folder = 'a' + config.dell_sc_verify_cert = False + config.san_port = 3033 + config.excluded_domain_ip = None + config.excluded_domain_ips = ['192.168.0.2', '192.168.0.3'] + helper = storagecenter_api.SCApiHelper(config, None, 'FC') + ret = helper._setup_connection() + self.assertEqual(set(ret.excluded_domain_ips), set(['192.168.0.2', + '192.168.0.3'])) + + @mock.patch.object(storagecenter_api.SCApi, + 'open_connection') + def test_setup_connection_excluded3(self, + mock_open_connection): + config = mock.MagicMock() + config.dell_sc_ssn = 12345 + config.san_ip = '192.168.0.101' + config.san_login = 'username' + config.san_password = 'password' + config.dell_sc_volume_folder = 'a' + config.dell_sc_server_folder = 'a' + config.dell_sc_verify_cert = False + config.san_port = 3033 + config.excluded_domain_ip = ['192.168.0.1'] + config.excluded_domain_ips = [] + helper = storagecenter_api.SCApiHelper(config, None, 'FC') + ret = helper._setup_connection() + self.assertEqual(ret.excluded_domain_ips, ['192.168.0.1']) + + @mock.patch.object(storagecenter_api.SCApi, + 'open_connection') + def test_setup_connection_excluded4(self, + mock_open_connection): + config = mock.MagicMock() + config.dell_sc_ssn = 12345 + config.san_ip = '192.168.0.101' + config.san_login = 'username' + config.san_password = 'password' + config.dell_sc_volume_folder = 'a' + config.dell_sc_server_folder = 'a' + config.dell_sc_verify_cert = False + config.san_port = 3033 + config.excluded_domain_ip = None + config.excluded_domain_ips = [] + helper = storagecenter_api.SCApiHelper(config, None, 'FC') + ret = helper._setup_connection() + self.assertEqual(ret.excluded_domain_ips, []) + + @mock.patch.object(storagecenter_api.SCApi, + 'open_connection') + def test_setup_connection_excluded5(self, + mock_open_connection): + config = mock.MagicMock() + config.dell_sc_ssn = 12345 + config.san_ip = '192.168.0.101' + config.san_login = 'username' + config.san_password = 'password' + config.dell_sc_volume_folder = 'a' + config.dell_sc_server_folder = 'a' + config.dell_sc_verify_cert = False + config.san_port = 3033 + config.excluded_domain_ip = ['192.168.0.1'] + config.excluded_domain_ips = ['192.168.0.1', '192.168.0.2'] + helper = storagecenter_api.SCApiHelper(config, None, 'FC') + ret = helper._setup_connection() + self.assertEqual(set(ret.excluded_domain_ips), set(['192.168.0.2', + '192.168.0.1'])) + self.assertEqual(12345, ret.primaryssn) + self.assertEqual(12345, ret.ssn) + self.assertEqual('FibreChannel', ret.protocol) + mock_open_connection.assert_called_once_with() + @mock.patch.object(storagecenter_api.SCApi, 'open_connection') def test_setup_connection_iscsi(self, diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py index 3b16309c478..f1382918259 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py @@ -356,9 +356,17 @@ class SCApiHelper(object): # about. connection.vfname = self.config.dell_sc_volume_folder connection.sfname = self.config.dell_sc_server_folder - connection.excluded_domain_ips = self.config.excluded_domain_ip - if not connection.excluded_domain_ips: - connection.excluded_domain_ips = [] + connection.excluded_domain_ips = self.config.excluded_domain_ips + if self.config.excluded_domain_ip: + LOG.info("Using excluded_domain_ip for " + "excluding domain IPs is deprecated in the " + "Stein release of OpenStack. Please use the " + "excluded_domain_ips configuration option.") + connection.excluded_domain_ips += self.config.excluded_domain_ip + + # Remove duplicates + connection.excluded_domain_ips = list(set( + connection.excluded_domain_ips)) # Our primary SSN doesn't change connection.primaryssn = self.primaryssn if self.storage_protocol == 'FC': @@ -435,10 +443,11 @@ class SCApi(object): 3.7.0 - Support for Data Reduction, Group QOS and Volume QOS. 4.0.0 - Driver moved to dell_emc. 4.1.0 - Timeouts added to rest calls. + 4.1.1 - excluded_domain_ips support. """ - APIDRIVERVERSION = '4.1.0' + APIDRIVERVERSION = '4.1.1' def __init__(self, host, port, user, password, verify, asynctimeout, synctimeout, apiversion): diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py index 6abd93d52a4..775f158aa9d 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_common.py @@ -67,7 +67,16 @@ common_opts = [ cfg.MultiOpt('excluded_domain_ip', item_type=types.IPAddress(), default=None, - help='Domain IP to be excluded from iSCSI returns.'), + deprecated_for_removal=True, + deprecated_reason="Replaced by excluded_domain_ips option", + deprecated_since="Stein", + help='DEPRECATED: Fault Domain IP to be excluded from ' + 'iSCSI returns.'), + cfg.ListOpt('excluded_domain_ips', + item_type=types.IPAddress(), + default=[], + help='Comma separated Fault Domain IPs to be excluded ' + 'from iSCSI returns.'), cfg.StrOpt('dell_server_os', default='Red Hat Linux 6.x', help='Server OS type to use when creating a new server on the ' diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_fc.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_fc.py index ad9f1f84b8d..c75f2b03576 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_fc.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_fc.py @@ -63,10 +63,11 @@ class SCFCDriver(storagecenter_common.SCCommonDriver, 3.7.0 - Support for Data Reduction, Group QOS and Volume QOS. 4.0.0 - Driver moved to dell_emc. 4.1.0 - Timeouts added to rest calls. + 4.1.1 - excluded_domain_ips support. """ - VERSION = '4.1.0' + VERSION = '4.1.1' CI_WIKI_NAME = "Dell_EMC_SC_Series_CI" diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_iscsi.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_iscsi.py index 3ac4ea05aa2..fb01c51545f 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_iscsi.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_iscsi.py @@ -63,10 +63,11 @@ class SCISCSIDriver(storagecenter_common.SCCommonDriver, 3.7.0 - Support for Data Reduction, Group QOS and Volume QOS. 4.0.0 - Driver moved to dell_emc. 4.1.0 - Timeouts added to rest calls. + 4.1.1 - excluded_domain_ips support. """ - VERSION = '4.1.0' + VERSION = '4.1.1' CI_WIKI_NAME = "Dell_EMC_SC_Series_CI" def __init__(self, *args, **kwargs): diff --git a/doc/source/configuration/block-storage/drivers/dell-storagecenter-driver.rst b/doc/source/configuration/block-storage/drivers/dell-storagecenter-driver.rst index 202287e2a32..0d805eefa35 100644 --- a/doc/source/configuration/block-storage/drivers/dell-storagecenter-driver.rst +++ b/doc/source/configuration/block-storage/drivers/dell-storagecenter-driver.rst @@ -353,14 +353,14 @@ not have to match the actual OS used on the node. Excluding a domain ~~~~~~~~~~~~~~~~~~ -This option excludes a Storage Center ISCSI fault domain from the ISCSI -properties returned by the initialize_connection call. This only applies to -the ISCSI driver. +This option excludes a list of Storage Center ISCSI fault domains from +the ISCSI properties returned by the initialize_connection call. This +only applies to the ISCSI driver. -Add the excluded_domain_ip option into the backend config for each fault domain -to be excluded. This option takes the specified Target IPv4 Address listed -under the fault domain. Older versions of DSM (EM) may list this as the Well -Known IP Address. +Add the excluded_domain_ips option into the backend config for several fault +domains to be excluded. This option takes a comma separated list of Target +IPv4 Addresses listed under the fault domain. Older versions of DSM (EM) may +list this as the Well Known IP Address. Add the following to the back-end specification to exclude the domains at 172.20.25.15 and 172.20.26.15. @@ -368,8 +368,9 @@ Add the following to the back-end specification to exclude the domains at .. code-block:: ini [dell] - excluded_domain_ip=172.20.25.15 - excluded_domain_ip=172.20.26.15 + excluded_domain_ips=172.20.25.15, 172.20.26.15 + + Setting Dell EMC SC REST API timeouts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/releasenotes/notes/Dell-SC-excluded_domain_ips_ListOpt-51bacddee199ce83.yaml b/releasenotes/notes/Dell-SC-excluded_domain_ips_ListOpt-51bacddee199ce83.yaml new file mode 100644 index 00000000000..6387f793eeb --- /dev/null +++ b/releasenotes/notes/Dell-SC-excluded_domain_ips_ListOpt-51bacddee199ce83.yaml @@ -0,0 +1,18 @@ +--- +features: + - Added an ``excluded_domain_ips`` option to the Dell EMC SC driver. This + is identical to the excluded_domain_ip option only comma separated + rather than multiple entry. This is concatenated with the + ``excluded_domain_ip`` option. +deprecations: + - | + The Dell EMC SC configuration option ``excluded_domain_ip`` has + been deprecated and will be removed in a future release. Deployments should + now migrate to the option ``excluded_domain_ips`` for equivalent + functionality. +upgrade: + - | + The Dell EMC SC configuration option ``excluded_domain_ip`` has + been deprecated and will be removed in a future release. Deployments should + now migrate to the option ``excluded_domain_ips`` for equivalent + functionality.