Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update cloud example to use MSG_vm_reboot. Update the tesh file
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 4 Jul 2012 14:35:16 +0000 (16:35 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 4 Jul 2012 14:36:24 +0000 (16:36 +0200)
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/cloud/masterslave_virtual_machines.tesh

index 4d6a84d..d1df1c7 100644 (file)
@@ -66,6 +66,7 @@ int master(int argc, char *argv[]) {
     MSG_vm_bind(vm, MSG_process_create_with_arguments(slavename,slave_fun,NULL,slaves[i],2,argv));
   }
 
+
   xbt_dynar_t vms = MSG_vms_as_dynar();
   XBT_INFO("Launched %ld VMs", xbt_dynar_length(vms));
 
@@ -99,6 +100,10 @@ int master(int argc, char *argv[]) {
     MSG_vm_bind(vm, MSG_process_create_with_arguments(slavename,slave_fun,NULL,slaves[i],2,argv));
   }
 
+  XBT_INFO("Reboot all the VMs");
+  for (i=0;i<xbt_dynar_length(vms);i++)
+    MSG_vm_reboot(xbt_dynar_get_as(vms,i,msg_vm_t));
+
   work_batch(slaves_count*2);
 
   XBT_INFO("Migrate everyone to the second host.");
@@ -140,11 +145,10 @@ int slave_fun(int argc, char *argv[])
   char *mailbox_name;
   msg_task_t task = NULL;
   _XBT_GNUC_UNUSED int res;
-
   /* since the slaves will move around, use slave_%d as mailbox names instead of hostnames */
   xbt_assert(argc>=2, "slave processes need to be given their rank as parameter");
   mailbox_name=bprintf("Slave_%s",argv[1]);
-
+  XBT_INFO("Slave listenning on %s",argv[1]);
   while (1) {
     res = MSG_task_receive(&(task),mailbox_name);
     xbt_assert(res == MSG_OK, "MSG_task_get failed");
index f63e78d..e3e62a5 100644 (file)
@@ -116,3 +116,4 @@ $ $SG_TEST_EXENV ${bindir:=.}/cloud/masterslave_virtual_machines$EXEEXT ${srcdir
 > [ 2835.981646] (0:@) Simulation time 2835.98
 > [ 2835.981646] (11:Slave 9@Provost) Received "finalize" from mailbox Slave_9
 > [ 2835.981646] (1:master@Jacquelin) Goodbye now!
+