Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
isolate VM migration parameters from others
[simgrid.git] / examples / msg / cloud-masterworker / cloud-masterworker.c
index 41fa989..12044ad 100644 (file)
@@ -83,16 +83,13 @@ static int master_fun(int argc, char *argv[])
     XBT_INFO("create %s on PM(%s)", vm_name, MSG_host_get_name(pm));
     msg_vm_t vm = MSG_vm_create_core(pm, vm_name);
 
-    s_vm_params_t params;
-    memset(&params, 0, sizeof(params));
-    params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes
-    MSG_vm_set_params(vm, &params);
+    MSG_vm_set_ramsize(vm, 1L * 1024 * 1024 * 1024); // 1GiB
 
     MSG_vm_start(vm);
     xbt_dynar_push(vms, &vm);
 
     XBT_INFO("put a process (%s) on %s", pr_name, vm_name);
-    MSG_process_create(pr_name, worker_fun, NULL, vm);
+    MSG_process_create(pr_name, worker_fun, NULL, (msg_host_t)vm);
 
     xbt_free(vm_name);
     xbt_free(pr_name);
@@ -104,7 +101,7 @@ static int master_fun(int argc, char *argv[])
 
   XBT_INFO("# Suspend all VMs");
   xbt_dynar_foreach(vms, i, vm) {
-    XBT_INFO("suspend %s", MSG_host_get_name(vm));
+    XBT_INFO("suspend %s", MSG_vm_get_name(vm));
     MSG_vm_suspend(vm);
   }
 
@@ -122,11 +119,11 @@ static int master_fun(int argc, char *argv[])
   XBT_INFO("# Add one more process on each VM");
   xbt_dynar_foreach(vms, i, vm) {
     unsigned int index = i + xbt_dynar_length(vms);
-    char *vm_name = bprintf("VM%02d", i);
-    char *pr_name = bprintf("WRK%02d", index);
+    char* vm_name      = bprintf("VM%02u", i);
+    char* pr_name      = bprintf("WRK%02u", index);
 
     XBT_INFO("put a process (%s) on %s", pr_name, vm_name);
-    MSG_process_create(pr_name, worker_fun, NULL, vm);
+    MSG_process_create(pr_name, worker_fun, NULL, (msg_host_t)vm);
 
     xbt_free(vm_name);
     xbt_free(pr_name);
@@ -161,9 +158,9 @@ static int master_fun(int argc, char *argv[])
 
   XBT_INFO("# Shutdown and destroy all the VMs. The remaining worker processes will be forcibly killed.");
   xbt_dynar_foreach(vms, i, vm) {
-    XBT_INFO("shutdown %s", MSG_host_get_name(vm));
+    XBT_INFO("shutdown %s", MSG_vm_get_name(vm));
     MSG_vm_shutdown(vm);
-    XBT_INFO("destroy %s", MSG_host_get_name(vm));
+    XBT_INFO("destroy %s", MSG_vm_get_name(vm));
     MSG_vm_destroy(vm);
   }