Allow DHCP and L3 agents to choose if they should report state
Bug #1143195 blueprint quantum-scheduler Change-Id: Iba7bf82d7130462be4dda6c1c5f9a0fc5633707d
This commit is contained in:
parent
ed665dc9ba
commit
32a029bc5e
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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}),
|
||||
|
Loading…
Reference in New Issue
Block a user