Merge "Config options: centralize options in availability_zones"

This commit is contained in:
Jenkins 2016-02-20 04:49:14 +00:00 committed by Gerrit Code Review
commit c18206a3b6
8 changed files with 48 additions and 30 deletions

View File

@ -12,16 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova.api.openstack.compute.schemas import availability_zone as schema
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import availability_zones
import nova.conf
from nova import objects
from nova import servicegroup
CONF = cfg.CONF
CONF = nova.conf.CONF
ALIAS = "os-availability-zone"
ATTRIBUTE_NAME = "availability_zone"
authorize = extensions.os_compute_authorizer(ALIAS)

View File

@ -16,8 +16,7 @@
"""Availability zone helper functions."""
import collections
from oslo_config import cfg
import nova.conf
from nova import cache_utils
from nova import objects
@ -27,17 +26,7 @@ from nova import objects
AZ_CACHE_SECONDS = 60 * 60
MC = None
availability_zone_opts = [
cfg.StrOpt('internal_service_availability_zone',
default='internal',
help='The availability_zone to show internal services under'),
cfg.StrOpt('default_availability_zone',
default='nova',
help='Default compute node availability_zone'),
]
CONF = cfg.CONF
CONF.register_opts(availability_zone_opts)
CONF = nova.conf.CONF
def _get_cache():

View File

@ -21,7 +21,7 @@ from oslo_config import cfg
# from nova.conf import api
# from nova.conf import api_database
# from nova.conf import availability_zone
from nova.conf import availability_zone
# from nova.conf import aws
# from nova.conf import barbican
# from nova.conf import base
@ -81,7 +81,7 @@ CONF = cfg.CONF
# api.register_opts(CONF)
# api_database.register_opts(CONF)
# availability_zone.register_opts(CONF)
availability_zone.register_opts(CONF)
# aws.register_opts(CONF)
# barbican.register_opts(CONF)
# base.register_opts(CONF)

View File

@ -0,0 +1,38 @@
# Copyright (c) 2013 Intel, Inc.
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
internal_service_availability_zone = cfg.StrOpt(
'internal_service_availability_zone',
default='internal',
help='The availability_zone to show internal services under')
default_availability_zone = cfg.StrOpt(
'default_availability_zone',
default='nova',
help='Default compute node availability_zone')
ALL_OPTS = [internal_service_availability_zone,
default_availability_zone]
def register_opts(conf):
conf.register_opts(ALL_OPTS)
def list_opts():
return {'DEFAULT': ALL_OPTS}

View File

@ -12,7 +12,6 @@
import itertools
import nova.availability_zones
import nova.baserpc
import nova.cloudpipe.pipelib
import nova.cmd.novnc
@ -63,7 +62,6 @@ def list_opts():
[nova.db.base.db_driver_opt],
[nova.ipv6.api.ipv6_backend_opt],
[nova.servicegroup.api.servicegroup_driver_opt],
nova.availability_zones.availability_zone_opts,
nova.cloudpipe.pipelib.cloudpipe_opts,
nova.cmd.novnc.opts,
nova.cmd.spicehtml5proxy.opts,

View File

@ -13,16 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log as logging
import nova.conf
from nova.scheduler import filters
from nova.scheduler.filters import utils
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
CONF.import_opt('default_availability_zone', 'nova.availability_zones')
CONF = nova.conf.CONF
class AvailabilityZoneFilter(filters.BaseHostFilter):

View File

@ -18,20 +18,16 @@ Tests for availability zones
"""
import mock
from oslo_config import cfg
import six
from nova import availability_zones as az
import nova.conf
from nova import context
from nova import db
from nova import objects
from nova import test
CONF = cfg.CONF
CONF.import_opt('internal_service_availability_zone',
'nova.availability_zones')
CONF.import_opt('default_availability_zone',
'nova.availability_zones')
CONF = nova.conf.CONF
class AvailabilityZoneTestCases(test.TestCase):

View File

@ -77,7 +77,6 @@ CONF = nova.conf.CONF
CONF.import_opt('compute_manager', 'nova.service')
CONF.import_opt('network_manager', 'nova.service')
CONF.import_opt('host', 'nova.netconf')
CONF.import_opt('default_availability_zone', 'nova.availability_zones')
CONF.import_opt('login_timeout', 'nova.virt.xenapi.client.session',
group="xenserver")