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
This commit is contained in:
Dharini Chandrasekar 2017-03-28 23:00:16 +00:00
parent 4dfc87c41e
commit 27d6d516bd
3 changed files with 12 additions and 50 deletions

View File

@ -16,13 +16,10 @@
"""Storage preference based location strategy module""" """Storage preference based location strategy module"""
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging
import six import six
import six.moves.urllib.parse as urlparse import six.moves.urllib.parse as urlparse
from glance.i18n import _, _LW from glance.i18n import _
LOG = logging.getLogger(__name__)
store_type_opts = [ store_type_opts = [
cfg.ListOpt('store_type_preference', cfg.ListOpt('store_type_preference',
@ -104,27 +101,6 @@ def get_ordered_locations(locations, uri_key='url', **kwargs):
preferred_store = str(preferred_store).strip() preferred_store = str(preferred_store).strip()
if not preferred_store: if not preferred_store:
continue 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 yield preferred_store
if not locations: if not locations:

View File

@ -157,9 +157,8 @@ class TestStoreTypeStrategyModule(base.IsolatedUnitTest):
"""Test routines in glance.common.location_strategy.store_type""" """Test routines in glance.common.location_strategy.store_type"""
def test_get_ordered_locations(self): def test_get_ordered_locations(self):
self.config(store_type_preference=[' rbd', 'sheepdog ', ' filesystem', self.config(store_type_preference=[' rbd', 'sheepdog ', ' file',
'swift ', ' http ', 'swift ', ' http ', 'vmware'],
'vmware_datastore'],
group='store_type_location_strategy') group='store_type_location_strategy')
locs = [{'url': 'file://image0', 'metadata': {'idx': 3}}, locs = [{'url': 'file://image0', 'metadata': {'idx': 3}},
{'url': 'rbd://image1', 'metadata': {'idx': 0}}, {'url': 'rbd://image1', 'metadata': {'idx': 0}},
@ -191,25 +190,3 @@ class TestStoreTypeStrategyModule(base.IsolatedUnitTest):
locs.sort(key=lambda loc: loc['metadata']['idx']) locs.sort(key=lambda loc: loc['metadata']['idx'])
# The result will ordered by preferred store type order. # The result will ordered by preferred store type order.
self.assertEqual(locs, ordered_locs) 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)

View File

@ -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