static int master_main(int argc, char* argv[]) { msg_host_t pm0 = MSG_host_by_name("Fafard"); msg_host_t pm1 = MSG_host_by_name("Tremblay"); msg_host_t pm2 = MSG_host_by_name("Bourassa"); msg_vm_t vm0 = MSG_vm_create_core(pm0, "VM0"); MSG_vm_set_ramsize(vm0, 1e9); // 1Gbytes MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %zu Mbytes RAM", MSG_vm_get_ramsize(vm0) / 1000 / 1000); vm_migrate(vm0, pm1); MSG_vm_destroy(vm0); vm0 = MSG_vm_create_core(pm0, "VM0"); MSG_vm_set_ramsize(vm0, 1e8); // 100Mbytes MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %zu Mbytes RAM", MSG_vm_get_ramsize(vm0) / 1000 / 1000); vm_migrate(vm0, pm1); MSG_vm_destroy(vm0); vm0 = MSG_vm_create_core(pm0, "VM0"); msg_vm_t vm1 = MSG_vm_create_core(pm0, "VM1"); MSG_vm_set_ramsize(vm0, 1e9); // 1Gbytes MSG_vm_set_ramsize(vm1, 1e9); // 1Gbytes MSG_vm_start(vm0); MSG_vm_start(vm1); XBT_INFO("Test: Migrate two VMs at once from PM0 to PM1"); vm_migrate_async(vm0, pm1); vm_migrate_async(vm1, pm1); MSG_process_sleep(10000); MSG_vm_destroy(vm0); MSG_vm_destroy(vm1); vm0 = MSG_vm_create_core(pm0, "VM0"); vm1 = MSG_vm_create_core(pm0, "VM1"); MSG_vm_set_ramsize(vm0, 1e9); // 1Gbytes MSG_vm_set_ramsize(vm1, 1e9); // 1Gbytes MSG_vm_start(vm0); MSG_vm_start(vm1); XBT_INFO("Test: Migrate two VMs at once to different PMs"); vm_migrate_async(vm0, pm1); vm_migrate_async(vm1, pm2); MSG_process_sleep(10000); MSG_vm_destroy(vm0); MSG_vm_destroy(vm1); return 0; }
static int master_main(int argc, char *argv[]) { msg_host_t pm0 = MSG_host_by_name("Fafard"); msg_host_t pm1 = MSG_host_by_name("Tremblay"); msg_host_t pm2 = MSG_host_by_name("Bourassa"); msg_vm_t vm0, vm1; s_vm_params_t params; memset(¶ms, 0, sizeof(params)); vm0 = MSG_vm_create_core(pm0, "VM0"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes MSG_host_set_params(vm0, ¶ms); MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %llu Mbytes RAM", params.ramsize / 1000 / 1000); vm_migrate(vm0, pm1); MSG_vm_destroy(vm0); vm0 = MSG_vm_create_core(pm0, "VM0"); params.ramsize = 1L * 1000 * 1000 * 100; // 100Mbytes MSG_host_set_params(vm0, ¶ms); MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %llu Mbytes RAM", params.ramsize / 1000 / 1000); vm_migrate(vm0, pm1); MSG_vm_destroy(vm0); vm0 = MSG_vm_create_core(pm0, "VM0"); vm1 = MSG_vm_create_core(pm0, "VM1"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes MSG_host_set_params(vm0, ¶ms); MSG_host_set_params(vm1, ¶ms); MSG_vm_start(vm0); MSG_vm_start(vm1); XBT_INFO("Test: Migrate two VMs at once from PM0 to PM1"); vm_migrate_async(vm0, pm1); vm_migrate_async(vm1, pm1); MSG_process_sleep(10000); MSG_vm_destroy(vm0); MSG_vm_destroy(vm1); vm0 = MSG_vm_create_core(pm0, "VM0"); vm1 = MSG_vm_create_core(pm0, "VM1"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes MSG_host_set_params(vm0, ¶ms); MSG_host_set_params(vm1, ¶ms); MSG_vm_start(vm0); MSG_vm_start(vm1); XBT_INFO("Test: Migrate two VMs at once to different PMs"); vm_migrate_async(vm0, pm1); vm_migrate_async(vm1, pm2); MSG_process_sleep(10000); MSG_vm_destroy(vm0); MSG_vm_destroy(vm1); return 0; }