Browse Source

Agent common config

Refactoring Neutron configuration options for agent common config to be
in neutron/conf/agent/common. This will allow centralization of all
configuration options and provide an easy way to import.

Partial-Bug: #1563069
Change-Id: Iebac0cdd3bcfd0135349128921b7ad7a1a939ab8
Needed-By: Ib676003bbe909b5a9013a3178b12dbe291d936af
changes/45/343045/42
John Perkins 5 years ago
parent
commit
7f23ccce23
  1. 2
      neutron/agent/common/utils.py
  2. 2
      neutron/agent/dhcp_agent.py
  3. 2
      neutron/agent/l3_agent.py
  4. 3
      neutron/agent/linux/external_process.py
  5. 2
      neutron/agent/linux/iptables_manager.py
  6. 2
      neutron/agent/linux/utils.py
  7. 2
      neutron/agent/metadata_agent.py
  8. 2
      neutron/cmd/netns_cleanup.py
  9. 2
      neutron/cmd/ovs_cleanup.py
  10. 2
      neutron/conf/agent/common.py
  11. 2
      neutron/conf/agent/l3/config.py
  12. 2
      neutron/debug/shell.py
  13. 23
      neutron/opts.py
  14. 2
      neutron/plugins/ml2/drivers/agent/config.py
  15. 2
      neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py
  16. 2
      neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py
  17. 2
      neutron/services/metering/agents/metering_agent.py
  18. 2
      neutron/services/metering/drivers/iptables/iptables_driver.py
  19. 2
      neutron/tests/common/net_helpers.py
  20. 2
      neutron/tests/functional/agent/l2/base.py
  21. 2
      neutron/tests/functional/agent/l3/framework.py
  22. 2
      neutron/tests/functional/agent/linux/test_dhcp.py
  23. 2
      neutron/tests/functional/agent/linux/test_ip_lib.py
  24. 2
      neutron/tests/functional/agent/test_dhcp_agent.py
  25. 2
      neutron/tests/functional/base.py
  26. 2
      neutron/tests/unit/agent/common/test_ovs_lib.py
  27. 2
      neutron/tests/unit/agent/common/test_utils.py
  28. 2
      neutron/tests/unit/agent/dhcp/test_agent.py
  29. 2
      neutron/tests/unit/agent/l3/test_agent.py
  30. 2
      neutron/tests/unit/agent/l3/test_dvr_local_router.py
  31. 4
      neutron/tests/unit/agent/l3/test_router_info.py
  32. 2
      neutron/tests/unit/agent/linux/test_dhcp.py
  33. 2
      neutron/tests/unit/agent/linux/test_interface.py
  34. 4
      neutron/tests/unit/agent/linux/test_iptables_firewall.py
  35. 2
      neutron/tests/unit/agent/metadata/test_driver.py
  36. 0
      neutron/tests/unit/conf/agent/__init__.py
  37. 2
      neutron/tests/unit/conf/agent/test_common.py
  38. 2
      neutron/tests/unit/debug/test_commands.py

2
neutron/agent/common/utils.py

@ -20,8 +20,8 @@ from oslo_log import log as logging
from oslo_utils import timeutils
from neutron._i18n import _LE
from neutron.agent.common import config
from neutron.common import utils as neutron_utils
from neutron.conf.agent import common as config
from neutron.conf.agent.database import agents_db

2
neutron/agent/dhcp_agent.py

@ -19,10 +19,10 @@ import sys
from oslo_config import cfg
from oslo_service import service
from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.common import config as common_config
from neutron.common import topics
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_config
from neutron.conf.agent.metadata import config as meta_conf
from neutron import service as neutron_service

2
neutron/agent/l3_agent.py

@ -19,13 +19,13 @@ import sys
from oslo_config import cfg
from oslo_service import service
from neutron.agent.common import config
from neutron.agent.linux import external_process
from neutron.agent.linux import interface
from neutron.agent.linux import pd
from neutron.agent.linux import ra
from neutron.common import config as common_config
from neutron.common import topics
from neutron.conf.agent import common as config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.agent.l3 import ha as ha_conf
from neutron.conf.agent.metadata import config as meta_conf

3
neutron/agent/linux/external_process.py

@ -24,10 +24,11 @@ from oslo_utils import fileutils
import six
from neutron._i18n import _, _LW, _LE
from neutron.agent.common import config as agent_cfg
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.conf.agent import common as agent_cfg
LOG = logging.getLogger(__name__)

