ofri masad has uploaded a new change for review.

Change subject: core: Fix for wrong error massage in add disk
......................................................................

core: Fix for wrong error massage in add disk

while quota in audit mode, when user tried to add a disk to an SD which
has no assigned quota - an error message was presented and the operation
was blocked. The error message was not correctly formatted.

This happens because when the DC was moved from Enforced to Audit mode
the quota cache was not refreshed. So all quotas on that DC remained in
the old enforcement mode.

Fixed the cache refresh rule. Now that the error is thrown from the
correct place in the code and only in Enforced mode, it is correctly
formatted.

Change-Id: Ifb23898a52c654dd03b7c9d1421fe456c9196da2
Bug-Url: https://bugzilla.redhat.com/906485
Signed-off-by: Ofri Masad <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
2 files changed, 4 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/95/13195/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
index e97c4bf..e9b8ecb 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
@@ -723,7 +723,7 @@
         }
 
         if (!storageDomainInQuota) {
-            
parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_QUOTA_IS_NOT_VALID.toString());
+            
parameters.getCanDoActionMessages().add(VdcBllMessages.ACTION_TYPE_FAILED_NO_QUOTA_SET_FOR_DOMAIN.toString());
             log.errorFormat("Quota storage parameters from command: {0}. 
Storage domain does not match quota",
                     parameters.getAuditLogable().getClass().getName());
             return false;
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
index 150f0f4..e3d7a3d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/UpdateStoragePoolCommand.java
@@ -11,7 +11,6 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.VdcObjectType;
 import org.ovirt.engine.core.common.action.StoragePoolManagementParameter;
-import org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum;
 import org.ovirt.engine.core.common.businessentities.StorageDomainStatic;
 import org.ovirt.engine.core.common.businessentities.StorageDomainType;
 import org.ovirt.engine.core.common.businessentities.StorageFormatType;
@@ -73,7 +72,7 @@
     }
 
     private void updateQuotaCache() {
-        if(wasQuotaEnforcementDisabled()){
+        if(wasQuotaEnforcementChanged()){
             
getQuotaManager().removeStoragePoolFromCache(getStoragePool().getId());
         }
     }
@@ -81,9 +80,8 @@
     /**
      * Checks whether part of the update was disabling quota enforcement on 
the Data Center
      */
-    private boolean wasQuotaEnforcementDisabled() {
-        return _oldStoragePool.getQuotaEnforcementType() != 
QuotaEnforcementTypeEnum.DISABLED
-                && getStoragePool().getQuotaEnforcementType() == 
QuotaEnforcementTypeEnum.DISABLED;
+    private boolean wasQuotaEnforcementChanged() {
+        return _oldStoragePool.getQuotaEnforcementType() != 
getStoragePool().getQuotaEnforcementType();
     }
 
     private void updateStoragePoolFormatType() {


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

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

Reply via email to