Cleaning up CONF.register_opts() in compute/__init__.py

This patch makes the import of oslo_config and registration
of _compute_opts consistent with all other imports and
registration statements in other files. In a future patch
that dynamically generates Cinder config options, it will now
be possible to get the options being registered in this file.

Change-Id: Ifaae49dd6d0163b5cde44df7b3ca904fb550f211
This commit is contained in:
Kendall Nelson 2015-08-21 13:15:25 -05:00
parent fdcc2278a0
commit 86197acd36
1 changed files with 9 additions and 8 deletions

View File

@ -13,21 +13,22 @@
# License for the specific language governing permissions and limitations
# under the License.
import oslo_config.cfg
from oslo_config import cfg
from oslo_utils import importutils
_compute_opts = [
oslo_config.cfg.StrOpt('compute_api_class',
compute_opts = [
cfg.StrOpt('compute_api_class',
default='cinder.compute.nova.API',
help='The full class name of the '
'compute API class to use'),
]
oslo_config.cfg.CONF.register_opts(_compute_opts)
CONF = cfg.CONF
CONF.register_opts(compute_opts)
def API():
compute_api_class = oslo_config.cfg.CONF.compute_api_class
compute_api_class = CONF.compute_api_class
cls = importutils.import_class(compute_api_class)
return cls()