ofri masad has uploaded a new change for review.

Change subject: webadmin: Change in Network QoS UI
......................................................................

webadmin: Change in Network QoS UI

Change in the network QoS UI. Setting default values to all fields

Change-Id: I7808be49c10ff4bf3e566baa2667ac58a1dbc9ac
Signed-off-by: Ofri Masad <oma...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkQoSModel.java
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
M packaging/etc/engine-config/engine-config.properties
5 files changed, 53 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/17555/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index e3298f9..e36c940 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1437,17 +1437,33 @@
     @DefaultValueAttribute("10240")
     MaxBurstNetworkQoSValue(519),
 
-    @TypeConverterAttribute(Double.class)
-    @DefaultValueAttribute("2.0")
-    AverageToPeakRatio(520),
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("10")
+    QoSInboundAverageDefaultValue(520),
 
-    @TypeConverterAttribute(Double.class)
-    @DefaultValueAttribute("0.2")
-    AverageToBurstRatio(521),
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("10")
+    QoSInboundPeakDefaultValue(521),
+
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("100")
+    QoSInboundBurstDefaultValue(522),
+
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("10")
+    QoSOutboundAverageDefaultValue(523),
+
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("10")
+    QoSOutboundPeakDefaultValue(524),
+
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("100")
+    QoSOutboundBurstDefaultValue(525),
 
     @TypeConverterAttribute(Boolean.class)
     @DefaultValueAttribute("true")
-    NormalizedMgmgNetworkEnabled(522),
+    NormalizedMgmgNetworkEnabled(526),
 
     Invalid(65535);
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index b82aa5b..22985a4 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -97,8 +97,12 @@
     MaxAverageNetworkQoSValue,
     MaxPeakNetworkQoSValue,
     MaxBurstNetworkQoSValue,
-    AverageToPeakRatio,
-    AverageToBurstRatio
+    QoSInboundAverageDefaultValue,
+    QoSInboundPeakDefaultValue,
+    QoSInboundBurstDefaultValue,
+    QoSOutboundAverageDefaultValue,
+    QoSOutboundPeakDefaultValue,
+    QoSOutboundBurstDefaultValue
     ;
 
     public static enum ConfigAuthType {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkQoSModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkQoSModel.java
index 595626c..815e4ce 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkQoSModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/datacenters/NetworkQoSModel.java
@@ -21,8 +21,6 @@
 public abstract class NetworkQoSModel extends Model {
 
 
-    private static Double AVERAGE_TO_BURST_RATIO;
-    private static Double AVERAGE_TO_PEAK_RATIO;
     private final ListModel sourceListModel;
     private ListModel dataCenters;
 
@@ -39,28 +37,22 @@
     protected NetworkQoS networkQoS = new NetworkQoS();
 
     public NetworkQoSModel(DataCenterNetworkQoSListModel sourceListModel) {
-        AVERAGE_TO_PEAK_RATIO = (Double) 
AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.AverageToPeakRatio);
-        AVERAGE_TO_BURST_RATIO = (Double) 
AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.AverageToBurstRatio);
-
-
         this.sourceListModel = sourceListModel;
         setName(new EntityModel());
         setDataCenters(new ListModel());
         getDataCenters().setSelectedItem(sourceListModel.getDataCenter());
         getDataCenters().setIsChangable(false);
-        setInboundAverage(new EntityModel());
-        setInboundPeak(new EntityModel());
-        setInboundBurst(new EntityModel());
-        setOutboundAverage(new EntityModel());
-        setOutboundPeak(new EntityModel());
-        setOutboundBurst(new EntityModel());
+        setInboundAverage(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSInboundAverageDefaultValue)));
+        setInboundPeak(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSInboundPeakDefaultValue)));
+        setInboundBurst(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSInboundBurstDefaultValue)));
+        setOutboundAverage(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSOutboundAverageDefaultValue)));
+        setOutboundPeak(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSOutboundPeakDefaultValue)));
+        setOutboundBurst(new 
EntityModel(AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.QoSOutboundBurstDefaultValue)));
         addCommands();
         setInboundEnabled(new EntityModel(Boolean.TRUE));
         setOutboundEnabled(new EntityModel(Boolean.TRUE));
         getInboundEnabled().getEntityChangedEvent().addListener(this);
         getOutboundEnabled().getEntityChangedEvent().addListener(this);
-        getInboundAverage().getEntityChangedEvent().addListener(this);
-        getOutboundAverage().getEntityChangedEvent().addListener(this);
     }
 
     public ListModel getSourceListModel() {
@@ -180,39 +172,7 @@
             updateInboundAvailability();
         } else if (getOutboundEnabled().equals(sender)) {
             updateOutboundAvailability();
-        } else if (getInboundAverage().equals(sender)) {
-            updateInboundValues();
-        } else if (getOutboundAverage().equals(sender)) {
-            updateOutboundValues();
         }
