From 4bf167201d628247e3f479790da94c41aaf3e67f Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Tue, 22 Nov 2016 05:08:56 -0600 Subject: [PATCH] webGui: generate VM xml with cpu topology as single-threaded when host cpu is AMD --- plugins/dynamix.vm.manager/classes/libvirt.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/dynamix.vm.manager/classes/libvirt.php b/plugins/dynamix.vm.manager/classes/libvirt.php index 7efcdcfe3..ad6607eb2 100644 --- a/plugins/dynamix.vm.manager/classes/libvirt.php +++ b/plugins/dynamix.vm.manager/classes/libvirt.php @@ -327,6 +327,12 @@ // detect if the processor is hyperthreaded: $intCPUThreadsPerCore = max(intval(shell_exec('/usr/bin/lscpu | grep \'Thread(s) per core\' | awk \'{print $4}\'')), 1); + // detect if the processor is AMD, and if so, force single threaded + $strCPUInfo = file_get_contents('/proc/cpuinfo'); + if (strpos($strCPUInfo, 'AuthenticAMD') !== false) { + $intCPUThreadsPerCore = 1; + } + // even amount of cores assigned and cpu is hyperthreaded: pass that info along to the cpu section below if ($intCPUThreadsPerCore > 1 && ($vcpus % $intCPUThreadsPerCore == 0)) { $intCores = $vcpus / $intCPUThreadsPerCore;