Gilad Chaplik has uploaded a new change for review.

Change subject: engine: scheduling optimization field
......................................................................

engine: scheduling optimization field

Add to cluster entity OptimizeForSpeed field.
Optimize for speed allows to skip host weighing in case
there are more than configurable amount of pending scheduling
requests.

Change-Id: I0784f89648093e650be73fcc3d850a4854d53c1a
Signed-off-by: Gilad Chaplik <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
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 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
M 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
A 
packaging/dbscripts/upgrade/03_03_0870_add_vds_group_scheduling_optimization_field.sql
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
M packaging/dbscripts/vds_groups_sp.sql
M packaging/etc/engine-config/engine-config.properties
18 files changed, 166 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/19270/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
index c31b91e..70bbe9c 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/SchedulingManager.java
@@ -11,6 +11,7 @@
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
 import 
org.ovirt.engine.core.bll.scheduling.external.ExternalSchedulerDiscoveryThread;
@@ -68,7 +69,7 @@
 
     private final Object policyUnitsLock = new Object();
 
-    private final ConcurrentHashMap<Guid, Object> clusterLockMap = new 
ConcurrentHashMap<Guid, Object>();
+    private final ConcurrentHashMap<Guid, Semaphore> clusterLockMap = new 
ConcurrentHashMap<Guid, Semaphore>();
 
     private final VdsFreeMemoryChecker noWaitingMemoryChecker = new 
VdsFreeMemoryChecker(new NonWaitingDelayer());
     private MigrationHandler migrationHandler;
@@ -170,8 +171,9 @@
             Guid destHostId,
             List<String> messages,
             VdsFreeMemoryChecker memoryChecker) {
-        clusterLockMap.putIfAbsent(cluster.getId(), new Object());
-        synchronized (clusterLockMap.get(cluster.getId())) {
+        clusterLockMap.putIfAbsent(cluster.getId(), new Semaphore(1));
+        try {
+            clusterLockMap.get(cluster.getId()).acquire();
             List<VDS> vdsList = getVdsDAO()
                     .getAllForVdsGroupWithStatus(cluster.getId(), 
VDSStatus.Up);
             updateInitialHostList(vdsList, hostBlackList, true);
@@ -206,7 +208,15 @@
             if (policy.getFunctions() == null || 
policy.getFunctions().isEmpty()) {
                 return vdsList.get(0).getId();
             }
-            Guid bestHost = runFunctions(policy.getFunctions(), vdsList, vm, 
parameters);
+            Guid bestHost = vdsList.get(0).getId();
+            // weigh hosts iff there are more than 1 host in case optimize for 
speed
+            // is true and there are more than configurable requests pending 
skip weighing
+            if (vdsList.size() > 1
+                    && (!cluster.isSchedulerOptimizeForSpeed()
+                    || clusterLockMap.get(cluster.getId()).getQueueLength() <=
+                    Config.<Integer> 
GetValue(ConfigValues.OptimizeSchedulerForSpeedPendingRequests))) {
+                bestHost = runFunctions(policy.getFunctions(), vdsList, vm, 
parameters);
+            }
             if (bestHost != null) {
                 getVdsDynamicDao().updatePartialVdsDynamicCalc(
                         bestHost,
@@ -217,6 +227,11 @@
                         vm.getNumOfCpus());
             }
             return bestHost;
+        } catch (InterruptedException e) {
+            // ignore
+            return null;
+        } finally {
+            clusterLockMap.get(cluster.getId()).release();
         }
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
index 55abfb4..48498ca 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
@@ -76,6 +76,8 @@
 
     private Map<String, String> clusterPolicyProperties;
 
+    private boolean schedulerOptimizeForSpeed;
+
     public VDSGroup() {
         migrateOnError = MigrateOnErrorOptions.YES;
         name = "";
@@ -265,6 +267,14 @@
         this.enableBallooning = enableBallooning;
     }
 
+    public boolean isSchedulerOptimizeForSpeed() {
+        return schedulerOptimizeForSpeed;
+    }
+
+    public void setSchedulerOptimizeForSpeed(boolean 
schedulerOptimizeForSpeed) {
+        this.schedulerOptimizeForSpeed = schedulerOptimizeForSpeed;
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -289,6 +299,7 @@
         result = prime * result + ((clusterPolicyName == null) ? 0 : 
clusterPolicyName.hashCode());
         result = prime * result + (clusterPolicyProperties == null ? 0 : 
clusterPolicyProperties.hashCode());
         result = prime * result + (enableBallooning ? 1231 : 1237);
+        result = prime * result + (schedulerOptimizeForSpeed ? 1231 : 1237);
         return result;
     }
 
@@ -324,6 +335,7 @@
                 && ObjectUtils.objectsEqual(clusterPolicyId, 
other.clusterPolicyId)
                 && ObjectUtils.objectsEqual(clusterPolicyName, 
other.clusterPolicyName)
                 && ObjectUtils.objectsEqual(clusterPolicyProperties, 
other.clusterPolicyProperties)
-                && enableBallooning == other.enableBallooning);
+                && enableBallooning == other.enableBallooning
+                && schedulerOptimizeForSpeed == 
other.schedulerOptimizeForSpeed);
     }
 }
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 6dcab75..0e16f75 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
@@ -1513,6 +1513,10 @@
     @DefaultValueAttribute("60")
     AutoStartVmsRunnerIntervalInSeconds(538),
 
