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

[#3178] Include server-name in status-get

This commit is contained in:
Marcin Siodelski 2024-01-05 17:25:04 +01:00
parent 83385b13a8
commit c48734c20e
4 changed files with 20 additions and 2 deletions

View File

@ -2172,7 +2172,8 @@ the HA status of two ``load-balancing`` servers:
"local": { "local": {
"role": "primary", "role": "primary",
"scopes": [ "server1" ], "scopes": [ "server1" ],
"state": "load-balancing" "state": "load-balancing",
"server-name": "server1"
}, },
"remote": { "remote": {
"age": 10, "age": 10,
@ -2184,7 +2185,8 @@ the HA status of two ``load-balancing`` servers:
"connecting-clients": 2, "connecting-clients": 2,
"unacked-clients": 1, "unacked-clients": 1,
"unacked-clients-left": 2, "unacked-clients-left": 2,
"analyzed-packets": 8 "analyzed-packets": 8,
"server-name": "server2"
} }
} }
} }

View File

@ -1662,6 +1662,7 @@ HAService::processStatusGet() const {
list->add(Element::create(scope)); list->add(Element::create(scope));
} }
local->set("scopes", list); local->set("scopes", list);
local->set("server-name", Element::create(config_->getThisServerName()));
ha_servers->set("local", local); ha_servers->set("local", local);
// Do not include remote server information if this is a backup server or // Do not include remote server information if this is a backup server or
@ -1682,6 +1683,7 @@ HAService::processStatusGet() const {
} catch (...) { } catch (...) {
remote->set("role", Element::create(std::string())); remote->set("role", Element::create(std::string()));
} }
remote->set("server-name", Element::create(config_->getFailoverPeerConfig()->getName()));
ha_servers->set("remote", remote); ha_servers->set("remote", remote);
return (ha_servers); return (ha_servers);

View File

@ -1683,9 +1683,11 @@ TEST_F(HAImplTest, statusGet) {
" \"local\": {" " \"local\": {"
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"scopes\": [ ]," " \"scopes\": [ ],"
" \"server-name\": \"server1\","
" \"state\": \"waiting\"" " \"state\": \"waiting\""
" }," " },"
" \"remote\": {" " \"remote\": {"
" \"server-name\": \"server2\","
" \"age\": 0," " \"age\": 0,"
" \"in-touch\": false," " \"in-touch\": false,"
" \"last-scopes\": [ ]," " \"last-scopes\": [ ],"
@ -1743,6 +1745,7 @@ TEST_F(HAImplTest, statusGetBackupServer) {
" \"local\": {" " \"local\": {"
" \"role\": \"backup\"," " \"role\": \"backup\","
" \"scopes\": [ ]," " \"scopes\": [ ],"
" \"server-name\": \"server3\","
" \"state\": \"backup\"" " \"state\": \"backup\""
" }" " }"
" }" " }"
@ -1791,6 +1794,7 @@ TEST_F(HAImplTest, statusGetPassiveBackup) {
" \"local\": {" " \"local\": {"
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"scopes\": [ \"server1\" ]," " \"scopes\": [ \"server1\" ],"
" \"server-name\": \"server1\","
" \"state\": \"passive-backup\"" " \"state\": \"passive-backup\""
" }" " }"
" }" " }"
@ -1839,6 +1843,7 @@ TEST_F(HAImplTest, statusGetHubAndSpoke) {
" \"local\": {" " \"local\": {"
" \"role\": \"standby\"," " \"role\": \"standby\","
" \"scopes\": [ ]," " \"scopes\": [ ],"
" \"server-name\": \"server2\","
" \"state\": \"waiting\"" " \"state\": \"waiting\""
" }," " },"
" \"remote\": {" " \"remote\": {"
@ -1850,6 +1855,7 @@ TEST_F(HAImplTest, statusGetHubAndSpoke) {
" \"last-scopes\": [ ]," " \"last-scopes\": [ ],"
" \"last-state\": \"\"," " \"last-state\": \"\","
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"server-name\": \"server1\","
" \"unacked-clients\": 0," " \"unacked-clients\": 0,"
" \"unacked-clients-left\": 0" " \"unacked-clients-left\": 0"
" }" " }"
@ -1861,6 +1867,7 @@ TEST_F(HAImplTest, statusGetHubAndSpoke) {
" \"local\": {" " \"local\": {"
" \"role\": \"standby\"," " \"role\": \"standby\","
" \"scopes\": [ ]," " \"scopes\": [ ],"
" \"server-name\": \"server4\","
" \"state\": \"waiting\"" " \"state\": \"waiting\""
" }," " },"
" \"remote\": {" " \"remote\": {"
@ -1872,6 +1879,7 @@ TEST_F(HAImplTest, statusGetHubAndSpoke) {
" \"last-scopes\": [ ]," " \"last-scopes\": [ ],"
" \"last-state\": \"\"," " \"last-state\": \"\","
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"server-name\": \"server3\","
" \"unacked-clients\": 0," " \"unacked-clients\": 0,"
" \"unacked-clients-left\": 0" " \"unacked-clients-left\": 0"
" }" " }"

View File

@ -2391,9 +2391,11 @@ TEST_F(HAServiceTest, hotStandbyScopeSelectionThisPrimary) {
" \"local\": {" " \"local\": {"
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"scopes\": [ \"server1\" ]," " \"scopes\": [ \"server1\" ],"
" \"server-name\": \"server1\","
" \"state\": \"hot-standby\"" " \"state\": \"hot-standby\""
" }, " " }, "
" \"remote\": {" " \"remote\": {"
" \"server-name\": \"server2\","
" \"age\": 0," " \"age\": 0,"
" \"in-touch\": false," " \"in-touch\": false,"
" \"role\": \"standby\"," " \"role\": \"standby\","
@ -2440,9 +2442,11 @@ TEST_F(HAServiceTest, hotStandbyScopeSelectionThisStandby) {
" \"local\": {" " \"local\": {"
" \"role\": \"standby\"," " \"role\": \"standby\","
" \"scopes\": [ ]," " \"scopes\": [ ],"
" \"server-name\": \"server2\","
" \"state\": \"waiting\"" " \"state\": \"waiting\""
" }, " " }, "
" \"remote\": {" " \"remote\": {"
" \"server-name\": \"server1\","
" \"age\": 0," " \"age\": 0,"
" \"in-touch\": false," " \"in-touch\": false,"
" \"role\": \"primary\"," " \"role\": \"primary\","
@ -6054,9 +6058,11 @@ TEST_F(HAServiceStateMachineTest, waitingParterDownLoadBalancingPartnerDown) {
" \"local\": {" " \"local\": {"
" \"role\": \"primary\"," " \"role\": \"primary\","
" \"scopes\": [ \"server1\" ], " " \"scopes\": [ \"server1\" ], "
" \"server-name\": \"server1\","
" \"state\": \"load-balancing\"" " \"state\": \"load-balancing\""
" }, " " }, "
" \"remote\": {" " \"remote\": {"
" \"server-name\": \"server2\","
" \"age\": " + s.str() + "," " \"age\": " + s.str() + ","
" \"in-touch\": true," " \"in-touch\": true,"
" \"role\": \"secondary\"," " \"role\": \"secondary\","