Roy Golan has uploaded a new change for review.

Change subject: core: maxVCpus revised
......................................................................

core: maxVCpus revised

we need to make sure must be result of cores * socket otherwise the VM
will fail to load by libvirt

for:
c  = 12 // cores
maxSocket = 16 //config
maxVCpu = 160 // config

maxVCpu = c * (min(maxSockets, maxVCpu / c)) // 12 * 13 = 156

prior to this fix vdsm would end up with

<vcpu current=12>160</vcpu>
<topology cores=12 socket=13 thread=1>

and 160 couldn't be fulfilled by cores * socket, 156

Change-Id: I2880c0a1523bf5c4a6b5144860efafb6df82deb4
Bug-Url: https://bugzilla.redhat.com/??????
Signed-off-by: Roy Golan <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VmInfoBuilderBase.java
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/39/31439/1

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 defedf7..54b9e65 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
@@ -83,16 +83,9 @@
                     ConfigValues.HotPlugCpuSupported,
                     vm.getVdsGroupCompatibilityVersion(),
                     vm.getClusterArch())) {
-                Integer maxSockets = Config.<Integer>getValue(
-                        ConfigValues.MaxNumOfVmSockets,
-                        vm.getVdsGroupCompatibilityVersion().getValue());
-                Integer maxVCpus = Config.<Integer>getValue(
-                        ConfigValues.MaxNumOfVmCpus,
-                        vm.getVdsGroupCompatibilityVersion().getValue());
-                maxVCpus = Math.min(maxVCpus, (vm.getCpuPerSocket() * 
maxSockets));
                 createInfo.put(
                         VdsProperties.max_number_of_cpus,
-                        maxVCpus.toString());
+                        calcMaxVCpu().toString());
             }
         }
         final String compatibilityVersion = 
vm.getVdsGroupCompatibilityVersion().toString();
@@ -170,6 +163,17 @@
         }
     }
 
+    private Integer calcMaxVCpu() {
+        Integer maxSockets = Config.<Integer>getValue(
+                ConfigValues.MaxNumOfVmSockets,
+                vm.getVdsGroupCompatibilityVersion().getValue());
+        Integer maxVCpus = Config.<Integer>getValue(
+                ConfigValues.MaxNumOfVmCpus,
+                vm.getVdsGroupCompatibilityVersion().getValue());
+        maxVCpus = vm.getCpuPerSocket() * (Math.min(maxSockets, maxVCpus / 
vm.getCpuPerSocket()));
+        return maxVCpus;
+    }
+
     private void addCpuPinning(final String compatibilityVersion) {
         final String cpuPinning = vm.getCpuPinning();
         if (StringUtils.isNotEmpty(cpuPinning)


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

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

Reply via email to