diff --git a/etc/dhcp_agent.ini b/etc/dhcp_agent.ini index 96253124754..01872e3535e 100644 --- a/etc/dhcp_agent.ini +++ b/etc/dhcp_agent.ini @@ -40,6 +40,3 @@ dhcp_driver = quantum.agent.linux.dhcp.Dnsmasq # they will be able to reach 169.254.169.254 through a router. # This option requires enable_isolated_metadata = True # enable_metadata_network = False - -# The Quantum DHCP agent manager. -# dhcp_agent_manager = quantum.agent.dhcp_agent.DhcpAgent diff --git a/etc/l3_agent.ini b/etc/l3_agent.ini index c08fa37cb05..133576c3f37 100644 --- a/etc/l3_agent.ini +++ b/etc/l3_agent.ini @@ -2,9 +2,6 @@ # Show debugging output in log (sets DEBUG log level output) # debug = True -# The Quantum L3 Agent manager -# l3_agent_manager = quantum.agent.l3_agent.L3NATAgent - # L3 requires that an interface driver be set. Choose the one that best # matches your plugin. diff --git a/quantum/agent/dhcp_agent.py b/quantum/agent/dhcp_agent.py index 917626468cb..89aa5604dc6 100644 --- a/quantum/agent/dhcp_agent.py +++ b/quantum/agent/dhcp_agent.py @@ -65,9 +65,6 @@ class DhcpAgent(manager.Manager): help=_("Allows for serving metadata requests from a " "dedicate network. Requires " "enable isolated_metadata = True ")), - cfg.StrOpt('dhcp_agent_manager', - default='quantum.agent.dhcp_agent.DhcpAgent', - help=_("The Quantum DHCP agent manager.")), ] def __init__(self, host=None): @@ -669,8 +666,8 @@ class DhcpAgentWithStateReport(DhcpAgent): 'agent_type': constants.AGENT_TYPE_DHCP} report_interval = cfg.CONF.AGENT.report_interval if report_interval: - heartbeat = loopingcall.LoopingCall(self._report_state) - heartbeat.start(interval=report_interval) + self.heartbeat = loopingcall.LoopingCall(self._report_state) + self.heartbeat.start(interval=report_interval) def _report_state(self): try: @@ -679,6 +676,13 @@ class DhcpAgentWithStateReport(DhcpAgent): ctx = context.get_admin_context_without_session() self.state_rpc.report_state(ctx, self.agent_state) + except AttributeError: + # This means the server does not support report_state + LOG.warn(_("Quantum server does not support state report." + " State report for this agent will be disabled.")) + self.heartbeat.stop() + self.run() + return except Exception: LOG.exception(_("Failed reporting state!")) return @@ -708,5 +712,6 @@ def main(): server = quantum_service.Service.create( binary='quantum-dhcp-agent', topic=topics.DHCP_AGENT, - report_interval=cfg.CONF.AGENT.report_interval) + report_interval=cfg.CONF.AGENT.report_interval, + manager='quantum.agent.dhcp_agent.DhcpAgentWithStateReport') service.launch(server).wait() diff --git a/quantum/agent/l3_agent.py b/quantum/agent/l3_agent.py index bfaa1c415e5..f2823926a4d 100644 --- a/quantum/agent/l3_agent.py +++ b/quantum/agent/l3_agent.py @@ -143,9 +143,6 @@ class L3NATAgent(manager.Manager): cfg.StrOpt('gateway_external_network_id', default='', help=_("UUID of external network for routers implemented " "by the agents.")), - cfg.StrOpt('l3_agent_manager', - default='quantum.agent.l3_agent.L3NATAgent', - help=_("The Quantum L3 Agent manager.")), ] def __init__(self, host, conf=None): @@ -696,8 +693,8 @@ class L3NATAgentWithStateReport(L3NATAgent): 'agent_type': l3_constants.AGENT_TYPE_L3} report_interval = cfg.CONF.AGENT.report_interval if report_interval: - heartbeat = loopingcall.LoopingCall(self._report_state) - heartbeat.start(interval=report_interval) + self.heartbeat = loopingcall.LoopingCall(self._report_state) + self.heartbeat.start(interval=report_interval) def _report_state(self): num_ex_gw_ports = 0 @@ -722,6 +719,12 @@ class L3NATAgentWithStateReport(L3NATAgent): self.state_rpc.report_state(self.context, self.agent_state) self.agent_state.pop('start_flag', None) + except AttributeError: + # This means the server does not support report_state + LOG.warn(_("Quantum server does not support state report." + " State report for this agent will be disabled.")) + self.heartbeat.stop() + return except Exception: LOG.exception(_("Failed reporting state!")) @@ -744,5 +747,6 @@ def main(): server = quantum_service.Service.create( binary='quantum-l3-agent', topic=topics.L3_AGENT, - report_interval=cfg.CONF.AGENT.report_interval) + report_interval=cfg.CONF.AGENT.report_interval, + manager='quantum.agent.l3_agent.L3NATAgentWithStateReport') service.launch(server).wait() diff --git a/quantum/agent/rpc.py b/quantum/agent/rpc.py index 4f33fb2dd1d..899c3450416 100644 --- a/quantum/agent/rpc.py +++ b/quantum/agent/rpc.py @@ -57,7 +57,7 @@ class PluginReportStateAPI(proxy.RpcProxy): topic=topic, default_version=self.BASE_RPC_API_VERSION) def report_state(self, context, agent_state): - return self.cast(context, + return self.call(context, self.make_msg('report_state', agent_state={'agent_state': agent_state}),