Xiaolei Shi has uploaded a new change for review.

Change subject: core: Avoid starting vm failed if pin to host is removed
......................................................................

core: Avoid starting vm failed if pin to host is removed

If the vm configured vm numa nodes and pinned them to host numa nodes,
when the host was removed,the pinned host numa nodes would be removed
also. Now if you try to run the vm, it would fail. This patch will
avoid this situation.

Change-Id: Icbbfd981d0996689cdc818bdd02e31155799d55c
Bug-Url: https://bugzilla.redhat.com/1101387
Signed-off-by: Bruce Shi <xiao-lei....@hp.com>
---
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/NumaUtils.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
2 files changed, 14 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/28166/1

diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/NumaUtils.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/NumaUtils.java
index 0015e4f..b83ddcb 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/NumaUtils.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/NumaUtils.java
@@ -42,7 +42,7 @@
     public static List<Integer> getPinnedNodeIndexList(List<Pair<Guid, 
Pair<Boolean, Integer>>> nodeList) {
         List<Integer> nodeIndexes = new ArrayList<>(nodeList.size());
         for (Pair<Guid, Pair<Boolean, Integer>> item : nodeList) {
-            if (item.getSecond().getFirst()) {
+            if (item.getSecond().getFirst() && item.getFirst() != null) {
                 nodeIndexes.add(item.getSecond().getSecond());
             }
         }
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
index cbb3b1a..0ec6fc1 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
@@ -196,6 +196,9 @@
                     }
                     else {
                         
vmNumaNodePinInfo.addAll(NumaUtils.getPinnedNodeIndexList(node.getVdsNumaNodeList()));
+                        if (vmNumaNodePinInfo.isEmpty()) {
+                            useAllVdsNodesMem = true;
+                        }
                     }
                 }
                 createInfo.put(VdsProperties.VM_NUMA_NODES, createVmNumaNodes);
@@ -215,11 +218,16 @@
                             
NumaUtils.buildStringFromListForNuma(vmNumaNodePinInfo));
                 }
             }
-            createInfo.put(VdsProperties.NUMA_TUNE, createNumaTune);
-            if (StringUtils.isEmpty(vm.getCpuPinning())) {
-                Map<String, Object> cpuPinDict = 
addCpuPinningForNumaSetting(vmNumaNodes, totalVdsNumaNodes);
-                if (!cpuPinDict.isEmpty()) {
-                    createInfo.put(VdsProperties.cpuPinning, cpuPinDict);
+            if (createNumaTune.containsKey(VdsProperties.NUMA_TUNE_NODESET) &&
+                    
StringUtils.isNotEmpty((String)createNumaTune.get(VdsProperties.NUMA_TUNE_NODESET)))
 {
+                createInfo.put(VdsProperties.NUMA_TUNE, createNumaTune);
+            }
+            if (!totalVdsNumaNodes.isEmpty()) {
+                if (StringUtils.isEmpty(vm.getCpuPinning())) {
+                    Map<String, Object> cpuPinDict = 
addCpuPinningForNumaSetting(vmNumaNodes, totalVdsNumaNodes);
+                    if (!cpuPinDict.isEmpty()) {
+                        createInfo.put(VdsProperties.cpuPinning, cpuPinDict);
+                    }
                 }
             }
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icbbfd981d0996689cdc818bdd02e31155799d55c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Xiaolei Shi <xiao-lei....@hp.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to