Use oslo_config.cfg.ConfigOpts in glance_store

Move from oslo.config to oslo_config. This change could prevent glance
failed by "NoSuchOptError: no such option: glance_store" triggered in
verify_default_store() error when startup [0].

The root cause is that when we import oslo.config.cfg (when importing
glance_store in glance context) first than oslo_config.cfg, global
oslo.config.cfg.ConfigOpts object (CONF) in glance_store code is a
different object (and type) than oslo_config.cfg.ConfigOpts object in
glance code, so register_opts() of glance_store registered all store
needed options to a separated ConfigOpts object but glance used one.

With change I30ecbf8f9de77496fcb643c7ad9738d79ad359f0) glance is using
oslo_config namespace now, so before release new glance_store, we need
merge this change in.

A clear and simpler example as following:

Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
>>> from glance_store import backend
>>> from glance.common import config  # we do this importing order for
pep8 required in now code.
>>> config.CONF == backend.CONF, config.CONF, backend.CONF
(False, <oslo_config.cfg.ConfigOpts object at 0x7f4e4cd18690>,
<oslo.config.cfg.ConfigOpts object at 0x7f4e4e521d50>)
# Renew python session.
>>> from glance.common import config
>>> from glance_store import backend
>>> config.CONF == backend.CONF, config.CONF, backend.CONF
(True, <oslo_config.cfg.ConfigOpts object at 0x7fc355937450>,
<oslo_config.cfg.ConfigOpts object at 0x7fc355937450>)

Change-Id: I1f1962c462b0c1fcdce0c04c6a1cec57d9f191eb
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
This commit is contained in:
Zhi Yan Liu 2015-03-01 20:31:14 +08:00
parent b8d62633ec
commit 2454639a60
5 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ import httplib
import logging
import math
from oslo.config import cfg
from oslo_config import cfg
from oslo_utils import excutils
from oslo_utils import units
import six

View File

@ -20,7 +20,7 @@ try:
except ImportError:
from ordereddict import OrderedDict
from oslo.config import cfg
from oslo_config import cfg
from glance_store import exceptions
from glance_store import i18n

View File

@ -15,7 +15,7 @@
import logging
from oslo.config import cfg
from oslo_config import cfg
from stevedore import driver
from stevedore import extension

View File

@ -18,7 +18,7 @@
import logging
from oslo.config import cfg
from oslo_config import cfg
from oslo_utils import importutils
from oslo_utils import units

View File

@ -40,7 +40,7 @@ credentials and is **not** user-facing.
import logging
import urlparse
from oslo.config import cfg
from oslo_config import cfg
from glance_store import exceptions