+    @TypeConverterAttribute(Integer.class)
+    @DefaultValueAttribute("10")
+    OptimizeSchedulerForSpeedPendingRequests(539),
+
     Invalid(65535);
 
     private int intValue;
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 7a33a1a..2d91607 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
@@ -105,7 +105,8 @@
     QoSOutboundBurstDefaultValue,
     MaxVmNameLengthWindows(ConfigAuthType.User),
     MaxVmNameLengthNonWindows(ConfigAuthType.User),
-    AttestationServer
+    AttestationServer,
+    OptimizeSchedulerForSpeedPendingRequests
     ;
 
     public static enum ConfigAuthType {
diff --git 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java
 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java
index 67d6084..4045a8e 100644
--- 
a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java
+++ 
b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VdsGroupDAODbFacadeImpl.java
@@ -168,7 +168,8 @@
                 .addValue("cluster_policy_id", group.getClusterPolicyId())
                 .addValue("cluster_policy_custom_properties",
                                 
SerializationFactory.getSerializer().serialize(group.getClusterPolicyProperties()))
-                .addValue("enable_balloon", group.isEnableBallooning());
+                .addValue("enable_balloon", group.isEnableBallooning())
+                .addValue("optimize_for_speed", 
group.isSchedulerOptimizeForSpeed());
 
         return parameterSource;
     }
@@ -207,6 +208,7 @@
             
entity.setClusterPolicyProperties(SerializationFactory.getDeserializer()
                     
.deserializeOrCreateNew(rs.getString("cluster_policy_custom_properties"), 
LinkedHashMap.class));
             entity.setEnableBallooning(rs.getBoolean("enable_balloon"));
+            
entity.setSchedulerOptimizeForSpeed(rs.getBoolean("optimize_for_speed"));
 
             return entity;
         }
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
index b0b66f6..f5ff08a 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
@@ -59,6 +59,7 @@
         // set cluster policy name to allow equals method to succeed
         
