Merge "[OVN] Fix get/update/delete of non-OVN agents"
This commit is contained in:
commit
9b02bc8543
@ -1145,7 +1145,7 @@ class OVNMechanismDriver(api.MechanismDriver):
|
||||
new_method = types.MethodType(new_fn, self._plugin)
|
||||
try:
|
||||
return new_method(*args, _driver=self, **kwargs)
|
||||
except KeyError:
|
||||
except n_exc.NotFound:
|
||||
return old_method(*args, **kwargs)
|
||||
|
||||
setattr(self._plugin, method_name, types.MethodType(fn, self._plugin))
|
||||
|
@ -742,3 +742,24 @@ class TestProvnetPorts(base.TestOVNFunctionalBase):
|
||||
ovn_localnetport = self._find_port_row_by_name(
|
||||
utils.ovn_provnet_port_name(seg_2['id']))
|
||||
self.assertIsNone(ovn_localnetport)
|
||||
|
||||
|
||||
class TestAgentApi(base.TestOVNFunctionalBase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.host = 'test-host'
|
||||
self.add_fake_chassis(self.host)
|
||||
self.plugin = self.mech_driver._plugin
|
||||
agent = {'agent_type': 'test', 'binary': '/bin/test',
|
||||
'host': self.host, 'topic': 'test_topic'}
|
||||
self.plugin.create_or_update_agent(self.context, agent)
|
||||
|
||||
def get_agent(self, agent_type):
|
||||
return next(iter(self.plugin.get_agents(
|
||||
self.context, filters={'agent_type': agent_type})))
|
||||
|
||||
def test_agent_show(self):
|
||||
for agent_type in ('test', ovn_const.OVN_CONTROLLER_AGENT):
|
||||
agent = self.get_agent(agent_type)
|
||||
self.assertTrue(self.plugin.get_agent(self.context, agent['id']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user