Repository: vcl
Updated Branches:
  refs/heads/develop 15b187fb6 -> de9e192f8


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


Project: http://git-wip-us.apache.org/repos/asf/vcl/repo
Commit: http://git-wip-us.apache.org/repos/asf/vcl/commit/de9e192f
Tree: http://git-wip-us.apache.org/repos/asf/vcl/tree/de9e192f
Diff: http://git-wip-us.apache.org/repos/asf/vcl/diff/de9e192f

Branch: refs/heads/develop
Commit: de9e192f821807857669f9a7cbe368ee8664e67b
Parents: 15b187f
Author: Josh Thompson <jftho...@ncsu.edu>
Authored: Fri Sep 7 13:04:09 2018 -0400
Committer: Josh Thompson <jftho...@ncsu.edu>
Committed: Fri Sep 7 13:04:09 2018 -0400

----------------------------------------------------------------------
 .../lib/VCL/Module/Provisioning/libvirt.pm      | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vcl/blob/de9e192f/managementnode/lib/VCL/Module/Provisioning/libvirt.pm
----------------------------------------------------------------------
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 @@ EOF
        #    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 @@ EOF
                                model => {
                                        'fallback' => 'allow',
                                },
-                               #'topology' => [
-                               #       {
-                               #               'sockets' => $cpu_count,
-                               #               'cores' => '2',
-                               #               'threads' => '2',
-                               #       }
-                               #],
-                               
+                               topology => {
+                                       'sockets' => $cpusockets,
+                                       'cores' => $cpucores,
+                                       'threads' => 1,
+                               },
                        }
                ],
                'clock' => [

Reply via email to