newGroup.setClusterPolicyName(clusterPolicyDao.get(existingVdsGroup.getClusterPolicyId()).getName());
         newGroup.setClusterPolicyProperties(new LinkedHashMap<String, 
String>());
+        newGroup.setSchedulerOptimizeForSpeed(true);
     }
 
     /**
@@ -322,6 +323,7 @@
         existingVdsGroup.setName("This is the new name");
         existingVdsGroup.setVirtService(false);
         existingVdsGroup.setGlusterService(true);
+        existingVdsGroup.setSchedulerOptimizeForSpeed(false);
 
         dao.update(existingVdsGroup);
 
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 9ba2907..11da105 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -591,6 +591,7 @@
         <column>trusted_service</column>
         <column>cluster_policy_id</column>
         <column>cluster_policy_custom_properties</column>
+        <column>optimize_for_speed</column>
         <row>
             <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d1</value>
             <value>rhel6.iscsi</value>
@@ -610,6 +611,7 @@
             <value>false</value>
             <value>20d25257-b4bd-4589-92a6-c4c5c5d3fd1a</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d2</value>
@@ -630,6 +632,7 @@
             <value>false</value>
             <value>20d25257-b4bd-4589-92a6-c4c5c5d3fd1a</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>b399944a-81ab-4ec5-8266-e19ba7c3c9d3</value>
@@ -650,6 +653,7 @@
             <value>false</value>
             <value>20d25257-b4bd-4589-92a6-c4c5c5d3fd1a</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>0e57070e-2469-4b38-84a2-f111aaabd49d</value>
@@ -670,6 +674,7 @@
             <value>true</value>
             <value>20d25257-b4bd-4589-92a6-c4c5c5d3fd1a</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>eba797fb-8e3b-4777-b63c-92e7a5957d7c</value>
@@ -690,6 +695,7 @@
             <value>true</value>
             <value>5a2b0939-7d46-4b73-a469-e9c2c7fc6a53</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80", "LowUtilization" : "20"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>eba797fb-8e3b-4777-b63c-92e7a5957d7d</value>
@@ -710,6 +716,7 @@
             <value>false</value>
             <value>5a2b0939-7d46-4b73-a469-e9c2c7fc6a53</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80", "LowUtilization" : "20"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>eba797fb-8e3b-4777-b63c-92e7a5957d7e</value>
@@ -730,6 +737,7 @@
             <value>true</value>
             <value>5a2b0939-7d46-4b73-a469-e9c2c7fc6a53</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80", "LowUtilization" : "20"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>eba797fb-8e3b-4777-b63c-92e7a5957d7f</value>
@@ -750,6 +758,7 @@
             <value>true</value>
             <value>5a2b0939-7d46-4b73-a469-e9c2c7fc6a53</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80", "LowUtilization" : "20"}</value>
+            <value>false</value>
         </row>
         <row>
             <value>ae956031-6be2-43d6-bb8f-5191c9253314</value>
@@ -770,6 +779,7 @@
             <value>false</value>
             <value>5a2b0939-7d46-4b73-a469-e9c2c7fc6a53</value>
             <value>{"CpuOverCommitDurationMinutes" : "2", "HighUtilization" : 
"80", "LowUtilization" : "20"}</value>
+            <value>false</value>
         </row>
     </table>
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index 57903a2..bb17616 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -3276,4 +3276,9 @@
         Integer maxVmNameLengthNonWindows = (Integer) 
AsyncDataProvider.getConfigValuePreConverted(ConfigurationValues.MaxVmNameLengthNonWindows);
         return maxVmNameLengthNonWindows == null ? 64 : 
maxVmNameLengthNonWindows;
     }
+
+    public static int getOptimizeSchedulerForSpeedPendingRequests() {
+        return (Integer) 
getConfigValuePreConverted(ConfigurationValues.OptimizeSchedulerForSpeedPendingRequests,
+                getDefaultConfigurationVersion());
+    }
 }
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
index cd545af..460d696 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterListModel.java
@@ -369,6 +369,8 @@
             clusterModel.getEnableTrustedService().setIsChangable(false);
         }
 
+        
clusterModel.getOptimizeForSpeed().setEntity(cluster.isSchedulerOptimizeForSpeed());
+
         AsyncDataProvider.getAllowClusterWithVirtGlusterEnabled(new 
AsyncQuery(this, new INewAsyncCallback() {
             @Override
             public void onSuccess(Object model, Object returnValue) {
@@ -637,6 +639,7 @@
         cluster.setTrustedService((Boolean) 
model.getEnableTrustedService().getEntity());
         cluster.setClusterPolicyId(((ClusterPolicy) 
model.getClusterPolicy().getSelectedItem()).getId());
         
cluster.setClusterPolicyProperties(KeyValueModel.convertProperties(model.getCustomPropertySheet().getEntity()));
+        cluster.setSchedulerOptimizeForSpeed((Boolean) 
model.getOptimizeForSpeed().getEntity());
 
         model.startProgress(null);
 
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
index a41a690..beb0dfc 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/clusters/ClusterModel.java
@@ -488,6 +488,26 @@
         this.enableBallooning = enableBallooning;
     }
 
+    private EntityModel optimizeForUtilization;
+
+    public EntityModel getOptimizeForUtilization() {
+        return optimizeForUtilization;
+    }
+
+    public void setOptimizeForUtilization(EntityModel optimizeForUtilization) {
+        this.optimizeForUtilization = optimizeForUtilization;
+    }
+
+    private EntityModel optimizeForSpeed;
+
+    public EntityModel getOptimizeForSpeed() {
+        return optimizeForSpeed;
+    }
+
+    public void setOptimizeForSpeed(EntityModel optimizeForSpeed) {
+        this.optimizeForSpeed = optimizeForSpeed;
+    }
+
     private boolean isGeneralTabValid;
 
     public boolean getIsGeneralTabValid()
@@ -613,6 +633,12 @@
         }
 
         return AsyncDataProvider.getClusterDefaultMemoryOverCommit();
+    }
+
+    public String getSchedulerOptimizationInfoMessage(){
+        return ConstantsManager.getInstance()
+                .getMessages()
+                
.schedulerOptimizationInfo(AsyncDataProvider.getOptimizeSchedulerForSpeedPendingRequests());
     }
 
     public void setMemoryOverCommit(int value)
@@ -802,6 +828,13 @@
         setCountThreadsAsCores(new 
EntityModel(AsyncDataProvider.getClusterDefaultCountThreadsAsCores()));
 
         setVersionSupportsCpuThreads(new EntityModel(true));
+
+        setOptimizeForUtilization(new EntityModel());
+        setOptimizeForSpeed(new EntityModel());
+        getOptimizeForUtilization().setEntity(true);
+        getOptimizeForSpeed().setEntity(false);
+        getOptimizeForUtilization().getEntityChangedEvent().addListener(this);
+        getOptimizeForSpeed().getEntityChangedEvent().addListener(this);
 
         AsyncQuery _asyncQuery = new AsyncQuery();
         _asyncQuery.setModel(this);
@@ -1097,6 +1130,10 @@
                 {
                     getMigrateOnErrorOption_YES().setEntity(false);
                     getMigrateOnErrorOption_NO().setEntity(false);
+                } else if (senderEntityModel == getOptimizeForUtilization()) {
+                    getOptimizeForSpeed().setEntity(false);
+                } else if (senderEntityModel == getOptimizeForSpeed()) {
+                    getOptimizeForUtilization().setEntity(false);
                 }
             }
         }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
index 42854c5..4739ef0 100644
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
+++ 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/UIMessages.java
@@ -3,8 +3,6 @@
 import java.util.Date;
 import java.util.List;
 
-import com.google.gwt.i18n.client.Constants.DefaultStringValue;
-
 public interface UIMessages extends com.google.gwt.i18n.client.Messages {
 
     @DefaultMessage("One of the parameters isn''t supported (available 
parameter(s): {0})")
@@ -293,4 +291,9 @@
 
     @DefaultMessage("This Network QoS is used by {0} Vnic Profiles.\nAre you 
sure you want to remove this Network QoS?\n\n Profiles using this QoS:\n")
     String removeNetworkQoSMessage(int numOfProfiles);
+
+    @DefaultMessage("Optimize scheduling for host weighing (ordering):\n" +
+            "Utilization: include weight modules in shceduling to allow best 
selection\n" +
+            "Speed: skip host weighing in case there are more than {0} pending 
requests")
+    String schedulerOptimizationInfo(int numOfRequests);
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 93f514c..52f30b9 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -3239,4 +3239,14 @@
 
     @DefaultStringValue("Rebalance completed")
     String rebalanceCompleted();
+
+    @DefaultStringValue("Optimize for Utilization")
+    String optimizeForUtilizationLabel();
+
+    @DefaultStringValue("Optimize for Speed")
+    String optimizeForSpeedLabel();
+
+    @DefaultStringValue("Scheduler Optimization")
+    String schedulerOptimizationPanelLabel();
+
 }
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
index f905e1f..daf413f 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.java
@@ -36,6 +36,7 @@
 import com.google.gwt.editor.client.SimpleBeanEditorDriver;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.safehtml.shared.SafeHtmlUtils;
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.FlowPanel;
@@ -247,14 +248,34 @@
     @WithElementId
     EntityModelCheckBoxEditor enableBallooning;
 
+    @UiField
+    @Ignore
+    Label schedulerOptimizationPanelTitle;
+
+    @UiField(provided = true)
+    InfoIcon schedulerOptimizationInfoIcon;
+
+    @UiField(provided = true)
+    @Path(value = "optimizeForUtilization.entity")
+    @WithElementId
+    EntityModelRadioButtonEditor optimizeForUtilizationEditor;
+
+    @UiField(provided = true)
+    @Path(value = "optimizeForSpeed.entity")
+    @WithElementId
+    EntityModelRadioButtonEditor optimizeForSpeedEditor;
+
     private final Driver driver = GWT.create(Driver.class);
 
     private final ApplicationMessages messages;
+
+    private final ApplicationTemplates templates;
 
     @Inject
     public ClusterPopupView(EventBus eventBus, ApplicationResources resources, 
ApplicationConstants constants, ApplicationMessages messages, 
ApplicationTemplates templates) {
         super(eventBus, resources);
         this.messages = messages;
+        this.templates = templates;
         initListBoxEditors();
         initRadioButtonEditors();
         initCheckBoxEditors();
@@ -326,6 +347,10 @@
         
clusterPolicyEditor.setLabel(constants.clusterPolicySelectPolicyLabel());
 
         enableBallooning.setLabel(constants.enableBallooningLabel());
+
+        
schedulerOptimizationPanelTitle.setText(constants.schedulerOptimizationPanelLabel());
+        
optimizeForUtilizationEditor.setLabel(constants.optimizeForUtilizationLabel());
+        optimizeForSpeedEditor.setLabel(constants.optimizeForSpeedLabel());
     }
 
     private void initRadioButtonEditors() {
@@ -340,6 +365,9 @@
         migrateOnErrorOption_YESEditor = new 
EntityModelRadioButtonEditor("2"); //$NON-NLS-1$
         migrateOnErrorOption_HA_ONLYEditor = new 
EntityModelRadioButtonEditor("2"); //$NON-NLS-1$
         migrateOnErrorOption_NOEditor = new EntityModelRadioButtonEditor("2"); 
//$NON-NLS-1$
+
+        optimizeForUtilizationEditor = new EntityModelRadioButtonEditor("3"); 
//$NON-NLS-1$
+        optimizeForSpeedEditor = new EntityModelRadioButtonEditor("3"); 
//$NON-NLS-1$
     }
 
     private void initListBoxEditors() {
@@ -383,6 +411,7 @@
 
         enableBallooning = new EntityModelCheckBoxEditor(Align.RIGHT);
         enableBallooning.getContentWidgetContainer().setWidth("350px"); 
//$NON-NLS-1$
+
     }
 
     private void initInfoIcons(ApplicationResources resources, 
ApplicationConstants constants, ApplicationTemplates templates)
@@ -390,6 +419,7 @@
         memoryOptimizationInfo = new 
InfoIcon(templates.italicFixedWidth("465px", 
constants.clusterPopupMemoryOptimizationInfo()), resources); //$NON-NLS-1$
 
         cpuThreadsInfo = new InfoIcon(templates.italicFixedWidth("600px", 
constants.clusterPopupCpuThreadsInfo()), resources); //$NON-NLS-1$
+        schedulerOptimizationInfoIcon = new 
InfoIcon(SafeHtmlUtils.EMPTY_SAFE_HTML, resources);
     }
 
     private void applyModeCustomizations() {
@@ -474,6 +504,11 @@
                 
customPropertiesSheetEditor.edit(object.getCustomPropertySheet());
             }
         });
+
+        schedulerOptimizationInfoIcon.setText(SafeHtmlUtils.fromTrustedString(
+                templates.italicFixedWidth("350px",//$NON-NLS-1$
+                object.getSchedulerOptimizationInfoMessage()).asString()
+                        .replaceAll("(\r\n|\n)", "<br />"))); //$NON-NLS-1$ 
//$NON-NLS-2$
     }
 
     private void optimizationForServerFormatter(ClusterModel object) {
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
index fd452bd..3c2ebe7 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/popup/cluster/ClusterPopupView.ui.xml
@@ -216,6 +216,12 @@
                                                                <g:ScrollPanel 
height="100px">
                                                                        
<k:KeyValueWidget ui:field="customPropertiesSheetEditor" />
                                                                </g:ScrollPanel>
+                                                               <g:FlowPanel>
+                                                                       
<g:Label ui:field="schedulerOptimizationPanelTitle" 
addStyleNames="{style.panelTitle}" />
+                                                                       
<d:InfoIcon ui:field="schedulerOptimizationInfoIcon" 
addStyleNames="{style.panelInfo}" />
+                                                                       
<e:EntityModelRadioButtonEditor ui:field="optimizeForUtilizationEditor" 
addStyleNames="{style.label}" />
+                                                                       
<e:EntityModelRadioButtonEditor ui:field="optimizeForSpeedEditor" 
addStyleNames="{style.label}" />
+                                                               </g:FlowPanel>
                                                                <g:FlowPanel 
ui:field="additionPropsPanel" addStyleNames="{style.nestedSubsequentPanel}">
                                                                        
<g:Label ui:field="additionPropsPanelTitle" addStyleNames="{style.panelTitle}" 
/>
                                                                        
<e:EntityModelCheckBoxEditor ui:field="enableTrustedServiceEditor" />
diff --git 
a/packaging/dbscripts/upgrade/03_03_0870_add_vds_group_scheduling_optimization_field.sql
 
b/packaging/dbscripts/upgrade/03_03_0870_add_vds_group_scheduling_optimization_field.sql
new file mode 100644
index 0000000..e818dc1
--- /dev/null
+++ 
b/packaging/dbscripts/upgrade/03_03_0870_add_vds_group_scheduling_optimization_field.sql
@@ -0,0 +1 @@
+select fn_db_add_column('vds_groups', 'optimize_for_speed', 'boolean not null 
default false');
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index a02d727..b219b7d 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -375,6 +375,7 @@
 select fn_db_add_config_value('MTUOverrideSupported','true','3.1');
 select fn_db_add_config_value('MTUOverrideSupported','true','3.2');
 select fn_db_add_config_value('MTUOverrideSupported','true','3.3');
+select 
fn_db_add_config_value('OptimizeSchedulerForSpeedPendingRequests','10','general');
 --Handling Organization Name
 select fn_db_add_config_value('OrganizationName','oVirt','general');
 select fn_db_add_config_value('OriginType','OVIRT','general');
diff --git a/packaging/dbscripts/vds_groups_sp.sql 
b/packaging/dbscripts/vds_groups_sp.sql
index 093994c..1981cea 100644
--- a/packaging/dbscripts/vds_groups_sp.sql
+++ b/packaging/dbscripts/vds_groups_sp.sql
@@ -26,15 +26,16 @@
        v_trusted_service BOOLEAN,
         v_cluster_policy_id UUID,
         v_cluster_policy_custom_properties text,
-       v_enable_balloon BOOLEAN)
+       v_enable_balloon BOOLEAN,
+       v_optimize_for_speed BOOLEAN)
 RETURNS VOID
    AS $procedure$
 BEGIN
       INSERT INTO vds_groups(vds_group_id,description, name, 
free_text_comment, cpu_name, storage_pool_id,  max_vds_memory_over_commit, 
count_threads_as_cores, compatibility_version,
         transparent_hugepages, migrate_on_error, virt_service, 
gluster_service, tunnel_migration, emulated_machine, trusted_service, 
cluster_policy_id,
-        cluster_policy_custom_properties, enable_balloon)
+        cluster_policy_custom_properties, enable_balloon, optimize_for_speed)
        VALUES(v_vds_group_id,v_description, v_name, v_free_text_comment, 
v_cpu_name, v_storage_pool_id,  v_max_vds_memory_over_commit, 
v_count_threads_as_cores, v_compatibility_version,
-    v_transparent_hugepages, v_migrate_on_error, v_virt_service, 
v_gluster_service, v_tunnel_migration, v_emulated_machine, v_trusted_service, 
v_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon);
+    v_transparent_hugepages, v_migrate_on_error, v_virt_service, 
v_gluster_service, v_tunnel_migration, v_emulated_machine, v_trusted_service, 
v_cluster_policy_id, v_cluster_policy_custom_properties, v_enable_balloon, 
v_optimize_for_speed);
 END; $procedure$
 LANGUAGE plpgsql;
 
@@ -60,7 +61,8 @@
        v_trusted_service BOOLEAN,
         v_cluster_policy_id UUID,
         v_cluster_policy_custom_properties text,
-       v_enable_balloon BOOLEAN)
+       v_enable_balloon BOOLEAN,
+       v_optimize_for_speed BOOLEAN)
 RETURNS VOID
 
        --The [vds_groups] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -75,7 +77,8 @@
       migrate_on_error = v_migrate_on_error,
       virt_service = v_virt_service, gluster_service = v_gluster_service, 
tunnel_migration = v_tunnel_migration,
       emulated_machine = v_emulated_machine, trusted_service = 
v_trusted_service, cluster_policy_id = v_cluster_policy_id,
-      cluster_policy_custom_properties = v_cluster_policy_custom_properties, 
enable_balloon = v_enable_balloon
+      cluster_policy_custom_properties = v_cluster_policy_custom_properties, 
enable_balloon = v_enable_balloon,
+      optimize_for_speed = v_optimize_for_speed
       WHERE vds_group_id = v_vds_group_id;
 END; $procedure$
 LANGUAGE plpgsql;
diff --git a/packaging/etc/engine-config/engine-config.properties 
b/packaging/etc/engine-config/engine-config.properties
index 4f9074f..9a2401d 100644
--- a/packaging/etc/engine-config/engine-config.properties
+++ b/packaging/etc/engine-config/engine-config.properties
@@ -71,6 +71,8 @@
 MaxRerunVmOnVdsCount.type=Integer
 MaxSchedulerWeight.description="Max weight score for a single scheduler weight 
module"
 MaxSchedulerWeight.type=Integer
+OptimizeSchedulerForSpeedPendingRequests.description="Skip Host weights if 
there are more than X requests pending for scheduling"
+OptimizeSchedulerForSpeedPendingRequests.type=Integer
 MaxStorageVdsDelayCheckSec.description="Max delay for check of domain in 
seconds"
 MaxStorageVdsDelayCheckSec.type=Integer
 MaxStorageVdsTimeoutCheckSec.description="Max timeout for last check of domain 
in seconds"


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

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

Reply via email to