Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make the prefix of the functions consistent, e.g., vm_{get/set}_state
authorTakahiro Hirofuchi <thirofuchi@debian.(none)>
Mon, 4 Feb 2013 13:32:29 +0000 (14:32 +0100)
committerTakahiro Hirofuchi <thirofuchi@debian.(none)>
Mon, 4 Feb 2013 13:32:29 +0000 (14:32 +0100)
include/simgrid/simix.h
src/msg/instr_msg_vm.c
src/msg/msg_vm.c
src/simix/smx_host_private.h
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/simix/smx_vm.c

index 7e678c6..fca2ef2 100644 (file)
@@ -330,11 +330,14 @@ XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
 
 /******************************* VM simcalls ********************************/
 // Create the vm_workstation at the SURF level
-XBT_PUBLIC(void*) simcall_vm_ws_create(const char *name, smx_host_t host);
-XBT_PUBLIC(void*) simcall_get_vm_state(smx_host_t vm);
+XBT_PUBLIC(void*) simcall_vm_create(const char *name, smx_host_t host);
+XBT_PUBLIC(int) simcall_vm_get_state(smx_host_t vm);
 XBT_PUBLIC(void) simcall_vm_start(smx_host_t vm);
+XBT_PUBLIC(void) simcall_vm_migrate(smx_host_t vm, smx_host_t dst_pm);
+XBT_PUBLIC(const char*) simcall_vm_get_phys_host(smx_host_t vm);
 XBT_PUBLIC(void) simcall_vm_suspend(smx_host_t vm);
 XBT_PUBLIC(void) simcall_vm_destroy(smx_host_t vm);
+XBT_PUBLIC(void) simcall_vm_shutdown(smx_host_t vm);
 
 /**************************** Process simcalls ********************************/
 /* Constructor and Destructor */
index 770f4cf..cc91b32 100644 (file)
@@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_vm, instr, "MSG VM");
 
 char *instr_vm_id (msg_vm_t vm, char *str, int len)
 {
-       return instr_vm_id_2 (MSG_get_vm_name(vm), str, len);
+       return instr_vm_id_2 (MSG_vm_get_name(vm), str, len);
 }
 
 char *instr_vm_id_2 (const char *vm_name, char *str, int len)
