Configure agents using neutron.common.config.init (formerly .parse)
After oslo.messaging port is done, we'll need to initialize RPC layer from all RPC agents. We'll put initialization into init() function, so the first step for migration is to make agents use it. The function is renamed to be explicit about the fact that we don't just parse configuration by calling it, but also do other common initializations, like setting RPC layer. blueprint oslo-messaging Change-Id: I71c62f270ac7a1ff1426a3f49a32133b65580e35
This commit is contained in:
parent
65deb1a4bf
commit
d8cf7fd7c5
@ -16,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
@ -29,6 +30,7 @@ from neutron.agent.linux import external_process
|
|||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
from neutron.agent.linux import ovs_lib # noqa
|
from neutron.agent.linux import ovs_lib # noqa
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
@ -610,7 +612,7 @@ def register_options():
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
register_options()
|
register_options()
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
server = neutron_service.Service.create(
|
server = neutron_service.Service.create(
|
||||||
binary='neutron-dhcp-agent',
|
binary='neutron-dhcp-agent',
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ from neutron.agent.linux import ip_lib
|
|||||||
from neutron.agent.linux import iptables_manager
|
from neutron.agent.linux import iptables_manager
|
||||||
from neutron.agent.linux import ovs_lib # noqa
|
from neutron.agent.linux import ovs_lib # noqa
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as l3_constants
|
from neutron.common import constants as l3_constants
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -977,7 +980,7 @@ def main(manager='neutron.agent.l3_agent.L3NATAgentWithStateReport'):
|
|||||||
config.register_root_helper(conf)
|
config.register_root_helper(conf)
|
||||||
conf.register_opts(interface.OPTS)
|
conf.register_opts(interface.OPTS)
|
||||||
conf.register_opts(external_process.OPTS)
|
conf.register_opts(external_process.OPTS)
|
||||||
conf(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
config.setup_logging(conf)
|
config.setup_logging(conf)
|
||||||
server = neutron_service.Service.create(
|
server = neutron_service.Service.create(
|
||||||
binary='neutron-l3-agent',
|
binary='neutron-l3-agent',
|
||||||
|
@ -20,6 +20,7 @@ import hashlib
|
|||||||
import hmac
|
import hmac
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
@ -384,7 +385,7 @@ def main():
|
|||||||
cache.register_oslo_configs(cfg.CONF)
|
cache.register_oslo_configs(cfg.CONF)
|
||||||
cfg.CONF.set_default(name='cache_url', default='memory://?default_ttl=5')
|
cfg.CONF.set_default(name='cache_url', default='memory://?default_ttl=5')
|
||||||
agent_conf.register_agent_state_opts_helper(cfg.CONF)
|
agent_conf.register_agent_state_opts_helper(cfg.CONF)
|
||||||
cfg.CONF(project='neutron')
|
config.init(sys.argv[1:])
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
utils.log_opt_values(LOG)
|
utils.log_opt_values(LOG)
|
||||||
proxy = UnixDomainMetadataProxy(cfg.CONF)
|
proxy = UnixDomainMetadataProxy(cfg.CONF)
|
||||||
|
@ -85,7 +85,7 @@ def main():
|
|||||||
cfg.CONF.register_cli_opts(OPTS)
|
cfg.CONF.register_cli_opts(OPTS)
|
||||||
cfg.CONF.set_override('use_stderr', True)
|
cfg.CONF.set_override('use_stderr', True)
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
config.parse(sys.argv[1:], default_config_files=[])
|
config.init(sys.argv[1:], default_config_files=[])
|
||||||
|
|
||||||
if cfg.CONF.config_file:
|
if cfg.CONF.config_file:
|
||||||
enable_tests_from_config()
|
enable_tests_from_config()
|
||||||
|
@ -21,6 +21,8 @@ subnets.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron.common import config
|
from neutron.common import config
|
||||||
@ -30,7 +32,7 @@ from neutron.openstack.common.notifier import api as notifier_api
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
config.init(sys.argv[1:])
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
cxt = context.get_admin_context()
|
cxt = context.get_admin_context()
|
||||||
|
@ -134,7 +134,7 @@ db_options.set_defaults(sql_connection=_SQL_CONNECTION_DEFAULT,
|
|||||||
max_overflow=20, pool_timeout=10)
|
max_overflow=20, pool_timeout=10)
|
||||||
|
|
||||||
|
|
||||||
def parse(args, **kwargs):
|
def init(args, **kwargs):
|
||||||
cfg.CONF(args=args, project='neutron',
|
cfg.CONF(args=args, project='neutron',
|
||||||
version='%%prog %s' % version.version_info.release_string(),
|
version='%%prog %s' % version.version_info.release_string(),
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
@ -166,7 +166,7 @@ class RestProxyAgent(rpc_compat.RpcCallback,
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
config.init(sys.argv[1:])
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
pl_config.register_config()
|
pl_config.register_config()
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -30,7 +31,7 @@ from oslo.config import cfg
|
|||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as n_const
|
from neutron.common import constants as n_const
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -472,8 +473,8 @@ class HyperVNeutronAgent(rpc_compat.RpcCallback):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
plugin = HyperVNeutronAgent()
|
plugin = HyperVNeutronAgent()
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -28,7 +29,7 @@ from oslo.config import cfg
|
|||||||
from neutron.agent.linux import ip_lib
|
from neutron.agent.linux import ip_lib
|
||||||
from neutron.agent.linux import ovs_lib
|
from neutron.agent.linux import ovs_lib
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as n_const
|
from neutron.common import constants as n_const
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -257,8 +258,8 @@ def create_agent_config_map(config):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF.register_opts(ip_lib.OPTS)
|
cfg.CONF.register_opts(ip_lib.OPTS)
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
agent_config = create_agent_config_map(cfg.CONF)
|
agent_config = create_agent_config_map(cfg.CONF)
|
||||||
|
@ -36,7 +36,7 @@ from neutron.agent.linux import ip_lib
|
|||||||
from neutron.agent.linux import utils
|
from neutron.agent.linux import utils
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants
|
from neutron.common import constants
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
@ -1029,9 +1029,9 @@ class LinuxBridgeNeutronAgentRPC(sg_rpc.SecurityGroupAgentRpcMixin):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
|
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
try:
|
try:
|
||||||
interface_mappings = q_utils.parse_mappings(
|
interface_mappings = q_utils.parse_mappings(
|
||||||
cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
|
cfg.CONF.LINUX_BRIDGE.physical_interface_mappings)
|
||||||
|
@ -27,7 +27,7 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as q_constants
|
from neutron.common import constants as q_constants
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -421,8 +421,8 @@ class MlnxEswitchNeutronAgent(sg_rpc.SecurityGroupAgentRpcMixin):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
interface_mappings = q_utils.parse_mappings(
|
interface_mappings = q_utils.parse_mappings(
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
# @author: Akihiro MOTOKI
|
# @author: Akihiro MOTOKI
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -29,7 +30,7 @@ eventlet.monkey_patch()
|
|||||||
from neutron.agent.linux import ovs_lib
|
from neutron.agent.linux import ovs_lib
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as q_const
|
from neutron.common import constants as q_const
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -234,9 +235,9 @@ class NECNeutronAgent(object):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
config.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
|
|
||||||
logging_config.setup_logging(config.CONF)
|
common_config.setup_logging(config.CONF)
|
||||||
|
|
||||||
# Determine which agent type to use.
|
# Determine which agent type to use.
|
||||||
integ_br = config.OVS.integration_bridge
|
integ_br = config.OVS.integration_bridge
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
"""NVSD agent code for security group events."""
|
"""NVSD agent code for security group events."""
|
||||||
|
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -25,7 +26,7 @@ eventlet.monkey_patch()
|
|||||||
from neutron.agent.linux import ovs_lib
|
from neutron.agent.linux import ovs_lib
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron import context as n_context
|
from neutron import context as n_context
|
||||||
@ -164,8 +165,8 @@ class NVSDNeutronAgent(rpc_compat.RpcCallback):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
config.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
logging_config.setup_logging(config.CONF)
|
common_config.setup_logging(config.CONF)
|
||||||
|
|
||||||
integ_br = config.AGENT.integration_bridge
|
integ_br = config.AGENT.integration_bridge
|
||||||
root_helper = config.AGENT.root_helper
|
root_helper = config.AGENT.root_helper
|
||||||
|
@ -33,7 +33,7 @@ from neutron.agent.linux import polling
|
|||||||
from neutron.agent.linux import utils
|
from neutron.agent.linux import utils
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as q_const
|
from neutron.common import constants as q_const
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -1502,8 +1502,8 @@ def create_agent_config_map(config):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF.register_opts(ip_lib.OPTS)
|
cfg.CONF.register_opts(ip_lib.OPTS)
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
q_utils.log_opt_values(LOG)
|
q_utils.log_opt_values(LOG)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -35,7 +35,7 @@ from neutron.agent.linux import ip_lib
|
|||||||
from neutron.agent.linux import ovs_lib
|
from neutron.agent.linux import ovs_lib
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||||
from neutron.common import config as logging_config
|
from neutron.common import config as common_config
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -286,9 +286,9 @@ class OVSNeutronOFPRyuAgent(rpc_compat.RpcCallback,
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
|
|
||||||
logging_config.setup_logging(cfg.CONF)
|
common_config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
integ_br = cfg.CONF.OVS.integration_bridge
|
integ_br = cfg.CONF.OVS.integration_bridge
|
||||||
polling_interval = cfg.CONF.AGENT.polling_interval
|
polling_interval = cfg.CONF.AGENT.polling_interval
|
||||||
|
@ -90,7 +90,7 @@ def main():
|
|||||||
help(sys.argv[0])
|
help(sys.argv[0])
|
||||||
args = ['--config-file']
|
args = ['--config-file']
|
||||||
args.append(sys.argv[1])
|
args.append(sys.argv[1])
|
||||||
config.parse(args)
|
config.init(args)
|
||||||
print("----------------------- Database Options -----------------------")
|
print("----------------------- Database Options -----------------------")
|
||||||
print("\tconnection: %s" % cfg.CONF.database.connection)
|
print("\tconnection: %s" % cfg.CONF.database.connection)
|
||||||
print("\tretry_interval: %d" % cfg.CONF.database.retry_interval)
|
print("\tretry_interval: %d" % cfg.CONF.database.retry_interval)
|
||||||
|
@ -37,7 +37,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# the configuration will be read into the cfg.CONF global data structure
|
# the configuration will be read into the cfg.CONF global data structure
|
||||||
config.parse(sys.argv[1:])
|
config.init(sys.argv[1:])
|
||||||
if not cfg.CONF.config_file:
|
if not cfg.CONF.config_file:
|
||||||
sys.exit(_("ERROR: Unable to find configuration file via the default"
|
sys.exit(_("ERROR: Unable to find configuration file via the default"
|
||||||
" search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
|
" search paths (~/.neutron/, ~/, /etc/neutron/, /etc/) and"
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
# @author: Gary Duan, vArmour Networks Inc.
|
# @author: Gary Duan, vArmour Networks Inc.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
@ -29,6 +31,7 @@ from neutron.agent import l3_agent
|
|||||||
from neutron.agent.linux import external_process
|
from neutron.agent.linux import external_process
|
||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
from neutron.agent.linux import ip_lib
|
from neutron.agent.linux import ip_lib
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as l3_constants
|
from neutron.common import constants as l3_constants
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
@ -337,7 +340,7 @@ def main():
|
|||||||
config.register_root_helper(conf)
|
config.register_root_helper(conf)
|
||||||
conf.register_opts(interface.OPTS)
|
conf.register_opts(interface.OPTS)
|
||||||
conf.register_opts(external_process.OPTS)
|
conf.register_opts(external_process.OPTS)
|
||||||
conf(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
config.setup_logging(conf)
|
config.setup_logging(conf)
|
||||||
server = neutron_service.Service.create(
|
server = neutron_service.Service.create(
|
||||||
binary='neutron-l3-agent',
|
binary='neutron-l3-agent',
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#
|
#
|
||||||
# @author: Mark McClain, DreamHost
|
# @author: Mark McClain, DreamHost
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
eventlet.monkey_patch()
|
eventlet.monkey_patch()
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
from neutron.openstack.common import service
|
from neutron.openstack.common import service
|
||||||
@ -57,7 +60,7 @@ def main():
|
|||||||
config.register_agent_state_opts_helper(cfg.CONF)
|
config.register_agent_state_opts_helper(cfg.CONF)
|
||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
|
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
config.setup_logging(cfg.CONF)
|
config.setup_logging(cfg.CONF)
|
||||||
|
|
||||||
mgr = manager.LbaasAgentManager(cfg.CONF)
|
mgr = manager.LbaasAgentManager(cfg.CONF)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -23,6 +24,7 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.agent import rpc as agent_rpc
|
from neutron.agent import rpc as agent_rpc
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as constants
|
from neutron.common import constants as constants
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
from neutron.common import topics
|
from neutron.common import topics
|
||||||
@ -287,7 +289,7 @@ def main():
|
|||||||
conf.register_opts(MeteringAgent.Opts)
|
conf.register_opts(MeteringAgent.Opts)
|
||||||
config.register_agent_state_opts_helper(conf)
|
config.register_agent_state_opts_helper(conf)
|
||||||
config.register_root_helper(conf)
|
config.register_root_helper(conf)
|
||||||
conf(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
config.setup_logging(conf)
|
config.setup_logging(conf)
|
||||||
server = neutron_service.Service.create(
|
server = neutron_service.Service.create(
|
||||||
binary='neutron-metering-agent',
|
binary='neutron-metering-agent',
|
||||||
|
@ -109,7 +109,7 @@ class BaseTestCase(testtools.TestCase):
|
|||||||
if args is None:
|
if args is None:
|
||||||
args = ['--config-file', etcdir('neutron.conf.test')]
|
args = ['--config-file', etcdir('neutron.conf.test')]
|
||||||
if conf is None:
|
if conf is None:
|
||||||
config.parse(args=args)
|
config.init(args=args)
|
||||||
else:
|
else:
|
||||||
conf(args)
|
conf(args)
|
||||||
|
|
||||||
|
@ -166,9 +166,10 @@ class TestRestProxyAgent(BaseAgentTestCase):
|
|||||||
'CONF.AGENT.root_helper': 'helper'}
|
'CONF.AGENT.root_helper': 'helper'}
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
mock.patch(AGENTMOD + '.cfg', **cfg_attrs),
|
mock.patch(AGENTMOD + '.cfg', **cfg_attrs),
|
||||||
|
mock.patch(AGENTMOD + '.config.init'),
|
||||||
mock.patch(NEUTRONCFG),
|
mock.patch(NEUTRONCFG),
|
||||||
mock.patch(PLCONFIG),
|
mock.patch(PLCONFIG),
|
||||||
) as (mock_conf, mock_log_conf, mock_pluginconf):
|
) as (mock_conf, mock_init, mock_log_conf, mock_pluginconf):
|
||||||
self.mod_agent.main()
|
self.mod_agent.main()
|
||||||
|
|
||||||
mock_log_conf.assert_has_calls([
|
mock_log_conf.assert_has_calls([
|
||||||
|
@ -212,13 +212,10 @@ class TestHyperVNeutronAgent(base.BaseTestCase):
|
|||||||
def test_main(self):
|
def test_main(self):
|
||||||
with mock.patch.object(hyperv_neutron_agent,
|
with mock.patch.object(hyperv_neutron_agent,
|
||||||
'HyperVNeutronAgent') as plugin:
|
'HyperVNeutronAgent') as plugin:
|
||||||
with mock.patch.object(hyperv_neutron_agent.cfg, 'CONF') as cfg:
|
with mock.patch.object(hyperv_neutron_agent,
|
||||||
with mock.patch.object(
|
'common_config') as common_config:
|
||||||
hyperv_neutron_agent,
|
|
||||||
'logging_config') as logging_config:
|
|
||||||
|
|
||||||
hyperv_neutron_agent.main()
|
hyperv_neutron_agent.main()
|
||||||
|
|
||||||
self.assertTrue(cfg.called)
|
self.assertTrue(common_config.init.called)
|
||||||
self.assertTrue(logging_config.setup_logging.called)
|
self.assertTrue(common_config.setup_logging.called)
|
||||||
plugin.assert_has_calls([mock.call().daemon_loop()])
|
plugin.assert_has_calls([mock.call().daemon_loop()])
|
||||||
|
@ -170,7 +170,7 @@ class ConfigMixin(object):
|
|||||||
def set_up_mocks(self):
|
def set_up_mocks(self):
|
||||||
# Mock the configuration file
|
# Mock the configuration file
|
||||||
args = ['--config-file', base.etcdir('neutron.conf.test')]
|
args = ['--config-file', base.etcdir('neutron.conf.test')]
|
||||||
neutron_config.parse(args=args)
|
neutron_config.init(args=args)
|
||||||
|
|
||||||
# Configure the ML2 mechanism drivers and network types
|
# Configure the ML2 mechanism drivers and network types
|
||||||
ml2_opts = {
|
ml2_opts = {
|
||||||
|
@ -350,16 +350,16 @@ class TestNecAgentMain(base.BaseTestCase):
|
|||||||
def test_main(self):
|
def test_main(self):
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
mock.patch.object(nec_neutron_agent, 'NECNeutronAgent'),
|
mock.patch.object(nec_neutron_agent, 'NECNeutronAgent'),
|
||||||
mock.patch.object(nec_neutron_agent, 'logging_config'),
|
mock.patch.object(nec_neutron_agent, 'common_config'),
|
||||||
mock.patch.object(nec_neutron_agent, 'config')
|
mock.patch.object(nec_neutron_agent, 'config')
|
||||||
) as (agent, logging_config, cfg):
|
) as (agent, common_config, cfg):
|
||||||
cfg.OVS.integration_bridge = 'br-int-x'
|
cfg.OVS.integration_bridge = 'br-int-x'
|
||||||
cfg.AGENT.root_helper = 'dummy-helper'
|
cfg.AGENT.root_helper = 'dummy-helper'
|
||||||
cfg.AGENT.polling_interval = 10
|
cfg.AGENT.polling_interval = 10
|
||||||
|
|
||||||
nec_neutron_agent.main()
|
nec_neutron_agent.main()
|
||||||
|
|
||||||
self.assertTrue(logging_config.setup_logging.called)
|
self.assertTrue(common_config.setup_logging.called)
|
||||||
agent.assert_has_calls([
|
agent.assert_has_calls([
|
||||||
mock.call('br-int-x', 'dummy-helper', 10),
|
mock.call('br-int-x', 'dummy-helper', 10),
|
||||||
mock.call().daemon_loop()
|
mock.call().daemon_loop()
|
||||||
|
@ -161,16 +161,16 @@ class TestOneConvergenceAgentMain(base.BaseTestCase):
|
|||||||
def test_main(self):
|
def test_main(self):
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
mock.patch.object(nvsd_neutron_agent, 'NVSDNeutronAgent'),
|
mock.patch.object(nvsd_neutron_agent, 'NVSDNeutronAgent'),
|
||||||
mock.patch.object(nvsd_neutron_agent, 'logging_config'),
|
mock.patch.object(nvsd_neutron_agent, 'common_config'),
|
||||||
mock.patch.object(nvsd_neutron_agent, 'config')
|
mock.patch.object(nvsd_neutron_agent, 'config')
|
||||||
) as (agent, logging_config, config):
|
) as (agent, common_config, config):
|
||||||
config.AGENT.integration_bridge = 'br-int-dummy'
|
config.AGENT.integration_bridge = 'br-int-dummy'
|
||||||
config.AGENT.root_helper = 'root-helper'
|
config.AGENT.root_helper = 'root-helper'
|
||||||
config.AGENT.polling_interval = 5
|
config.AGENT.polling_interval = 5
|
||||||
|
|
||||||
nvsd_neutron_agent.main()
|
nvsd_neutron_agent.main()
|
||||||
|
|
||||||
self.assertTrue(logging_config.setup_logging.called)
|
self.assertTrue(common_config.setup_logging.called)
|
||||||
agent.assert_has_calls([
|
agent.assert_has_calls([
|
||||||
mock.call('br-int-dummy', 'root-helper', 5),
|
mock.call('br-int-dummy', 'root-helper', 5),
|
||||||
mock.call().daemon_loop()
|
mock.call().daemon_loop()
|
||||||
|
@ -610,15 +610,15 @@ class TestRyuNeutronAgent(RyuAgentTestCase):
|
|||||||
'CONF.AGENT.root_helper': 'helper'}
|
'CONF.AGENT.root_helper': 'helper'}
|
||||||
with contextlib.nested(
|
with contextlib.nested(
|
||||||
mock.patch(self._AGENT_NAME + '.cfg', **cfg_attrs),
|
mock.patch(self._AGENT_NAME + '.cfg', **cfg_attrs),
|
||||||
mock.patch(self._AGENT_NAME + '.logging_config'),
|
mock.patch(self._AGENT_NAME + '.common_config'),
|
||||||
mock.patch(self._AGENT_NAME + '._get_tunnel_ip',
|
mock.patch(self._AGENT_NAME + '._get_tunnel_ip',
|
||||||
return_value='10.0.0.1'),
|
return_value='10.0.0.1'),
|
||||||
mock.patch(self._AGENT_NAME + '._get_ovsdb_ip',
|
mock.patch(self._AGENT_NAME + '._get_ovsdb_ip',
|
||||||
return_value='172.16.0.1'),
|
return_value='172.16.0.1'),
|
||||||
) as (mock_conf, mock_log_conf, _tun, _ovsdb):
|
) as (mock_conf, mock_common_conf, _tun, _ovsdb):
|
||||||
self.mod_agent.main()
|
self.mod_agent.main()
|
||||||
|
|
||||||
mock_log_conf.assert_has_calls([
|
mock_common_conf.assert_has_calls([
|
||||||
mock.call(mock_conf)
|
mock.call(mock_conf)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.debug import commands
|
from neutron.debug import commands
|
||||||
from neutron.debug import debug_agent
|
from neutron.debug import debug_agent
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
@ -37,7 +38,7 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
super(TestDebugCommands, self).setUp()
|
super(TestDebugCommands, self).setUp()
|
||||||
cfg.CONF.register_opts(interface.OPTS)
|
cfg.CONF.register_opts(interface.OPTS)
|
||||||
cfg.CONF.register_opts(debug_agent.NeutronDebugAgent.OPTS)
|
cfg.CONF.register_opts(debug_agent.NeutronDebugAgent.OPTS)
|
||||||
cfg.CONF(args=[], project='neutron')
|
common_config.init([])
|
||||||
config.register_interface_driver_opts_helper(cfg.CONF)
|
config.register_interface_driver_opts_helper(cfg.CONF)
|
||||||
config.register_use_namespaces_opts_helper(cfg.CONF)
|
config.register_use_namespaces_opts_helper(cfg.CONF)
|
||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
|
@ -28,6 +28,7 @@ from neutron.agent.common import config
|
|||||||
from neutron.agent import dhcp_agent
|
from neutron.agent import dhcp_agent
|
||||||
from neutron.agent.linux import dhcp
|
from neutron.agent.linux import dhcp
|
||||||
from neutron.agent.linux import interface
|
from neutron.agent.linux import interface
|
||||||
|
from neutron.common import config as common_config
|
||||||
from neutron.common import constants as const
|
from neutron.common import constants as const
|
||||||
from neutron.common import exceptions
|
from neutron.common import exceptions
|
||||||
from neutron.common import rpc_compat
|
from neutron.common import rpc_compat
|
||||||
@ -157,7 +158,7 @@ class TestDhcpAgent(base.BaseTestCase):
|
|||||||
config.register_root_helper(cfg.CONF)
|
config.register_root_helper(cfg.CONF)
|
||||||
cfg.CONF.register_opts(dhcp.OPTS)
|
cfg.CONF.register_opts(dhcp.OPTS)
|
||||||
cfg.CONF.register_opts(interface.OPTS)
|
cfg.CONF.register_opts(interface.OPTS)
|
||||||
cfg.CONF(project='neutron')
|
common_config.init(sys.argv[1:])
|
||||||
agent_mgr = dhcp_agent.DhcpAgentWithStateReport(
|
agent_mgr = dhcp_agent.DhcpAgentWithStateReport(
|
||||||
'testhost')
|
'testhost')
|
||||||
eventlet.greenthread.sleep(1)
|
eventlet.greenthread.sleep(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user