ofri masad has uploaded a new change for review.

Change subject: core: Fix cant add LUN disk bug
......................................................................

core: Fix cant add LUN disk bug

Adding LUN disk was causing InvalidQuotaParameterException
because the Quota checks requires storage-pool.

Adding LUN is done by the AddDiskCommand and it has no defined
storage-pool (and no quota consumption).

The check was changed so that the storage-pool would be looked for only
if the command return not-empty list of quotaConsumptioParameters.

Change-Id: I72e5e856debc15a4e566287cedfe63ea04dbc1b5
Signed-off-by: Ofri Masad <oma...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
1 file changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/11/9411/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
index 29d157d..55991c7 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CommandBase.java
@@ -636,11 +636,6 @@
             return true;
         }
 
-        if (getStoragePool() == null) {
-            throw new InvalidQuotaParametersException("Command: " + 
this.getClass().getName()
-                    + ". Storage pool is not available for quota calculation. 
");
-        }
-
         QuotaConsumptionParametersWrapper quotaConsumptionParametersWrapper = 
new QuotaConsumptionParametersWrapper(this,
                 getReturnValue().getCanDoActionMessages());
         
quotaConsumptionParametersWrapper.setParameters(getQuotaConsumptionParameters());
@@ -650,6 +645,15 @@
                     + ". No Quota parameters available.");
         }
 
+        if (quotaConsumptionParametersWrapper.getParameters().isEmpty()) {
+            return true;
+        }
+
+        if (getStoragePool() == null) {
+            throw new InvalidQuotaParametersException("Command: " + 
this.getClass().getName()
+                    + ". Storage pool is not available for quota calculation. 
");
+        }
+
         boolean result = 
getQuotaManager().consume(quotaConsumptionParametersWrapper);
         setQuotaChanged(result);
         return result;


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I72e5e856debc15a4e566287cedfe63ea04dbc1b5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: ofri masad <oma...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to