return __MSG_vm_is_state(vm, SURF_VM_STATE_RUNNING);
}
-#if 0
/** @brief Returns whether the given VM is currently migrating
* @ingroup msg_VMs
*/
{
return __MSG_vm_is_state(vm, SURF_VM_STATE_MIGRATING);
}
-#endif
/** @brief Returns whether the given VM is currently suspended, not running.
* @ingroup msg_VMs
return ind_vm;
}
+/** @brief Destroy a VM. Destroy the VM object from the simulation.
+ * @ingroup msg_VMs
+ */
+void MSG_vm_destroy(msg_vm_t vm)
+{
+ /* First, terminate all processes on the VM if necessary */
+ if (MSG_vm_is_running(vm))
+ simcall_vm_shutdown(vm);
+
+ if (!MSG_vm_is_created(vm)) {
+ XBT_CRITICAL("shutdown the given VM before destroying it");
+ DIE_IMPOSSIBLE;
+ }
+
+ /* Then, destroy the VM object */
+ simcall_vm_destroy(vm);
+
+ __MSG_host_destroy(vm);
+
+ #ifdef HAVE_TRACING
+ TRACE_msg_vm_end(vm);
+ #endif
+}
+
/** @brief Start a vm (i.e., boot the guest operating system)
* @ingroup msg_VMs
return total;
}
+// TODO Is this code redundant with the information provided by
+// msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
void MSG_host_add_task(msg_host_t host, msg_task_t task)
{
msg_host_priv_t priv = msg_host_resource_priv(host);
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)
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;
/* 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;
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;
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);
}
-/** @brief Destroy a VM. Destroy the VM object from the simulation.
- * @ingroup msg_VMs
- */
-void MSG_vm_destroy(msg_vm_t vm)
-{
- /* First, terminate all processes on the VM if necessary */
- if (MSG_vm_is_running(vm))
- simcall_vm_shutdown(vm);
-
- if (!MSG_vm_is_created(vm)) {
- XBT_CRITICAL("shutdown the given VM before destroying it");
- DIE_IMPOSSIBLE;
- }
-
- /* Then, destroy the VM object */
- simcall_vm_destroy(vm);
-
- __MSG_host_destroy(vm);
-
- #ifdef HAVE_TRACING
- TRACE_msg_vm_end(vm);
- #endif
-}
-/** @brief Get the physical host of a givne VM.
+/** @brief Get the physical host of a given VM.
* @ingroup msg_VMs
*/
msg_host_t MSG_vm_get_pm(msg_vm_t vm)