Moti Asayag has uploaded a new change for review.

Change subject: engine: Fail import vm if mac addresses are missing
......................................................................

engine: Fail import vm if mac addresses are missing

When a vm is imported as new entity, there is a
mac allocation for any imported vnic. If the mac
addresses pool has insufficient addresses, the
action fails during the execution. The patch fails
the operation on can-do-action with a proper message
to the user for the failure reason.

Change-Id: I86680baa28c22def751c9c092f4cfde26ab1c45c
Bug-Url: https://bugzilla.redhat.com/1008168
Signed-off-by: Moti Asayag <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/20589/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
index 1084edf..f2f0f35 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
@@ -187,6 +187,11 @@
 
         if (getParameters().isImportAsNewEntity()) {
             initImportClonedVm();
+
+            if (getVm().getInterfaces().size() > 
MacPoolManager.getInstance().getAvailableMacsCount()) {
+                
addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES);
+                return false;
+            }
         }
 
         return canDoActionAfterCloneVm(domainsMap);


-- 
To view, visit http://gerrit.ovirt.org/20589
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86680baa28c22def751c9c092f4cfde26ab1c45c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Moti Asayag <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to