Merge "Use call to report state when ovs_agent starts up"
This commit is contained in:
commit
01a0e72a61
@ -170,6 +170,7 @@ class OVSNeutronAgent(n_rpc.RpcCallback,
|
||||
self.root_helper = root_helper
|
||||
self.available_local_vlans = set(moves.xrange(q_const.MIN_VLAN_TAG,
|
||||
q_const.MAX_VLAN_TAG))
|
||||
self.use_call = True
|
||||
self.tunnel_types = tunnel_types or []
|
||||
self.l2_pop = l2_population
|
||||
# TODO(ethuleau): Change ARP responder so it's not dependent on the
|
||||
@ -255,7 +256,9 @@ class OVSNeutronAgent(n_rpc.RpcCallback,
|
||||
self.int_br_device_count)
|
||||
try:
|
||||
self.state_rpc.report_state(self.context,
|
||||
self.agent_state)
|
||||
self.agent_state,
|
||||
self.use_call)
|
||||
self.use_call = False
|
||||
self.agent_state.pop('start_flag', None)
|
||||
except Exception:
|
||||
LOG.exception(_("Failed reporting state!"))
|
||||
|
@ -785,12 +785,27 @@ class TestOvsNeutronAgent(base.BaseTestCase):
|
||||
self.agent.int_br_device_count = 5
|
||||
self.agent._report_state()
|
||||
report_st.assert_called_with(self.agent.context,
|
||||
self.agent.agent_state)
|
||||
self.agent.agent_state, True)
|
||||
self.assertNotIn("start_flag", self.agent.agent_state)
|
||||
self.assertFalse(self.agent.use_call)
|
||||
self.assertEqual(
|
||||
self.agent.agent_state["configurations"]["devices"],
|
||||
self.agent.int_br_device_count
|
||||
)
|
||||
self.agent._report_state()
|
||||
report_st.assert_called_with(self.agent.context,
|
||||
self.agent.agent_state, False)
|
||||
|
||||
def test_report_state_fail(self):
|
||||
with mock.patch.object(self.agent.state_rpc,
|
||||
"report_state") as report_st:
|
||||
report_st.side_effect = Exception()
|
||||
self.agent._report_state()
|
||||
report_st.assert_called_with(self.agent.context,
|
||||
self.agent.agent_state, True)
|
||||
self.agent._report_state()
|
||||
report_st.assert_called_with(self.agent.context,
|
||||
self.agent.agent_state, True)
|
||||
|
||||
def test_network_delete(self):
|
||||
with contextlib.nested(
|
||||
|
Loading…
x
Reference in New Issue
Block a user