2
neutron/agent/linux/iptables_manager.py

@ -32,11 +32,11 @@ from oslo_utils import excutils
import six
from neutron._i18n import _, _LE, _LW
from neutron.agent.common import config
from neutron.agent.linux import iptables_comments as ic
from neutron.agent.linux import utils as linux_utils
from neutron.common import exceptions as n_exc
from neutron.common import utils
from neutron.conf.agent import common as config
LOG = logging.getLogger(__name__)

2
neutron/agent/linux/utils.py

@ -34,9 +34,9 @@ from oslo_utils import fileutils
from six.moves import http_client as httplib
from neutron._i18n import _, _LE
from neutron.agent.common import config
from neutron.agent.linux import xenapi_root_helper
from neutron.common import utils
from neutron.conf.agent import common as config
from neutron import wsgi

2
neutron/agent/metadata_agent.py

@ -17,11 +17,11 @@ import sys
from oslo_config import cfg
from oslo_log import log as logging
from neutron.agent.common import config as agent_conf
from neutron.agent.metadata import agent
from neutron.common import cache_utils as cache
from neutron.common import config
from neutron.common import utils
from neutron.conf.agent import common as agent_conf
from neutron.conf.agent.metadata import config as meta
LOG = logging.getLogger(__name__)

2
neutron/cmd/netns_cleanup.py

@ -24,7 +24,6 @@ from oslo_log import log as logging
from oslo_utils import importutils
from neutron._i18n import _LE, _LW
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import dvr_fip_ns
from neutron.agent.l3 import dvr_snat_ns
@ -36,6 +35,7 @@ from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.common import config
from neutron.conf.agent import cmd
from neutron.conf.agent import common as agent_config
from neutron.conf.agent import dhcp as dhcp_config

2
neutron/cmd/ovs_cleanup.py

@ -17,12 +17,12 @@ from oslo_config import cfg
from oslo_log import log as logging
from neutron._i18n import _LI
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import config
from neutron.conf.agent import cmd
from neutron.conf.agent import common as agent_config
from neutron.conf.agent.l3 import config as l3_config

2
neutron/agent/common/config.py → neutron/conf/agent/common.py

@ -131,7 +131,7 @@ def get_log_args(conf, log_file_name, **kwargs):
return cmd_args
def register_root_helper(conf):
def register_root_helper(conf=cfg.CONF):
conf.register_opts(ROOT_HELPER_OPTS, 'AGENT')

2
neutron/conf/agent/l3/config.py

@ -18,7 +18,7 @@ from neutron_lib import constants
from oslo_config import cfg
from neutron._i18n import _
from neutron.agent.common import config
from neutron.conf.agent import common as config
OPTS = [

2
neutron/debug/shell.py

@ -20,9 +20,9 @@ from oslo_utils import importutils
from neutron._i18n import _
from neutron._i18n import _LW
from neutron.agent.common import config
from neutron.agent.common import utils
from neutron.agent.linux import interface
from neutron.conf.agent import common as config
from neutron.debug import debug_agent
from neutronclient.common import exceptions as exc
from neutronclient import shell

23
neutron/opts.py

@ -17,7 +17,7 @@ import operator
from keystoneauth1 import loading as ks_loading
from oslo_config import cfg
import neutron.agent.common.config
import neutron.agent.agent_extensions_manager
import neutron.agent.linux.interface
import neutron.agent.linux.pd
import neutron.agent.linux.ra
@ -25,6 +25,7 @@ import neutron.agent.ovsdb.api
import neutron.agent.securitygroups_rpc
import neutron.common.cache_utils
import neutron.conf.agent.agent_extensions_manager
import neutron.conf.agent.common
import neutron.conf.agent.dhcp
import neutron.conf.agent.l3.config
import neutron.conf.agent.l3.ha
@ -80,15 +81,15 @@ def list_agent_opts():
return [
('agent',
itertools.chain(
neutron.agent.common.config.ROOT_HELPER_OPTS,
neutron.agent.common.config.AGENT_STATE_OPTS,
neutron.agent.common.config.IPTABLES_OPTS,
neutron.agent.common.config.PROCESS_MONITOR_OPTS,
neutron.agent.common.config.AVAILABILITY_ZONE_OPTS)
neutron.conf.agent.common.ROOT_HELPER_OPTS,
neutron.conf.agent.common.AGENT_STATE_OPTS,
neutron.conf.agent.common.IPTABLES_OPTS,
neutron.conf.agent.common.PROCESS_MONITOR_OPTS,
neutron.conf.agent.common.AVAILABILITY_ZONE_OPTS)
),
('DEFAULT',
itertools.chain(
neutron.agent.common.config.INTERFACE_DRIVER_OPTS,
neutron.conf.agent.common.INTERFACE_DRIVER_OPTS,
neutron.conf.agent.metadata.config.SHARED_OPTS)
)
]
@ -154,17 +155,17 @@ def list_base_agent_opts():
('DEFAULT',
itertools.chain(
neutron.agent.linux.interface.OPTS,
neutron.agent.common.config.INTERFACE_DRIVER_OPTS,
neutron.conf.agent.common.INTERFACE_DRIVER_OPTS,
neutron.conf.agent.ovs_conf.OPTS)
),
('agent', neutron.agent.common.config.AGENT_STATE_OPTS),
('agent', neutron.conf.agent.common.AGENT_STATE_OPTS),
('ovs', neutron.agent.ovsdb.api.OPTS),
]
def list_az_agent_opts():
return [
('agent', neutron.agent.common.config.AVAILABILITY_ZONE_OPTS),
('agent', neutron.conf.agent.common.AVAILABILITY_ZONE_OPTS),
]
@ -231,7 +232,7 @@ def list_metadata_agent_opts():
meta_conf.UNIX_DOMAIN_METADATA_PROXY_OPTS,
neutron.conf.cache_utils.cache_opts)
),
('agent', neutron.agent.common.config.AGENT_STATE_OPTS)
('agent', neutron.conf.agent.common.AGENT_STATE_OPTS)
]

