def _execute_op(self, operation, session): op_details = operation.__name__ if operation.__doc__: op_details += " (%s)" % operation.func_doc try: LOG.info(_LI("Starting maintenance operation %s."), op_details) db.update_maintenance_operation(session, operation=operation) operation(session=session) LOG.info(_LI("Finished maintenance operation %s."), op_details) except Exception: LOG.exception(_LE("Failed during maintenance operation %s."), op_details)
def execute_ops(self): LOG.info(_LI("Starting journal maintenance run.")) session = neutron_db_api.get_writer_session() if not db.lock_maintenance(session): LOG.info(_LI("Maintenance already running, aborting.")) return try: for operation in self.maintenance_ops: self._execute_op(operation, session) finally: db.update_maintenance_operation(session, operation=None) db.unlock_maintenance(session) LOG.info(_LI("Finished journal maintenance run."))
def execute_ops(self): LOG.info(_LI("Starting journal maintenance run.")) session = neutron_db_api.get_session() if not db.lock_maintenance(session): LOG.info(_LI("Maintenance already running, aborting.")) return try: for operation in self.maintenance_ops: self._execute_op(operation, session) finally: db.update_maintenance_operation(session, operation=None) db.unlock_maintenance(session) LOG.info(_LI("Finished journal maintenance run."))