diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 37c34c7692..65dc8007a5 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -792,24 +792,6 @@ public: return (io_service_); } - /// @brief Recount the leases per class for V4 leases. - /// - /// Clears the current class-lease counts and then iterates - /// over existing leases, retabulating counts based on class - /// lists in each lease user-context. - /// - /// For RDBMs back ends this is a NOP. - virtual void recountClassLeases4() {} - - /// @brief Recount the leases per class for V6 leases. - /// - /// Clears the current class-lease counts and then iterates - /// over existing leases, retabulating counts based on class - /// lists in each lease user-context. - /// - /// For RDBMs back ends this is a NOP. - virtual void recountClassLeases6() {} - /// @brief Returns the class lease count for a given class and lease type. /// /// @param client_class client class for which the count is desired diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index c8bb7556b9..2080986da5 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -2084,6 +2084,7 @@ Memfile_LeaseMgr::wipeLeases6(const SubnetID& subnet_id) { void Memfile_LeaseMgr::recountClassLeases4() { + class_lease_counter_.clear(); auto & idx = storage4_.get(); auto lower = idx.begin(); @@ -2099,6 +2100,7 @@ Memfile_LeaseMgr::recountClassLeases4() { void Memfile_LeaseMgr::recountClassLeases6() { + class_lease_counter_.clear(); auto & idx = storage6_.get(); auto lower = idx.begin(); diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.h b/src/lib/dhcpsrv/memfile_lease_mgr.h index e6da001913..b11eb59de3 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.h +++ b/src/lib/dhcpsrv/memfile_lease_mgr.h @@ -1219,6 +1219,13 @@ private: ClassLeaseCounter class_lease_counter_; public: + /// @brief Returns the class lease count for a given class and lease type. + /// + /// @param client_class client class for which the count is desired + /// @param ltype type of lease for which the count is desired. Defaults to + /// Lease::TYPE_V4. + virtual size_t getClassLeaseCount(const ClientClass& client_class, + const Lease::Type& ltype = Lease::TYPE_V4); /// @brief Recount the leases per class for V4 leases. /// @@ -1232,15 +1239,7 @@ public: /// Clears the current class-lease count map and then iterates /// over all, retabulating counts based on class lists in each lease /// user-context. - virtual void recountClassLeases6(); - - /// @brief Returns the class lease count for a given class and lease type. - /// - /// @param client_class client class for which the count is desired - /// @param ltype type of lease for which the count is desired. Defaults to - /// Lease::TYPE_V4. - virtual size_t getClassLeaseCount(const ClientClass& client_class, - const Lease::Type& ltype = Lease::TYPE_V4); + void recountClassLeases6(); /// @brief Clears the class-lease count map. void clearClassLeaseCounts();