- }
- catch (xbt_ex& e) {
- //hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
- // Stop the dirty page tracking an return (there is no memory space to release)
- stop_dirty_page_tracking(ms->vm);
- return 0;
- }
-
- double clock_post_send = MSG_get_clock();
- mig_timeout -= (clock_post_send - clock_prev_send);
- if (mig_timeout < 0) {
- XBT_VERB("The duration of stage 1 exceeds the timeout value, skip stage 2");
- skip_stage2 = 1;
- }
+ try {
+ /* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
+ * transfer exceeds the timeout value. */
+ XBT_VERB("Stage 1: Gonna send %llu bytes", ramsize);
+ sg_size_t sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, ramsize, ms->mbox, 1, 0, mig_speed, -1);
+ remaining_size -= sent;
+ computed_during_stage1 = lookup_computed_flop_counts(ms->vm, 1, 0);
+
+ if (sent < ramsize) {
+ XBT_VERB("mig-stage1: timeout, force moving to stage 3");
+ skip_stage2 = true;
+ } else if (sent > ramsize)
+ XBT_CRITICAL("bug");
+
+ } catch (xbt_ex& e) {
+ // hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
+ // Stop the dirty page tracking an return (there is no memory space to release)
+ stop_dirty_page_tracking(ms->vm);
+ return 0;
+ }