]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1305] addresses comments
authorRazvan Becheriu <razvan@isc.org>
Tue, 18 Aug 2020 18:47:18 +0000 (21:47 +0300)
committerRazvan Becheriu <razvan@isc.org>
Tue, 18 Aug 2020 20:11:25 +0000 (23:11 +0300)
doc/sphinx/api/status-get.json
doc/sphinx/arm/ctrl-channel.rst
doc/sphinx/arm/hooks-ha.rst
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/tests/ctrl_dhcp4_srv_unittest.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/tests/ctrl_dhcp6_srv_unittest.cc

index e2facef9856639ae0034581fdba11120b31a0be2..3a61d75baa0a38a62fb0b30c0c6a09ab6292dcfa 100644 (file)
         "                    }",
         "                }",
         "            }",
-        "        ]",
+        "        ],",
+        "        \"multi-threading-enabled\": true,",
+        "        \"thread-pool-size\": 4,",
+        "        \"packet-queue-size\": 64",
         "    }",
         "}"
     ],
index 35cc66ec637472464aa1ccc34146d7afab61b38a..da0b4215669f9b2b6a7de8094dfeb6a52dffada0 100644 (file)
@@ -580,11 +580,22 @@ The ``status-get`` command returns server's runtime information:
      * remote: for the remote server the last known state, served
        HA scopes and the role of the server in HA relationship.
 
-The ``high-availability`` information is only returned when the command is
+ - multi-threading-enabled: flag indicating if multi-threading is enabled.
+
+ - thread-pool-size: number of dhcp service threads.
+
+ - packet-queue-size: size of the packet queue size.
+
+The ``high-availability`` information is returned only when the command is
 sent to the DHCP servers being in the HA setup. This parameter is
 never returned when the ``status-get`` command is sent to the
 Control Agent or DDNS deamon.
 
+The ``thread-pool-size`` and ``packet-queue-size`` information is returned only
+when the command is send to DHCP servers with multi-threading enabled. This
+parameter is never returned when the ``status-get`` command is sent to the
+Control Agent or DDNS deamon.
+
 To learn more about the HA status information returned by the
 ``status-get`` command please refer to the the :ref:`command-ha-status-get`
 section.
index 3de24d56c5e4bcf0f01999426149762508fa8ee3..0da4ea04ed2b5664966075b14a17f9c5750f21bc 100644 (file)
@@ -1617,7 +1617,10 @@ the HA status of two load balancing servers:
                        }
                    }
                }
-           ]
+           ],
+           "multi-threading-enabled": true,
+           "thread-pool-size": 4,
+           "packet-queue-size": 64
        }
    }
 
index f6a06b8a898c934bbb07f02d36bcf8ef577b3349..c38966d2e780abe233a60485ba2553846027d355 100644 (file)
@@ -661,10 +661,13 @@ ControlledDhcpv4Srv::commandStatusGetHandler(const string&,
     }
 
     if (MultiThreadingMgr::instance().getMode()) {
-        status->set("thread-pool-size", Element::create(
-                    long(MultiThreadingMgr::instance().getThreadPoolSize())));
-        status->set("packet-queue-size", Element::create(
-                    long(MultiThreadingMgr::instance().getPacketQueueSize())));
+        status->set("multi-threading-enabled", Element::create(true));
+        status->set("thread-pool-size", Element::create(static_cast<int32_t>(
+                        MultiThreadingMgr::instance().getThreadPoolSize())));
+        status->set("packet-queue-size", Element::create(static_cast<int32_t>(
+                        MultiThreadingMgr::instance().getPacketQueueSize())));
+    } else {
+        status->set("multi-threading-enabled", Element::create(false));
     }
 
     return (createAnswer(0, status));
