Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix missing call to surf - Adrien
authoralebre <adrien.lebre@inria.fr>
Thu, 31 Jan 2013 09:54:51 +0000 (10:54 +0100)
committeralebre <adrien.lebre@inria.fr>
Thu, 31 Jan 2013 09:54:51 +0000 (10:54 +0100)
src/msg/msg_vm.c
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/simix/smx_vm.c
src/surf/vm_workstation.c

index fc9edcb..eb2dbdc 100644 (file)
@@ -25,9 +25,9 @@ msg_vm_t MSG_vm_create(msg_host_t location, const char *name,
   new = (msg_vm_t) __MSG_host_create(vm_workstation);
 
 
-  MSG_vm_set_property_value(new, "CORE_NB", bprintf("%d", core_nb)), NULL);
-  MSG_vm_set_property_value(new, "MEM_CAP", bprintf("%d", core_nb)), NULL);
-  MSG_vm_set_property_value(new, "NET_CAP", bprintf("%d", core_nb)), NULL);
+  MSG_vm_set_property_value(new, "CORE_NB", bprintf("%d", core_nb), free);
+  MSG_vm_set_property_value(new, "MEM_CAP", bprintf("%d", core_nb), free);
+  MSG_vm_set_property_value(new, "NET_CAP", bprintf("%d", core_nb), free);
 
   #ifdef HAVE_TRACING
   TRACE_msg_vm_create(name, location);
index f08a07b..e6fe1b0 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_CREATE, vm_create, WITH_ANSWER, TPTR(result), TSTRING(name), TSPEC(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_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \
 ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \
 ACTION(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result)) sep \
index 0a92bb8..35e2a36 100644 (file)
@@ -284,7 +284,7 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
  */
 void* simcall_vm_create(const char *name, smx_host_t host){
 {
-  return simcall_BODY_vm_crate(name, host);
+  return simcall_BODY_vm_create(name, host);
 }
 
 
index e94b17b..bb3805f 100644 (file)
@@ -18,26 +18,26 @@ static void SIMIX_execution_finish(smx_action_t action);
 /**
  * \brief Internal function to create a SIMIX host.
  * \param name name of the host to create
- * \param workstation the SURF workstation to encapsulate
  * \param data some user data (may be NULL)
  */
-smx_host_t SIMIX_vm_create(const char *name,
-                               void *workstation, void *data)
+smx_host_t SIMIX_vm_create(const char *name, smx_host_t phys_host)
 {
 
-
-
   smx_host_priv_t smx_host = xbt_new0(s_smx_host_priv_t, 1);
   s_smx_process_t proc;
 
+  // TODO check why we do not have any VM here and why we have the host_proc_hookup  ?
+
   /* Host structure */
-  smx_host->data = data;
+  smx_host->data = NULL;
   smx_host->process_list =
       xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
 
   /* Update global variables */
   xbt_lib_set(host_lib,name,SIMIX_HOST_LEVEL,smx_host);
-  
+
+  /* Create surf associated resource */
+  surf_vm_workstation_model->extension.vm_workstation.create();
   return xbt_lib_get_elm_or_null(host_lib, name);
 }
 
@@ -93,8 +93,8 @@ void SIMIX_host_destroy(void *h)
 //  }
 //  return host_dict;
 //}
-smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host_t host){
-   return SIMIX_vm_create(name, host);
+smx_host_t SIMIX_pre_vm_create(smx_simcall_t simcall, const char *name, smx_host_t phys_host){
+   return SIMIX_vm_create(name, phys_host);
 }
 
 smx_host_t SIMIX_host_get_by_name(const char *name){
index b4a3609..cb76055 100644 (file)
@@ -16,8 +16,8 @@ typedef struct workstation_VM2013 {
   surf_resource_t physical_workstation;  // Pointer to the host OS
 } s_workstation_VM2013_t, *workstation_VM2013_t;
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf,
-                                "Logging specific to the SURF workstation module");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf,
+                                "Logging specific to the SURF VM workstation module");
 
 surf_model_t surf_vm_workstation_model = NULL;
 
@@ -29,6 +29,7 @@ static void *vm_ws_create (const char *name, void *phys_workstation)
   workstation->generic_resource.name = xbt_strdup(name);
   workstation->physical_workstation = phys_workstation;
   xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, workstation);
+
 }
 
 static int ws_resource_used(void *resource_id)
@@ -376,7 +377,7 @@ static surf_action_t ws_action_ls(void *workstation, const char* mount, const ch
 
 static void surf_vm_workstation_model_init_internal(void)
 {
-  // TODO Adrien, who is calling sufr_model_init() and Why ?
+  // TODO Adrien, who is calling surf_model_init() and Why ?
   surf_vm_workstation_model = surf_model_init();
 
   surf_vm_workstation_model->name = "Virtual Workstation";
@@ -444,7 +445,7 @@ void surf_workstation_model_init_current_default(void)
   xbt_cfg_setdefault_int(_sg_cfg_set, "network/crosstraffic", 1);
   surf_cpu_model_init_Cas01();
   surf_network_model_init_LegrandVelho();
-
+// TODO fix me
   xbt_dynar_push(model_list, &surf_workstation_model);
   sg_platf_host_add_cb(vm_ws_create);
 //  sg_platf_postparse_add_cb(create_workstations);