]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5674] Added logs when state machine (un)paused.
authorMarcin Siodelski <marcin@isc.org>
Wed, 11 Jul 2018 12:37:17 +0000 (14:37 +0200)
committerMarcin Siodelski <marcin@isc.org>
Wed, 11 Jul 2018 12:37:17 +0000 (14:37 +0200)
src/hooks/dhcp/high_availability/ha_messages.mes
src/hooks/dhcp/high_availability/ha_state_machine_control.cc
src/hooks/dhcp/high_availability/ha_state_machine_control.h

index efe6761904df97a0e57c5e54e0c217c557b89a6d..d0aea18523a03ec27f33554294cad358c20764e0 100644 (file)
@@ -296,6 +296,21 @@ of server startup or reconfiguration. The first argument provides the HA mode.
 The second argument specifies the role of this server instance in this
 configuration.
 
+% HA_STATE_MACHINE_CONTINUED state machine is un-paused
+This informational message is issued when the HA state machine is un-paused.
+This unlocks the server from the current state. It may transition to any
+other state if it needs to do so, e.g. 'partner-down' if its partner appears
+to be offline. The server may also remain in the current state if the HA
+setup state warrants such behavior.
+
+% HA_STATE_MACHINE_PAUSED state machine paused in state %1
+This informational message is issued when the HA state machine is paused.
+HA state machine may be paused in certain states specified in the HA hooks library
+confuguration. When the state machine is paused, the server remains in the given
+state until it is explicitly unpaused (via ha-continue command). If the state
+machine is paused, the server operates normally but can't transition to any
+other state.
+
 % HA_STATE_TRANSITION server transitions from %1 to %2 state, partner state is %3
 This informational message is issued when the server transitions to a new
 state as a result of some interaction (or lack of thereof) with its partner.
index 31692a985386cae579624d53c0dab93b7b03cfa6..8033991a8601bbb44d0391acddd13b937e0acb88 100644 (file)
@@ -4,7 +4,10 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+#include <ha_log.h>
+#include <ha_service_states.h>
 #include <ha_state_machine_control.h>
+#include <boost/algorithm/string.hpp>
 
 namespace isc {
 namespace ha {
@@ -33,10 +36,22 @@ HAStateMachineControl::notify(const int state) {
         if ((state_config->getPausing() == HAConfig::StateConfig::PAUSE_ALWAYS) ||
             ((state_config->getPausing() == HAConfig::StateConfig::PAUSE_ONCE) &&
              first_visit)) {
+            std::string state_name = stateToString(state);
+            boost::to_upper(state_name);
+            LOG_INFO(ha_logger, HA_STATE_MACHINE_PAUSED)
+                .arg(state_name);
             paused_ = true;
         }
     }
 }
 
+void
+HAStateMachineControl::unpause() {
+    if (amPaused()) {
+        LOG_INFO(ha_logger, HA_STATE_MACHINE_CONTINUED);
+        paused_ = false;
+    }
+}
+
 } // end of namespace isc::ha
 } // end of namespace isc
index 887c70124be4cf2d20e5890628096cccd37a1d72..f94645a4e6c12a2a7b423f63f955ba2f3e4f607b 100644 (file)
@@ -58,9 +58,7 @@ public:
     }
 
     /// @brief Clears flag indicating that the state machine is paused.
-    void unpause() {
-        paused_ = false;
-    }
+    void unpause();
 
 private: