This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.14
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.14 by this push:
     new 1a47719  kvm: set cpu topology only if cpucore per socket is positive 
value (#4527)
1a47719 is described below

commit 1a4771958860a72f50d179b58c4e319c99d12308
Author: Wei Zhou <[email protected]>
AuthorDate: Thu Dec 10 09:59:28 2020 +0100

    kvm: set cpu topology only if cpucore per socket is positive value (#4527)
    
    This PR fixes a regression issue in #4497
    
    In cloudstack 4.14 or before, the cpu topology is set only when cpucore per 
socket is set (to 4 or 6).
    in other conditions, there is no cpu topology in vm xml definition.
    
    with #4497, vm will have cpu topology in its xml definition, if cpucore per 
socket is not set.
    
        <topology sockets='<vm cpu cores>' cores='1' threads='1'/>
    Not sure if it causes any issue. I think it would be better not to add this 
part in vm xml definition if cpucore per socket is not set.
---
 .../com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index c438833..efda1a2 100644
--- 
a/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ 
b/plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -4239,10 +4239,10 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
                 numCoresPerSocket = 6;
             } else if (vcpus % 4 == 0) {
                 numCoresPerSocket = 4;
-            } else {
-                numCoresPerSocket = 1;
             }
         }
-        cmd.setTopology(numCoresPerSocket, vcpus / numCoresPerSocket);
+        if (numCoresPerSocket > 0) {
+            cmd.setTopology(numCoresPerSocket, vcpus / numCoresPerSocket);
+        }
     }
 }

Reply via email to