2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-30 05:27: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": {
"role": "primary",
"scopes": [ "server1" ],
"state": "load-balancing"
"state": "load-balancing",
"server-name": "server1"
},
"remote": {
"age": 10,
@ -2184,7 +2185,8 @@ the HA status of two ``load-balancing`` servers:
"connecting-clients": 2,
"unacked-clients": 1,
"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));
}
local->set("scopes", list);
local->set("server-name", Element::create(config_->getThisServerName()));
ha_servers->set("local", local);
// Do not include remote server information if this is a backup server or
@ -1682,6 +1683,7 @@ HAService::processStatusGet() const {
} catch (...) {
remote->set("role", Element::create(std::string()));
}
remote->set("server-name", Element::create(config_->getFailoverPeerConfig()->getName()));
ha_servers->set("remote", remote);
return (ha_servers);

View File

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

View File

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