From 0fcc85dd7c6ea2e8b1da0cc1c09f9e7e414918a2 Mon Sep 17 00:00:00 2001 From: alebre Date: Thu, 31 Jan 2013 10:54:51 +0100 Subject: [PATCH] Fix missing call to surf - Adrien --- src/msg/msg_vm.c | 6 +++--- src/simix/smx_smurf_private.h | 2 +- src/simix/smx_user.c | 2 +- src/simix/smx_vm.c | 18 +++++++++--------- src/surf/vm_workstation.c | 9 +++++---- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index fc9edcb15e..eb2dbdc9d4 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -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); diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index f08a07bf44..e6fe1b0fb9 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -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 \ diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 0a92bb894d..35e2a363cb 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -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); } diff --git a/src/simix/smx_vm.c b/src/simix/smx_vm.c index e94b17b736..bb3805f772 100644 --- a/src/simix/smx_vm.c +++ b/src/simix/smx_vm.c @@ -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){ diff --git a/src/surf/vm_workstation.c b/src/surf/vm_workstation.c index b4a3609953..cb76055ee7 100644 --- a/src/surf/vm_workstation.c +++ b/src/surf/vm_workstation.c @@ -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); -- 2.20.1