2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 13:37:55 +00:00

[#1735] Added log messages to HA config parsing

Added INFO level log messages when HA+MT has been
    disabled due to incompatible core or system settings.

modified:
    ha_config.cc
    ha_messages.mes
    ha_messages.cc
    ha_messages.h
This commit is contained in:
Thomas Markwalder
2021-04-08 13:08:18 -04:00
parent c47134972e
commit 14e3b308cc
4 changed files with 21 additions and 6 deletions

View File

@@ -13,6 +13,7 @@
#include <exceptions/exceptions.h>
#include <util/multi_threading_mgr.h>
#include <util/strutil.h>
#include <ha_log.h>
#include <ha_config.h>
#include <ha_service_states.h>
#include <sstream>
@@ -412,10 +413,8 @@ HAConfig::validate() {
CfgMultiThreading::extract(mcfg, dhcp_mt_enabled, dhcp_threads, dummy_queue_size);
if (!dhcp_mt_enabled) {
// @todo replace with a WARNING log
std::cout << "HA multi-threading cannot be enabled when"
<< " Kea core multi-threading is disabled"
<< std::endl;
// HA+MT requires DHCP multi-threading.
LOG_INFO(ha_logger, HA_CONFIG_DHCP_MT_DISABLED);
enable_multi_threading_ = false;
return;
}
@@ -425,8 +424,7 @@ HAConfig::validate() {
dhcp_threads = MultiThreadingMgr::detectThreadCount();
// If machine says it cannot support threads.
if (!dhcp_threads) {
// @todo - this needs a WARNING log
std::cout << "DHCP threads is 0, but detectThreadCount returns 0" << std::endl;
LOG_INFO(ha_logger, HA_CONFIG_SYSTEM_MT_UNSUPPORTED);
enable_multi_threading_ = false;
return;
}

View File

@@ -24,11 +24,13 @@ extern const isc::log::MessageID HA_COMMUNICATION_INTERRUPTED_CLIENT6_UNACKED =
extern const isc::log::MessageID HA_CONFIGURATION_FAILED = "HA_CONFIGURATION_FAILED";
extern const isc::log::MessageID HA_CONFIGURATION_SUCCESSFUL = "HA_CONFIGURATION_SUCCESSFUL";
extern const isc::log::MessageID HA_CONFIG_AUTO_FAILOVER_DISABLED = "HA_CONFIG_AUTO_FAILOVER_DISABLED";
extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED = "HA_CONFIG_DHCP_MT_DISABLED";
extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED = "HA_CONFIG_LEASE_SYNCING_DISABLED";
extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER = "HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER";
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER = "HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER";
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_DISABLED = "HA_CONFIG_LEASE_UPDATES_DISABLED";
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_DISABLED_REMINDER = "HA_CONFIG_LEASE_UPDATES_DISABLED_REMINDER";
extern const isc::log::MessageID HA_CONFIG_SYSTEM_MT_UNSUPPORTED = "HA_CONFIG_SYSTEM_MT_UNSUPPORTED";
extern const isc::log::MessageID HA_CONTINUE_HANDLER_FAILED = "HA_CONTINUE_HANDLER_FAILED";
extern const isc::log::MessageID HA_DEINIT_OK = "HA_DEINIT_OK";
extern const isc::log::MessageID HA_DHCP4_START_SERVICE_FAILED = "HA_DHCP4_START_SERVICE_FAILED";
@@ -121,11 +123,13 @@ const char* values[] = {
"HA_CONFIGURATION_FAILED", "failed to configure High Availability hooks library: %1",
"HA_CONFIGURATION_SUCCESSFUL", "HA hook library has been successfully configured",
"HA_CONFIG_AUTO_FAILOVER_DISABLED", "auto-failover disabled for %1",
"HA_CONFIG_DHCP_MT_DISABLED", "HA multi-threading has been disabled, it cannot be enabled when Kea global multi-threading is disabled",
"HA_CONFIG_LEASE_SYNCING_DISABLED", "lease database synchronization between HA servers is disabled",
"HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER", "bypassing SYNCING state because lease database synchronization is administratively disabled",
"HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER", "unusual configuration where \"send-lease-updates\": %1 and \"sync-leases\": %2",
"HA_CONFIG_LEASE_UPDATES_DISABLED", "lease updates will not be generated",
"HA_CONFIG_LEASE_UPDATES_DISABLED_REMINDER", "lease updates are administratively disabled and will not be generated while in %1 state",
"HA_CONFIG_SYSTEM_MT_UNSUPPORTED", "HA multi-threading has been disabled, auto-detection of thread support reports 0",
"HA_CONTINUE_HANDLER_FAILED", "ha-continue command failed: %1",
"HA_DEINIT_OK", "unloading High Availability hooks library successful",
"HA_DHCP4_START_SERVICE_FAILED", "failed to start DHCPv4 HA service in dhcp4_srv_configured callout: %1",

View File

@@ -25,11 +25,13 @@ extern const isc::log::MessageID HA_COMMUNICATION_INTERRUPTED_CLIENT6_UNACKED;
extern const isc::log::MessageID HA_CONFIGURATION_FAILED;
extern const isc::log::MessageID HA_CONFIGURATION_SUCCESSFUL;
extern const isc::log::MessageID HA_CONFIG_AUTO_FAILOVER_DISABLED;
extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED;
extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED;
extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER;
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER;
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_DISABLED;
extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_DISABLED_REMINDER;
extern const isc::log::MessageID HA_CONFIG_SYSTEM_MT_UNSUPPORTED;
extern const isc::log::MessageID HA_CONTINUE_HANDLER_FAILED;
extern const isc::log::MessageID HA_DEINIT_OK;
extern const isc::log::MessageID HA_DHCP4_START_SERVICE_FAILED;

View File

@@ -154,6 +154,17 @@ are administratively disabled and will not be issued in the HA state to
which the server has transitioned. The sole argument specifies the state
into which the server has transitioned.
% HA_CONFIG_DHCP_MT_DISABLED HA multi-threading has been disabled, it cannot be enabled when Kea global multi-threading is disabled
This informational message is issued when HA configuration has enabled
multi-threading while Kea global configuration has multi-threading disabled.
% HA_CONFIG_SYSTEM_MT_UNSUPPORTED HA multi-threading has been disabled, auto-detection of thread support reports 0
This informational message is issued when HA multi-threading configuration has
specified auto-detection for the number of threads to use and the system
reports the number of concurrent threads as 0. If you now your system can
support multiple threads, then you may override this condition by specifying
explicit values for http-listener-threads and http-client-threads.
% HA_CONTINUE_HANDLER_FAILED ha-continue command failed: %1
This error message is issued to indicate that the ha-continue command handler
failed while processing the command. The argument provides the reason for