-// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
boost::bind(&HAService::normalStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_LOAD_BALANCING_ST)->getPausing());
+ defineState(HA_MAINTAINED_ST, stateToString(HA_MAINTAINED_ST),
+ boost::bind(&HAService::normalStateHandler, this),
+ config_->getStateMachineConfig()->getStateConfig(HA_MAINTAINED_ST)->getPausing());
+
defineState(HA_PARTNER_DOWN_ST, stateToString(HA_PARTNER_DOWN_ST),
boost::bind(&HAService::partnerDownStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_PARTNER_DOWN_ST)->getPausing());
+ defineState(HA_PARTNER_MAINTAINED_ST, stateToString(HA_PARTNER_MAINTAINED_ST),
+ boost::bind(&HAService::partnerDownStateHandler, this),
+ config_->getStateMachineConfig()->getStateConfig(HA_PARTNER_MAINTAINED_ST)->getPausing());
+
defineState(HA_READY_ST, stateToString(HA_READY_ST),
boost::bind(&HAService::readyStateHandler, this),
config_->getStateMachineConfig()->getStateConfig(HA_READY_ST)->getPausing());
-// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// it doesn't respond to heartbeats.
void normalStateHandler();
+ /// @brief Handler for the "maintained" state.
+ ///
+ /// This is a handler invoked when one of the servers detected that
+ /// its partner is in the "partner-maintained" state. The server
+ /// being in this state is awaiting the shutdown by the administrator.
+ /// The administrator shuts down the server to perform some planned
+ /// maintenance. Meanwhile, the partner being in the "partner-maintained"
+ /// state responds to all DHCP queries. The server being in the
+ /// "maintained" state responds to no DHCP queries.
+ void maintainedStateHandler();
+
/// @brief Handler for "partner-down" state.
///
/// This is a handler invoked for the server which detected a failure
/// to the "waiting" state to try to resolve the conflict with the partner.
void partnerDownStateHandler();
+ /// @brief Handler for "partner-maintained" state.
+ ///
+ /// This is a handler invoked for the server which was administratively
+ /// transitioned to the "partner-maintained" state. This is the case
+ /// when the partner needs to be shutdown for some planned maintenance.
+ ///
+ /// The server receiving ha-maintenance-start command transitions to this
+ /// state. It sends the ha-maintenance-notify command to the partner to cause
+ /// the partner to stop responding to the DHCP queries. Next, this server
+ /// starts responding to all DHCP queries. This allows the server
+ /// administrator to safely shutdown the partner as it is no longer
+ /// responsible for any portion of the DHCP traffic.
+ ///
+ /// The server being in the "partner-maintained" state remains in this
+ /// state until the first unsuccessful lease update, ha-heartbeat or any
+ /// other command send to the partner due to the issues with communication.
+ /// In that case the server assumes that the partner has been shutdown
+ /// and transitions to the "partner-down" state in which it still responds
+ /// to all DHCP queries but doesn't attempt to send lease updates to the
+ /// offline partner.
+ void partnerMaintainedStateHandler();
+
/// @brief Handler for "ready" state.
///
/// This a handler invoked for the server which finished synchronizing
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
return ("hot-standby");
case HA_LOAD_BALANCING_ST:
return ("load-balancing");
+ case HA_MAINTAINED_ST:
+ return ("maintained");
case HA_PARTNER_DOWN_ST:
return ("partner-down");
+ case HA_PARTNER_MAINTAINED_ST:
+ return ("partner-maintained");
case HA_READY_ST:
return ("ready");
case HA_SYNCING_ST:
} else if (state_name == "load-balancing") {
return (HA_LOAD_BALANCING_ST);
+ } else if (state_name == "maintained") {
+ return (HA_MAINTAINED_ST);
+
} else if (state_name == "partner-down") {
return (HA_PARTNER_DOWN_ST);
+ } else if (state_name == "partner-maintained") {
+ return (HA_PARTNER_MAINTAINED_ST);
+
} else if (state_name == "ready") {
return (HA_READY_ST);
-// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
/// Load balancing state.
const int HA_LOAD_BALANCING_ST = util::StateModel::SM_DERIVED_STATE_MIN + 3;
+/// Maintainedo state.
+const int HA_MAINTAINED_ST = util::StateModel::SM_DERIVED_STATE_MIN + 4;
+
/// Partner down state.
-const int HA_PARTNER_DOWN_ST = util::StateModel::SM_DERIVED_STATE_MIN + 4;
+const int HA_PARTNER_DOWN_ST = util::StateModel::SM_DERIVED_STATE_MIN + 5;
+
+/// Partner maintained state.
+const int HA_PARTNER_MAINTAINED_ST = util::StateModel::SM_DERIVED_STATE_MIN + 6;
/// Server ready state, i.e. synchronized database, can enable DHCP service.
-const int HA_READY_ST = util::StateModel::SM_DERIVED_STATE_MIN + 5;
+const int HA_READY_ST = util::StateModel::SM_DERIVED_STATE_MIN + 7;
/// Synchronizing database state.
-const int HA_SYNCING_ST = util::StateModel::SM_DERIVED_STATE_MIN + 6;
+const int HA_SYNCING_ST = util::StateModel::SM_DERIVED_STATE_MIN + 8;
/// HA service terminated state.
-const int HA_TERMINATED_ST = util::StateModel::SM_DERIVED_STATE_MIN + 7;
+const int HA_TERMINATED_ST = util::StateModel::SM_DERIVED_STATE_MIN + 9;
/// Server waiting state, i.e. waiting for another server to be ready.
-const int HA_WAITING_ST = util::StateModel::SM_DERIVED_STATE_MIN + 8;
+const int HA_WAITING_ST = util::StateModel::SM_DERIVED_STATE_MIN + 10;
/// Special state indicating that this server is unable to communicate with
/// the partner.