Browse Source

[5341] Default lfc-interval is now set to 3600.

Marcin Siodelski 7 years ago
parent
commit
11408b4728

+ 2 - 2
doc/guide/dhcp4-srv.xml

@@ -352,8 +352,8 @@ be followed by a comma and another object definition.</para>
       removes redundant (historical) information from the lease file
       removes redundant (historical) information from the lease file
       and effectively reduces the lease file size. The cleanup process is described
       and effectively reduces the lease file size. The cleanup process is described
       in more detailed fashion further in this section. The default value of the
       in more detailed fashion further in this section. The default value of the
-      <command>lfc-interval</command> is <userinput>0</userinput>, which disables
-      the LFC.</simpara>
+      <command>lfc-interval</command> is <userinput>3600</userinput>. A value of 0
+      disables the LFC.</simpara>
     </listitem>
     </listitem>
 
 
   </itemizedlist>
   </itemizedlist>

+ 2 - 2
doc/guide/dhcp6-srv.xml

@@ -347,8 +347,8 @@ be followed by a comma and another object definition.</para>
       removes redundant (historical) information from the lease file
       removes redundant (historical) information from the lease file
       and effectively reduces the lease file size. The cleanup process is described
       and effectively reduces the lease file size. The cleanup process is described
       in more detailed fashion further in this section. The default value of the
       in more detailed fashion further in this section. The default value of the
-      <command>lfc-interval</command> is <userinput>0</userinput>, which disables
-      the LFC.</simpara>
+      <command>lfc-interval</command> is <userinput>3600</userinput>. A value of 0
+      disables the LFC.</simpara>
     </listitem>
     </listitem>
 
 
   </itemizedlist>
   </itemizedlist>

+ 2 - 1
src/bin/keactrl/kea-dhcp4.conf.pre

@@ -61,7 +61,8 @@
     "lease-database": {
     "lease-database": {
         // Memfile is the simplest and easiest backend to use. It's a in-memory
         // Memfile is the simplest and easiest backend to use. It's a in-memory
         // C++ database that stores its state in CSV file.
         // C++ database that stores its state in CSV file.
-        "type": "memfile"
+        "type": "memfile",
+        "lfc-interval": 3600
     },
     },
 
 
     // Kea allows storing host reservations in a database. If your network is
     // Kea allows storing host reservations in a database. If your network is

+ 2 - 1
src/bin/keactrl/kea-dhcp6.conf.pre

@@ -53,7 +53,8 @@
     // There are dedicated examples for each backend. See Section 8.2.2 "Lease
     // There are dedicated examples for each backend. See Section 8.2.2 "Lease
     // Storage" for details.
     // Storage" for details.
     "lease-database": {
     "lease-database": {
-        "type": "memfile"
+        "type": "memfile",
+        "lfc-interval": 3600
     },
     },
 
 
     // Kea allows storing host reservations in a database. If your network is
     // Kea allows storing host reservations in a database. If your network is

+ 2 - 2
src/lib/dhcpsrv/memfile_lease_mgr.cc

@@ -1219,11 +1219,11 @@ Memfile_LeaseMgr::lfcCallback() {
 
 
 void
 void
 Memfile_LeaseMgr::lfcSetup(bool conversion_needed) {
 Memfile_LeaseMgr::lfcSetup(bool conversion_needed) {
-    std::string lfc_interval_str = "0";
+    std::string lfc_interval_str = "3600";
     try {
     try {
         lfc_interval_str = conn_.getParameter("lfc-interval");
         lfc_interval_str = conn_.getParameter("lfc-interval");
     } catch (const std::exception&) {
     } catch (const std::exception&) {
-        // Ignore and default to 0.
+        // Ignore and default to 3600.
     }
     }
 
 
     uint32_t lfc_interval = 0;
     uint32_t lfc_interval = 0;

+ 5 - 1
src/lib/dhcpsrv/tests/memfile_lease_mgr_unittest.cc

@@ -188,7 +188,8 @@ public:
         std::ostringstream s;
         std::ostringstream s;
         s << "type=memfile " << (u == V4 ? "universe=4 " : "universe=6 ")
         s << "type=memfile " << (u == V4 ? "universe=4 " : "universe=6 ")
           << "name="
           << "name="
-          << getLeaseFilePath(u == V4 ? "leasefile4_0.csv" : "leasefile6_0.csv");
+          << getLeaseFilePath(u == V4 ? "leasefile4_0.csv" : "leasefile6_0.csv")
+          << " lfc-interval=0";
         return (s.str());
         return (s.str());
     }
     }
 
 
@@ -426,6 +427,7 @@ TEST_F(MemfileLeaseMgrTest, persistLeases) {
 
 
     DatabaseConnection::ParameterMap pmap;
     DatabaseConnection::ParameterMap pmap;
     pmap["universe"] = "4";
     pmap["universe"] = "4";
+    pmap["lfc-interval"] = "0";
     // Specify the names of the lease files. Leases will be written.
     // Specify the names of the lease files. Leases will be written.
     pmap["name"] = getLeaseFilePath("leasefile4_1.csv");
     pmap["name"] = getLeaseFilePath("leasefile4_1.csv");
     boost::scoped_ptr<Memfile_LeaseMgr> lease_mgr(new Memfile_LeaseMgr(pmap));
     boost::scoped_ptr<Memfile_LeaseMgr> lease_mgr(new Memfile_LeaseMgr(pmap));
@@ -1633,6 +1635,7 @@ TEST_F(MemfileLeaseMgrTest, lease4ContainerIndexUpdate) {
     pmap["universe"] = "4";
     pmap["universe"] = "4";
     pmap["name"] = leasefile;
     pmap["name"] = leasefile;
     pmap["persist"] = "true";
     pmap["persist"] = "true";
+    pmap["lfc-interval"] = "0";
 
 
     srand(seed);
     srand(seed);
 
 
@@ -1772,6 +1775,7 @@ TEST_F(MemfileLeaseMgrTest, lease6ContainerIndexUpdate) {
     pmap["universe"] = "6";
     pmap["universe"] = "6";
     pmap["name"] = leasefile;
     pmap["name"] = leasefile;
     pmap["persist"] = "true";
     pmap["persist"] = "true";
+    pmap["lfc-interval"] = "0";
 
 
     srand(seed);
     srand(seed);