]> AND Public Git Repository - simgrid.git/blobdiff - src/msg/msg_vm.c
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Now VM operations workig!
[simgrid.git] / src / msg / msg_vm.c
index a6b5b99e8969d8fc65fdc077ad68cae9700d2116..45c9bf843d52f25db43c4d199282bc7d41156166 100644 (file)
@@ -94,7 +94,7 @@ const char *MSG_vm_get_name(msg_vm_t vm) {
 
 
 /* **** Check state of a VM **** */
-static inline int __MSG_vm_is_state(msg_vm_t vm, e_msg_vm_state_t state) {
+static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state) {
   return simcall_vm_get_state(vm) == state;
 }
 
@@ -103,7 +103,7 @@ static inline int __MSG_vm_is_state(msg_vm_t vm, e_msg_vm_state_t state) {
  */
 int MSG_vm_is_created(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_created);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_CREATED);
 }
 
 /** @brief Returns whether the given VM is currently running
@@ -111,7 +111,7 @@ int MSG_vm_is_created(msg_vm_t vm)
  */
 int MSG_vm_is_running(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_running);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_RUNNING);
 }
 
 /** @brief Returns whether the given VM is currently migrating
@@ -119,7 +119,7 @@ int MSG_vm_is_running(msg_vm_t vm)
  */
 int MSG_vm_is_migrating(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_migrating);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_MIGRATING);
 }
 
 /** @brief Returns whether the given VM is currently suspended, not running.
@@ -127,7 +127,7 @@ int MSG_vm_is_migrating(msg_vm_t vm)
  */
 int MSG_vm_is_suspended(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_suspended);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_SUSPENDED);
 }
 
 /** @brief Returns whether the given VM is being saved (FIXME: live saving or not?).
@@ -135,7 +135,7 @@ int MSG_vm_is_suspended(msg_vm_t vm)
  */
 int MSG_vm_is_saving(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_saving);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVING);
 }
 
 /** @brief Returns whether the given VM has been saved, not running.
@@ -143,7 +143,7 @@ int MSG_vm_is_saving(msg_vm_t vm)
  */
 int MSG_vm_is_saved(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_saved);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVED);
 }
 
 /** @brief Returns whether the given VM is being restored, not running.
@@ -151,7 +151,7 @@ int MSG_vm_is_saved(msg_vm_t vm)
  */
 int MSG_vm_is_restoring(msg_vm_t vm)
 {
-  return __MSG_vm_is_state(vm, msg_vm_state_restoring);
+  return __MSG_vm_is_state(vm, SURF_VM_STATE_RESTORING);
 }
 
 
@@ -256,7 +256,7 @@ void MSG_vm_shutdown(msg_vm_t vm)
  * MSG_task_send() before or after, depending on whether you want to do cold or hot
  * migration.
  */
-void MSG_vm_migrate(msg_vm_t vm, msg_host_t destination)
+void MSG_vm_migrate(msg_vm_t vm, msg_host_t new_pm)
 {
   /* some thoughts:
    * - One approach is ...
@@ -279,16 +279,14 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t destination)
    *   
    */
 
-  #ifdef HAVE_TRACING
-  const char *old_pm_name = simcall_vm_get_phys_host(vm);
-  msg_host_t old_pm_ind  = xbt_lib_get_elm_or_null(host_lib, old_pm_name);
-  #endif
+  msg_host_t old_pm = simcall_vm_get_pm(vm);
 
-  simcall_vm_migrate(vm, destination);
+  simcall_vm_migrate(vm, new_pm);
 
+  XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", vm->key, old_pm->key, new_pm->key);
 
   #ifdef HAVE_TRACING
-  TRACE_msg_vm_change_host(vm, old_pm_ind, destination);
+  TRACE_msg_vm_change_host(vm, old_pm, new_pm);
   #endif
 }
 
@@ -305,6 +303,8 @@ void MSG_vm_suspend(msg_vm_t vm)
 {
   simcall_vm_suspend(vm);
 
+  XBT_DEBUG("vm_suspend done");
+
   #ifdef HAVE_TRACING
   TRACE_msg_vm_suspend(vm);
   #endif
@@ -339,13 +339,11 @@ void MSG_vm_resume(msg_vm_t vm)
 void MSG_vm_save(msg_vm_t vm)
 {
   simcall_vm_save(vm);
-
   #ifdef HAVE_TRACING
   TRACE_msg_vm_save(vm);
   #endif
 }
 
-
 /** @brief Restore the execution of the VM. All processes on the VM run again.
  *  @ingroup msg_VMs
  *