Browse Source

Maintenance: Log how long the synchronization took

To help with debug, this patch is adding a debug log indicating how long
the maintenance task took to run.

Change-Id: I607126a2b0d22613550b655ea19bc232f6ace020
(cherry picked from commit e593cb4fc6)
changes/02/673002/1
Lucas Alvares Gomes 1 year ago
parent
commit
6e8e5b2e80
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      networking_ovn/common/maintenance.py

+ 7
- 0
networking_ovn/common/maintenance.py View File

@@ -21,6 +21,7 @@ from neutron.common import config as n_conf
21 21
 from neutron_lib import context as n_context
22 22
 from neutron_lib import worker
23 23
 from oslo_log import log
24
+from oslo_utils import timeutils
24 25
 
25 26
 from networking_ovn.common import constants as ovn_const
26 27
 from networking_ovn.db import maintenance as db_maint
@@ -90,6 +91,7 @@ class DBInconsistenciesPeriodics(object):
90 91
         self._nb_idl = self._ovn_client._nb_idl
91 92
         self._idl = self._nb_idl.idl
92 93
         self._idl.set_lock('ovn_db_inconsistencies_periodics')
94
+        self._sync_timer = timeutils.StopWatch()
93 95
 
94 96
         self._resources_func_map = {
95 97
             ovn_const.TYPE_NETWORKS: {
@@ -214,6 +216,7 @@ class DBInconsistenciesPeriodics(object):
214 216
         if not any([create_update_inconsistencies, delete_inconsistencies]):
215 217
             return
216 218
         LOG.warning('Inconsistencies found in the database!')
219
+        self._sync_timer.restart()
217 220
 
218 221
         # Fix the create/update resources inconsistencies
219 222
         for row in create_update_inconsistencies:
@@ -247,6 +250,10 @@ class DBInconsistenciesPeriodics(object):
247 250
                               {'res_uuid': row.resource_uuid,
248 251
                                'res_type': row.resource_type})
249 252
 
253
+        LOG.info('Maintenance thread synchronization finished '
254
+                 '(took %.2f seconds)', self._sync_timer.elapsed())
255
+        self._sync_timer.stop()
256
+
250 257
     def _create_lrouter_port(self, port):
251 258
         admin_context = n_context.get_admin_context()
252 259
         router_id = port['device_id']

Loading…
Cancel
Save