2
neutron/plugins/ml2/drivers/agent/config.py

@ -16,7 +16,7 @@
from oslo_config import cfg
from neutron.agent.common import config
from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import agent
agent.register_agent_opts()

2
neutron/plugins/ml2/drivers/mech_sriov/agent/common/config.py

@ -17,7 +17,7 @@
from oslo_config import cfg
from neutron._i18n import _
from neutron.agent.common import config
from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers.mech_sriov import agent_common as \
agent_common_config

2
neutron/plugins/ml2/drivers/openvswitch/agent/common/config.py

@ -14,7 +14,7 @@
from oslo_config import cfg
from neutron.agent.common import config
from neutron.conf.agent import common as config
from neutron.conf.plugins.ml2.drivers import ovs_conf
ovs_conf.register_ovs_agent_opts()

2
neutron/services/metering/agents/metering_agent.py

@ -26,13 +26,13 @@ from oslo_utils import importutils
from oslo_utils import timeutils
from neutron._i18n import _, _LE, _LI, _LW
from neutron.agent.common import config
from neutron.agent import rpc as agent_rpc
from neutron.common import config as common_config
from neutron.common import constants as n_const
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.common import utils
from neutron.conf.agent import common as config
from neutron.conf.services import metering_agent
from neutron import manager
from neutron import service as neutron_service

2
neutron/services/metering/drivers/iptables/iptables_driver.py

@ -19,7 +19,6 @@ from oslo_utils import importutils
import six
from neutron._i18n import _, _LE, _LI
from neutron.agent.common import config
from neutron.agent.l3 import dvr_snat_ns
from neutron.agent.l3 import namespaces
from neutron.agent.linux import interface
@ -27,6 +26,7 @@ from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_manager
from neutron.common import constants
from neutron.common import ipv6_utils
from neutron.conf.agent import common as config
from neutron.services.metering.drivers import abstract_driver

2
neutron/tests/common/net_helpers.py

@ -33,7 +33,6 @@ from oslo_config import cfg
from oslo_utils import uuidutils
import six
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
from neutron.agent.linux import bridge_lib
from neutron.agent.linux import interface
@ -41,6 +40,7 @@ from neutron.agent.linux import ip_lib
from neutron.agent.linux import iptables_firewall
from neutron.agent.linux import utils
from neutron.common import utils as common_utils
from neutron.conf.agent import common as config
from neutron.db import db_base_plugin_common
from neutron.plugins.ml2.drivers.linuxbridge.agent import \
linuxbridge_neutron_agent as linuxbridge_agent

2
neutron/tests/functional/agent/l2/base.py

