2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 13:07:50 +00:00

[#2960] removed deprecated libreload command

This commit is contained in:
Razvan Becheriu 2024-05-08 12:29:35 +03:00
parent 6f66da2371
commit 6d10d6424e
18 changed files with 1 additions and 382 deletions

View File

@ -68,7 +68,6 @@ src/share/api/lease6-update.json
src/share/api/lease6-wipe.json
src/share/api/lease6-write.json
src/share/api/leases-reclaim.json
src/share/api/libreload.json
src/share/api/list-commands.json
src/share/api/network4-add.json
src/share/api/network4-del.json

View File

@ -537,31 +537,6 @@ returning client that previously used that lease. See :ref:`lease-affinity`
for details. Also, see :ref:`lease-reclamation` for general
information about the processing of expired leases (lease reclamation).
.. isccmd:: libreload
.. _command-libreload:
The ``libreload`` Command
-------------------------
This command is now deprecated and will be removed in future Kea versions.
The :isccmd:`libreload` command first unloads and then loads all currently
loaded hook libraries. This is primarily intended to allow one or more
hook libraries to be replaced with newer versions, without requiring Kea
servers to be reconfigured or restarted. The hook libraries
are passed the same parameter values (if any) that were passed when they
were originally loaded.
::
{
"command": "libreload",
"arguments": { }
}
The server responds with a result of either 0, indicating success,
or 1, indicating failure.
.. isccmd:: list-commands
.. _command-list-commands:

View File

@ -650,11 +650,3 @@ Sysrepo 0.x or 1.x
Kea 2.3.2 introduced support for Sysrepo 2.x. Unfortunately,
Sysrepo continues to undergo major changes that are backward-incompatible,
and current Kea versions do not support Sysrepo earlier than versions 2.x.
:isccmd:`libreload` command
----------------------------------------
The :isccmd:`libreload` command was deprecated in Kea 2.3.4. The code to handle this command is
still there, but there are reports of it being buggy and not really usable.
Kea 2.3 and 2.4 versions produce a warning when this command
is used, and it will be removed entirely sometime in the 2.5 branch.

View File

@ -228,43 +228,6 @@ ControlledDhcpv4Srv::commandShutdownHandler(const string&, ConstElementPtr args)
return (createAnswer(CONTROL_RESULT_SUCCESS, "Shutting down."));
}
ConstElementPtr
ControlledDhcpv4Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
LOG_WARN(dhcp4_logger, DHCP4_DEPRECATED).arg("libreload command");
// stop thread pool (if running)
MultiThreadingCriticalSection cs;
// Clear the packet queue.
MultiThreadingMgr::instance().getThreadPool().reset();
try {
/// Get list of currently loaded libraries and reload them.
HookLibsCollection loaded = HooksManager::getLibraryInfo();
HooksManager::prepareUnloadLibraries();
static_cast<void>(HooksManager::unloadLibraries());
IOServiceMgr::instance().clearIOServices();
bool multi_threading_enabled = true;
uint32_t thread_count = 0;
uint32_t queue_size = 0;
CfgMultiThreading::extract(CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading(),
multi_threading_enabled, thread_count, queue_size);
bool status = HooksManager::loadLibraries(loaded, multi_threading_enabled);
if (!status) {
isc_throw(Unexpected, "Failed to reload hooks libraries "
"(WARNING: libreload is deprecated).");
}
} catch (const std::exception& ex) {
LOG_ERROR(dhcp4_logger, DHCP4_HOOKS_LIBS_RELOAD_FAIL);
ConstElementPtr answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
return (answer);
}
ConstElementPtr answer = isc::config::createAnswer(CONTROL_RESULT_SUCCESS,
"Hooks libraries successfully reloaded "
"(WARNING: libreload is deprecated).");
return (answer);
}
ConstElementPtr
ControlledDhcpv4Srv::commandConfigReloadHandler(const string&,
ConstElementPtr /*args*/) {
@ -891,9 +854,6 @@ ControlledDhcpv4Srv::processCommand(const string& command,
if (command == "shutdown") {
return (srv->commandShutdownHandler(command, args));
} else if (command == "libreload") {
return (srv->commandLibReloadHandler(command, args));
} else if (command == "config-reload") {
return (srv->commandConfigReloadHandler(command, args));
@ -1235,9 +1195,6 @@ ControlledDhcpv4Srv::ControlledDhcpv4Srv(uint16_t server_port /*= DHCP4_SERVER_P
CommandMgr::instance().registerCommand("dhcp-disable",
std::bind(&ControlledDhcpv4Srv::commandDhcpDisableHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("libreload",
std::bind(&ControlledDhcpv4Srv::commandLibReloadHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("leases-reclaim",
std::bind(&ControlledDhcpv4Srv::commandLeasesReclaimHandler, this, ph::_1, ph::_2));
@ -1322,7 +1279,6 @@ ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
CommandMgr::instance().deregisterCommand("dhcp-disable");
CommandMgr::instance().deregisterCommand("dhcp-enable");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("libreload");
CommandMgr::instance().deregisterCommand("server-tag-get");
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("statistic-get");

View File

@ -81,7 +81,6 @@ public:
///
/// Currently supported commands are:
/// - shutdown
/// - libreload
/// - config-reload
/// - config-set
/// - config-get
@ -168,19 +167,6 @@ private:
commandShutdownHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Handler for processing 'libreload' command
///
/// This handler processes libreload command, which unloads all hook
/// libraries and reloads them.
///
/// @param command (parameter ignored)
/// @param args (parameter ignored)
///
/// @return status of the command
isc::data::ConstElementPtr
commandLibReloadHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Handler for processing 'config-reload' command
///
/// This handler processes config-reload command, which processes

View File

@ -77,7 +77,6 @@ extern const isc::log::MessageID DHCP4_EMPTY_HOSTNAME = "DHCP4_EMPTY_HOSTNAME";
extern const isc::log::MessageID DHCP4_FLEX_ID = "DHCP4_FLEX_ID";
extern const isc::log::MessageID DHCP4_GENERATE_FQDN = "DHCP4_GENERATE_FQDN";
extern const isc::log::MessageID DHCP4_HANDLE_SIGNAL_EXCEPTION = "DHCP4_HANDLE_SIGNAL_EXCEPTION";
extern const isc::log::MessageID DHCP4_HOOKS_LIBS_RELOAD_FAIL = "DHCP4_HOOKS_LIBS_RELOAD_FAIL";
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_RCVD_DROP = "DHCP4_HOOK_BUFFER_RCVD_DROP";
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_RCVD_SKIP = "DHCP4_HOOK_BUFFER_RCVD_SKIP";
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_SEND_SKIP = "DHCP4_HOOK_BUFFER_SEND_SKIP";
@ -266,7 +265,6 @@ const char* values[] = {
"DHCP4_FLEX_ID", "%1: flexible identifier generated for incoming packet: %2",
"DHCP4_GENERATE_FQDN", "%1: client did not send a FQDN or hostname; FQDN will be generated for the client",
"DHCP4_HANDLE_SIGNAL_EXCEPTION", "An exception was thrown while handing signal: %1",
"DHCP4_HOOKS_LIBS_RELOAD_FAIL", "reload of hooks libraries failed",
"DHCP4_HOOK_BUFFER_RCVD_DROP", "received buffer from %1 to %2 over interface %3 was dropped because a callout set the drop flag",
"DHCP4_HOOK_BUFFER_RCVD_SKIP", "received buffer from %1 to %2 over interface %3 is not parsed because a callout set the next step to SKIP.",
"DHCP4_HOOK_BUFFER_SEND_SKIP", "%1: prepared response is dropped because a callout set the next step to SKIP.",

View File

@ -78,7 +78,6 @@ extern const isc::log::MessageID DHCP4_EMPTY_HOSTNAME;
extern const isc::log::MessageID DHCP4_FLEX_ID;
extern const isc::log::MessageID DHCP4_GENERATE_FQDN;
extern const isc::log::MessageID DHCP4_HANDLE_SIGNAL_EXCEPTION;
extern const isc::log::MessageID DHCP4_HOOKS_LIBS_RELOAD_FAIL;
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_RCVD_DROP;
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_RCVD_SKIP;
extern const isc::log::MessageID DHCP4_HOOK_BUFFER_SEND_SKIP;

View File

@ -413,11 +413,6 @@ create DNS entries for unsophisticated clients.
This error message is printed when an ISC or standard exception was raised during signal
processing. This likely indicates a coding error and should be reported to ISC.
% DHCP4_HOOKS_LIBS_RELOAD_FAIL reload of hooks libraries failed
A "libreload" command was issued to reload the hooks libraries but for
some reason the reload failed. Other error messages issued from the
hooks framework will indicate the nature of the problem.
% DHCP4_HOOK_BUFFER_RCVD_DROP received buffer from %1 to %2 over interface %3 was dropped because a callout set the drop flag
This debug message is printed when a callout installed on buffer4_receive
hook point set the drop flag. For this particular hook point, the

View File

@ -448,96 +448,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commands) {
EXPECT_EQ(77, server_->getExitValue());
}
// Check that the "libreload" command will reload libraries
TEST_F(CtrlChannelDhcpv4SrvTest, libreload) {
createUnixChannelServer();
// Ensure no marker files to start with.
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Load two libraries
HookLibsCollection libraries;
libraries.push_back(make_pair(CALLOUT_LIBRARY_1, ConstElementPtr()));
HooksManager::loadLibraries(libraries);
// Check they are loaded.
HookLibsCollection loaded_libraries =
HooksManager::getLibraryInfo();
ASSERT_TRUE(libraries == loaded_libraries);
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "1"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Now execute the "libreload" command. This should cause the libraries
// to unload and to reload.
std::string response;
sendUnixCommand("{ \"command\": \"libreload\" }", response);
EXPECT_EQ("{ \"result\": 0, "
"\"text\": \"Hooks libraries successfully reloaded "
"(WARNING: libreload is deprecated).\" }"
, response);
// Check that the libraries have unloaded and reloaded. The libraries are
// unloaded in the reverse order to which they are loaded. When they load,
// they should append information to the loading marker file.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "1"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "11"));
}
// Check that the "libreload" command will fail to reload libraries which are
// not compatible when multi-threading is enabled
TEST_F(CtrlChannelDhcpv4SrvTest, libreloadFailMultiThreading) {
createUnixChannelServer();
// Ensure no marker files to start with.
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Disable multi-threading to temporarily trick the hook manager
// into loading single-threaded libraries.
MultiThreadingMgr::instance().setMode(false);
// Load two libraries
HookLibsCollection libraries;
libraries.push_back(make_pair(CALLOUT_LIBRARY_1, ConstElementPtr()));
libraries.push_back(make_pair(CALLOUT_LIBRARY_2, ConstElementPtr()));
HooksManager::loadLibraries(libraries);
// Check they are loaded.
HookLibsCollection loaded_libraries =
HooksManager::getLibraryInfo();
ASSERT_TRUE(libraries == loaded_libraries);
// ... which also included checking that the marker file created by the
// load functions exists and holds the correct value (of "12" - the
// first library appends "1" to the file, the second appends "2"). Also
// check that the unload marker file does not yet exist.
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Enable multi-threading before libreload command which should now fail
// as the second library is not multi-threading compatible.
MultiThreadingMgr::instance().setMode(true);
// Now execute the "libreload" command. This should cause the libraries
// to unload and to reload.
std::string response;
sendUnixCommand("{ \"command\": \"libreload\" }", response);
EXPECT_EQ("{ \"result\": 1, "
"\"text\": \"Failed to reload hooks libraries"
" (WARNING: libreload is deprecated).\" }"
, response);
// Check that the libraries have unloaded and failed to reload. The
// libraries are unloaded in the reverse order to which they are loaded.
// When they load, they should append information to the loading marker
// file. Failing to load the second library will also unload the first
// library.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "211"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "121"));
}
// This test checks which commands are registered by the DHCPv4 server.
TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) {
@ -570,7 +480,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, commandsRegistration) {
EXPECT_TRUE(command_list.find("\"config-set\"") != string::npos);
EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos);
EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos);
EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos);
EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos);
EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos);
@ -1509,7 +1418,6 @@ TEST_F(CtrlChannelDhcpv4SrvTest, listCommands) {
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
checkListCommands(rsp, "libreload");
checkListCommands(rsp, "version-get");
checkListCommands(rsp, "server-tag-get");
checkListCommands(rsp, "shutdown");

View File

@ -231,43 +231,6 @@ ControlledDhcpv6Srv::commandShutdownHandler(const string&, ConstElementPtr args)
return (createAnswer(CONTROL_RESULT_SUCCESS, "Shutting down."));
}
ConstElementPtr
ControlledDhcpv6Srv::commandLibReloadHandler(const string&, ConstElementPtr) {
LOG_WARN(dhcp6_logger, DHCP6_DEPRECATED).arg("libreload command");
// stop thread pool (if running)
MultiThreadingCriticalSection cs;
// Clear the packet queue.
MultiThreadingMgr::instance().getThreadPool().reset();
try {
/// Get list of currently loaded libraries and reload them.
HookLibsCollection loaded = HooksManager::getLibraryInfo();
HooksManager::prepareUnloadLibraries();
static_cast<void>(HooksManager::unloadLibraries());
IOServiceMgr::instance().clearIOServices();
bool multi_threading_enabled = true;
uint32_t thread_count = 0;
uint32_t queue_size = 0;
CfgMultiThreading::extract(CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading(),
multi_threading_enabled, thread_count, queue_size);
bool status = HooksManager::loadLibraries(loaded, multi_threading_enabled);
if (!status) {
isc_throw(Unexpected, "Failed to reload hooks libraries "
"(WARNING: libreload is deprecated).");
}
} catch (const std::exception& ex) {
LOG_ERROR(dhcp6_logger, DHCP6_HOOKS_LIBS_RELOAD_FAIL);
ConstElementPtr answer = isc::config::createAnswer(CONTROL_RESULT_ERROR, ex.what());
return (answer);
}
ConstElementPtr answer = isc::config::createAnswer(CONTROL_RESULT_SUCCESS,
"Hooks libraries successfully reloaded "
"(WARNING: libreload is deprecated).");
return (answer);
}
ConstElementPtr
ControlledDhcpv6Srv::commandConfigReloadHandler(const string&,
ConstElementPtr /*args*/) {
@ -896,9 +859,6 @@ ControlledDhcpv6Srv::processCommand(const string& command,
if (command == "shutdown") {
return (srv->commandShutdownHandler(command, args));
} else if (command == "libreload") {
return (srv->commandLibReloadHandler(command, args));
} else if (command == "config-reload") {
return (srv->commandConfigReloadHandler(command, args));
@ -1258,9 +1218,6 @@ ControlledDhcpv6Srv::ControlledDhcpv6Srv(uint16_t server_port /*= DHCP6_SERVER_P
CommandMgr::instance().registerCommand("dhcp-disable",
std::bind(&ControlledDhcpv6Srv::commandDhcpDisableHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("libreload",
std::bind(&ControlledDhcpv6Srv::commandLibReloadHandler, this, ph::_1, ph::_2));
CommandMgr::instance().registerCommand("leases-reclaim",
std::bind(&ControlledDhcpv6Srv::commandLeasesReclaimHandler, this, ph::_1, ph::_2));
@ -1345,7 +1302,6 @@ ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
CommandMgr::instance().deregisterCommand("dhcp-disable");
CommandMgr::instance().deregisterCommand("dhcp-enable");
CommandMgr::instance().deregisterCommand("leases-reclaim");
CommandMgr::instance().deregisterCommand("libreload");
CommandMgr::instance().deregisterCommand("server-tag-get");
CommandMgr::instance().deregisterCommand("shutdown");
CommandMgr::instance().deregisterCommand("statistic-get");

View File

@ -81,7 +81,6 @@ public:
///
/// Currently supported commands are:
/// - shutdown
/// - libreload
/// - config-reload
/// - config-set
/// - config-get
@ -168,19 +167,6 @@ private:
commandShutdownHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Handler for processing 'libreload' command
///
/// This handler processes libreload command, which unloads all hook
/// libraries and reloads them.
///
/// @param command (parameter ignored)
/// @param args (parameter ignored)
///
/// @return status of the command
isc::data::ConstElementPtr
commandLibReloadHandler(const std::string& command,
isc::data::ConstElementPtr args);
/// @brief Handler for processing 'config-reload' command
///
/// This handler processes config-reload command, which processes

View File

@ -69,7 +69,6 @@ extern const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_FAIL = "DHCP6_DYN
extern const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS = "DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS";
extern const isc::log::MessageID DHCP6_FLEX_ID = "DHCP6_FLEX_ID";
extern const isc::log::MessageID DHCP6_HANDLE_SIGNAL_EXCEPTION = "DHCP6_HANDLE_SIGNAL_EXCEPTION";
extern const isc::log::MessageID DHCP6_HOOKS_LIBS_RELOAD_FAIL = "DHCP6_HOOKS_LIBS_RELOAD_FAIL";
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_DROP = "DHCP6_HOOK_BUFFER_RCVD_DROP";
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_SKIP = "DHCP6_HOOK_BUFFER_RCVD_SKIP";
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_SEND_SKIP = "DHCP6_HOOK_BUFFER_SEND_SKIP";
@ -247,7 +246,6 @@ const char* values[] = {
"DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS", "dynamic server reconfiguration succeeded with file: %1",
"DHCP6_FLEX_ID", "%1: flexible identifier generated for incoming packet: %2",
"DHCP6_HANDLE_SIGNAL_EXCEPTION", "An exception was thrown while handing signal: %1",
"DHCP6_HOOKS_LIBS_RELOAD_FAIL", "reload of hooks libraries failed",
"DHCP6_HOOK_BUFFER_RCVD_DROP", "received buffer from %1 to %2 over interface %3 was dropped because a callout set the drop flag",
"DHCP6_HOOK_BUFFER_RCVD_SKIP", "received buffer from %1 to %2 over interface %3 is not parsed because a callout set the next step to SKIP",
"DHCP6_HOOK_BUFFER_SEND_SKIP", "%1: prepared DHCPv6 response was dropped because a callout set the next step to SKIP",

View File

@ -70,7 +70,6 @@ extern const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_FAIL;
extern const isc::log::MessageID DHCP6_DYNAMIC_RECONFIGURATION_SUCCESS;
extern const isc::log::MessageID DHCP6_FLEX_ID;
extern const isc::log::MessageID DHCP6_HANDLE_SIGNAL_EXCEPTION;
extern const isc::log::MessageID DHCP6_HOOKS_LIBS_RELOAD_FAIL;
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_DROP;
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_RCVD_SKIP;
extern const isc::log::MessageID DHCP6_HOOK_BUFFER_SEND_SKIP;

View File

@ -368,11 +368,6 @@ debugging assistance for flexible identifier.
This error message is printed when an exception was raised during signal
processing. This likely indicates a coding error and should be reported to ISC.
% DHCP6_HOOKS_LIBS_RELOAD_FAIL reload of hooks libraries failed
A "libreload" command was issued to reload the hooks libraries but for
some reason the reload failed. Other error messages issued from the
hooks framework will indicate the nature of the problem.
% DHCP6_HOOK_BUFFER_RCVD_DROP received buffer from %1 to %2 over interface %3 was dropped because a callout set the drop flag
This debug message is printed when a callout installed on buffer6_receive
hook point set the drop flag. For this particular hook point, the

View File

@ -472,100 +472,6 @@ TEST_F(CtrlDhcpv6SrvTest, commands) {
EXPECT_EQ(77, srv->getExitValue());
}
// Check that the "libreload" command will reload libraries
TEST_F(CtrlChannelDhcpv6SrvTest, libreload) {
createUnixChannelServer();
// Ensure no marker files to start with.
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Load two libraries
HookLibsCollection libraries;
libraries.push_back(make_pair(CALLOUT_LIBRARY_1, ConstElementPtr()));
HooksManager::loadLibraries(libraries);
// Check they are loaded.
HookLibsCollection loaded_libraries =
HooksManager::getLibraryInfo();
ASSERT_TRUE(libraries == loaded_libraries);
// ... which also included checking that the marker file created by the
// load functions exists and holds the correct value (of "12" - the
// first library appends "1" to the file, the second appends "2"). Also
// check that the unload marker file does not yet exist.
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "1"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Now execute the "libreload" command. This should cause the libraries
// to unload and to reload.
std::string response;
sendUnixCommand("{ \"command\": \"libreload\" }", response);
EXPECT_EQ("{ \"result\": 0, "
"\"text\": \"Hooks libraries successfully reloaded"
" (WARNING: libreload is deprecated).\" }"
, response);
// Check that the libraries have unloaded and reloaded. The libraries are
// unloaded in the reverse order to which they are loaded. When they load,
// they should append information to the loading marker file.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "1"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "11"));
}
// Check that the "libreload" command will fail to reload libraries which are
// not compatible when multi-threading is enabled
TEST_F(CtrlChannelDhcpv6SrvTest, libreloadFailMultiThreading) {
createUnixChannelServer();
// Ensure no marker files to start with.
ASSERT_FALSE(checkMarkerFileExists(LOAD_MARKER_FILE));
ASSERT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Disable multi-threading to temporarily trick the hook manager
// into loading single-threaded libraries.
MultiThreadingMgr::instance().setMode(false);
// Load two libraries
HookLibsCollection libraries;
libraries.push_back(make_pair(CALLOUT_LIBRARY_1, ConstElementPtr()));
libraries.push_back(make_pair(CALLOUT_LIBRARY_2, ConstElementPtr()));
HooksManager::loadLibraries(libraries);
// Check they are loaded.
HookLibsCollection loaded_libraries =
HooksManager::getLibraryInfo();
ASSERT_TRUE(libraries == loaded_libraries);
// ... which also included checking that the marker file created by the
// load functions exists and holds the correct value (of "12" - the
// first library appends "1" to the file, the second appends "2"). Also
// check that the unload marker file does not yet exist.
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "12"));
EXPECT_FALSE(checkMarkerFileExists(UNLOAD_MARKER_FILE));
// Enable multi-threading before libreload command which should now fail
// as the second library is not multi-threading compatible.
MultiThreadingMgr::instance().setMode(true);
// Now execute the "libreload" command. This should cause the libraries
// to unload and to reload.
std::string response;
sendUnixCommand("{ \"command\": \"libreload\" }", response);
EXPECT_EQ("{ \"result\": 1, "
"\"text\": \"Failed to reload hooks libraries "
"(WARNING: libreload is deprecated).\" }"
, response);
// Check that the libraries have unloaded and failed to reload. The
// libraries are unloaded in the reverse order to which they are loaded.
// When they load, they should append information to the loading marker
// file. Failing to load the second library will also unload the first
// library.
EXPECT_TRUE(checkMarkerFile(UNLOAD_MARKER_FILE, "211"));
EXPECT_TRUE(checkMarkerFile(LOAD_MARKER_FILE, "121"));
}
typedef std::map<std::string, isc::data::ConstElementPtr> ElementMap;
// This test checks which commands are registered by the DHCPv6 server.
@ -601,7 +507,6 @@ TEST_F(CtrlDhcpv6SrvTest, commandsRegistration) {
EXPECT_TRUE(command_list.find("\"config-set\"") != string::npos);
EXPECT_TRUE(command_list.find("\"config-write\"") != string::npos);
EXPECT_TRUE(command_list.find("\"leases-reclaim\"") != string::npos);
EXPECT_TRUE(command_list.find("\"libreload\"") != string::npos);
EXPECT_TRUE(command_list.find("\"server-tag-get\"") != string::npos);
EXPECT_TRUE(command_list.find("\"shutdown\"") != string::npos);
EXPECT_TRUE(command_list.find("\"statistic-get\"") != string::npos);
@ -1549,7 +1454,6 @@ TEST_F(CtrlChannelDhcpv6SrvTest, listCommands) {
checkListCommands(rsp, "config-write");
checkListCommands(rsp, "list-commands");
checkListCommands(rsp, "leases-reclaim");
checkListCommands(rsp, "libreload");
checkListCommands(rsp, "version-get");
checkListCommands(rsp, "server-tag-get");
checkListCommands(rsp, "shutdown");

View File

@ -21,10 +21,7 @@ HooksConfig::verifyLibraries(const Element::Position& position,
bool multi_threading_enabled) const {
// The code used to follow this logic:
//
// Check if the list of libraries has changed. If not, nothing is done
// - the command "DhcpN libreload" is required to reload the same
// libraries (this prevents needless reloads when anything else in the
// configuration is changed).
// Check if the list of libraries has changed. If not, nothing is done.
//
// We no longer rely on this. Parameters can change. And even if the
// parameters stay the same, they could point to files that could

View File

@ -68,7 +68,6 @@ api_files += $(top_srcdir)/src/share/api/lease6-update.json
api_files += $(top_srcdir)/src/share/api/lease6-wipe.json
api_files += $(top_srcdir)/src/share/api/lease6-write.json
api_files += $(top_srcdir)/src/share/api/leases-reclaim.json
api_files += $(top_srcdir)/src/share/api/libreload.json
api_files += $(top_srcdir)/src/share/api/list-commands.json
api_files += $(top_srcdir)/src/share/api/network4-add.json
api_files += $(top_srcdir)/src/share/api/network4-del.json

View File

@ -1,23 +0,0 @@
{
"access": "write",
"avail": "1.2.0",
"brief": [
"This command first unloads and then reloads all currently loaded hooks libraries.",
"This command is deprecated and will be removed in future Kea versions."
],
"cmd-comment": [
"The server responds with 0, indicating success, or 1, indicating a failure."
],
"cmd-syntax": [
"{",
" \"command\": \"libreload\",",
" \"arguments\": { }",
"}"
],
"description": "See <xref linkend=\"command-libreload\"/>",
"name": "libreload",
"support": [
"kea-dhcp4",
"kea-dhcp6"
]
}