From: alebre Date: Wed, 24 Apr 2013 14:56:29 +0000 (+0200) Subject: Merge branch 'hypervisor' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid into hypervisor X-Git-Tag: v3_11_beta~297^2^2~40^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2489210b4ea8d03fbece8db288ef9e3ff6725723?hp=d2eccd8b07aad6831e902b9749f8f5c23163b249 Merge branch 'hypervisor' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid into hypervisor --- diff --git a/examples/msg/cloud/masterslave_virtual_machines.c b/examples/msg/cloud/masterslave_virtual_machines.c index ee927e379c..ab8c47dd55 100644 --- a/examples/msg/cloud/masterslave_virtual_machines.c +++ b/examples/msg/cloud/masterslave_virtual_machines.c @@ -60,7 +60,7 @@ int master_fun(int argc, char *argv[]) /* Launch VMs and worker processes. One VM per PM, and one worker process per VM. */ - XBT_INFO("Launch %ld VMs", workers_count); + XBT_INFO("Launch %d VMs", workers_count); for (i=0; i< workers_count; i++) { char *vm_name = bprintf("VM%02d", i); char *pr_name = bprintf("WRK%02d", i); diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 9ca633932c..723c659185 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -72,6 +72,9 @@ typedef struct ws_params { double dp_rate; double dp_cap; + + /* set migration speed */ + double mig_speed; } s_ws_params_t, *ws_params_t; typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */ diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index 9ec992333e..d3aee81525 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -521,11 +521,16 @@ void MSG_host_del_task(msg_host_t host, msg_task_t task) static void send_migration_data(const char *vm_name, const char *src_pm_name, const char *dst_pm_name, - double size, char *mbox, int stage, int stage2_round) + double size, char *mbox, int stage, int stage2_round, double mig_speed) { char *task_name = get_mig_task_name(vm_name, src_pm_name, dst_pm_name, stage); msg_task_t task = MSG_task_create(task_name, 0, size, NULL); - msg_error_t ret = MSG_task_send(task, mbox); + + msg_error_t ret; + if (mig_speed > 0) + ret = MSG_task_send_bounded(task, mbox, mig_speed); + else + ret = MSG_task_send(task, mbox); xbt_assert(ret == MSG_OK); if (stage == 2) @@ -559,6 +564,7 @@ static int migration_tx_fun(int argc, char *argv[]) const double max_downtime = params.max_downtime; const double dp_rate = params.dp_rate; const double dp_cap = params.dp_cap; + const double mig_speed = params.mig_speed; double remaining_size = ramsize + devsize; double threshold = max_downtime * 125 * 1000 * 1000; @@ -573,7 +579,7 @@ static int migration_tx_fun(int argc, char *argv[]) /* Stage1: send all memory pages to the destination. */ start_dirty_page_tracking(vm); - send_migration_data(vm_name, src_pm_name, dst_pm_name, ramsize, mbox, 1, 0); + send_migration_data(vm_name, src_pm_name, dst_pm_name, ramsize, mbox, 1, 0, mig_speed); remaining_size -= ramsize; @@ -607,7 +613,7 @@ static int migration_tx_fun(int argc, char *argv[]) if (remaining_size < threshold) break; - send_migration_data(vm_name, src_pm_name, dst_pm_name, updated_size, mbox, 2, stage2_round); + send_migration_data(vm_name, src_pm_name, dst_pm_name, updated_size, mbox, 2, stage2_round, mig_speed); remaining_size -= updated_size; stage2_round += 1; @@ -620,7 +626,7 @@ stage3: simcall_vm_suspend(vm); stop_dirty_page_tracking(vm); - send_migration_data(vm_name, src_pm_name, dst_pm_name, remaining_size, mbox, 3, 0); + send_migration_data(vm_name, src_pm_name, dst_pm_name, remaining_size, mbox, 3, 0, mig_speed); xbt_free(mbox); diff --git a/src/surf/vm_workstation.c b/src/surf/vm_workstation.c index e5996fe77a..ac7dcc769d 100644 --- a/src/surf/vm_workstation.c +++ b/src/surf/vm_workstation.c @@ -143,7 +143,7 @@ static void vm_ws_migrate(void *ind_vm, void *ind_dst_pm) if (state != SURF_ACTION_DONE) XBT_CRITICAL("FIXME: may need a proper handling, %d", state); if (ws_vm2013->cpu_action->remains > 0) - XBT_CRITICAL("FIXME: need copy the state(?), %d", ws_vm2013->cpu_action->remains); + XBT_CRITICAL("FIXME: need copy the state(?), %f", ws_vm2013->cpu_action->remains); int ret = surf_cpu_model_pm->action_unref(ws_vm2013->cpu_action); xbt_assert(ret == 1, "Bug: some resource still remains"); diff --git a/src/surf/workstation_private.h b/src/surf/workstation_private.h index 22866eb6b7..f786f4f0d5 100644 --- a/src/surf/workstation_private.h +++ b/src/surf/workstation_private.h @@ -30,6 +30,7 @@ surf_action_t ws_execute(void *workstation, double size); surf_action_t ws_action_sleep(void *workstation, double duration); void ws_action_suspend(surf_action_t action); void ws_action_resume(surf_action_t action); +void ws_action_cancel(surf_action_t action); e_surf_resource_state_t ws_get_state(void *workstation); double ws_action_get_remains(surf_action_t action);