Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline 4 more VM simcalls
[simgrid.git] / src / simix / smx_vm.cpp
index 429bd5c..0e85880 100644 (file)
@@ -12,7 +12,6 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_vm, simix, "Logging specific to SIMIX Virtual Machines");
 
-/* works for VMs and PMs */
 static long host_get_ramsize(sg_host_t vm, int *overcommit)
 {
   s_vm_params_t params;
@@ -24,36 +23,6 @@ static long host_get_ramsize(sg_host_t vm, int *overcommit)
   return params.ramsize;
 }
 
-/* **** start a VM **** */
-void SIMIX_vm_start(sg_host_t vm)
-{
-  sg_host_t pm = static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getPm();
-
-  simgrid::vm::VmHostExt::ensureVmExtInstalled();
-  if (pm->extension<simgrid::vm::VmHostExt>() == nullptr)
-    pm->extension_set(new simgrid::vm::VmHostExt());
-
-  long pm_ramsize = pm->extension<simgrid::vm::VmHostExt>()->ramsize;
-  int pm_overcommit = pm->extension<simgrid::vm::VmHostExt>()->overcommit;
-  long vm_ramsize = host_get_ramsize(vm, nullptr);
-
-  if (pm_ramsize && !pm_overcommit) { /* Only verify that we don't overcommit on need */
-    /* Retrieve the memory occupied by the VMs on that host. Yep, we have to traverse all VMs of all hosts for that */
-    long total_ramsize_of_vms = 0;
-    for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::surf::VirtualMachineImpl::allVms_)
-      if (pm == ws_vm->pimpl_vm_->getPm())
-        total_ramsize_of_vms += ws_vm->pimpl_vm_->getRamsize();
-
-    if (vm_ramsize > pm_ramsize - total_ramsize_of_vms) {
-      XBT_WARN("cannnot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).",
-               sg_host_get_name(vm), sg_host_get_name(pm), vm_ramsize, pm_ramsize - total_ramsize_of_vms, pm_ramsize);
-      THROWF(vm_error, 0, "The VM %s cannot be started", vm->name().c_str());
-    }
-  }
-
-  static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->setState(SURF_VM_STATE_RUNNING);
-}
-
 /**
  * @brief Function to suspend a SIMIX VM host. This function stops the execution of the
  * VM. All the processes on this VM will pause. The state of the VM is