Commit 365c86bc authored by Marcin Siodelski's avatar Marcin Siodelski

[5674] Added logs when state machine (un)paused.

parent 717006b2
......@@ -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.
......
......@@ -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
......@@ -58,9 +58,7 @@ public:
}
/// @brief Clears flag indicating that the state machine is paused.
void unpause() {
paused_ = false;
}
void unpause();
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment