From: Marcin Siodelski Date: Wed, 11 Jul 2018 12:37:17 +0000 (+0200) Subject: [5674] Added logs when state machine (un)paused. X-Git-Tag: ha_phase2~54^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=365c86bcf7d0ed235331f6a90b4b7575ef151642;p=thirdparty%2Fkea.git [5674] Added logs when state machine (un)paused. --- diff --git a/src/hooks/dhcp/high_availability/ha_messages.mes b/src/hooks/dhcp/high_availability/ha_messages.mes index efe6761904..d0aea18523 100644 --- a/src/hooks/dhcp/high_availability/ha_messages.mes +++ b/src/hooks/dhcp/high_availability/ha_messages.mes @@ -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. diff --git a/src/hooks/dhcp/high_availability/ha_state_machine_control.cc b/src/hooks/dhcp/high_availability/ha_state_machine_control.cc index 31692a9853..8033991a86 100644 --- a/src/hooks/dhcp/high_availability/ha_state_machine_control.cc +++ b/src/hooks/dhcp/high_availability/ha_state_machine_control.cc @@ -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 +#include #include +#include 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 diff --git a/src/hooks/dhcp/high_availability/ha_state_machine_control.h b/src/hooks/dhcp/high_availability/ha_state_machine_control.h index 887c70124b..f94645a4e6 100644 --- a/src/hooks/dhcp/high_availability/ha_state_machine_control.h +++ b/src/hooks/dhcp/high_availability/ha_state_machine_control.h @@ -58,9 +58,7 @@ public: } /// @brief Clears flag indicating that the state machine is paused. - void unpause() { - paused_ = false; - } + void unpause(); private: