Merge "Move config options from nova/api directory (3)"

This commit is contained in:
Jenkins
2016-05-11 16:54:07 +00:00
committed by Gerrit Code Review
7 changed files with 32 additions and 38 deletions

View File

@@ -18,7 +18,6 @@
WSGI middleware for OpenStack Compute API.
"""
from oslo_config import cfg
from oslo_log import log as logging
import nova.api.openstack
@@ -36,15 +35,11 @@ from nova.api.openstack.compute.legacy_v2 import server_metadata \
from nova.api.openstack.compute.legacy_v2 import servers as v2_servers
from nova.api.openstack.compute.legacy_v2 import versions \
as legacy_v2_versions
import nova.conf
from nova.i18n import _LW
allow_instance_snapshots_opt = cfg.BoolOpt('allow_instance_snapshots',
default=True,
help='Permit instance snapshot operations.')
CONF = cfg.CONF
CONF.register_opt(allow_instance_snapshots_opt)
CONF = nova.conf.CONF
LOG = logging.getLogger(__name__)

View File

@@ -17,7 +17,6 @@
import itertools
import os
from oslo_config import cfg
import six
from webob import exc
@@ -25,6 +24,7 @@ from nova.api.openstack import common
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova import compute
import nova.conf
from nova.i18n import _
from nova import utils
@@ -32,9 +32,7 @@ ALIAS = "os-fping"
authorize = extensions.os_compute_authorizer(ALIAS)
CONF = cfg.CONF
CONF.import_opt('fping_path', 'nova.api.openstack.compute.legacy_v2.contrib.'
'fping')
CONF = nova.conf.CONF
class FpingController(wsgi.Controller):

View File

@@ -15,21 +15,13 @@
"""Extension for hiding server addresses in certain states."""
from oslo_config import cfg
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.compute import vm_states
opts = [
cfg.ListOpt('osapi_hide_server_address_states',
default=[vm_states.BUILDING],
help='List of instance states that should hide network info'),
]
import nova.conf
CONF = cfg.CONF
CONF.register_opts(opts)
CONF = nova.conf.CONF
ALIAS = 'os-hide-server-addresses'
authorize = extensions.os_compute_soft_authorizer(ALIAS)

View File

@@ -17,27 +17,21 @@
import itertools
import os
from oslo_config import cfg
import six
from webob import exc
from nova.api.openstack import common
from nova.api.openstack import extensions
from nova import compute
import nova.conf
from nova.i18n import _
from nova import utils
authorize = extensions.extension_authorizer('compute', 'fping')
authorize_all_tenants = extensions.extension_authorizer(
'compute', 'fping:all_tenants')
fping_opts = [
cfg.StrOpt("fping_path",
default="/usr/sbin/fping",
help="Full path to fping."),
]
CONF = cfg.CONF
CONF.register_opts(fping_opts)
CONF = nova.conf.CONF
class FpingController(object):

View File

@@ -15,7 +15,6 @@ import itertools
import nova.api.openstack.compute
import nova.api.openstack.compute.hide_server_addresses
import nova.api.openstack.compute.legacy_v2.contrib
import nova.api.openstack.compute.legacy_v2.contrib.fping
import nova.api.openstack.compute.legacy_v2.contrib.os_tenant_networks
import nova.api.openstack.compute.legacy_v2.extensions
import nova.api.openstack.compute.legacy_v2.servers
@@ -25,13 +24,10 @@ def list_opts():
return [
('DEFAULT',
itertools.chain(
[nova.api.openstack.compute.allow_instance_snapshots_opt],
nova.api.openstack.compute.legacy_v2.contrib.ext_opts,
nova.api.openstack.compute.legacy_v2.contrib.fping.fping_opts,
nova.api.openstack.compute.legacy_v2.contrib.os_tenant_networks.
os_network_opts,
nova.api.openstack.compute.legacy_v2.extensions.ext_opts,
nova.api.openstack.compute.hide_server_addresses.opts,
nova.api.openstack.compute.legacy_v2.servers.server_opts,
)),
]

View File

@@ -72,10 +72,29 @@ osapi_opts = [
'to glance resources'),
]
allow_instance_snapshots_opt = cfg.BoolOpt('allow_instance_snapshots',
default=True,
help='Permit instance snapshot operations.')
# NOTE(edleafe): I should import the value directly from
# nova.compute.vm_states, but that creates a circular import. Since this value
# is not likely to be changed, I'm copy/pasting it here.
BUILDING = "building" # VM only exists in DB
osapi_hide_opt = cfg.ListOpt('osapi_hide_server_address_states',
default=[BUILDING],
help='List of instance states that should hide network info')
fping_path_opt = cfg.StrOpt("fping_path",
default="/usr/sbin/fping",
help="Full path to fping.")
ALL_OPTS = (auth_opts +
metadata_opts +
[file_opt] +
osapi_opts +
[allow_instance_snapshots_opt] +
[osapi_hide_opt] +
[fping_path_opt] +
[])
# Please note that final empty list in the line above is just to allow adding
# additional options in later patches without changing the last line. Once they
@@ -87,6 +106,9 @@ def register_opts(conf):
conf.register_opts(metadata_opts)
conf.register_opt(file_opt)
conf.register_opts(osapi_opts)
conf.register_opt(allow_instance_snapshots_opt)
conf.register_opt(osapi_hide_opt)
conf.register_opt(fping_path_opt)
def list_opts():

View File

@@ -13,14 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from nova.compute import vm_states
import nova.conf
from nova.tests.functional.api_sample_tests import test_servers
CONF = cfg.CONF
CONF.import_opt('osapi_hide_server_address_states',
'nova.api.openstack.compute.hide_server_addresses')
CONF = nova.conf.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.legacy_v2.extensions')