index 2b18837..b6f55c7 100644 (file)
@@ -107,7 +107,7 @@ msg_vm_t MSG_vm_create(msg_host_t ind_host, const char *name,
   msg_vm_t new = NULL;
   void *ind_vm_workstation =  NULL;
   // Ask simix to create the surf vm resource
-  ind_vm_workstation = simcall_vm_ws_create(name,ind_host);
+  ind_vm_workstation = simcall_vm_create(name,ind_host);
   new = (msg_vm_t) __MSG_host_create(ind_vm_workstation);
 
   MSG_vm_set_property_value(new, "CORE_NB", bprintf("%d", core_nb), free);
@@ -142,7 +142,7 @@ void MSG_vm_start(msg_vm_t vm) {
 
 /* **** Check state of a VM **** */
 int __MSG_vm_is_state(msg_vm_t vm, e_msg_vm_state_t state) {
-       return simcall_get_vm_state(vm) == state ;
+       return simcall_vm_get_state(vm) == state ;
 }
 
 /** @brief Returns whether the given VM is currently suspended
index d586ea6..7edebe0 100644 (file)
@@ -94,10 +94,10 @@ smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host
 void SIMIX_vm_start(smx_host_t ind_vm);
 void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm);
 
-void SIMIX_set_vm_state(smx_host_t ind_vm, int state);
-void SIMIX_prev_set_vm_state(smx_host_t ind_vm, int state);
+void SIMIX_vm_set_state(smx_host_t ind_vm, int state);
+void SIMIX_prev_vm_set_state(smx_host_t ind_vm, int state);
 
-int SIMIX_get_vm_state(smx_host_t ind_vm);
+int SIMIX_vm_get_state(smx_host_t ind_vm);
 int SIMIX_pre_vm_state(smx_host_t ind_vm);
 
 void SIMIX_vm_suspend(smx_host_t ind_vm);
index 4d63029..18d0acc 100644 (file)
@@ -274,7 +274,7 @@ ACTION(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSW
 ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
 ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
-ACTION(SIMCALL_VM_WS_CREATE, vm_ws_create, WITH_ANSWER, TPTR(result), TSTRING(name), TSPEC(phys_host, smx_host_t)) sep \
+ACTION(SIMCALL_VM_CREATE, vm_create, WITH_ANSWER, TPTR(result), TSTRING(name), TSPEC(phys_host, smx_host_t)) sep \
 ACTION(SIMCALL_VM_START, vm_start, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_phys_host, smx_host_t)) sep \
 ACTION(SIMCALL_VM_SET_STATE, vm_set_state, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TINT(state)) sep \
 ACTION(SIMCALL_VM_GET_STATE, vm_get_state, WITH_ANSWER, TINT(result), TSPEC(ind_vm, smx_host_t)) sep \
index 016f7ab..95e6b84 100644 (file)
@@ -282,12 +282,19 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
  * \param host A host
  * \return The properties of this host
  */
-void* simcall_vm_ws_create(const char *name, smx_host_t phys_host){
-  return simcall_BODY_vm_ws_create(name, phys_host);
+void* simcall_vm_create(const char *name, smx_host_t phys_host){
+  /* jump to SIMIX_pre_vm_create() */
+  return simcall_BODY_vm_create(name, phys_host);
 }
 
 void simcall_vm_start(smx_host_t vm) {
-  simcall_BODY_set_vm_state(vm, msg_vm_state_running);
+  simcall_BODY_vm_set_state(vm, msg_vm_state_running);
+}
+
+int simcall_vm_get_state(smx_host_t vm)
+{
+  /* will jump to SIMIX_pre_vm_get_state */
+  return simcall_BODY_vm_get_state(vm);
 }
 
 void simcall_vm_migrate(smx_host_t vm, smx_host_t dst_phys)
index cd1a29a..dd3c42d 100644 (file)
@@ -50,15 +50,15 @@ smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host
 
 
 /* **** start a VM **** */
-int __can_be_started(smx_host_t vm){
+static int __can_be_started(smx_host_t vm){
        // TODO add checking code related to overcommitment or not.
        return 1;
 }
 void SIMIX_vm_start(smx_host_t ind_vm){
 
   //TODO only start the VM if you can
-  if (can_be_started(ind_vm))
-         SIMIX_set_vm_state(ind_vm, msg_vm_state_running);
+  if (__can_be_started(ind_vm))
+         SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
   else
          THROWF(vm_error, 0, "The VM %s cannot be started", SIMIX_host_get_name(ind_vm));
 }
@@ -68,18 +68,18 @@ void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm){
 }
 
 /* ***** set/get state of a VM ***** */
-void SIMIX_set_vm_state(smx_host_t ind_vm, int state){
+void SIMIX_vm_set_state(smx_host_t ind_vm, int state){
        surf_vm_workstation_model->extension.vm_workstation.set_state(ind_vm, state);
 }
-void SIMIX_prev_set_vm_state(smx_host_t ind_vm, int state){
-       SIMIX_set_vm_state(ind_vm, state);
+void SIMIX_pre_vm_set_state(smx_host_t ind_vm, int state){
+       SIMIX_vm_set_state(ind_vm, state);
 }
 
-int SIMIX_get_vm_state(smx_host_t ind_vm){
+int SIMIX_vm_get_state(smx_host_t ind_vm){
  return surf_vm_workstation_model->extension.vm_workstation.get_state(ind_vm);
 }
-int SIMIX_pre_vm_state(smx_host_t ind_vm){
-       return SIMIX_get_vm_state(ind_vm);
+int SIMIX_pre_vm_get_state(smx_host_t ind_vm){
+       return SIMIX_vm_get_state(ind_vm);
 }
 
 /**
@@ -94,12 +94,12 @@ void SIMIX_vm_migrate(smx_host_t ind_vm, smx_host_t ind_dst_pm)
   /* TODO: check state */
 
   /* TODO: Using the variable of the MSG layer is not clean. */
-  SIMIX_set_vm_state(ind_vm, msg_vm_state_migrating);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_migrating);
 
   /* jump to vm_ws_migrate(). this will update the vm location. */
   surf_vm_workstation_model->extension.vm_workstation.migrate(ind_vm, ind_dst_pm);
 
-  SIMIX_set_vm_state(ind_vm, msg_vm_state_running);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
 }
 
 void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm){
@@ -142,7 +142,7 @@ void SIMIX_vm_suspend(smx_host_t ind_vm)
   }
 
   /* TODO: Using the variable of the MSG layer is not clean. */
-  SIMIX_set_vm_state(ind_vm, msg_vm_state_suspended);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_suspended);
 }
 
 void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm){
@@ -169,7 +169,7 @@ void SIMIX_vm_resume(smx_host_t ind_vm)
   }
 
   /* TODO: Using the variable of the MSG layer is not clean. */
-  SIMIX_set_vm_state(ind_vm, msg_vm_state_running);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
 }
 
 void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm){
@@ -197,7 +197,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_set_vm_state(ind_vm, msg_vm_state_sleeping);
+  SIMIX_vm_set_state(ind_vm, msg_vm_state_sleeping);
 }
 
 void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm){