-
-
-static int do_migration(msg_vm_t vm, msg_host_t src_pm, msg_host_t dst_pm)
-{
- struct migration_session *ms = xbt_new(struct migration_session, 1);
- ms->vm = vm;
- ms->src_pm = src_pm;
- ms->dst_pm = dst_pm;
- ms->mbox_ctl = get_mig_mbox_ctl(vm, src_pm, dst_pm);
- ms->mbox = get_mig_mbox_src_dst(vm, src_pm, dst_pm);
-
-
- char *pr_rx_name = get_mig_process_rx_name(vm, src_pm, dst_pm);
- char *pr_tx_name = get_mig_process_tx_name(vm, src_pm, dst_pm);
-
-// msg_process_t tx_process, rx_process;
-// MSG_process_create(pr_rx_name, migration_rx_fun, ms, dst_pm);
-// MSG_process_create(pr_tx_name, migration_tx_fun, ms, src_pm);
-#if 1
- {
- char **argv = xbt_new(char *, 2);
- argv[0] = pr_rx_name;
- argv[1] = NULL;
-/*rx_process = */ MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
- }
- {
- char **argv = xbt_new(char *, 2);
- argv[0] = pr_tx_name;
- argv[1] = NULL;
-/* tx_process = */MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
- }
-#endif
-
- /* wait until the migration have finished or on error has occured */
- {
- XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed");
- msg_task_t task = NULL;
- msg_error_t ret = MSG_TIMEOUT;
- while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o
- ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4);
-
- xbt_free(ms->mbox_ctl);
- xbt_free(ms->mbox);
- xbt_free(ms);
-
- //xbt_assert(ret == MSG_OK);
- if(ret == MSG_HOST_FAILURE){
- // Note that since the communication failed, the owner did not change and the task should be destroyed on the other side.
- // Hence, just throw the execption
- XBT_INFO("SRC crashes, throw an exception (m-control)");
- //MSG_process_kill(tx_process); // Adrien, I made a merge on Nov 28th 2014, I'm not sure whether this line is required or not
- return -1;
- }
- else if((ret == MSG_TRANSFER_FAILURE) || (ret == MSG_TIMEOUT)){ // MSG_TIMEOUT here means that MSG_host_is_avail() returned false.
- XBT_INFO("DST crashes, throw an exception (m-control)");
- return -2;
- }
-
-
- char *expected_task_name = get_mig_task_name(vm, src_pm, dst_pm, 4);
- xbt_assert(strcmp(task->name, expected_task_name) == 0);
- xbt_free(expected_task_name);
- MSG_task_destroy(task);
- return 0;
- }
-}
-
-
-
-