[OVN][FT] Mech driver stop accessing DB at exit

"OVNMechanismDriver._clean_hash_ring" is called at exit. Because the
SQL connection is already closed, an exception is logged. This patch
mocks this method and avoids the OVN FTs to log this message.

Closes-Bug: #1919352

Change-Id: I6c68d15d0af644ab00467bea8e0cd3ca816f5cc5
(cherry picked from commit 92a4db01fe)
(cherry picked from commit 0fb614046f)
This commit is contained in:
Rodolfo Alonso Hernandez 2021-03-16 15:24:53 +00:00 committed by yatin
parent 9214dd7015
commit 7b73d29d8a
1 changed files with 3 additions and 0 deletions

View File

@ -285,6 +285,9 @@ class TestOVNFunctionalBase(test_plugin.Ml2PluginV2TestCase,
self.addCleanup(self._collect_processes_logs)
self.addCleanup(self.stop)
# NOTE(ralonsoh): do not access to the DB at exit when the SQL
# connection is already closed, to avoid useless exception messages.
mock.patch.object(self.mech_driver, '_clean_hash_ring').start()
self.mech_driver.pre_fork_initialize(
mock.ANY, mock.ANY, trigger_cls.trigger)