From: Kendall Nelson Date: Mon, 9 Nov 2015 16:52:43 +0000 (-0600) Subject: Removal of deprecated NPIV option in Storwize X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8b1fd62ec370d87a6e3554398125edc69ebde8b0;p=openstack-build%2Fcinder-build.git Removal of deprecated NPIV option in Storwize The storwize_svc_npiv_compatibility_mode option was deprecated and set to be removed during the M release. This patch removes the option, the associated code, and the test cases for the associated code. This patch also removes the unused import versionutils. Closes-Bug:1514585 Change-Id: Ib91dae38e28cd0ff1994fd8efe7c3eb4ee2c3d39 --- diff --git a/cinder/tests/unit/test_storwize_svc.py b/cinder/tests/unit/test_storwize_svc.py index c2098e6c8..b85f683aa 100644 --- a/cinder/tests/unit/test_storwize_svc.py +++ b/cinder/tests/unit/test_storwize_svc.py @@ -2392,34 +2392,15 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.driver.initialize_connection, volume2, self._connector) - # with storwize_svc_npiv_compatibility_mode set to True, - # lsfabric can return [] and initilize_connection will still - # complete successfully - with mock.patch.object(storwize_svc_common.StorwizeHelpers, 'get_conn_fc_wwpns') as conn_fc_wwpns: conn_fc_wwpns.return_value = [] - self._set_flag('storwize_svc_npiv_compatibility_mode', - True) - expected_fc_npiv = { - 'driver_volume_type': 'fibre_channel', - 'data': {'target_lun': 1, - 'target_wwn': '5005076802432ADE', - 'target_discovered': False}} + ret = self.driver.initialize_connection(volume2, self._connector) - self.assertEqual( - expected_fc_npiv['driver_volume_type'], - ret['driver_volume_type']) - for k, v in expected_fc_npiv['data'].items(): - self.assertEqual(v, ret['data'][k]) - self._set_flag('storwize_svc_npiv_compatibility_mode', - False) ret = self.driver.terminate_connection(volume1, self._connector) - # For npiv compatibility test case, we need to terminate connection - # to the 2nd volume - # Return the fc info only when last volume detached + if protocol == 'FC' and self.USESIM: # For the first volume detach, ret['data'] should be empty # only ret['driver_volume_type'] returned @@ -3498,76 +3479,6 @@ class StorwizeSVCDriverTestCase(test.TestCase): self.assertIs('copying', model_update['replication_status']) self.driver.delete_volume(volume) - def test_storwize_initiator_target_map_npiv(self): - # Create two volumes to be used in mappings - ctxt = context.get_admin_context() - self._set_flag('storwize_svc_npiv_compatibility_mode', True) - - # Generate us a test volume - volume = self._generate_vol_info(None, None) - self.driver.create_volume(volume) - - # FIbre Channel volume type - vol_type = volume_types.create(ctxt, 'FC', {'protocol': 'FC'}) - - volume['volume_type_id'] = vol_type['id'] - - # Make sure that the volumes have been created - self._assert_vol_exists(volume['name'], True) - - wwpns = ['ff00000000000000', 'ff00000000000001'] - connector = {'host': 'storwize-svc-test', 'wwpns': wwpns} - - # Initialise the connection - with mock.patch.object(storwize_svc_common.StorwizeHelpers, - 'get_conn_fc_wwpns') as conn_fc_wwpns: - conn_fc_wwpns.return_value = [] - init_ret = self.driver.initialize_connection(volume, connector) - - # Check that the initiator_target_map is as expected - init_data = {'driver_volume_type': 'fibre_channel', - 'data': {'initiator_target_map': - {'ff00000000000000': ['5005076802432ADE', - '5005076802332ADE', - '5005076802532ADE', - '5005076802232ADE', - '5005076802132ADE', - '5005086802132ADE', - '5005086802332ADE', - '5005086802532ADE', - '5005086802232ADE', - '5005086802432ADE'], - 'ff00000000000001': ['5005076802432ADE', - '5005076802332ADE', - '5005076802532ADE', - '5005076802232ADE', - '5005076802132ADE', - '5005086802132ADE', - '5005086802332ADE', - '5005086802532ADE', - '5005086802232ADE', - '5005086802432ADE']}, - 'target_discovered': False, - 'target_lun': 0, - 'target_wwn': '5005076802432ADE', - 'volume_id': volume['id'] - } - } - - self.assertEqual(init_data, init_ret) - - # Terminate connection - term_ret = self.driver.terminate_connection(volume, connector) - # Check that the initiator_target_map is as expected - term_data = {'driver_volume_type': 'fibre_channel', - 'data': {'initiator_target_map': - {'ff00000000000000': ['AABBCCDDEEFF0011'], - 'ff00000000000001': ['AABBCCDDEEFF0011']} - } - } - - self.assertEqual(term_data, term_ret) - def test_storwize_consistency_group_snapshot(self): cg_type = self._create_consistency_group_volume_type() self.ctxt.user_id = 'fake_user_id' diff --git a/cinder/volume/drivers/ibm/storwize_svc/__init__.py b/cinder/volume/drivers/ibm/storwize_svc/__init__.py index 12c61cdc0..9fe37c8da 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/__init__.py +++ b/cinder/volume/drivers/ibm/storwize_svc/__init__.py @@ -39,7 +39,6 @@ import time from oslo_config import cfg from oslo_log import log as logging -from oslo_log import versionutils from oslo_service import loopingcall from oslo_utils import excutils from oslo_utils import units @@ -109,15 +108,6 @@ storwize_svc_opts = [ cfg.BoolOpt('storwize_svc_multihostmap_enabled', default=True, help='Allows vdisk to multi host mapping'), - # TODO(xqli): storwize_svc_npiv_compatibility_mode should always be set - # to True. It will be deprecated and removed in M release. - cfg.BoolOpt('storwize_svc_npiv_compatibility_mode', - default=True, - help='Indicate whether svc driver is compatible for NPIV ' - 'setup. If it is compatible, it will allow no wwpns ' - 'being returned on get_conn_fc_wwpns during ' - 'initialize_connection. It should always be set to ' - 'True. It will be deprecated and removed in M release.'), cfg.BoolOpt('storwize_svc_allow_tenant_qos', default=False, help='Allow tenants to specify QOS on create'), @@ -187,15 +177,6 @@ class StorwizeSVCDriver(san.SanDriver, """Check that we have all configuration details from the storage.""" LOG.debug('enter: do_setup') - # storwize_svc_npiv_compatibility_mode should always be set to True. - # It will be deprecated and removed in M release. If the options is - # set to False, we'll warn the operator. - msg = _LW("The option storwize_svc_npiv_compatibility_mode will be " - "deprecated and not used. It will be removed in the " - "M release.") - if not self.configuration.storwize_svc_npiv_compatibility_mode: - versionutils.report_deprecated_feature(LOG, msg) - # Get storage system name, id, and code level self._state.update(self._helpers.get_system_info()) @@ -458,24 +439,11 @@ class StorwizeSVCDriver(san.SanDriver, conn_wwpns = self._helpers.get_conn_fc_wwpns(host_name) # If conn_wwpns is empty, then that means that there were - # no target ports with visibility to any of the initiators. - # We will either fail the attach, or return all target - # ports, depending on the value of the - # storwize_svc_npiv_compatibity_mode flag. + # no target ports with visibility to any of the initiators + # so we return all target ports. if len(conn_wwpns) == 0: - # TODO(xqli): Remove storwize_svc_npiv_compatibility_mode - # in M release. - npiv_compat = (self.configuration. - storwize_svc_npiv_compatibility_mode) - if not npiv_compat: - msg = (_('Could not get FC connection information for ' - 'the host-volume connection. Is the host ' - 'configured properly for FC connections?')) - LOG.error(msg) - raise exception.VolumeBackendAPIException(data=msg) - else: - for node in self._state['storage_nodes'].values(): - conn_wwpns.extend(node['WWPN']) + for node in self._state['storage_nodes'].values(): + conn_wwpns.extend(node['WWPN']) if not vol_opts['multipath']: # preferred_node_entry can have a list of WWPNs while only