Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Compilation is at least ok - Ad(rien)
[simgrid.git] / src / simix / smx_vm.c
index d2eab04..213c165 100644 (file)
@@ -116,6 +116,32 @@ void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm)
   surf_vm_workstation_migrate(ind_vm, ind_dst_pm);
 }
 
+/**
+ * \brief Encompassing simcall to prevent the removal of the src or the dst node at the end of a VM migration
+ *  The simcall actually invokes the following calls: 
+ *     simcall_vm_set_affinity(vm, src_pm, 0); 
+ *     simcall_vm_migrate(vm, dst_pm); 
+ *     simcall_vm_resume(vm);
+ *
+ * It is called at the end of the migration_rx_fun function from msg/msg_vm.c
+ *
+ * \param vm VM to migrate
+ * \param src_pm  Source physical host
+ * \param dst_pmt Destination physical host
+ */
+void SIMIX_vm_migratefrom_resumeto(smx_host_t vm, smx_host_t src_pm, smx_host_t dst_pm)
+{
+  /* deinstall the current affinity setting for the CPU */
+  SIMIX_vm_set_affinity(vm, src_pm, 0);
+
+  /* Update the vm location */
+  SIMIX_vm_migrate(vm, dst_pm);
+  /* Resume the VM */
+  smx_process_t self = SIMIX_process_self(); 
+  SIMIX_vm_resume(vm, self->simcall.issuer);
+} 
+
 /**
  * \brief Function to get the physical host of the given SIMIX VM host.
  *