@ -23,12 +23,12 @@ from neutron_lib.utils import net
from oslo_config import cfg
from oslo_utils import uuidutils
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.l2 import l2_agent_extensions_manager as ext_manager
from neutron.agent.linux import interface
from neutron.agent.linux import polling
from neutron.common import utils
from neutron.conf.agent import common as agent_config
from neutron.conf import common as common_config
from neutron.conf.plugins.ml2.drivers import ovs_conf
from neutron.plugins.common import constants as p_const

2
neutron/tests/functional/agent/l3/framework.py

@ -25,7 +25,6 @@ from oslo_utils import uuidutils
import testtools
import textwrap
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import agent as neutron_l3_agent
from neutron.agent.l3 import namespaces
@ -35,6 +34,7 @@ from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
from neutron.agent.linux import keepalived
from neutron.common import utils as common_utils
from neutron.conf.agent import common as agent_config
from neutron.conf import common as common_config
from neutron.tests.common import l3_test_common
from neutron.tests.common import net_helpers

2
neutron/tests/functional/agent/linux/test_dhcp.py

@ -15,11 +15,11 @@
import mock
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.linux import dhcp
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import utils as common_utils
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_conf
from neutron.conf import common as common_conf
from neutron.tests import base as tests_base

2
neutron/tests/functional/agent/linux/test_ip_lib.py

@ -23,10 +23,10 @@ from oslo_log import log as logging
from oslo_utils import importutils
import testtools
from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import utils
from neutron.conf.agent import common as config
from neutron.tests.common import net_helpers
from neutron.tests.functional import base as functional_base

2
neutron/tests/functional/agent/test_dhcp_agent.py

@ -24,7 +24,6 @@ from neutron_lib import constants as lib_const
from oslo_config import fixture as fixture_config
from oslo_utils import uuidutils
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
from neutron.agent.dhcp import agent
from neutron.agent import dhcp_agent
@ -34,6 +33,7 @@ from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.common import utils as common_utils
from neutron.conf.agent import common as config
from neutron.tests.common import net_helpers
from neutron.tests.functional.agent.linux import helpers
from neutron.tests.functional import base

2
neutron/tests/functional/base.py

@ -17,8 +17,8 @@ import os
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.linux import utils
from neutron.conf.agent import common as config
from neutron.tests import base
from neutron.tests.common import base as common_base
from neutron.tests.common import helpers

2
neutron/tests/unit/agent/common/test_ovs_lib.py

@ -21,9 +21,9 @@ from oslo_utils import uuidutils
import tenacity
import testtools
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
from neutron.agent.common import utils
from neutron.conf.agent import common as config
from neutron.plugins.common import constants
from neutron.plugins.ml2.drivers.openvswitch.agent.common \
import constants as p_const

2
neutron/tests/unit/agent/common/test_utils.py

@ -15,9 +15,9 @@
import mock
from neutron.agent.common import config
from neutron.agent.common import utils
from neutron.agent.linux import interface
from neutron.conf.agent import common as config
from neutron.tests import base
from neutron.tests.unit import testlib_api

2
neutron/tests/unit/agent/dhcp/test_agent.py

@ -26,7 +26,6 @@ from oslo_config import cfg
import oslo_messaging
import testtools
from neutron.agent.common import config
from neutron.agent.dhcp import agent as dhcp_agent
from neutron.agent import dhcp_agent as entry
from neutron.agent.linux import dhcp
@ -35,6 +34,7 @@ from neutron.agent.metadata import driver as metadata_driver
from neutron.common import config as common_config
from neutron.common import constants as n_const
from neutron.common import utils
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_config
from neutron.tests import base

2
neutron/tests/unit/agent/l3/test_agent.py

@ -30,7 +30,6 @@ from oslo_utils import uuidutils
import six
from testtools import matchers
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import agent as l3_agent
from neutron.agent.l3 import dvr_edge_router as dvr_router
from neutron.agent.l3 import dvr_snat_ns
@ -49,6 +48,7 @@ from neutron.agent.metadata import driver as metadata_driver
from neutron.agent import rpc as agent_rpc
from neutron.common import constants as n_const
from neutron.common import exceptions as n_exc
from neutron.conf.agent import common as agent_config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.agent.l3 import ha as ha_conf
from neutron.conf import common as base_config

2
neutron/tests/unit/agent/l3/test_dvr_local_router.py