index 22efe381e08581457399b6f09bba9bc01fa90cd8..e601e8d3097d013c49a2b948438b6186d7277054 100644 (file)
@@ -1120,6 +1120,16 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) {
     EXPECT_LE(found_reload->intValue(), 5);
     EXPECT_GE(found_reload->intValue(), 0);
 
+    auto found_multi_threading = arguments->get("multi-threading-enabled");
+    ASSERT_TRUE(found_multi_threading);
+    EXPECT_EQ(false, found_multi_threading->boolValue());
+
+    auto found_thread_count = arguments->get("thread-pool-size");
+    ASSERT_FALSE(found_thread_count);
+
+    auto found_queue_size = arguments->get("packet-queue-size");
+    ASSERT_FALSE(found_queue_size);
+
     MultiThreadingMgr::instance().setMode(true);
     MultiThreadingMgr::instance().setThreadPoolSize(4);
     MultiThreadingMgr::instance().setPacketQueueSize(64);
@@ -1153,11 +1163,15 @@ TEST_F(CtrlChannelDhcpv4SrvTest, statusGet) {
     EXPECT_LE(found_reload->intValue(), 5);
     EXPECT_GE(found_reload->intValue(), 0);
 
-    auto found_thread_count = arguments->get("thread-pool-size");
+    found_multi_threading = arguments->get("multi-threading-enabled");
+    ASSERT_TRUE(found_multi_threading);
+    EXPECT_EQ(true, found_multi_threading->boolValue());
+
+    found_thread_count = arguments->get("thread-pool-size");
     ASSERT_TRUE(found_thread_count);
     EXPECT_EQ(found_thread_count->intValue(), 4);
 
-    auto found_queue_size = arguments->get("packet-queue-size");
+    found_queue_size = arguments->get("packet-queue-size");
     ASSERT_TRUE(found_queue_size);
     EXPECT_EQ(found_queue_size->intValue(), 64);
 }
index 7a316363dd20b5538076529f346c623296486316..bcb9d3992d9247eb063701736b909cd55b0eeaa5 100644 (file)
@@ -664,10 +664,13 @@ ControlledDhcpv6Srv::commandStatusGetHandler(const string&,
     }
 
     if (MultiThreadingMgr::instance().getMode()) {
-        status->set("thread-pool-size", Element::create(
-                    long(MultiThreadingMgr::instance().getThreadPoolSize())));
-        status->set("packet-queue-size", Element::create(
-                    long(MultiThreadingMgr::instance().getPacketQueueSize())));
+        status->set("multi-threading-enabled", Element::create(true));
+        status->set("thread-pool-size", Element::create(static_cast<int32_t>(
+                        MultiThreadingMgr::instance().getThreadPoolSize())));
+        status->set("packet-queue-size", Element::create(static_cast<int32_t>(
+                        MultiThreadingMgr::instance().getPacketQueueSize())));
+    } else {
+        status->set("multi-threading-enabled", Element::create(false));
     }
 
     return (createAnswer(0, status));
index ac6ea65c7c050b90c29f34c8d86ad6cc346429da..50d5987c2101392fae99649d08787e016a47ce2b 100644 (file)
@@ -1010,6 +1010,16 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) {
     EXPECT_LE(found_reload->intValue(), 5);
     EXPECT_GE(found_reload->intValue(), 0);
 
+    auto found_multi_threading = arguments->get("multi-threading-enabled");
+    ASSERT_TRUE(found_multi_threading);
+    EXPECT_EQ(false, found_multi_threading->boolValue());
+
+    auto found_thread_count = arguments->get("thread-pool-size");
+    ASSERT_FALSE(found_thread_count);
+
+    auto found_queue_size = arguments->get("packet-queue-size");
+    ASSERT_FALSE(found_queue_size);
+
     MultiThreadingMgr::instance().setMode(true);
     MultiThreadingMgr::instance().setThreadPoolSize(4);
     MultiThreadingMgr::instance().setPacketQueueSize(64);
@@ -1043,11 +1053,15 @@ TEST_F(CtrlChannelDhcpv6SrvTest, statusGet) {
     EXPECT_LE(found_reload->intValue(), 5);
     EXPECT_GE(found_reload->intValue(), 0);
 
-    auto found_thread_count = arguments->get("thread-pool-size");
+    found_multi_threading = arguments->get("multi-threading-enabled");
+    ASSERT_TRUE(found_multi_threading);
+    EXPECT_EQ(true, found_multi_threading->boolValue());
+
+    found_thread_count = arguments->get("thread-pool-size");
     ASSERT_TRUE(found_thread_count);
     EXPECT_EQ(found_thread_count->intValue(), 4);
 
-    auto found_queue_size = arguments->get("packet-queue-size");
+    found_queue_size = arguments->get("packet-queue-size");
     ASSERT_TRUE(found_queue_size);
     EXPECT_EQ(found_queue_size->intValue(), 64);
 }