diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index 977f4fe6721..25863276c09 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -270,3 +270,6 @@ iscsi.session.cleanup.enabled=false # This parameter specifies the heartbeat update timeout in ms; The default value is 60000ms (1 min). # Depending on the use case, this timeout might need increasing/decreasing. # heartbeat.update.timeout=60000 + +# Enable manually setting CPU's topology on KVM's VM. +# enable.manually.setting.cpu.topology.on.kvm.vm=true diff --git a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java index b685484db31..d04e98fb704 100644 --- a/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java +++ b/agent/src/main/java/com/cloud/agent/properties/AgentProperties.java @@ -32,6 +32,13 @@ public class AgentProperties{ */ public static final Property HEARTBEAT_UPDATE_TIMEOUT = new Property("heartbeat.update.timeout", 60000); + /** + * Enable manually setting CPU's topology on KVM's VM.
+ * Data type: boolean.
+ * Default value: true. + */ + public static final Property ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM = new Property("enable.manually.setting.cpu.topology.on.kvm.vm", true); + public static class Property { private final String name; private final T defaultValue; 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 48752d1c88c..df729cbe355 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 @@ -109,6 +109,8 @@ import com.cloud.agent.api.to.NfsTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.agent.dao.impl.PropertiesStorage; +import com.cloud.agent.properties.AgentProperties; +import com.cloud.agent.properties.AgentPropertiesFileHandler; import com.cloud.agent.resource.virtualnetwork.VRScripts; import com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer; import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource; @@ -411,6 +413,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv protected MemStat _memStat = new MemStat(_dom0MinMem, _dom0OvercommitMem); private final LibvirtUtilitiesHelper libvirtUtilitiesHelper = new LibvirtUtilitiesHelper(); + protected Boolean enableManuallySettingCpuTopologyOnKvmVm = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM); + protected long getHypervisorLibvirtVersion() { return _hypervisorLibvirtVersion; } @@ -4502,6 +4506,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv } private void setCpuTopology(CpuModeDef cmd, int vcpus, Map details) { + if (!enableManuallySettingCpuTopologyOnKvmVm) { + s_logger.debug(String.format("Skipping manually setting CPU topology on VM's XML due to it is disabled in agent.properties {\"property\": \"%s\", \"value\": %s}.", + AgentProperties.ENABLE_MANUALLY_SETTING_CPU_TOPOLOGY_ON_KVM_VM.getName(), enableManuallySettingCpuTopologyOnKvmVm)); + return; + } // multi cores per socket, for larger core configs int numCoresPerSocket = -1; if (details != null) {