plysan has uploaded a new change for review.

Change subject: engine: Insufficient free macs while there is enough macs in 
pool
......................................................................

engine: Insufficient free macs while there is enough macs in pool

When required mac address allocation is bigger than available macs
count in a specific mac range in mac pool, while smaller than
available macs count in mac pool, 'Insufficient amount of free
MACs' error happens.

This patch avoid consuming a mac range with the mac count bigger
than the mac rang's available macs.

Change-Id: Ie3087ad5278da6b4c26ff5123fcd9c07b1dfcec8
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1208416
Signed-off-by: plysan <ply...@gmail.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/MacsStorage.java
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/39483/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/MacsStorage.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/MacsStorage.java
index dfaf926..e5c47d4 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/MacsStorage.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/MacsStorage.java
@@ -65,7 +65,11 @@
         int remainingMacs = numberOfMacs;
         while (remainingMacs > 0) {
             final Range rangeWithAvailableMac = getRangeWithAvailableMac();
-            final List<Long> allocatedMacs = 
rangeWithAvailableMac.allocateMacs(remainingMacs);
+            int allocatingMacsCount = remainingMacs;
+            if (rangeWithAvailableMac.getAvailableCount() < remainingMacs) {
+                allocatingMacsCount = 
rangeWithAvailableMac.getAvailableCount();
+            }
+            final List<Long> allocatedMacs = 
rangeWithAvailableMac.allocateMacs(allocatingMacsCount);
 
             remainingMacs -= allocatedMacs.size();
             result.addAll(allocatedMacs);


-- 
To view, visit https://gerrit.ovirt.org/39483
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3087ad5278da6b4c26ff5123fcd9c07b1dfcec8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: plysan <ply...@gmail.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to