From 27d6d516bd2baa059bafdc7cda23b6f5406f9f85 Mon Sep 17 00:00:00 2001 From: Dharini Chandrasekar Date: Tue, 28 Mar 2017 23:00:16 +0000 Subject: [PATCH] Clean up acceptable values for 'store_type_preference' The store values 'filesystem' and 'vmware_datastore' were deprecated for 'store_type_preference' as per [1] in Newton. This was to maintain uniformity with the values accepted for 'store' opt and 'store_type_preference' opt. This patch removes acceptance for the old store values and ensures uniformity between store names used in glance and glance_store. [1] I3d8593cdae6780ae721afedcf47dd45afa684f25 Change-Id: Id225275f7aad308bde450bef8bc6fd6ad7e3c6d2 --- glance/common/location_strategy/store_type.py | 26 +----------------- .../unit/common/test_location_strategy.py | 27 ++----------------- ...tore_type_preference-39081e4045894731.yaml | 9 +++++++ 3 files changed, 12 insertions(+), 50 deletions(-) create mode 100644 releasenotes/notes/clean-up-acceptable-values-store_type_preference-39081e4045894731.yaml diff --git a/glance/common/location_strategy/store_type.py b/glance/common/location_strategy/store_type.py index 90ad523209..104381e27d 100644 --- a/glance/common/location_strategy/store_type.py +++ b/glance/common/location_strategy/store_type.py @@ -16,13 +16,10 @@ """Storage preference based location strategy module""" from oslo_config import cfg -from oslo_log import log as logging import six import six.moves.urllib.parse as urlparse -from glance.i18n import _, _LW - -LOG = logging.getLogger(__name__) +from glance.i18n import _ store_type_opts = [ cfg.ListOpt('store_type_preference', @@ -104,27 +101,6 @@ def get_ordered_locations(locations, uri_key='url', **kwargs): preferred_store = str(preferred_store).strip() if not preferred_store: continue - # NOTE(dharinic): The following conversion of ``filesystem`` and - # ``vmware_datastore`` to ``file`` and ``vmware`` respectively - # are to make store names consistent in Glance and glance_store - # and also be backward compatible. - # Reference: Bug 1615852 - if preferred_store == 'filesystem': - preferred_store = 'file' - msg = _LW('The value ``filesystem`` is DEPRECATED for use ' - 'with ``store_type_preference``. It will be ' - 'removed in the Pike release. Please use ``file`` ' - 'instead. Please see the Glance Newton release ' - 'notes for more information.') - LOG.warn(msg) - if preferred_store == 'vmware_datastore': - preferred_store = 'vmware' - msg = _LW('The value ``vmware_datastore`` is DEPRECATED for ' - 'use with ``store_type_preference``. It will be ' - 'removed in the Pike release. Please use ``vmware`` ' - 'instead. Please see the Glance Newton release ' - 'notes for more information.') - LOG.warn(msg) yield preferred_store if not locations: diff --git a/glance/tests/unit/common/test_location_strategy.py b/glance/tests/unit/common/test_location_strategy.py index 1858289b41..1567f045e5 100644 --- a/glance/tests/unit/common/test_location_strategy.py +++ b/glance/tests/unit/common/test_location_strategy.py @@ -157,9 +157,8 @@ class TestStoreTypeStrategyModule(base.IsolatedUnitTest): """Test routines in glance.common.location_strategy.store_type""" def test_get_ordered_locations(self): - self.config(store_type_preference=[' rbd', 'sheepdog ', ' filesystem', - 'swift ', ' http ', - 'vmware_datastore'], + self.config(store_type_preference=[' rbd', 'sheepdog ', ' file', + 'swift ', ' http ', 'vmware'], group='store_type_location_strategy') locs = [{'url': 'file://image0', 'metadata': {'idx': 3}}, {'url': 'rbd://image1', 'metadata': {'idx': 0}}, @@ -191,25 +190,3 @@ class TestStoreTypeStrategyModule(base.IsolatedUnitTest): locs.sort(key=lambda loc: loc['metadata']['idx']) # The result will ordered by preferred store type order. self.assertEqual(locs, ordered_locs) - - def test_get_ordered_locations_with_consistent_store_names(self): - """This test is for the change made with respect to making store names - in glance to be consistent with store names used in glance_store. - Reference: Bug #1615852 - """ - self.config(store_type_preference=[' rbd', 'sheepdog ', 'file', - 'swift ', ' http ', 'vmware'], - group='store_type_location_strategy') - locs = [{'url': 'file://image0', 'metadata': {'idx': 3}}, - {'url': 'rbd://image1', 'metadata': {'idx': 0}}, - {'url': 'file://image3', 'metadata': {'idx': 4}}, - {'url': 'swift://image4', 'metadata': {'idx': 6}}, - {'url': 'cinder://image5', 'metadata': {'idx': 9}}, - {'url': 'file://image6', 'metadata': {'idx': 5}}, - {'url': 'rbd://image7', 'metadata': {'idx': 1}}, - {'url': 'vsphere://image9', 'metadata': {'idx': 8}}, - {'url': 'sheepdog://image8', 'metadata': {'idx': 2}}] - ordered_locs = store_type.get_ordered_locations(copy.deepcopy(locs)) - locs.sort(key=lambda loc: loc['metadata']['idx']) - # The result will ordered by preferred store type order. - self.assertEqual(locs, ordered_locs) diff --git a/releasenotes/notes/clean-up-acceptable-values-store_type_preference-39081e4045894731.yaml b/releasenotes/notes/clean-up-acceptable-values-store_type_preference-39081e4045894731.yaml new file mode 100644 index 0000000000..aae5bb9004 --- /dev/null +++ b/releasenotes/notes/clean-up-acceptable-values-store_type_preference-39081e4045894731.yaml @@ -0,0 +1,9 @@ +--- +upgrade: + - | + Deprecated values are no longer recognized for the configuration option + ``store_type_preference``. + The two non-standard values 'filesystem' and 'vmware_datastore' were + DEPRECATED in Newton and are no longer operable. The correct values + for those stores are 'file' and 'vmware'. See the Newton release notes + for more information at https://docs.openstack.org/releasenotes/glance/newton.html#upgrade-notes