ofri masad has uploaded a new change for review.

Change subject: core: Add Audit log messages for Quota "Audit" mode
......................................................................

core: Add Audit log messages for Quota "Audit" mode

Added different log messages for quota. When Quota is in "Audit"
enforcement mode, the actions are not blocked - so the message needs to
be different.

Change-Id: I29efba60b9f48a4397bcf42e7956a8a024116bc2
Bug-Url: https://bugzilla.redhat.com/895633
Signed-off-by: Ofri Masad <oma...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/quota/QuotaManager.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
M 
backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
3 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/17370/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 253316d..000a558 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
@@ -286,7 +286,9 @@
                     storageRequestPercentage);
             requestIsApproved = true;
         } else {
-            log.setFirst(AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT);
+            log.setFirst(quotaEnforcementTypeEnum == 
QuotaEnforcementTypeEnum.HARD_ENFORCEMENT ?
+                    AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT :
+                    
AuditLogType.USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT_PERMISSIVE_MODE);
             quotaManagerAuditLogger.addCustomValuesStorage(log.getSecond(),
                     quota.getQuotaName(),
                     quota.getId(),
@@ -367,7 +369,9 @@
                     newMemoryPercent > 100);
             requestIsApproved = true;
         } else {
-            
auditLogPair.setFirst(AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT); 
// passed the grace
+            auditLogPair.setFirst(quotaEnforcementTypeEnum == 
QuotaEnforcementTypeEnum.HARD_ENFORCEMENT ?
+                    AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT:
+                    
AuditLogType.USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT_PERMISSIVE_MODE); // 
passed the grace
             
quotaManagerAuditLogger.addCustomValuesVdsGroup(auditLogPair.getSecond(),
                     quota.getQuotaName(),
                     quota.getId(),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
index d9425dd..77ccfce 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java
@@ -201,6 +201,8 @@
     QUOTA_STORAGE_RESIZE_LOWER_THEN_CONSUMPTION(3012),
     MISSING_QUOTA_STORAGE_PARAMETERS_PERMISSIVE_MODE(3013),
     MISSING_QUOTA_CLUSTER_PARAMETERS_PERMISSIVE_MODE(3014),
+    USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT_PERMISSIVE_MODE(3015),
+    USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT_PERMISSIVE_MODE(3016),
 
     // Gluster Audit Logs
     GLUSTER_VOLUME_CREATE(4000),
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
index 56349a0..3f49445 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties
@@ -107,9 +107,11 @@
 USER_DELETE_QUOTA=Quota ${QuotaName} has been deleted by ${UserName}.
 USER_FAILED_DELETE_QUOTA=Failed to delete Quota ${QuotaName}. The operation 
was initiated by ${UserName}..
 USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT=Cluster-Quota ${QuotaName} limit 
exceeded and operation was blocked. Utilization: ${Utilization}, Requested: 
${Requested} - Please select a different quota or contact your administrator to 
extend the quota.
+USER_EXCEEDED_QUOTA_VDS_GROUP_GRACE_LIMIT_PERMISSIVE_MODE=Cluster-Quota 
${QuotaName} limit exceeded, proceeding since in Permissive (Audit) mode. 
Utilization: ${Utilization}, Requested: ${Requested} - Please select a 
different quota or contact your administrator to extend the quota.
 USER_EXCEEDED_QUOTA_VDS_GROUP_LIMIT=Cluster-Quota ${QuotaName} limit exceeded 
and entered the grace zone. Utilization: ${Utilization} (It is advised to 
select a different quota or contact your administrator to extend the quota).
 USER_EXCEEDED_QUOTA_VDS_GROUP_THRESHOLD=Cluster-Quota ${QuotaName} is about to 
exceed. Utilization: ${Utilization}
 USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT=Storage-Quota ${QuotaName} limit 
exceeded and operation was blocked. Utilization(used/requested): 
${CurrentStorage}%/${Requested}% - Please select a different quota or contact 
your administrator to extend the quota.
+USER_EXCEEDED_QUOTA_STORAGE_GRACE_LIMIT_PERMISSIVE_MODE=Storage-Quota 
${QuotaName} limit exceeded, proceeding since in Permissive (Audit) mode. 
Utilization(used/requested): ${CurrentStorage}%/${Requested}% - Please select a 
different quota or contact your administrator to extend the quota.
 USER_EXCEEDED_QUOTA_STORAGE_LIMIT=Storage-Quota ${QuotaName} limit exceeded 
and entered the grace zone. Utilization: ${CurrentStorage}% (It is advised to 
select a different quota or contact your administrator to extend the quota).
 USER_EXCEEDED_QUOTA_STORAGE_THRESHOLD=Storage-Quota ${QuotaName} is about to 
exceed. Utilization: ${CurrentStorage}%
 QUOTA_STORAGE_RESIZE_LOWER_THEN_CONSUMPTION=Storage-Quota ${QuotaName}: the 
new size set for this quota is less than current disk utilization.


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I29efba60b9f48a4397bcf42e7956a8a024116bc2
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