Browse Source

[5307] Addressed review comments.

- Increase total_attempts one by one.
- Add debug message to indicate skipping reservations in subnet
  which classes do not match.
Marcin Siodelski 7 years ago
parent
commit
30ee1d625f
2 changed files with 16 additions and 2 deletions
  1. 10 2
      src/lib/dhcpsrv/alloc_engine.cc
  2. 6 0
      src/lib/dhcpsrv/alloc_engine_messages.mes

+ 10 - 2
src/lib/dhcpsrv/alloc_engine.cc

@@ -333,6 +333,13 @@ AllocEngine::findReservationInternal(ContextType& ctx,
                     break;
                     break;
                 }
                 }
             }
             }
+
+        } else {
+            LOG_DEBUG(alloc_engine_logger, ALLOC_ENGINE_DBG_TRACE,
+                      ALLOC_ENGINE_RESERVATIONS_SKIPPED)
+                .arg(ctx.query_->getLabel())
+                .arg(subnet->toText());
+
         }
         }
 
 
         // We need to get to the next subnet if this is a shared network. If it
         // We need to get to the next subnet if this is a shared network. If it
@@ -771,9 +778,10 @@ AllocEngine::allocateUnreservedLeases6(ClientContext6& ctx) {
         uint64_t max_attempts = (attempts_ > 0 ? attempts_  :
         uint64_t max_attempts = (attempts_ > 0 ? attempts_  :
                                  subnet->getPoolCapacity(ctx.currentIA().type_));
                                  subnet->getPoolCapacity(ctx.currentIA().type_));
 
 
-        total_attempts += max_attempts;
-
         for (uint64_t i = 0; i < max_attempts; ++i) {
         for (uint64_t i = 0; i < max_attempts; ++i) {
+
+            ++total_attempts;
+
             IOAddress candidate = allocator->pickAddress(subnet, ctx.duid_,
             IOAddress candidate = allocator->pickAddress(subnet, ctx.duid_,
                                                          hint);
                                                          hint);
 
 

+ 6 - 0
src/lib/dhcpsrv/alloc_engine_messages.mes

@@ -18,6 +18,12 @@ reclaimed has a corresponding DNS entry it needs to be removed.
 This message indicates that removal of the DNS entry has failed.
 This message indicates that removal of the DNS entry has failed.
 Nevertheless the lease will be reclaimed.
 Nevertheless the lease will be reclaimed.
 
 
+% ALLOC_ENGINE_RESERVATIONS_SKIPPED %1 not using reservations in subnet %2 because client's classes do not match
+This debug message is issued when the allocation engine will not use host
+reservations in a given subnet because this subnet is not allowed for
+the given client due to client classification. The first argument includes
+client identification information. The second argument identifies a subnet.
+
 % ALLOC_ENGINE_V4_ALLOC_ERROR %1: error during attempt to allocate an IPv4 address: %2
 % ALLOC_ENGINE_V4_ALLOC_ERROR %1: error during attempt to allocate an IPv4 address: %2
 An error occurred during an attempt to allocate an IPv4 address, the
 An error occurred during an attempt to allocate an IPv4 address, the
 reason for the failure being contained in the message.  The server will
 reason for the failure being contained in the message.  The server will