Commit df955449 authored by Francis Dupont's avatar Francis Dupont Committed by Marcin Siodelski
Browse files

[#1041] Checkpoint: added HA state, reload time to do

parent 34e7cfb7
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2018-2019 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
......@@ -262,6 +262,23 @@ HAImpl::commandProcessed(hooks::CalloutHandle& callout_handle) {
callout_handle.getArgument("name", command_name);
if (command_name == "dhcp-enable") {
service_->adjustNetworkState();
} else if (command_name == "status-get") {
// Get the response.
ConstElementPtr response;
callout_handle.getArgument("response", response);
if (!response || (response->getType() != Element::map)) {
return;
}
// Get the arguments item from the response.
ConstElementPtr resp_args = response->get("arguments");
if (!resp_args || (resp_args->getType() != Element::map)) {
return;
}
// Add the ha state to arguments.
std::string state = stateToString(service_->getCurrState());
ElementPtr mutable_resp_args =
boost::const_pointer_cast<Element>(response);
mutable_resp_args->set("ha-state", Element::create(state));
}
}
......
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2018-2019 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
......@@ -118,6 +118,7 @@ public:
/// service is enabled in a state for which this is not allowed, e.g.
/// waiting, syncing etc. We don't want to rely on the HA partner to do
/// a correct thing in that respect.
/// It too adds the HA state to "status-get" commands.
///
/// @param callout_handle Callout handle provided to the callout.
void commandProcessed(hooks::CalloutHandle& callout_handle);
......
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