From 478eeb617b0ea4414850b4d2dd3e5305b19e3404 Mon Sep 17 00:00:00 2001 From: Samuel Lepetit Date: Thu, 14 Jun 2012 15:12:53 +0200 Subject: [PATCH] Revert "Debug the cloud API, it should work as expected now." This reverts commit 535815db45bb2162b257e5c208ee7015dd2cc8f6. --- .../msg/cloud/masterslave_virtual_machines.c | 4 ++- src/msg/msg_private.h | 6 ---- src/msg/msg_process.c | 33 +++++-------------- src/msg/msg_vm.c | 23 ++----------- 4 files changed, 15 insertions(+), 51 deletions(-) diff --git a/examples/msg/cloud/masterslave_virtual_machines.c b/examples/msg/cloud/masterslave_virtual_machines.c index 87d10504ba..0ed5b9069d 100644 --- a/examples/msg/cloud/masterslave_virtual_machines.c +++ b/examples/msg/cloud/masterslave_virtual_machines.c @@ -98,6 +98,7 @@ int master(int argc, char *argv[]) { argv[2] = NULL; MSG_vm_bind(vm, MSG_process_create_with_arguments(slavename,slave_fun,NULL,slaves[i],2,argv)); } + work_batch(slaves_count*2); XBT_INFO("Migrate everyone to the second host."); for (i=0;idata; - //free the process data - if (process_data) { - //Remove the process from its vm - if (process_data->current_vm) { - int pos = xbt_dynar_search(process_data->current_vm->processes,&smx_proc); - xbt_dynar_remove_at(process_data->current_vm->processes,pos, NULL); - } - //Free the data if a function was provided - if (process_data->data && msg_global->process_data_cleanup) { - msg_global->process_data_cleanup(process_data->data); - } - xbt_free(process_data); + // free the data if a function was provided + if (msg_proc->data && msg_global->process_data_cleanup) { + msg_global->process_data_cleanup(msg_proc->data); } - //free the MSG process + // free the MSG process xbt_free(msg_proc); } @@ -258,10 +248,7 @@ void* MSG_process_get_data(m_process_t process) /* get from SIMIX the MSG process data, and then the user data */ simdata_process_t simdata = simcall_process_get_data(process); - if (!simdata->data) { - return NULL; - } - return ((msg_process_data_t)simdata->data)->data; + return simdata->data; } /** \ingroup m_process_management @@ -275,10 +262,8 @@ MSG_error_t MSG_process_set_data(m_process_t process, void *data) xbt_assert(process != NULL, "Invalid parameter"); simdata_process_t simdata = simcall_process_get_data(process); - if (!simdata->data) { - simdata->data = xbt_new0(s_msg_process_data_t, 1); - } - ((msg_process_data_t)simdata->data)->data = data; + simdata->data = data; + return MSG_OK; } diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index fd951c21dd..b31536f187 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -65,24 +65,7 @@ int MSG_vm_is_running(msg_vm_t vm) { * @bug for now, if a binded process terminates, every VM functions will segfault. Baaaad. */ void MSG_vm_bind(msg_vm_t vm, m_process_t process) { - simdata_process_t simdata = simcall_process_get_data(process); - if (!simdata->data) { - simdata->data = xbt_new0(s_msg_process_data_t,1); - } - //If if it is already in a vm, get it out of it - if ( ((msg_process_data_t)(simdata->data))->current_vm) { - msg_vm_t old_vm = ((msg_process_data_t)(simdata->data))->current_vm; - int pos = xbt_dynar_search(old_vm->processes,&process); - xbt_dynar_remove_at(old_vm->processes,pos, NULL); - //If it is on the wrong host, migrate it to the new host - if (vm->location != old_vm->location) { - MSG_process_migrate(process,vm->location); - } - } - - ((msg_process_data_t)(simdata->data))->current_vm = vm; - - xbt_dynar_push_as(vm->processes,m_process_t,process); + xbt_dynar_push_as(vm->processes,m_process_t,process); } /** @brief Removes the given process from the given VM, and kill it * @ingroup msg_VMs @@ -124,7 +107,7 @@ void MSG_vm_suspend(msg_vm_t vm) { unsigned int cpt; m_process_t process; xbt_dynar_foreach(vm->processes,cpt,process) { - XBT_DEBUG("suspend process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process))); + XBT_INFO("suspend process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process))); MSG_process_suspend(process); } } @@ -140,7 +123,7 @@ void MSG_vm_resume(msg_vm_t vm) { unsigned int cpt; m_process_t process; xbt_dynar_foreach(vm->processes,cpt,process) { - XBT_DEBUG("resume process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process))); + XBT_INFO("resume process %s of host %s",MSG_process_get_name(process),MSG_host_get_name(MSG_process_get_host(process))); MSG_process_resume(process); } } -- 2.20.1