Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix minor issues aroud the msg layer
authorTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Fri, 15 Feb 2013 12:17:45 +0000 (13:17 +0100)
committerTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Fri, 15 Feb 2013 12:59:30 +0000 (13:59 +0100)
include/msg/msg.h
src/msg/instr_msg_vm.c
src/msg/msg_private.h
src/simix/smx_vm.c

index 22117aa..885f7ef 100644 (file)
@@ -343,8 +343,9 @@ XBT_PUBLIC(int) MSG_get_channel_number(void);
 /* This function should not be called directly, but rather from MSG_vm_start_from_template that does not exist yet*/
 
 // TODO add VDI later
-XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t location, const char *name,
-                                     int core_nb, int mem_cap, int net_cap);
+XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
+XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name,
+    int core_nb, int mem_cap, int net_cap, char *disk_path, int disk_size);
 
 XBT_PUBLIC(void) MSG_vm_start(msg_vm_t);
 
index cc91b32..f4437c7 100644 (file)
@@ -117,7 +117,7 @@ void TRACE_msg_vm_resume(msg_vm_t vm)
   }
 }
 
-void TRACE_msg_vm_sleep_in(msg_vm_t vm)
+void TRACE_msg_vm_save(msg_vm_t vm)
 {
   if (TRACE_msg_vm_is_enabled()){
     int len = INSTR_DEFAULT_STR_SIZE;
@@ -125,12 +125,12 @@ void TRACE_msg_vm_sleep_in(msg_vm_t vm)
 
     container_t vm_container = PJ_container_get (instr_vm_id(vm, str, len));
     type_t type = PJ_type_get ("MSG_VM_STATE", vm_container->type);
-    val_t value = PJ_value_get ("sleep", type);
+    val_t value = PJ_value_get ("save", type);
     new_pajePushState (MSG_get_clock(), vm_container, type, value);
   }
 }
 
-void TRACE_msg_vm_sleep_out(msg_vm_t vm)
+void TRACE_msg_vm_restore(msg_vm_t vm)
 {
   if (TRACE_msg_vm_is_enabled()){
     int len = INSTR_DEFAULT_STR_SIZE;
index a44834c..97fade8 100644 (file)
@@ -163,16 +163,16 @@ void TRACE_msg_process_sleep_out(msg_process_t process);
 void TRACE_msg_process_end(msg_process_t process);
 
 /* declaration of instrumentation functions from instr_msg_vm.c */
-char *instr_vm_id (msg_vm_t vm, char *str, int len);
-char *instr_vm_id_2 (const char *vm_name, char *str, int len);
+char *instr_vm_id(msg_vm_t vm, char *str, int len);
+char *instr_vm_id_2(const char *vm_name, char *str, int len);
 void TRACE_msg_vm_change_host(msg_vm_t vm, msg_host_t old_host,
                                    msg_host_t new_host);
-void TRACE_msg_vm_create (const char *vm_name, msg_host_t host);
+void TRACE_msg_vm_create(const char *vm_name, msg_host_t host);
 void TRACE_msg_vm_kill(msg_vm_t process);
 void TRACE_msg_vm_suspend(msg_vm_t vm);
 void TRACE_msg_vm_resume(msg_vm_t vm);
-void TRACE_msg_vm_sleep_in(msg_vm_t vm);
-void TRACE_msg_vm_sleep_out(msg_vm_t vm);
+void TRACE_msg_vm_save(msg_vm_t vm);
+void TRACE_msg_vm_restore(msg_vm_t vm);
 void TRACE_msg_vm_end(msg_vm_t vm);
 
 SG_END_DECL()
index ccd4a25..6c566a6 100644 (file)
@@ -51,7 +51,7 @@ smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host
 
 static int get_host_property_as_integer(smx_host_t host, const char *name)
 {
-  xbt_dict_t dict = simix_host_get_properties(host);
+  xbt_dict_t dict = SIMIX_host_get_properties(host);
 
   char *value = xbt_dict_get_or_null(dict, name);
   return atoi(value);
@@ -64,10 +64,10 @@ static int __can_be_started(smx_host_t vm)
 {
        // TODO add checking code related to overcommitment or not.
 
-  int overcommit = get_host_property_as_integer("OverCommit");
-  int core_nb = get_host_property_as_integer("CORE_NB");
-  int mem_cap = get_host_property_as_integer("MEM_CAP");
-  int net_cap = get_host_property_as_integer("NET_CAP");
+  int overcommit = get_host_property_as_integer(vm, "OverCommit");
+  int core_nb = get_host_property_as_integer(vm, "CORE_NB");
+  int mem_cap = get_host_property_as_integer(vm, "MEM_CAP");
+  int net_cap = get_host_property_as_integer(vm, "NET_CAP");
 
   /* we need to get other VM objects on this physical host. */
 
@@ -227,7 +227,7 @@ void SIMIX_vm_save(smx_host_t ind_vm)
   xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
          XBT_DEBUG("save %s", SIMIX_host_get_name(ind_vm));
         /* FIXME: calling a simcall from the SIMIX layer is strange. */
-         simcall_process_save(smx_process);
+         simcall_process_suspend(smx_process);
   }
 
   /* TODO: Using the variable of the MSG layer is not clean. */
@@ -257,7 +257,7 @@ void SIMIX_vm_restore(smx_host_t ind_vm)
   xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
          XBT_DEBUG("restore %s", SIMIX_host_get_name(ind_vm));
         /* FIXME: calling a simcall from the SIMIX layer is strange. */
-         simcall_process_restore(smx_process);
+         simcall_process_resume(smx_process);
   }
 
   /* TODO: Using the variable of the MSG layer is not clean. */
@@ -290,7 +290,7 @@ void SIMIX_vm_shutdown(smx_host_t ind_vm, smx_process_t issuer)
   }
 
   /* TODO: Using the variable of the MSG layer is not clean. */
-  SIMIX_vm_set_state(ind_vm, msg_vm_state_sleeping);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_created);
 }
 
 void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm){