From b3aeef43df7f59dfb6fff77291340c1680aa924f Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 31 Aug 2021 19:05:04 +0200 Subject: [PATCH] M #-: Deal with Address Range resize to 0 (cherry picked from commit e8f1a7641cf36831bf5426b1d2f17120ab893d2a) --- src/vnm/AddressRange.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/vnm/AddressRange.cc b/src/vnm/AddressRange.cc index efe1839d8b..b8e2abb463 100644 --- a/src/vnm/AddressRange.cc +++ b/src/vnm/AddressRange.cc @@ -446,7 +446,18 @@ int AddressRange::update_attributes( return -1; } - if (allocated.upper_bound(new_size-1) != allocated.end()) + std::map::iterator it; + + if ( new_size == 0 ) + { + it = allocated.find(0); + } + else + { + it = allocated.upper_bound(new_size - 1); + } + + if (it != allocated.end()) { error_msg = "New SIZE cannot be applied. There are used leases" " that would fall outside the range.";