-    }
-
-    private void updateOutboundValues() {
-        try {
-            int average = 
Integer.parseInt(getOutboundAverage().getEntity().toString());
-
-            if (getOutboundPeak().getEntity() == null || 
getOutboundPeak().getEntity() instanceof Integer) {
-                getOutboundPeak().setEntity((int) (average * 
AVERAGE_TO_PEAK_RATIO));
-            }
-            if (getOutboundBurst().getEntity() == null || 
getOutboundBurst().getEntity() instanceof Integer) {
-                getOutboundBurst().setEntity((int) (average * 
AVERAGE_TO_BURST_RATIO));
-            }
-
-        } catch (NumberFormatException ignored) {}
-    }
-
-    private void updateInboundValues() {
-        try {
-            int average = 
Integer.parseInt(getInboundAverage().getEntity().toString());
-
-            if (getInboundPeak().getEntity() == null || 
getInboundPeak().getEntity() instanceof Integer) {
-                getInboundPeak().setEntity((int) (average * 
AVERAGE_TO_PEAK_RATIO));
-            }
-            if (getInboundBurst().getEntity() == null || 
getInboundBurst().getEntity() instanceof Integer) {
-                getInboundBurst().setEntity((int) (average * 
AVERAGE_TO_BURST_RATIO));
-            }
-
-        } catch (NumberFormatException ignored) {}
     }
 
     private void updateOutboundAvailability() {
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index c8b692c..afbdaed 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -584,8 +584,12 @@
 select fn_db_add_config_value('MaxAverageNetworkQoSValue','1024','general');
 select fn_db_add_config_value('MaxPeakNetworkQoSValue','2048','general');
 select fn_db_add_config_value('MaxBurstNetworkQoSValue','10240','general');
-select fn_db_add_config_value('AverageToPeakRatio','2.0','general');
-select fn_db_add_config_value('AverageToBurstRatio','0.2','general');
+select fn_db_add_config_value('QoSInboundAverageDefaultValue','10','general');
+select fn_db_add_config_value('QoSInboundPeakDefaultValue','10','general');
+select fn_db_add_config_value('QoSInboundBurstDefaultValue','100','general');
+select fn_db_add_config_value('QoSOutboundAverageDefaultValue','10','general');
+select fn_db_add_config_value('QoSOutboundPeakDefaultValue','10','general');
+select fn_db_add_config_value('QoSOutboundBurstDefaultValue','100','general');
 
 
------------------------------------------------------------------------------------
 --                  Update with override section
diff --git a/packaging/etc/engine-config/engine-config.properties 
b/packaging/etc/engine-config/engine-config.properties
index 1ef4d81..2ed7304 100644
--- a/packaging/etc/engine-config/engine-config.properties
+++ b/packaging/etc/engine-config/engine-config.properties
@@ -293,7 +293,15 @@
 MaxPeakNetworkQoSValue.type=Integer
 MaxBurstNetworkQoSValue.description="Maximum value for Burst Networks QoS (Mb)"
 MaxBurstNetworkQoSValue.type=Integer
-AverageToPeakRatio.description="Ratio between the Average and the 
automatically suggested value of Peak in Network QoS UI"
-AverageToPeakRatio.type=Double
-AverageToBurstRatio.description="Ratio between the Average and the 
automatically suggested value of Burst in Network QoS UI"
-AverageToBurstRatio.type=Double
\ No newline at end of file
+QoSInboundAverageDefaultValue.description="Default value for Network QoS 
Inbound Average (Mbps)"
+QoSInboundAverageDefaultValue.type=Integer
+QoSInboundPeakDefaultValue.description="Default value for Network QoS Inbound 
Peak (Mbps)"
+QoSInboundPeakDefaultValue.type=Integer
+QoSInboundBurstDefaultValue.description="Default value for Network QoS Inbound 
Burst (Mbps)"
+QoSInboundBurstDefaultValue.type=Integer
+QoSOutboundAverageDefaultValue.description="Default value for Network QoS 
Outbound Average (Mbps)"
+QoSOutboundAverageDefaultValue.type=Integer
+QoSOutboundPeakDefaultValue.description="Default value for Network QoS 
Outbound Peak (Mbps)"
+QoSOutboundPeakDefaultValue.type=Integer
+QoSOutboundBurstDefaultValue.description="Default value for Network QoS 
Outbound Burst (Mbps)"
+QoSOutboundBurstDefaultValue.type=Integer
\ No newline at end of file


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

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