Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Prevent segfault when VM's host is created with pstate > 0
authorFred Suter <suterf@ornl.gov>
Fri, 15 Jul 2022 14:12:56 +0000 (10:12 -0400)
committerFred Suter <suterf@ornl.gov>
Fri, 15 Jul 2022 14:12:56 +0000 (10:12 -0400)
sealing the vCPU before setting its pstate to that of the physical host
seems to be enough.

src/surf/HostImpl.cpp

index 82b2f92..d646288 100644 (file)
@@ -159,11 +159,12 @@ s4u::VirtualMachine* HostImpl::create_vm(const std::string& name, s4u::VirtualMa
   auto* cpu =
       englobing_zone_->get_cpu_vm_model()->create_cpu(vm, speeds)->set_core_count(vm->get_vm_impl()->get_core_amount());
 
-  if (get_iface()->get_pstate() != 0)
-    cpu->set_pstate(get_iface()->get_pstate());
-
   cpu->seal();
 
+  if (get_iface()->get_pstate() != 0) {
+    cpu->set_pstate(get_iface()->get_pstate());
+  }
+
   /* Currently, a VM uses the network resource of its physical host */
   vm->set_netpoint(get_iface()->get_netpoint());