Merge "Supply missing cisco_cfg_agent.ini file"

This commit is contained in:
Jenkins 2014-09-24 16:07:23 +00:00 committed by Gerrit Code Review
commit bf98f967d7
6 changed files with 27 additions and 10 deletions

View File

@ -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

View File

@ -127,20 +127,20 @@ class CiscoCfgAgent(manager.Manager):
self.devmgr_rpc = CiscoDeviceManagementApi(topics.L3PLUGIN, host) self.devmgr_rpc = CiscoDeviceManagementApi(topics.L3PLUGIN, host)
def _initialize_service_helpers(self, 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: try:
self.routing_service_helper = importutils.import_object( self.routing_service_helper = importutils.import_object(
svc_helper_class, host, self.conf, self) svc_helper_class, host, self.conf, self)
except ImportError as e: except ImportError as e:
LOG.warn(_("Error in loading routing service helper. Class " LOG.warn(_("Error in loading routing service helper. Class "
"specified is %(class)s. Reason:%(reason)s"), "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}) 'reason': e})
self.routing_service_helper = None self.routing_service_helper = None
def _start_periodic_tasks(self): def _start_periodic_tasks(self):
self.loop = loopingcall.FixedIntervalLoopingCall(self.process_services) 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): def after_start(self):
LOG.info(_("Cisco cfg agent started")) LOG.info(_("Cisco cfg agent started"))
@ -334,7 +334,7 @@ class CiscoCfgAgentWithStateReport(CiscoCfgAgent):
def main(manager='neutron.plugins.cisco.cfg_agent.' def main(manager='neutron.plugins.cisco.cfg_agent.'
'cfg_agent.CiscoCfgAgentWithStateReport'): 'cfg_agent.CiscoCfgAgentWithStateReport'):
conf = cfg.CONF conf = cfg.CONF
conf.register_opts(CiscoCfgAgent.OPTS) conf.register_opts(CiscoCfgAgent.OPTS, "cfg_agent")
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.register_opts(interface.OPTS) conf.register_opts(interface.OPTS)

View File

@ -55,7 +55,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
if credentials: if credentials:
self._csr_user = credentials['username'] self._csr_user = credentials['username']
self._csr_password = credentials['password'] 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._csr_conn = None
self._intfs_enabled = False self._intfs_enabled = False
except KeyError as e: except KeyError as e:

View File

@ -33,7 +33,7 @@ STATUS_OPTS = [
"or high load when the device may not be responding.")), "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): def _is_pingable(ip):
@ -76,7 +76,7 @@ class DeviceStatus(object):
def get_backlogged_hosting_devices_info(self): def get_backlogged_hosting_devices_info(self):
wait_time = datetime.timedelta( wait_time = datetime.timedelta(
seconds=cfg.CONF.hosting_device_dead_timeout) seconds=cfg.CONF.cfg_agent.hosting_device_dead_timeout)
resp = [] resp = []
for hd_id in self.backlog_hosting_devices: for hd_id in self.backlog_hosting_devices:
hd = self.backlog_hosting_devices[hd_id]['hd'] hd = self.backlog_hosting_devices[hd_id]['hd']
@ -158,13 +158,14 @@ class DeviceStatus(object):
'ip': hd['management_ip_address']}) 'ip': hd['management_ip_address']})
if timeutils.is_older_than( if timeutils.is_older_than(
hd['backlog_insertion_ts'], 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 " LOG.debug("Hosting device: %(hd_id)s @ %(ip)s hasn't "
"been reachable for the last %(time)d seconds. " "been reachable for the last %(time)d seconds. "
"Marking it dead.", "Marking it dead.",
{'hd_id': hd_id, {'hd_id': hd_id,
'ip': hd['management_ip_address'], '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) response_dict['dead'].append(hd_id)
hd.pop('backlog_insertion_ts', None) hd.pop('backlog_insertion_ts', None)
del self.backlog_hosting_devices[hd_id] del self.backlog_hosting_devices[hd_id]

View File

@ -71,7 +71,7 @@ class TestCiscoCfgAgentWIthStateReporting(base.BaseTestCase):
self.conf = cfg.ConfigOpts() self.conf = cfg.ConfigOpts()
config.register_agent_state_opts_helper(cfg.CONF) config.register_agent_state_opts_helper(cfg.CONF)
self.conf.register_opts(base_config.core_opts) 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') cfg.CONF.set_override('report_interval', 0, 'AGENT')
super(TestCiscoCfgAgentWIthStateReporting, self).setUp() super(TestCiscoCfgAgentWIthStateReporting, self).setUp()
self.devmgr_plugin_api_cls_p = mock.patch( self.devmgr_plugin_api_cls_p = mock.patch(

View File

@ -55,6 +55,7 @@ data_files =
etc/neutron/plugins/bigswitch/ssl/host_certs/README etc/neutron/plugins/bigswitch/ssl/host_certs/README
etc/neutron/plugins/brocade = etc/neutron/plugins/brocade/brocade.ini etc/neutron/plugins/brocade = etc/neutron/plugins/brocade/brocade.ini
etc/neutron/plugins/cisco = etc/neutron/plugins/cisco =
etc/neutron/plugins/cisco/cisco_cfg_agent.ini
etc/neutron/plugins/cisco/cisco_plugins.ini etc/neutron/plugins/cisco/cisco_plugins.ini
etc/neutron/plugins/cisco/cisco_router_plugin.ini etc/neutron/plugins/cisco/cisco_router_plugin.ini
etc/neutron/plugins/cisco/cisco_vpn_agent.ini etc/neutron/plugins/cisco/cisco_vpn_agent.ini