@ -19,7 +19,6 @@ from oslo_config import cfg
from oslo_log import log
from oslo_utils import uuidutils
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import agent as l3_agent
from neutron.agent.l3 import dvr_local_router as dvr_router
from neutron.agent.l3 import link_local_allocator as lla
@ -29,6 +28,7 @@ from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.common import constants as n_const
from neutron.common import utils as common_utils
from neutron.conf.agent import common as agent_config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.agent.l3 import ha as ha_conf
from neutron.conf import common as base_config

4
neutron/tests/unit/agent/l3/test_router_info.py

@ -14,10 +14,10 @@ import mock
from neutron_lib import constants as lib_constants
from oslo_utils import uuidutils
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import router_info
from neutron.agent.linux import ip_lib
from neutron.common import exceptions as n_exc
from neutron.conf.agent import common as config
from neutron.tests import base
@ -28,7 +28,7 @@ class TestRouterInfo(base.BaseTestCase):
def setUp(self):
super(TestRouterInfo, self).setUp()
conf = agent_config.setup_conf()
conf = config.setup_conf()
self.ip_cls_p = mock.patch('neutron.agent.linux.ip_lib.IPWrapper')
ip_cls = self.ip_cls_p.start()

2
neutron/tests/unit/agent/linux/test_dhcp.py

@ -23,10 +23,10 @@ import oslo_messaging
from oslo_utils import fileutils
import testtools
from neutron.agent.common import config
from neutron.agent.linux import dhcp
from neutron.agent.linux import external_process
from neutron.common import constants as n_const
from neutron.conf.agent import common as config
from neutron.conf.agent import dhcp as dhcp_config
from neutron.conf import common as base_config
from neutron.extensions import extra_dhcp_opt as edo_ext

2
neutron/tests/unit/agent/linux/test_interface.py

@ -16,11 +16,11 @@
import mock
from neutron_lib import constants
from neutron.agent.common import config
from neutron.agent.common import ovs_lib
from neutron.agent.linux import interface
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils
from neutron.conf.agent import common as config
from neutron.tests import base

4
neutron/tests/unit/agent/linux/test_iptables_firewall.py

@ -21,7 +21,6 @@ from oslo_config import cfg
import six
import testtools
from neutron.agent.common import config as a_cfg
from neutron.agent import firewall
from neutron.agent.linux import ip_conntrack
from neutron.agent.linux import ipset_manager
@ -29,6 +28,7 @@ from neutron.agent.linux import iptables_comments as ic
from neutron.agent.linux import iptables_firewall
from neutron.common import exceptions as n_exc
from neutron.common import utils
from neutron.conf.agent import common as agent_config
from neutron.conf.agent import securitygroups_rpc as security_config
from neutron.tests import base
from neutron.tests.unit.api.v2 import test_base
@ -71,8 +71,8 @@ COMMIT
class BaseIptablesFirewallTestCase(base.BaseTestCase):
def setUp(self):
super(BaseIptablesFirewallTestCase, self).setUp()
cfg.CONF.register_opts(a_cfg.ROOT_HELPER_OPTS, 'AGENT')
security_config.register_securitygroups_opts()
agent_config.register_root_helper(cfg.CONF)
cfg.CONF.set_override('comment_iptables_rules', False, 'AGENT')
self.utils_exec_p = mock.patch(
'neutron.agent.linux.utils.execute')

2
neutron/tests/unit/agent/metadata/test_driver.py

@ -19,11 +19,11 @@ import mock
from oslo_config import cfg
from oslo_utils import uuidutils
from neutron.agent.common import config as agent_config
from neutron.agent.l3 import agent as l3_agent
from neutron.agent.l3 import router_info
from neutron.agent.metadata import driver as metadata_driver
from neutron.common import constants
from neutron.conf.agent import common as agent_config
from neutron.conf.agent.l3 import config as l3_config
from neutron.conf.agent.l3 import ha as ha_conf
from neutron.conf.agent.metadata import config as meta_conf

0
neutron/tests/unit/conf/agent/__init__.py

2
neutron/tests/unit/agent/common/test_config.py → neutron/tests/unit/conf/agent/test_common.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron.agent.common import config
from neutron.conf.agent import common as config
from neutron.tests import base

2
neutron/tests/unit/debug/test_commands.py

@ -18,9 +18,9 @@ import socket
import mock
from oslo_config import cfg
from neutron.agent.common import config
from neutron.agent.linux import interface
from neutron.common import config as common_config
from neutron.conf.agent import common as config
from neutron.debug import commands
from neutron.debug import debug_agent
from neutron.extensions import portbindings

Loading…
Cancel
Save