From: Francis Dupont Date: Fri, 25 Oct 2019 14:50:59 +0000 (+0200) Subject: [904-add-ability-to-force-a-cb-update-remotely] Addressed comments but still command... X-Git-Tag: Kea-1.7.1~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4b9f16a61e14c285f016937ed842c0993bd2436;p=thirdparty%2Fkea.git [904-add-ability-to-force-a-cb-update-remotely] Addressed comments but still command to update --- diff --git a/doc/sphinx/arm/dhcp4-srv.rst b/doc/sphinx/arm/dhcp4-srv.rst index cb7613271b..f870bebf34 100644 --- a/doc/sphinx/arm/dhcp4-srv.rst +++ b/doc/sphinx/arm/dhcp4-srv.rst @@ -5891,9 +5891,10 @@ server's performance, because the server needs to make at least one query to the database to discover the pending configuration updates. The default value of the ``config-fetch-wait-time`` is 30 seconds. -To trigger an immediate polling the ``server-update`` command is -available for both DHCPv4 and DHCPv6 servers since the 1.7.1 Kea -release. +The ``server-update`` command can be used to force the server to +immediately poll the configuration changes from the database and avoid +waiting for the next fetch cycle. The command was added in 1.7.1 Kea +release for DHCPv4 and DHCPv6 servers. Finally, in the configuration example above, two hooks libraries are loaded. The first, ``libdhcp_mysql_cb.so``, is the implementation of diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 5c24fe64d8..3b4af1a352 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -565,6 +565,7 @@ ControlledDhcpv4Srv::commandServerUpdateHandler(const std::string&, server_->getCBControl()->databaseConfigFetch(srv_cfg, mode); } catch (const std::exception& ex) { LOG_ERROR(dhcp4_logger, DHCP4_CB_FETCH_UPDATES_FAIL) + .arg("server-update command") .arg(ex.what()); return (createAnswer(CONTROL_RESULT_ERROR, "Server update failed: " + string(ex.what()))); @@ -1077,6 +1078,7 @@ ControlledDhcpv4Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg, } catch (const std::exception& ex) { LOG_ERROR(dhcp4_logger, DHCP4_CB_FETCH_UPDATES_FAIL) + .arg("periodic poll") .arg(ex.what()); // We allow at most 10 consecutive failures after which we stop diff --git a/src/bin/dhcp4/dhcp4_messages.cc b/src/bin/dhcp4/dhcp4_messages.cc index 807b8147da..f08d23b89b 100644 --- a/src/bin/dhcp4/dhcp4_messages.cc +++ b/src/bin/dhcp4/dhcp4_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed Jul 10 2019 15:10 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 16:40 #include #include @@ -150,7 +150,7 @@ const char* values[] = { "DHCP4_BUFFER_RECEIVE_FAIL", "error on attempt to receive packet: %1", "DHCP4_BUFFER_UNPACK", "parsing buffer received from %1 to %2 over interface %3", "DHCP4_BUFFER_WAIT_SIGNAL", "signal received while waiting for next packet, next waiting signal is %1", - "DHCP4_CB_FETCH_UPDATES_FAIL", "error on attempt to fetch configuration updates from the configuration backend(s): %1", + "DHCP4_CB_FETCH_UPDATES_FAIL", "error on attempt to fetch configuration updates from the configuration backend(s) for %1: %2", "DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED", "maximum number of configuration fetch attempts: 10, has been exhausted without success", "DHCP4_CLASS_ASSIGNED", "%1: client packet has been assigned to the following class(es): %2", "DHCP4_CLASS_UNCONFIGURED", "%1: client packet belongs to an unconfigured class: %2", diff --git a/src/bin/dhcp4/dhcp4_messages.h b/src/bin/dhcp4/dhcp4_messages.h index f58ca25bbe..f08447d69b 100644 --- a/src/bin/dhcp4/dhcp4_messages.h +++ b/src/bin/dhcp4/dhcp4_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Wed Jul 10 2019 15:10 +// File created from ../../../src/bin/dhcp4/dhcp4_messages.mes on Fri Oct 25 2019 16:40 #ifndef DHCP4_MESSAGES_H #define DHCP4_MESSAGES_H diff --git a/src/bin/dhcp4/dhcp4_messages.mes b/src/bin/dhcp4/dhcp4_messages.mes index 7a0b1c19f2..e400a0cfbb 100644 --- a/src/bin/dhcp4/dhcp4_messages.mes +++ b/src/bin/dhcp4/dhcp4_messages.mes @@ -46,12 +46,14 @@ by the process. The signal will be handled before the server starts waiting for next packets. The argument specifies the next signal to be handled by the server. -% DHCP4_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1 +% DHCP4_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s) for %1: %2 This error message is issued when the server attempted to fetch configuration updates from the database and this attempt failed. -The server will re-try according to the configured value of the -config-fetch-wait-time parameter. The sole argument contains the -reason for failure. +If the error happens during periodic poll, the server will re-try +according to the configured value of the config-fetch-wait-time +parameter. The arguments contain the fetch context, i.e. during +periodic poll or by the server-update command, and the reason for +failure. % DHCP4_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success This error indicates that the server has made a number of unsuccessful diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index c84e71ba6d..9f86128b48 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -565,6 +565,7 @@ ControlledDhcpv6Srv::commandServerUpdateHandler(const std::string&, server_->getCBControl()->databaseConfigFetch(srv_cfg, mode); } catch (const std::exception& ex) { LOG_ERROR(dhcp6_logger, DHCP6_CB_FETCH_UPDATES_FAIL) + .arg("server-update command") .arg(ex.what()); return (createAnswer(CONTROL_RESULT_ERROR, "Server update failed: " + string(ex.what()))); @@ -1095,6 +1096,7 @@ ControlledDhcpv6Srv::cbFetchUpdates(const SrvConfigPtr& srv_cfg, } catch (const std::exception& ex) { LOG_ERROR(dhcp6_logger, DHCP6_CB_FETCH_UPDATES_FAIL) + .arg("periodic poll") .arg(ex.what()); // We allow at most 10 consecutive failures after which we stop diff --git a/src/bin/dhcp6/dhcp6_messages.cc b/src/bin/dhcp6/dhcp6_messages.cc index d4e7fc7c72..1c47f130c6 100644 --- a/src/bin/dhcp6/dhcp6_messages.cc +++ b/src/bin/dhcp6/dhcp6_messages.cc @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Jul 16 2019 11:03 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 16:41 #include #include diff --git a/src/bin/dhcp6/dhcp6_messages.h b/src/bin/dhcp6/dhcp6_messages.h index ccb62f0f7f..c5a99b6e5b 100644 --- a/src/bin/dhcp6/dhcp6_messages.h +++ b/src/bin/dhcp6/dhcp6_messages.h @@ -1,4 +1,4 @@ -// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Tue Jul 16 2019 11:03 +// File created from ../../../src/bin/dhcp6/dhcp6_messages.mes on Fri Oct 25 2019 16:41 #ifndef DHCP6_MESSAGES_H #define DHCP6_MESSAGES_H diff --git a/src/bin/dhcp6/dhcp6_messages.mes b/src/bin/dhcp6/dhcp6_messages.mes index c980593f61..d6e08f49ab 100644 --- a/src/bin/dhcp6/dhcp6_messages.mes +++ b/src/bin/dhcp6/dhcp6_messages.mes @@ -56,9 +56,11 @@ be handled by the server. % DHCP6_CB_FETCH_UPDATES_FAIL error on attempt to fetch configuration updates from the configuration backend(s): %1 This error message is issued when the server attempted to fetch configuration updates from the database and this attempt failed. -The server will re-try according to the configured value of the -config-fetch-wait-time parameter. The sole argument contains the -reason for failure. +If the error happens during periodic poll, the server will re-try +according to the configured value of the config-fetch-wait-time +parameter. The arguments contain the fetch context, i.e. during +periodic poll or by the server-update command, and the reason for +failure. % DHCP6_CB_FETCH_UPDATES_RETRIES_EXHAUSTED maximum number of configuration fetch attempts: 10, has been exhausted without success This error indicates that the server has made a number of unsuccessful