Merge "Move config options from nova/api directory (4)"
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import strutils
|
||||
from webob import exc
|
||||
|
||||
@@ -24,13 +23,12 @@ from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
from nova.api import validation
|
||||
from nova import compute
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enable_instance_password',
|
||||
'nova.api.openstack.compute.legacy_v2.servers')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
ALIAS = "os-evacuate"
|
||||
authorize = extensions.os_compute_authorizer(ALIAS)
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
import netaddr
|
||||
import netaddr.core as netexc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
import webob
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import extensions
|
||||
import nova.conf
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
@@ -30,25 +30,7 @@ import nova.network
|
||||
from nova import quota
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
os_network_opts = [
|
||||
cfg.BoolOpt("enable_network_quota",
|
||||
default=False,
|
||||
help='Enables or disables quota checking for tenant '
|
||||
'networks'),
|
||||
cfg.StrOpt('use_neutron_default_nets',
|
||||
default="False",
|
||||
help='Control for checking for default networks'),
|
||||
cfg.StrOpt('neutron_default_tenant_id',
|
||||
default="default",
|
||||
help='Default tenant id when creating neutron '
|
||||
'networks'),
|
||||
cfg.IntOpt('quota_networks',
|
||||
default=3,
|
||||
help='Number of private networks allowed per project'),
|
||||
]
|
||||
CONF.register_opts(os_network_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
QUOTAS = quota.QUOTAS
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@@ -18,7 +18,6 @@ import base64
|
||||
import re
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_utils import netutils
|
||||
@@ -43,17 +42,7 @@ from nova import policy
|
||||
from nova import utils
|
||||
|
||||
|
||||
server_opts = [
|
||||
cfg.BoolOpt('enable_instance_password',
|
||||
default=True,
|
||||
help='Enables returning of the instance password by the'
|
||||
' relevant server API calls such as create, rebuild'
|
||||
' or rescue, If the hypervisor does not support'
|
||||
' password injection then the password returned will'
|
||||
' not be correct'),
|
||||
]
|
||||
CONF = nova.conf.CONF
|
||||
CONF.register_opts(server_opts)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
"""The rescue mode extension."""
|
||||
|
||||
from oslo_config import cfg
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import common
|
||||
@@ -23,14 +22,13 @@ from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
from nova.api import validation
|
||||
from nova import compute
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova import utils
|
||||
|
||||
|
||||
ALIAS = "os-rescue"
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enable_instance_password',
|
||||
'nova.api.openstack.compute.legacy_v2.servers')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
authorize = extensions.os_compute_authorizer(ALIAS)
|
||||
|
||||
|
||||
@@ -48,8 +48,6 @@ ALIAS = 'servers'
|
||||
TAG_SEARCH_FILTERS = ('tags', 'tags-any', 'not-tags', 'not-tags-any')
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
CONF.import_opt('enable_instance_password',
|
||||
'nova.api.openstack.compute.legacy_v2.servers')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
authorize = extensions.os_compute_authorizer(ALIAS)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
import netaddr
|
||||
import netaddr.core as netexc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
from webob import exc
|
||||
@@ -25,6 +24,7 @@ from nova.api.openstack.compute.schemas import tenant_networks as schema
|
||||
from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
from nova.api import validation
|
||||
import nova.conf
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
@@ -33,16 +33,7 @@ import nova.network
|
||||
from nova import quota
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('enable_network_quota', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('use_neutron_default_nets', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('neutron_default_tenant_id', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
CONF.import_opt('quota_networks', 'nova.api.openstack.compute.'
|
||||
'legacy_v2.contrib.os_tenant_networks')
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
ALIAS = 'os-tenant-networks'
|
||||
|
||||
|
||||
@@ -12,12 +12,8 @@
|
||||
|
||||
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.os_tenant_networks
|
||||
import nova.api.openstack.compute.legacy_v2.extensions
|
||||
import nova.api.openstack.compute.legacy_v2.servers
|
||||
|
||||
|
||||
def list_opts():
|
||||
@@ -25,9 +21,6 @@ def list_opts():
|
||||
('DEFAULT',
|
||||
itertools.chain(
|
||||
nova.api.openstack.compute.legacy_v2.contrib.ext_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.legacy_v2.servers.server_opts,
|
||||
)),
|
||||
]
|
||||
|
||||
@@ -52,6 +52,7 @@ from nova.conf import ipv6
|
||||
from nova.conf import ironic
|
||||
from nova.conf import key_manager
|
||||
# from nova.conf import keystone_authtoken
|
||||
# from nova.conf import legacy_api
|
||||
from nova.conf import libvirt
|
||||
from nova.conf import mks
|
||||
# from nova.conf import matchmaker_redis
|
||||
@@ -124,6 +125,7 @@ ipv6.register_opts(CONF)
|
||||
ironic.register_opts(CONF)
|
||||
key_manager.register_opts(CONF)
|
||||
# keystone_authtoken.register_opts(CONF)
|
||||
# legacy_api.register_opts(CONF)
|
||||
libvirt.register_opts(CONF)
|
||||
# matchmaker_redis.register_opts(CONF)
|
||||
# metadata.register_opts(CONF)
|
||||
|
||||
@@ -76,7 +76,7 @@ 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
|
||||
# NOTE(edleafe): I would like to 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
|
||||
@@ -88,6 +88,31 @@ fping_path_opt = cfg.StrOpt("fping_path",
|
||||
default="/usr/sbin/fping",
|
||||
help="Full path to fping.")
|
||||
|
||||
os_network_opts = [
|
||||
cfg.BoolOpt("enable_network_quota",
|
||||
default=False,
|
||||
help='Enables or disables quota checking for tenant '
|
||||
'networks'),
|
||||
cfg.StrOpt('use_neutron_default_nets',
|
||||
default="False",
|
||||
help='Control for checking for default networks'),
|
||||
cfg.StrOpt('neutron_default_tenant_id',
|
||||
default="default",
|
||||
help='Default tenant id when creating neutron '
|
||||
'networks'),
|
||||
cfg.IntOpt('quota_networks',
|
||||
default=3,
|
||||
help='Number of private networks allowed per project'),
|
||||
]
|
||||
|
||||
enable_inst_pw_opt = cfg.BoolOpt('enable_instance_password',
|
||||
default=True,
|
||||
help='Enables returning of the instance password by the'
|
||||
' relevant server API calls such as create, rebuild'
|
||||
' or rescue, If the hypervisor does not support'
|
||||
' password injection then the password returned will'
|
||||
' not be correct')
|
||||
|
||||
ALL_OPTS = (auth_opts +
|
||||
metadata_opts +
|
||||
[file_opt] +
|
||||
@@ -95,10 +120,8 @@ ALL_OPTS = (auth_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
|
||||
# are all moved, the empty list will be removed.
|
||||
os_network_opts +
|
||||
[enable_inst_pw_opt])
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
@@ -109,6 +132,8 @@ def register_opts(conf):
|
||||
conf.register_opt(allow_instance_snapshots_opt)
|
||||
conf.register_opt(osapi_hide_opt)
|
||||
conf.register_opt(fping_path_opt)
|
||||
conf.register_opts(os_network_opts)
|
||||
conf.register_opt(enable_inst_pw_opt)
|
||||
|
||||
|
||||
def list_opts():
|
||||
|
||||
Reference in New Issue
Block a user