From dfd394cd6b4777ddecd96a2acb95a5714964a031 Mon Sep 17 00:00:00 2001 From: Hareesh Puthalath Date: Tue, 2 Sep 2014 06:05:37 +0200 Subject: [PATCH] Supply missing cisco_cfg_agent.ini file cisco_cfg_agent.ini file was missed in the initial commit and caused neutron startup issues. This patch supplies the proper ini file and adds it back to neutron setup.cfg. Also the introduced config options are put in a specific group instead of default as was in the initial commit. Change-Id: I74b3b77fe6e196524809580f522f91f3b62f5ba7 Closes-bug: #1351466 --- etc/neutron/plugins/cisco/cisco_cfg_agent.ini | 15 +++++++++++++++ neutron/plugins/cisco/cfg_agent/cfg_agent.py | 8 ++++---- .../csr1kv/csr1kv_routing_driver.py | 2 +- neutron/plugins/cisco/cfg_agent/device_status.py | 9 +++++---- .../tests/unit/cisco/cfg_agent/test_cfg_agent.py | 2 +- setup.cfg | 1 + 6 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 etc/neutron/plugins/cisco/cisco_cfg_agent.ini diff --git a/etc/neutron/plugins/cisco/cisco_cfg_agent.ini b/etc/neutron/plugins/cisco/cisco_cfg_agent.ini new file mode 100644 index 0000000000..d99e838278 --- /dev/null +++ b/etc/neutron/plugins/cisco/cisco_cfg_agent.ini @@ -0,0 +1,15 @@ +[cfg_agent] +# (IntOpt) Interval in seconds for processing of service updates. +# That is when the config agent's process_services() loop executes +# and it lets each service helper to process its service resources. +# rpc_loop_interval = 10 + +# (StrOpt) Period-separated module path to the routing service helper class. +# routing_svc_helper_class = neutron.plugins.cisco.cfg_agent.service_helpers.routing_svc_helper.RoutingServiceHelper + +# (IntOpt) Timeout value in seconds for connecting to a hosting device. +# device_connection_timeout = 30 + +# (IntOpt) The time in seconds until a backlogged hosting device is +# presumed dead or booted to an error state. +# hosting_device_dead_timeout = 300 diff --git a/neutron/plugins/cisco/cfg_agent/cfg_agent.py b/neutron/plugins/cisco/cfg_agent/cfg_agent.py index a1ae4d8db5..a661872d48 100644 --- a/neutron/plugins/cisco/cfg_agent/cfg_agent.py +++ b/neutron/plugins/cisco/cfg_agent/cfg_agent.py @@ -129,20 +129,20 @@ class CiscoCfgAgent(manager.Manager): self.devmgr_rpc = CiscoDeviceManagementApi(topics.L3PLUGIN, host) def _initialize_service_helpers(self, host): - svc_helper_class = self.conf.routing_svc_helper_class + svc_helper_class = self.conf.cfg_agent.routing_svc_helper_class try: self.routing_service_helper = importutils.import_object( svc_helper_class, host, self.conf, self) except ImportError as e: LOG.warn(_("Error in loading routing service helper. Class " "specified is %(class)s. Reason:%(reason)s"), - {'class': self.conf.routing_svc_helper_class, + {'class': self.conf.cfg_agent.routing_svc_helper_class, 'reason': e}) self.routing_service_helper = None def _start_periodic_tasks(self): self.loop = loopingcall.FixedIntervalLoopingCall(self.process_services) - self.loop.start(interval=self.conf.rpc_loop_interval) + self.loop.start(interval=self.conf.cfg_agent.rpc_loop_interval) def after_start(self): LOG.info(_("Cisco cfg agent started")) @@ -336,7 +336,7 @@ class CiscoCfgAgentWithStateReport(CiscoCfgAgent): def main(manager='neutron.plugins.cisco.cfg_agent.' 'cfg_agent.CiscoCfgAgentWithStateReport'): conf = cfg.CONF - conf.register_opts(CiscoCfgAgent.OPTS) + conf.register_opts(CiscoCfgAgent.OPTS, "cfg_agent") config.register_agent_state_opts_helper(conf) config.register_root_helper(conf) conf.register_opts(interface.OPTS) diff --git a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py index 68f8fac77d..f3e6cef1fe 100644 --- a/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py +++ b/neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py @@ -57,7 +57,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase): if credentials: self._csr_user = credentials['username'] self._csr_password = credentials['password'] - self._timeout = cfg.CONF.device_connection_timeout + self._timeout = cfg.CONF.cfg_agent.device_connection_timeout self._csr_conn = None self._intfs_enabled = False except KeyError as e: diff --git a/neutron/plugins/cisco/cfg_agent/device_status.py b/neutron/plugins/cisco/cfg_agent/device_status.py index b5c5007474..03d7b411c7 100644 --- a/neutron/plugins/cisco/cfg_agent/device_status.py +++ b/neutron/plugins/cisco/cfg_agent/device_status.py @@ -35,7 +35,7 @@ STATUS_OPTS = [ "or high load when the device may not be responding.")), ] -cfg.CONF.register_opts(STATUS_OPTS) +cfg.CONF.register_opts(STATUS_OPTS, "cfg_agent") def _is_pingable(ip): @@ -78,7 +78,7 @@ class DeviceStatus(object): def get_backlogged_hosting_devices_info(self): wait_time = datetime.timedelta( - seconds=cfg.CONF.hosting_device_dead_timeout) + seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout) resp = [] for hd_id in self.backlog_hosting_devices: hd = self.backlog_hosting_devices[hd_id]['hd'] @@ -160,13 +160,14 @@ class DeviceStatus(object): 'ip': hd['management_ip_address']}) if timeutils.is_older_than( hd['backlog_insertion_ts'], - cfg.CONF.hosting_device_dead_timeout): + cfg.CONF.cfg_agent.hosting_device_dead_timeout): LOG.debug("Hosting device: %(hd_id)s @ %(ip)s hasn't " "been reachable for the last %(time)d seconds. " "Marking it dead.", {'hd_id': hd_id, 'ip': hd['management_ip_address'], - 'time': cfg.CONF.hosting_device_dead_timeout}) + 'time': cfg.CONF.cfg_agent. + hosting_device_dead_timeout}) response_dict['dead'].append(hd_id) hd.pop('backlog_insertion_ts', None) del self.backlog_hosting_devices[hd_id] diff --git a/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py b/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py index 740a730814..2d9b63f157 100644 --- a/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py +++ b/neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py @@ -73,7 +73,7 @@ class TestCiscoCfgAgentWIthStateReporting(base.BaseTestCase): self.conf = cfg.ConfigOpts() config.register_agent_state_opts_helper(cfg.CONF) self.conf.register_opts(base_config.core_opts) - self.conf.register_opts(cfg_agent.CiscoCfgAgent.OPTS) + self.conf.register_opts(cfg_agent.CiscoCfgAgent.OPTS, "cfg_agent") cfg.CONF.set_override('report_interval', 0, 'AGENT') super(TestCiscoCfgAgentWIthStateReporting, self).setUp() self.devmgr_plugin_api_cls_p = mock.patch( diff --git a/setup.cfg b/setup.cfg index d3aa4329dc..d5c9018f31 100644 --- a/setup.cfg +++ b/setup.cfg @@ -54,6 +54,7 @@ data_files = etc/neutron/plugins/bigswitch/ssl/host_certs/README etc/neutron/plugins/brocade = etc/neutron/plugins/brocade/brocade.ini etc/neutron/plugins/cisco = + etc/neutron/plugins/cisco/cisco_cfg_agent.ini etc/neutron/plugins/cisco/cisco_plugins.ini etc/neutron/plugins/cisco/cisco_router_plugin.ini etc/neutron/plugins/cisco/cisco_vpn_agent.ini