Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
(hopefully) fix the memory issues in the VMs
[simgrid.git] / src / msg / msg_vm.cpp
index 77b9855..fb1e82d 100644 (file)
@@ -12,6 +12,7 @@
 #include <xbt/ex.hpp>
 
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
+#include "src/plugins/vm/VmHostExt.hpp"
 #include <simgrid/s4u/VirtualMachine.hpp>
 #include <simgrid/s4u/host.hpp>
 
@@ -52,7 +53,7 @@ void MSG_vm_get_params(msg_vm_t vm, vm_params_t params)
 /* **** Check state of a VM **** */
 static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state)
 {
-  return simcall_vm_get_state(vm) == state;
+  return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getState() == state;
 }
 
 /** @brief Returns whether the given VM has just created, not running.
@@ -127,8 +128,9 @@ int MSG_vm_is_restoring(msg_vm_t vm)
 msg_vm_t MSG_vm_create(msg_host_t pm, const char *name, int ncpus, int ramsize, int net_cap, char *disk_path,
                        int disksize, int mig_netspeed, int dp_intensity)
 {
-  /* For the moment, intensity_rate is the percentage against the migration
-   * bandwidth */
+  simgrid::vm::VmHostExt::ensureVmExtInstalled();
+
+  /* For the moment, intensity_rate is the percentage against the migration bandwidth */
   double host_speed = MSG_host_get_speed(pm);
   double update_speed = ((double)dp_intensity/100) * mig_netspeed;
 
@@ -225,7 +227,8 @@ void MSG_vm_shutdown(msg_vm_t vm)
 {
   /* msg_vm_t equals to msg_host_t */
   simcall_vm_shutdown(vm);
-
+  MSG_process_sleep(0.); // Make sure that the processes in the VM are killed in this scheduling round before processing
+                         // (eg with the VM destroy)
   // TRACE_msg_vm_(vm);
 }