Merge "Fixing inconsistency in Glance store names." into stable/newton
This commit is contained in:
commit
eed0c5fef9
@ -4096,18 +4096,13 @@
|
|||||||
# Possible values:
|
# Possible values:
|
||||||
# * Empty list
|
# * Empty list
|
||||||
# * Comma separated list of registered store names. Legal values are:
|
# * Comma separated list of registered store names. Legal values are:
|
||||||
# (NOTE: Use only the following choices, which, unfortunately,
|
# * file
|
||||||
# are not entirely consistent with the store names used in other
|
|
||||||
# similar configuration options. Please take extra care while
|
|
||||||
# setting this option, and read the help text carefully when
|
|
||||||
# setting other similar options.)
|
|
||||||
# * filesystem
|
|
||||||
# * http
|
# * http
|
||||||
# * rbd
|
# * rbd
|
||||||
# * swift
|
# * swift
|
||||||
# * sheepdog
|
# * sheepdog
|
||||||
# * cinder
|
# * cinder
|
||||||
# * vmware_datastore
|
# * vmware
|
||||||
#
|
#
|
||||||
# Related options:
|
# Related options:
|
||||||
# * location_strategy
|
# * location_strategy
|
||||||
|
@ -16,19 +16,14 @@
|
|||||||
"""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 _
|
from glance.i18n import _, _LW
|
||||||
|
|
||||||
# TODO(dharinic): The help text for ``store_type_preference`` must be
|
LOG = logging.getLogger(__name__)
|
||||||
# edited to replace ``filesystem``and ``vmware_datastore`` with ``file``
|
|
||||||
# and ``vmware`` respectively upon resolution of Bug #1615852.
|
|
||||||
# Also, remove the Note from ``Possible Values`` sections upon
|
|
||||||
# resolution of Bug #1615852.
|
|
||||||
|
|
||||||
# NOTE(dharinic): We cannot restrict the choices for ``store_type_preference``
|
|
||||||
# for backward compatability reasons. See Bug #1615852.
|
|
||||||
store_type_opts = [
|
store_type_opts = [
|
||||||
cfg.ListOpt('store_type_preference',
|
cfg.ListOpt('store_type_preference',
|
||||||
default=[],
|
default=[],
|
||||||
@ -48,18 +43,13 @@ change the location order.
|
|||||||
Possible values:
|
Possible values:
|
||||||
* Empty list
|
* Empty list
|
||||||
* Comma separated list of registered store names. Legal values are:
|
* Comma separated list of registered store names. Legal values are:
|
||||||
(NOTE: Use only the following choices, which, unfortunately,
|
* file
|
||||||
are not entirely consistent with the store names used in other
|
|
||||||
similar configuration options. Please take extra care while
|
|
||||||
setting this option, and read the help text carefully when
|
|
||||||
setting other similar options.)
|
|
||||||
* filesystem
|
|
||||||
* http
|
* http
|
||||||
* rbd
|
* rbd
|
||||||
* swift
|
* swift
|
||||||
* sheepdog
|
* sheepdog
|
||||||
* cinder
|
* cinder
|
||||||
* vmware_datastore
|
* vmware
|
||||||
|
|
||||||
Related options:
|
Related options:
|
||||||
* location_strategy
|
* location_strategy
|
||||||
@ -89,13 +79,13 @@ def init():
|
|||||||
# possible to prevent make relationships with Glance(server)-specific code,
|
# possible to prevent make relationships with Glance(server)-specific code,
|
||||||
# for example: using functions within store module to validate
|
# for example: using functions within store module to validate
|
||||||
# 'store_type_preference' option.
|
# 'store_type_preference' option.
|
||||||
mapping = {'filesystem': ['file', 'filesystem'],
|
mapping = {'file': ['file', 'filesystem'],
|
||||||
'http': ['http', 'https'],
|
'http': ['http', 'https'],
|
||||||
'rbd': ['rbd'],
|
'rbd': ['rbd'],
|
||||||
'swift': ['swift', 'swift+https', 'swift+http'],
|
'swift': ['swift', 'swift+https', 'swift+http'],
|
||||||
'sheepdog': ['sheepdog'],
|
'sheepdog': ['sheepdog'],
|
||||||
'cinder': ['cinder'],
|
'cinder': ['cinder'],
|
||||||
'vmware_datastore': ['vsphere']}
|
'vmware': ['vsphere']}
|
||||||
_STORE_TO_SCHEME_MAP.clear()
|
_STORE_TO_SCHEME_MAP.clear()
|
||||||
_STORE_TO_SCHEME_MAP.update(mapping)
|
_STORE_TO_SCHEME_MAP.update(mapping)
|
||||||
|
|
||||||
@ -114,6 +104,27 @@ 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:
|
||||||
|
@ -158,15 +158,17 @@ class TestStoreTypeStrategyModule(base.IsolatedUnitTest):
|
|||||||
|
|
||||||
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 ', ' filesystem',
|
||||||
'swift ', ' http '],
|
'swift ', ' http ',
|
||||||
|
'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}},
|
||||||
{'url': 'file://image3', 'metadata': {'idx': 4}},
|
{'url': 'file://image3', 'metadata': {'idx': 4}},
|
||||||
{'url': 'swift://image4', 'metadata': {'idx': 6}},
|
{'url': 'swift://image4', 'metadata': {'idx': 6}},
|
||||||
{'url': 'cinder://image5', 'metadata': {'idx': 8}},
|
{'url': 'cinder://image5', 'metadata': {'idx': 9}},
|
||||||
{'url': 'file://image6', 'metadata': {'idx': 5}},
|
{'url': 'file://image6', 'metadata': {'idx': 5}},
|
||||||
{'url': 'rbd://image7', 'metadata': {'idx': 1}},
|
{'url': 'rbd://image7', 'metadata': {'idx': 1}},
|
||||||
|
{'url': 'vsphere://image9', 'metadata': {'idx': 8}},
|
||||||
{'url': 'sheepdog://image8', 'metadata': {'idx': 2}}]
|
{'url': 'sheepdog://image8', 'metadata': {'idx': 2}}]
|
||||||
ordered_locs = store_type.get_ordered_locations(copy.deepcopy(locs))
|
ordered_locs = store_type.get_ordered_locations(copy.deepcopy(locs))
|
||||||
locs.sort(key=lambda loc: loc['metadata']['idx'])
|
locs.sort(key=lambda loc: loc['metadata']['idx'])
|
||||||
@ -189,3 +191,25 @@ 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)
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- |
|
||||||
|
Some backend store names were inconsistent between glance
|
||||||
|
and glance_store. This meant that operators of the
|
||||||
|
VMware datastore or file system store were required to use
|
||||||
|
store names in ``glance-api.conf`` that did not correspond
|
||||||
|
to any valid identifier in glance_store. As this situation
|
||||||
|
encouraged misconfiguration and operator unhappiness, we
|
||||||
|
have made the store names consistent in the Newton
|
||||||
|
release. What this means for you:
|
||||||
|
|
||||||
|
* This change applies only to operators who are using
|
||||||
|
multiple image locations
|
||||||
|
* This change applies only to operators using the VMware
|
||||||
|
datastore or filesystem stores
|
||||||
|
* This change applies only to the ``store_type_preference``
|
||||||
|
option
|
||||||
|
* *VMware datastore operators*: The old name, now
|
||||||
|
**DEPRECATED**, was ``vmware_datastore``. The **new**
|
||||||
|
name, used in both glance and glance_store, is
|
||||||
|
``vmware``
|
||||||
|
* *File system store operators*: the old name, now
|
||||||
|
**DEPRECATED**, was ``filesystem``. The **new** name,
|
||||||
|
used in both glance and glance_store, is ``file``
|
||||||
|
* This change is backward compatible, that is, the old
|
||||||
|
names will be recognized by the code during the deprecation
|
||||||
|
period. Support for the deprecated names will be removed in
|
||||||
|
the **Pike** release
|
||||||
|
* We strongly encourage operators to modify their
|
||||||
|
``glance-api.conf`` files immediately to use the **new**
|
||||||
|
names
|
Loading…
Reference in New Issue
Block a user