ofri masad has uploaded a new change for review.

Change subject: webadmin: QoS - check Peak not under Average
......................................................................

webadmin: QoS - check Peak not under Average

Add check to canDoAction of QoS commands to make sure that Peak value is
not lower then Average value.

Change-Id: I3e0c184cfb3e2deb0f39615800a2958b340ad724
Signed-off-by: Ofri Masad <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/NetworkQoSCommandBase.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
M backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
M 
frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
5 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/02/17202/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/NetworkQoSCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/NetworkQoSCommandBase.java
index 45e72b4..39c5dc9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/NetworkQoSCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/qos/NetworkQoSCommandBase.java
@@ -64,9 +64,20 @@
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_VALUES);
         }
 
+        if (peakLowerThenAverage()) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THEN_AVERAGE);
+        }
+
         return true;
     }
 
+    protected  boolean peakLowerThenAverage() {
+        return (getNetworkQoS().getInboundPeak() != null
+                && getNetworkQoS().getInboundPeak() < 
getNetworkQoS().getInboundAverage())
+                || (getNetworkQoS().getOutboundPeak() != null
+                && getNetworkQoS().getOutboundPeak() < 
getNetworkQoS().getOutboundAverage());
+    }
+
     protected boolean missingValues() {
         return missingValue(getNetworkQoS().getInboundAverage(),
                 getNetworkQoS().getInboundPeak(),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
index a3a0237..9c80c41 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/errors/VdcBllMessages.java
@@ -761,6 +761,7 @@
     ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_DATA(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND(ErrorType.BAD_PARAMETERS),
     ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID(ErrorType.BAD_PARAMETERS),
+    
ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THEN_AVERAGE(ErrorType.BAD_PARAMETERS),
 
     // memory QOS features
     QOS_BALLOON_NOT_SUPPORTED(ErrorType.BAD_PARAMETERS);
diff --git 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
index 14ed5a3..abde2c1 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -926,6 +926,7 @@
 ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_DATA=Cannot ${action} ${type}. Invalid 
QoS.
 ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND=Cannot ${action} ${type}. QoS entity 
not found.
 ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID=Cannot ${action} ${type}. Data 
Center does not contain the specific QoS entity.
+ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THEN_AVERAGE=Cannot ${action} 
${type}. Peak cannot be set lower then Average.
 QOS_NAME_NOT_NULL=QoS name cannot be empty.
 QOS_NAME_INVALID=Invalid QoS name (name must be formed of "a-z0-9A-Z" or "-_ ")
 QOS_NAME_TOO_LONG=QoS name length must be under 255 characters.
diff --git 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
index 96451eb..793be92 100644
--- 
a/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
+++ 
b/frontend/webadmin/modules/frontend/src/main/java/org/ovirt/engine/ui/frontend/AppErrors.java
@@ -2501,6 +2501,9 @@
     @DefaultStringValue("Cannot ${action} ${type}. Data Center does not 
contain the specific QoS entity.")
     String ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID();
 
+    @DefaultStringValue("Cannot ${action} ${type}. Peak cannot be set lower 
then Average.")
+    String ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THEN_AVERAGE();
+
     @DefaultStringValue("QoS name cannot be empty.")
     String QOS_NAME_NOT_NULL();
 
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index d41c223..58c26ab 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -906,6 +906,7 @@
 ACTION_TYPE_FAILED_NETWORK_QOS_MISSING_DATA=Cannot ${action} ${type}. Invalid 
QoS.
 ACTION_TYPE_FAILED_NETWORK_QOS_NOT_FOUND=Cannot ${action} ${type}. QoS entity 
not found.
 ACTION_TYPE_FAILED_NETWORK_QOS_INVALID_DC_ID=Cannot ${action} ${type}. Data 
Center does not contain the specific QoS entity.
+ACTION_TYPE_FAILED_NETWORK_QOS_PEAK_LOWER_THEN_AVERAGE=Cannot ${action} 
${type}. Peak cannot be set lower then Average.
 QOS_NAME_NOT_NULL=QoS name cannot be empty.
 QOS_NAME_INVALID=Invalid QoS name (name must be formed of "a-z0-9A-Z" or "-_ ")
 QOS_NAME_TOO_LONG=QoS name length must be under 255 characters.


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

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