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);
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 \
*/
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);
}
/**
* \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);
}
// }
// 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){
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;
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)
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";
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);