Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Deprecate functions MSG_global_init() / MSG_global_init_args() in flavor of MSG_init()
[simgrid.git] / examples / msg / cloud / masterslave_virtual_machines.c
index 7db2605..1bc53a2 100644 (file)
@@ -99,6 +99,8 @@ int master(int argc, char *argv[]) {
     MSG_vm_bind(vm, MSG_process_create_with_arguments(slavename,slave_fun,NULL,slaves[i],2,argv));
   }
 
+  work_batch(slaves_count*2);
+
   XBT_INFO("Migrate everyone to the second host.");
   for (i=0;i<xbt_dynar_length(vms);i++)
     MSG_vm_migrate(xbt_dynar_get_as(vms,i,msg_vm_t),slaves[1]);
@@ -111,7 +113,6 @@ int master(int argc, char *argv[]) {
     MSG_vm_resume(vm);
   }
 
-  work_batch(slaves_count*2);
 
   XBT_INFO("Let's shut down the simulation. 10 first processes will be shut down cleanly while the second half will forcefully get killed");
   for (i = 0; i < slaves_count; i++) {
@@ -124,6 +125,7 @@ int master(int argc, char *argv[]) {
   for (i=0;i<xbt_dynar_length(vms);i++) {
     msg_vm_t vm = xbt_dynar_get_as(vms,i,msg_vm_t);
     MSG_vm_shutdown(vm);
+    MSG_vm_destroy(vm);
   }
 
   XBT_INFO("Goodbye now!");
@@ -158,6 +160,7 @@ int slave_fun(int argc, char *argv[])
     MSG_task_destroy(task);
     task = NULL;
   }
+
   free(mailbox_name);
   return 0;
 }                               /* end_of_slave */
@@ -173,7 +176,7 @@ int main(int argc, char *argv[])
   int i;
 
   /* Get the arguments */
-  MSG_global_init(&argc, argv);
+  MSG_init(&argc, argv);
   if (argc < 2) {
     printf("Usage: %s platform_file\n", argv[0]);
     printf("example: %s msg_platform.xml\n", argv[0]);