diff --git a/nova/api/metadata/handler.py b/nova/api/metadata/handler.py index 7e9c36aaf1..44e569dc7e 100644 --- a/nova/api/metadata/handler.py +++ b/nova/api/metadata/handler.py @@ -28,6 +28,7 @@ import webob.exc from nova.api.metadata import base from nova import cache_utils +import nova.conf from nova import context as nova_context from nova import exception from nova.i18n import _ @@ -36,21 +37,9 @@ from nova.i18n import _LW from nova.network.neutronv2 import api as neutronapi from nova import wsgi -CONF = cfg.CONF +CONF = nova.conf.CONF CONF.import_opt('use_forwarded_for', 'nova.api.auth') -metadata_proxy_opts = [ - cfg.BoolOpt( - 'service_metadata_proxy', - default=False, - help='Set flag to indicate Neutron will proxy metadata requests and ' - 'resolve instance ids.'), - cfg.StrOpt( - 'metadata_proxy_shared_secret', - default='', secret=True, - help='Shared secret to validate proxies Neutron metadata requests'), -] - metadata_opts = [ cfg.IntOpt('metadata_cache_expiration', default=15, @@ -62,7 +51,6 @@ metadata_opts = [ 'changes to take effect.') ] -CONF.register_opts(metadata_proxy_opts, 'neutron') CONF.register_opts(metadata_opts) LOG = logging.getLogger(__name__) diff --git a/nova/api/opts.py b/nova/api/opts.py index fb93ea6a89..0dd276c645 100644 --- a/nova/api/opts.py +++ b/nova/api/opts.py @@ -25,92 +25,6 @@ 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 -import nova.availability_zones -import nova.baserpc -import nova.cells.manager -import nova.cells.messaging -import nova.cells.opts -import nova.cells.rpc_driver -import nova.cells.rpcapi -import nova.cells.scheduler -import nova.cells.state -import nova.cells.weights.mute_child -import nova.cells.weights.ram_by_instance_type -import nova.cells.weights.weight_offset -import nova.cert.rpcapi -import nova.cloudpipe.pipelib -import nova.cmd.novncproxy -import nova.cmd.serialproxy -import nova.cmd.spicehtml5proxy -import nova.compute.api -import nova.compute.flavors -import nova.compute.manager -import nova.compute.monitors -import nova.compute.resource_tracker -import nova.compute.rpcapi -import nova.conductor.api -import nova.conductor.rpcapi -import nova.conductor.tasks.live_migrate -import nova.console.manager -import nova.console.rpcapi -import nova.console.serial -import nova.console.xvp -import nova.consoleauth -import nova.consoleauth.manager -import nova.consoleauth.rpcapi -import nova.crypto -import nova.db.api -import nova.db.base -import nova.db.sqlalchemy.api -import nova.exception -import nova.image.download.file -import nova.image.glance -import nova.ipv6.api -import nova.keymgr -import nova.keymgr.barbican -import nova.keymgr.conf_key_mgr -import nova.netconf -import nova.network -import nova.network.driver -import nova.network.floating_ips -import nova.network.ldapdns -import nova.network.linux_net -import nova.network.manager -import nova.network.neutronv2.api -import nova.network.rpcapi -import nova.network.security_group.openstack_driver -import nova.notifications -import nova.objects.network -import nova.pci.request -import nova.pci.whitelist -import nova.quota -import nova.scheduler.driver -import nova.scheduler.filter_scheduler -import nova.scheduler.filters.aggregate_image_properties_isolation -import nova.scheduler.filters.core_filter -import nova.scheduler.filters.disk_filter -import nova.scheduler.filters.io_ops_filter -import nova.scheduler.filters.isolated_hosts_filter -import nova.scheduler.filters.num_instances_filter -import nova.scheduler.filters.ram_filter -import nova.scheduler.filters.trusted_filter -import nova.scheduler.host_manager -import nova.scheduler.ironic_host_manager -import nova.scheduler.manager -import nova.scheduler.rpcapi -import nova.scheduler.scheduler_options -import nova.scheduler.utils -import nova.scheduler.weights.io_ops -import nova.scheduler.weights.metrics -import nova.scheduler.weights.ram -import nova.service -import nova.servicegroup.api -import nova.utils -import nova.vnc -import nova.vnc.xvp_proxy -import nova.volume -import nova.volume.cinder -import nova.wsgi def list_opts(): @@ -131,6 +45,5 @@ def list_opts(): nova.api.openstack.compute.hide_server_addresses.opts, nova.api.openstack.compute.legacy_v2.servers.server_opts, )), - ('neutron', nova.api.metadata.handler.metadata_proxy_opts), ('osapi_v21', nova.api.openstack.api_opts), ] diff --git a/nova/conf/neutron.py b/nova/conf/neutron.py index b6d4dd6790..eaf2faa589 100644 --- a/nova/conf/neutron.py +++ b/nova/conf/neutron.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +import itertools from oslo_config import cfg @@ -34,11 +35,28 @@ neutron_opts = [ ' extensions'), ] +metadata_proxy_opts = [ + cfg.BoolOpt( + 'service_metadata_proxy', + default=False, + help='Set flag to indicate Neutron will proxy metadata requests and ' + 'resolve instance ids.'), + cfg.StrOpt( + 'metadata_proxy_shared_secret', + default='', secret=True, + help='Shared secret to validate proxies Neutron metadata requests'), +] + +ALL_OPTS = list(itertools.chain( + neutron_opts, + metadata_proxy_opts +)) + def register_opts(conf): conf.register_group(neutron_group) - conf.register_opts(neutron_opts, group=neutron_group) + conf.register_opts(ALL_OPTS, group=neutron_group) def list_opts(): - return {neutron_group: neutron_opts} + return {neutron_group: ALL_OPTS}