VCL-1104 - set cpu topology for libvirt VMs
libvirt.pm: modified generate_domain_xml: added topology to $xml_hashref under cpu section and logic to set related variables
diff --git a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
index 44691bc..b38ffff 100644
--- a/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
+++ b/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
@@ -1799,6 +1799,13 @@
# Windows, however, expects it to be in so called 'localtime'."
my $clock_offset = ($image_os_type =~ /windows/) ? 'localtime' : 'utc';
+ my $cpusockets = $cpu_count;
+ my $cpucores = 1;
+ if($cpu_count > 2) {
+ $cpusockets = 2;
+ $cpucores = ($cpu_count - ($cpu_count % 2)) / 2;
+ }
+
my $xml_hashref = {
'type' => $domain_type,
'description' => [$description],
@@ -1828,14 +1835,11 @@
model => {
'fallback' => 'allow',
},
- #'topology' => [
- # {
- # 'sockets' => $cpu_count,
- # 'cores' => '2',
- # 'threads' => '2',
- # }
- #],
-
+ topology => {
+ 'sockets' => $cpusockets,
+ 'cores' => $cpucores,
+ 'threads' => 1,
+ },
}
],
'clock' => [