Martin Sivák has uploaded a new change for review.

Change subject: Add scheduling filter that checks NUMA compatibility
......................................................................

Add scheduling filter that checks NUMA compatibility

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1149494
Change-Id: I0a6a0883a2098c26971ca69641675da9eb724a3d
Signed-off-by: Martin Sivák <msi...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java
A 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/NumaFilterPolicyUnit.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/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
M 
frontend/webadmin/modules/webadmin/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
A packaging/dbscripts/upgrade/03_06_510_add_numa_policy_unit.sql
8 files changed, 63 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/34699/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java
index ee9376a..2c63000 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/PolicyUnitImpl.java
@@ -19,6 +19,7 @@
 import org.ovirt.engine.core.bll.scheduling.policyunits.NetworkPolicyUnit;
 import org.ovirt.engine.core.bll.scheduling.policyunits.NoneBalancePolicyUnit;
 import org.ovirt.engine.core.bll.scheduling.policyunits.NoneWeightPolicyUnit;
+import org.ovirt.engine.core.bll.scheduling.policyunits.NumaFilterPolicyUnit;
 import org.ovirt.engine.core.bll.scheduling.policyunits.PinToHostPolicyUnit;
 import 
org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingBalancePolicyUnit;
 import 
org.ovirt.engine.core.bll.scheduling.policyunits.PowerSavingWeightPolicyUnit;
@@ -44,6 +45,8 @@
 
     public static PolicyUnitImpl getPolicyUnitImpl(PolicyUnit policyUnit) {
         switch (policyUnit.getName()) {
+        case "NUMA":
+            return new NumaFilterPolicyUnit(policyUnit);
         case "PinToHost":
             return new PinToHostPolicyUnit(policyUnit);
         case "CPU":
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/NumaFilterPolicyUnit.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/NumaFilterPolicyUnit.java
new file mode 100644
index 0000000..c3e2092
--- /dev/null
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/scheduling/policyunits/NumaFilterPolicyUnit.java
@@ -0,0 +1,47 @@
+package org.ovirt.engine.core.bll.scheduling.policyunits;
+
+import org.apache.commons.lang.StringUtils;
+import org.ovirt.engine.core.bll.CpuFlagsManagerHandler;
+import org.ovirt.engine.core.bll.scheduling.PolicyUnitImpl;
+import org.ovirt.engine.core.common.businessentities.ServerCpu;
+import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.errors.VdcBllMessages;
+import org.ovirt.engine.core.common.scheduling.PerHostMessages;
+import org.ovirt.engine.core.common.scheduling.PolicyUnit;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class NumaFilterPolicyUnit extends PolicyUnitImpl {
+    public NumaFilterPolicyUnit(PolicyUnit policyUnit) {
+        super(policyUnit);
+    }
+
+    @Override
+    public List<VDS> filter(List<VDS> hosts, VM vm, Map<String, String> 
parameters,
+                            PerHostMessages messages) {
+        if (!vm.getvNumaNodeList().isEmpty()) {
+            List<VDS> hostsToRunOn = new ArrayList<VDS>();
+            for (VDS host : hosts) {
+                if (host.getNumaNodeList().isEmpty()) {
+                    messages.addMessage(host.getId(), 
VdcBllMessages.VAR__DETAIL__LOW_CPU_LEVEL.toString());
+
+                    log.debugFormat("Host {0} was filtered out as it does not 
support NUMA features requested by VM {1}",
+                            host.getName(),
+                            vm.getName());
+                } else {
+                    log.debugFormat("Host {0} was not filtered out as it does 
support NUMA features requested by VM {1}",
+                            host.getName(),
+                            vm.getName());
+                    hostsToRunOn.add(host);
+                }
+            }
+
+            return hostsToRunOn;
+        } else {
+            return hosts;
+        }
+    }
+}
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 3e584fa..3a75525 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
@@ -1028,6 +1028,7 @@
     VAR__DETAIL__NOT_ENOUGH_CORES,
     VAR__DETAIL__NUMA_PINNING_FAILED,
     VAR__DETAIL__NOT_HE_HOST,
+    VAR__DETAIL__NOT_NUMA_HOST,
     SCHEDULING_NO_HOSTS,
     SCHEDULING_HOST_FILTERED_REASON,
     SCHEDULING_HOST_FILTERED_REASON_WITH_DETAIL,
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 b4b1970..d7a0ba5 100644
--- 
a/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
+++ 
b/backend/manager/modules/dal/src/main/resources/bundles/AppErrors.properties
@@ -1233,6 +1233,7 @@
 VAR__DETAIL__NOT_ENOUGH_CORES=$detailMessage it does not have enough cores to 
run the VM
 VAR__DETAIL__NUMA_PINNING_FAILED=$detailMessage it has insufficient NUMA node 
free memory to run the VM
 VAR__DETAIL__NOT_HE_HOST=$detailMessage it is not a Hosted Engine host.
+VAR__DETAIL__NOT_NUMA_HOST=$detailMessage it does not support NUMA.
 SCHEDULING_NO_HOSTS=There are no hosts to use. Check that the cluster contains 
at least one host in Up state.
 VAR__FILTERTYPE__EXTERNAL=$filterType external
 VAR__FILTERTYPE__INTERNAL=$filterType internal
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 70cc80f..701d8cc 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
@@ -3293,6 +3293,9 @@
     @DefaultStringValue("$detailMessage it is not a Hosted Engine host.")
     String VAR__DETAIL__NOT_HE_HOST();
 
+    @DefaultStringValue("$detailMessage it does not support NUMA.")
+    String VAR__DETAIL__NOT_NUMA_HOST();
+
     @DefaultStringValue("There are no hosts to use. Check that the cluster 
contains at least one host in Up state.")
     String SCHEDULING_NO_HOSTS();
 
diff --git 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
index 52c500e..4ce4a9d 100644
--- 
a/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
+++ 
b/frontend/webadmin/modules/userportal-gwtp/src/main/resources/org/ovirt/engine/ui/frontend/AppErrors.properties
@@ -1018,6 +1018,7 @@
 VAR__DETAIL__NOT_ENOUGH_CORES=$detailMessage it does not have enough cores to 
run the VM
 VAR__DETAIL__NUMA_PINNING_FAILED=$detailMessage it has insufficient NUMA node 
free memory to run the VM
 VAR__DETAIL__NOT_HE_HOST=$detailMessage it is not a Hosted Engine host.
+VAR__DETAIL__NOT_NUMA_HOST=$detailMessage it does not support NUMA.
 SCHEDULING_NO_HOSTS=There are no hosts to use. Check that the cluster contains 
at least one host in Up state.
 VAR__FILTERTYPE__EXTERNAL=$filterType external
 VAR__FILTERTYPE__INTERNAL=$filterType internal
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 27f3aae..4990fa7 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
@@ -1196,6 +1196,7 @@
 VAR__DETAIL__NOT_ENOUGH_CORES=$detailMessage it does not have enough cores to 
run the VM
 VAR__DETAIL__NUMA_PINNING_FAILED=$detailMessage it has insufficient NUMA node 
free memory to run the VM
 VAR__DETAIL__NOT_HE_HOST=$detailMessage it is not a Hosted Engine host.
+VAR__DETAIL__NOT_NUMA_HOST=$detailMessage it does not support NUMA.
 SCHEDULING_NO_HOSTS=There are no hosts to use. Check that the cluster contains 
at least one host in Up state.
 VAR__FILTERTYPE__EXTERNAL=$filterType external
 VAR__FILTERTYPE__INTERNAL=$filterType internal
diff --git a/packaging/dbscripts/upgrade/03_06_510_add_numa_policy_unit.sql 
b/packaging/dbscripts/upgrade/03_06_510_add_numa_policy_unit.sql
new file mode 100644
index 0000000..b2cfa85
--- /dev/null
+++ b/packaging/dbscripts/upgrade/03_06_510_add_numa_policy_unit.sql
@@ -0,0 +1,6 @@
+INSERT INTO policy_units (id, name, is_internal, custom_properties_regex, 
type, enabled, description) VALUES ('e659c871-0bf1-4ccc-b748-f28f5d08ddd0', 
'NUMA', true, NULL, 0, true, 'Do not attempt to start NUMA VMs on non-NUMA 
hosts.');
+
+INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, 
filter_sequence, factor) VALUES ('20d25257-b4bd-4589-92a6-c4c5c5d3fd1a', 
'e659c871-0bf1-4ccc-b748-f28f5d08ddd0', 0, 0);
+INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, 
filter_sequence, factor) VALUES ('5a2b0939-7d46-4b73-a469-e9c2c7fc6a53', 
'e659c871-0bf1-4ccc-b748-f28f5d08ddd0', 0, 0);
+INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, 
filter_sequence, factor) VALUES ('b4ed2332-a7ac-4d5f-9596-99a439cb2812', 
'e659c871-0bf1-4ccc-b748-f28f5d08ddd0', 0, 0);
+INSERT INTO cluster_policy_units (cluster_policy_id, policy_unit_id, 
filter_sequence, factor) VALUES ('8d5d7bec-68de-4a67-b53e-0ac54686d579', 
'e659c871-0bf1-4ccc-b748-f28f5d08ddd0', 0, 0);
\ No newline at end of file


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0a6a0883a2098c26971ca69641675da9eb724a3d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to