Move shared metadata driver related config options

This change moves metadata driver related config options to metadata
driver module to prepare the use of metadata driver method in the dhcp
agent (daughter change). The metadata_port option is not moved as the
dhcp agent uses a non-configurable port (80).

Change-Id: Ie45fdad86f33d35fca3096c4c52fae941a279e76
Partial-Bug: #1187107
This commit is contained in:
Cedric Brandily 2015-01-07 22:21:10 +00:00
parent 6510c32f04
commit e171271f12
4 changed files with 24 additions and 15 deletions

View File

@ -55,19 +55,5 @@ OPTS = [
cfg.BoolOpt('enable_metadata_proxy', default=True,
help=_("Allow running metadata proxy.")),
cfg.BoolOpt('router_delete_namespaces', default=False,
help=_("Delete namespace after removing a router.")),
cfg.StrOpt('metadata_proxy_socket',
default='$state_path/metadata_proxy',
help=_('Location of Metadata Proxy UNIX domain '
'socket')),
cfg.StrOpt('metadata_proxy_user',
default='',
help=_("User (uid or name) running metadata proxy after "
"its initialization (if empty: L3 agent effective "
"user)")),
cfg.StrOpt('metadata_proxy_group',
default='',
help=_("Group (gid or name) running metadata proxy after "
"its initialization (if empty: L3 agent effective "
"group)"))
help=_("Delete namespace after removing a router."))
]

View File

@ -26,6 +26,7 @@ from neutron.agent.l3 import config as l3_config
from neutron.agent.l3 import ha
from neutron.agent.linux import external_process
from neutron.agent.linux import interface
from neutron.agent.metadata import driver as metadata_driver
from neutron.common import config as common_config
from neutron.common import topics
from neutron.openstack.common import service
@ -34,6 +35,7 @@ from neutron import service as neutron_service
def register_opts(conf):
conf.register_opts(l3_config.OPTS)
conf.register_opts(metadata_driver.MetadataDriver.OPTS)
conf.register_opts(ha.OPTS)
config.register_interface_driver_opts_helper(conf)
config.register_use_namespaces_opts_helper(conf)

View File

@ -15,6 +15,8 @@
import os
from oslo.config import cfg
from neutron.agent.common import config
from neutron.agent.linux import external_process
from neutron.openstack.common import log as logging
@ -24,6 +26,24 @@ LOG = logging.getLogger(__name__)
class MetadataDriver(advanced_service.AdvancedService):
OPTS = [
cfg.StrOpt('metadata_proxy_socket',
default='$state_path/metadata_proxy',
help=_('Location of Metadata Proxy UNIX domain '
'socket')),
cfg.StrOpt('metadata_proxy_user',
default='',
help=_("User (uid or name) running metadata proxy after "
"its initialization (if empty: L3 agent effective "
"user)")),
cfg.StrOpt('metadata_proxy_group',
default='',
help=_("Group (gid or name) running metadata proxy after "
"its initialization (if empty: L3 agent effective "
"group)"))
]
def __init__(self, l3_agent):
super(MetadataDriver, self).__init__(l3_agent)
self.metadata_port = l3_agent.conf.metadata_port

View File

@ -37,6 +37,7 @@ class TestMetadataDriver(base.BaseTestCase):
def setUp(self):
super(TestMetadataDriver, self).setUp()
cfg.CONF.register_opts(l3_config.OPTS)
cfg.CONF.register_opts(metadata_driver.MetadataDriver.OPTS)
agent_config.register_root_helper(cfg.CONF)
def test_metadata_nat_rules(self):