2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[#1041] Checkpoint: added reload, doc to do

This commit is contained in:
Francis Dupont
2019-12-06 02:16:30 +01:00
committed by Marcin Siodelski
parent 15a9c8871e
commit 51a472788c
4 changed files with 30 additions and 2 deletions

View File

@@ -587,7 +587,11 @@ ControlledDhcpv4Srv::commandStatusGetHandler(const string&,
auto uptime = now - start_;
status->set("uptime", Element::create(uptime.total_seconds()));
// todo: duration since last config commit.
auto last_commit = CfgMgr::instance().getCurrentCfg()->getLastCommitTime();
if (!last_commit.is_not_a_date_time()) {
auto reload = now - last_commit;
status->set("reload", Element::create(reload.total_seconds()));
}
// todo: number of service threads.

View File

@@ -587,7 +587,11 @@ ControlledDhcpv6Srv::commandStatusGetHandler(const string&,
auto uptime = now - start_;
status->set("uptime", Element::create(uptime.total_seconds()));
// todo: duration since last config commit.
auto last_commit = CfgMgr::instance().getCurrentCfg()->getLastCommitTime();
if (!last_commit.is_not_a_date_time()) {
auto reload = now - last_commit;
status->set("reload", Element::create(reload.total_seconds()));
}
// todo: number of service threads.

View File

@@ -108,6 +108,10 @@ CfgMgr::commit() {
}
}
// Set the last commit timestamp.
auto now = boost::posix_time::second_clock::universal_time();
configuration_->setLastCommitTime(now);
// Now we need to set the statistics back.
configuration_->updateStatistics();
}

View File

@@ -30,6 +30,7 @@
#include <cc/user_context.h>
#include <cc/simple_parser.h>
#include <boost/shared_ptr.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <vector>
#include <stdint.h>
@@ -679,6 +680,18 @@ public:
/// @param srv_elem server top level map to alter
static void moveDdnsParams(isc::data::ElementPtr srv_elem);
/// @brief Returns the last commit timestamp.
/// @return the last commit timestamp.
boost::posix_time::ptime getLastCommitTime() const {
return (last_commit_time_);
}
/// @brief Sets the last commit timestamp.
/// @param last_commit_time last commit timestamp.
void setLastCommitTime(const boost::posix_time::ptime& last_commit_time) {
last_commit_time_ = last_commit_time;
}
/// @brief Unparse a configuration object
///
/// @return a pointer to unparsed configuration
@@ -832,6 +845,9 @@ private:
/// @brief Pointer to the configuration consistency settings
CfgConsistencyPtr cfg_consist_;
/// @brief Stores the last commit timestamp.
boost::posix_time::ptime last_commit_time_;
};
/// @name Pointers to the @c SrvConfig object.