]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Supply missing cisco_cfg_agent.ini file
authorHareesh Puthalath <hareesh.puthalath@gmail.com>
Tue, 2 Sep 2014 04:05:37 +0000 (06:05 +0200)
committerHareesh Puthalath <hareesh.puthalath@gmail.com>
Fri, 5 Sep 2014 14:38:04 +0000 (16:38 +0200)
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 [new file with mode: 0644]
neutron/plugins/cisco/cfg_agent/cfg_agent.py
neutron/plugins/cisco/cfg_agent/device_drivers/csr1kv/csr1kv_routing_driver.py
neutron/plugins/cisco/cfg_agent/device_status.py
neutron/tests/unit/cisco/cfg_agent/test_cfg_agent.py
setup.cfg

diff --git a/etc/neutron/plugins/cisco/cisco_cfg_agent.ini b/etc/neutron/plugins/cisco/cisco_cfg_agent.ini
new file mode 100644 (file)
index 0000000..d99e838
--- /dev/null
@@ -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
index a1ae4d8db53e5e7ac8258f911b404284eeadac18..a661872d48bff2ec31c0ad0e395583c18385178b 100644 (file)
@@ -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)
index 68f8fac77d08dd8f4e4f95b7eb02dd2e647110b6..f3e6cef1fead3ab0d5c9367ded21f06de6992116 100644 (file)
@@ -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:
index b5c5007474039adb39946519c41e9f085607eef5..03d7b411c7ea85cc609819c24624a058f99f16f0 100644 (file)
@@ -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]
index 740a73081485b5dfb8ada0d9f5d1abc6d39a0d8c..2d9b63f157b0a0136edf2b19b6ec549d990b9c01 100644 (file)
@@ -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(
index d3aa4329dcee262d16afa8a8660fac6ba79ad863..d5c9018f3122350a7a94074f4efa5006e5109958 100644 (file)
--- 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