Merge "Clean up acceptable values for 'store_type_preference'"

This commit is contained in:
Jenkins 2017-04-27 15:10:58 +00:00 committed by Gerrit Code Review
commit 578f538baf
3 changed files with 12 additions and 50 deletions

View File

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

View File

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

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