From: Martin Quinson Date: Mon, 20 Jul 2015 23:06:25 +0000 (+0200) Subject: cosmetics and documentation around VM parameters X-Git-Tag: v3_12~451 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f70ee620c8df5cdf749f4dfbc9777359cd3cb12a?hp=c8e76b757f3d74435fd4c96459c92683acc3c244 cosmetics and documentation around VM parameters --- diff --git a/examples/msg/cloud/bound.c b/examples/msg/cloud/bound.c index d9c6adc689..0c471b0c64 100644 --- a/examples/msg/cloud/bound.c +++ b/examples/msg/cloud/bound.c @@ -344,7 +344,7 @@ static int master_main(int argc, char *argv[]) { msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0"); - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes MSG_host_set_params(vm0, ¶ms); diff --git a/examples/msg/cloud/master_worker_vm.c b/examples/msg/cloud/master_worker_vm.c index 3d1fb4cbe6..77617ddc5a 100644 --- a/examples/msg/cloud/master_worker_vm.c +++ b/examples/msg/cloud/master_worker_vm.c @@ -70,7 +70,7 @@ int master_fun(int argc, char *argv[]) XBT_INFO("create %s on PM(%s)", vm_name, MSG_host_get_name(pm)); msg_vm_t vm = MSG_vm_create_core(pm, vm_name); - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes MSG_host_set_params(vm, ¶ms); diff --git a/examples/msg/cloud/migrate_vm.c b/examples/msg/cloud/migrate_vm.c index 13cce2fbec..9bd4b36a7a 100644 --- a/examples/msg/cloud/migrate_vm.c +++ b/examples/msg/cloud/migrate_vm.c @@ -64,7 +64,7 @@ static int master_main(int argc, char *argv[]) msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 1, msg_host_t); msg_host_t pm2 = xbt_dynar_get_as(hosts_dynar, 2, msg_host_t); msg_vm_t vm0, vm1; - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); diff --git a/examples/msg/cloud/multicore.c b/examples/msg/cloud/multicore.c index 8fb26bfb3b..28c409b9fa 100644 --- a/examples/msg/cloud/multicore.c +++ b/examples/msg/cloud/multicore.c @@ -177,7 +177,7 @@ static void test_vm_pin(void) msg_vm_t vm2 = MSG_vm_create_core(pm2, "VM2"); msg_vm_t vm3 = MSG_vm_create_core(pm2, "VM3"); - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1024 * 1024; params.skip_stage1 = 1; diff --git a/examples/msg/cloud/simple_vm.c b/examples/msg/cloud/simple_vm.c index 3d10a25bc8..b1f1220f34 100644 --- a/examples/msg/cloud/simple_vm.c +++ b/examples/msg/cloud/simple_vm.c @@ -255,7 +255,7 @@ static int master_main(int argc, char *argv[]) XBT_INFO("### Relocate VM0 between PM0 and PM1"); vm0 = MSG_vm_create_core(pm0, "VM0"); { - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes MSG_host_set_params(vm0, ¶ms); diff --git a/include/simgrid/datatypes.h b/include/simgrid/datatypes.h index e46e72b00b..3a407d8832 100644 --- a/include/simgrid/datatypes.h +++ b/include/simgrid/datatypes.h @@ -7,7 +7,7 @@ #ifndef SIMGRID_DATATYPES_H_ #define SIMGRID_DATATYPES_H_ -typedef struct ws_params { +typedef struct vm_params { int ncpus; sg_size_t ramsize; int overcommit; @@ -24,6 +24,6 @@ typedef struct ws_params { /* set migration speed */ double mig_speed; -} s_ws_params_t, *ws_params_t; +} s_vm_params_t, *vm_params_t; #endif /* SIMGRID_DATATYPES_H_ */ diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 72baeebf21..f5e114464e 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -321,8 +321,8 @@ XBT_PUBLIC(void) MSG_host_set_pstate(msg_host_t h, int pstate); XBT_PUBLIC(int) MSG_host_get_pstate(msg_host_t host); XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void); XBT_PUBLIC(int) MSG_get_host_number(void); -XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params); -XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params); +XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, vm_params_t params); +XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, vm_params_t params); XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host); XBT_PUBLIC(xbt_dynar_t) MSG_host_get_attached_storage_list(msg_host_t host); XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 3fca936d2a..aa162260df 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -341,8 +341,8 @@ XBT_PUBLIC(void) simcall_host_execution_set_affinity(smx_synchro_t execution, sg XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_synchro_t execution); XBT_PUBLIC(xbt_dict_t) simcall_host_get_mounted_storage_list(sg_host_t host); XBT_PUBLIC(xbt_dynar_t) simcall_host_get_attached_storage_list(sg_host_t host); -XBT_PUBLIC(void) simcall_host_get_params(sg_host_t vm, ws_params_t param); -XBT_PUBLIC(void) simcall_host_set_params(sg_host_t vm, ws_params_t param); +XBT_PUBLIC(void) simcall_host_get_params(sg_host_t vm, vm_params_t param); +XBT_PUBLIC(void) simcall_host_set_params(sg_host_t vm, vm_params_t param); /******************************* VM simcalls ********************************/ // Create the vm_workstation at the SURF level diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index 04111ff469..d0f362e3c0 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -387,23 +387,15 @@ XBT_PUBLIC(sg_size_t) surf_host_get_used_size(surf_resource_t resource, const ch /** @brief Get the list of VMs hosted on the host */ XBT_PUBLIC(xbt_dynar_t) surf_host_get_vms(surf_resource_t resource); -/** - * @brief [brief description] - * @details [long description] - * - * @param resource [description] - * @param params [description] +/** @brief Retrieve the params of that VM + * @details You can use fields ramsize and overcommit on a PM, too. */ -XBT_PUBLIC(void) surf_host_get_params(surf_resource_t resource, ws_params_t params); +XBT_PUBLIC(void) surf_host_get_params(surf_resource_t resource, vm_params_t params); -/** - * @brief [brief description] - * @details [long description] - * - * @param resource [description] - * @param params [description] +/** @brief Sets the params of that VM/PM + * @details You can use fields ramsize and overcommit on a PM, too. */ -XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, ws_params_t params); +XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, vm_params_t params); /** * @brief Destroy a VM @@ -412,18 +404,10 @@ XBT_PUBLIC(void) surf_host_set_params(surf_resource_t resource, ws_params_t para */ XBT_PUBLIC(void) surf_vm_destroy(surf_resource_t resource); -/** - * @brief Suspend a VM - * - * @param resource The surf vm - */ +/** @brief Suspend a VM */ XBT_PUBLIC(void) surf_vm_suspend(surf_resource_t resource); -/** - * @brief Resume a VM - * - * @param resource The surf vm - */ +/** @brief Resume a VM */ XBT_PUBLIC(void) surf_vm_resume(surf_resource_t resource); /** diff --git a/src/msg/msg_host.c b/src/msg/msg_host.c index feab85041b..cf97815abf 100644 --- a/src/msg/msg_host.c +++ b/src/msg/msg_host.c @@ -334,7 +334,7 @@ int MSG_host_is_off(msg_host_t host) * \param host a host * \param params a prameter object */ -void MSG_host_set_params(msg_host_t host, ws_params_t params) +void MSG_host_set_params(msg_host_t host, vm_params_t params) { simcall_host_set_params(host, params); } @@ -345,7 +345,7 @@ void MSG_host_set_params(msg_host_t host, ws_params_t params) * \param host a host * \param params a prameter object */ -void MSG_host_get_params(msg_host_t host, ws_params_t params) +void MSG_host_get_params(msg_host_t host, vm_params_t params) { simcall_host_get_params(host, params); } diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index e68d1dd22d..6da50ee9ec 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -178,7 +178,7 @@ msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name, double update_speed = ((double)dp_intensity/100) * mig_netspeed; msg_vm_t vm = MSG_vm_create_core(ind_pm, name); - s_ws_params_t params; + s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = (sg_size_t)ramsize * 1024 * 1024; //params.overcommit = 0; @@ -354,7 +354,7 @@ static int migration_rx_fun(int argc, char *argv[]) // The structure has been created in the do_migration function and should only be freed in the same place ;) struct migration_session *ms = MSG_process_get_data(MSG_process_self()); - s_ws_params_t params; + s_vm_params_t params; simcall_host_get_params(ms->vm, ¶ms); int need_exit = 0; @@ -699,7 +699,7 @@ static int migration_tx_fun(int argc, char *argv[]) // Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;) struct migration_session *ms = MSG_process_get_data(MSG_process_self()); - s_ws_params_t params; + s_vm_params_t params; simcall_host_get_params(ms->vm, ¶ms); const sg_size_t ramsize = params.ramsize; const sg_size_t devsize = params.devsize; diff --git a/src/simix/libsmx.c b/src/simix/libsmx.c index 8fe404ae9e..5bbfc58106 100644 --- a/src/simix/libsmx.c +++ b/src/simix/libsmx.c @@ -457,12 +457,12 @@ void simcall_vm_set_affinity(sg_host_t vm, sg_host_t pm, unsigned long mask) simcall_BODY_vm_set_affinity(vm, pm, mask); } -void simcall_host_get_params(sg_host_t vm, ws_params_t params) +void simcall_host_get_params(sg_host_t vm, vm_params_t params) { simcall_BODY_host_get_params(vm, params); } -void simcall_host_set_params(sg_host_t vm, ws_params_t params) +void simcall_host_set_params(sg_host_t vm, vm_params_t params) { simcall_BODY_host_set_params(vm, params); } diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 24514ae22f..78fbb2216f 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -463,8 +463,8 @@ static inline sg_host_t simcall_host_get_params__get__ind_vm(smx_simcall_t simca static inline void simcall_host_get_params__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline ws_params_t simcall_host_get_params__get__params(smx_simcall_t simcall) { - return (ws_params_t) simcall->args[1].dp; +static inline vm_params_t simcall_host_get_params__get__params(smx_simcall_t simcall) { + return (vm_params_t) simcall->args[1].dp; } static inline void simcall_host_get_params__set__params(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; @@ -476,8 +476,8 @@ static inline sg_host_t simcall_host_set_params__get__ind_vm(smx_simcall_t simca static inline void simcall_host_set_params__set__ind_vm(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline ws_params_t simcall_host_set_params__get__params(smx_simcall_t simcall) { - return (ws_params_t) simcall->args[1].dp; +static inline vm_params_t simcall_host_set_params__get__params(smx_simcall_t simcall) { + return (vm_params_t) simcall->args[1].dp; } static inline void simcall_host_set_params__set__params(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; diff --git a/src/simix/popping_bodies.c b/src/simix/popping_bodies.c index a4a28c8af3..4384ea1a8f 100644 --- a/src/simix/popping_bodies.c +++ b/src/simix/popping_bodies.c @@ -645,7 +645,7 @@ inline static xbt_dynar_t simcall_BODY_host_get_attached_storage_list(sg_host_t return self->simcall.result.dp; } -inline static void simcall_BODY_host_get_params(sg_host_t ind_vm, ws_params_t params) { +inline static void simcall_BODY_host_get_params(sg_host_t ind_vm, vm_params_t params) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ @@ -667,7 +667,7 @@ inline static void simcall_BODY_host_get_params(sg_host_t ind_vm, ws_params_t pa } -inline static void simcall_BODY_host_set_params(sg_host_t ind_vm, ws_params_t params) { +inline static void simcall_BODY_host_set_params(sg_host_t ind_vm, vm_params_t params) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ diff --git a/src/simix/popping_generated.c b/src/simix/popping_generated.c index 084a236e29..be4dc47e7e 100644 --- a/src/simix/popping_generated.c +++ b/src/simix/popping_generated.c @@ -312,12 +312,12 @@ case SIMCALL_HOST_GET_ATTACHED_STORAGE_LIST: break; case SIMCALL_HOST_GET_PARAMS: - SIMIX_host_get_params((sg_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp); + SIMIX_host_get_params((sg_host_t) simcall->args[0].dp,(vm_params_t) simcall->args[1].dp); SIMIX_simcall_answer(simcall); break; case SIMCALL_HOST_SET_PARAMS: - SIMIX_host_set_params((sg_host_t) simcall->args[0].dp,(ws_params_t) simcall->args[1].dp); + SIMIX_host_set_params((sg_host_t) simcall->args[0].dp,(vm_params_t) simcall->args[1].dp); SIMIX_simcall_answer(simcall); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 3649ebf7c5..83044b4e31 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -76,8 +76,8 @@ Proc - host_execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, Blck H host_execution_wait (int) (execution, void*, smx_synchro_t) Func - host_get_mounted_storage_list (void*, xbt_dict_t) (host, void*, sg_host_t) Func - host_get_attached_storage_list (void*, xbt_dynar_t) (host, void*, sg_host_t) -Proc - host_get_params (void) (ind_vm, void*, sg_host_t) (params, void*, ws_params_t) -Proc - host_set_params (void) (ind_vm, void*, sg_host_t) (params, void*, ws_params_t) +Proc - host_get_params (void) (ind_vm, void*, sg_host_t) (params, void*, vm_params_t) +Proc - host_set_params (void) (ind_vm, void*, sg_host_t) (params, void*, vm_params_t) Func - vm_create (void*, sg_host_t) (name, const char*) (ind_pm, void*, sg_host_t) Proc - vm_start (void) (ind_vm, void*, sg_host_t) Func - vm_get_state (int) (ind_vm, void*, sg_host_t) diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index da124c71d8..6a367b2152 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -594,13 +594,13 @@ void SIMIX_set_category(smx_synchro_t synchro, const char *category) * \param host the host to get_phys_host (a sg_host_t) * \param param the parameter object space to be overwritten (a ws_params_t) */ -void SIMIX_host_get_params(sg_host_t ind_vm, ws_params_t params) +void SIMIX_host_get_params(sg_host_t ind_vm, vm_params_t params) { /* jump to ws_get_params(). */ surf_host_get_params(ind_vm, params); } -void SIMIX_host_set_params(sg_host_t ind_vm, ws_params_t params) +void SIMIX_host_set_params(sg_host_t ind_vm, vm_params_t params) { /* jump to ws_set_params(). */ surf_host_set_params(ind_vm, params); diff --git a/src/simix/smx_host_private.h b/src/simix/smx_host_private.h index 17d0ec1994..e780746d33 100644 --- a/src/simix/smx_host_private.h +++ b/src/simix/smx_host_private.h @@ -103,9 +103,9 @@ void SIMIX_vm_set_affinity(sg_host_t ind_vm, sg_host_t ind_pm, unsigned long mas void SIMIX_vm_migratefrom_resumeto(sg_host_t vm, sg_host_t src_pm, sg_host_t dst_pm); -void SIMIX_host_get_params(sg_host_t ind_vm, ws_params_t params); +void SIMIX_host_get_params(sg_host_t ind_vm, vm_params_t params); -void SIMIX_host_set_params(sg_host_t ind_vm, ws_params_t params); +void SIMIX_host_set_params(sg_host_t ind_vm, vm_params_t params); SG_END_DECL() diff --git a/src/simix/smx_vm.c b/src/simix/smx_vm.c index 2f4ddbca24..a2e9831b83 100644 --- a/src/simix/smx_vm.c +++ b/src/simix/smx_vm.c @@ -37,7 +37,7 @@ sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host) /* works for VMs and PMs */ static long host_get_ramsize(sg_host_t vm, int *overcommit) { - s_ws_params_t params; + s_vm_params_t params; surf_host_get_params(vm, ¶ms); if (overcommit) diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index 5c6903f176..4382e94ea5 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -373,12 +373,12 @@ xbt_dynar_t Host::getVms() return dyn; } -void Host::getParams(ws_params_t params) +void Host::getParams(vm_params_t params) { *params = p_params; } -void Host::setParams(ws_params_t params) +void Host::setParams(vm_params_t params) { /* may check something here. */ p_params = *params; diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index 685925d237..5f3f64f0ae 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -315,22 +315,13 @@ public: xbt_dynar_t getVms(); /* common with vm */ - /** - * @brief [brief description] - * @details [long description] - * - * @param params [description] - */ - void getParams(ws_params_t params); - - /** - * @brief [brief description] - * @details [long description] - * - * @param params [description] - */ - void setParams(ws_params_t params); - s_ws_params_t p_params; + /** @brief Retrieve a copy of the parameters of that VM/PM + * @details The ramsize and overcommit fields are used on the PM too */ + void getParams(vm_params_t params); + /** @brief Sets the params of that VM/PM */ + void setParams(vm_params_t params); +private: + s_vm_params_t p_params; }; /********** diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 260984f828..9c172d4aa3 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -383,11 +383,11 @@ xbt_dynar_t surf_host_get_vms(surf_resource_t host){ return vms_; } -void surf_host_get_params(surf_resource_t host, ws_params_t params){ +void surf_host_get_params(surf_resource_t host, vm_params_t params){ get_casted_host(host)->getParams(params); } -void surf_host_set_params(surf_resource_t host, ws_params_t params){ +void surf_host_set_params(surf_resource_t host, vm_params_t params){ get_casted_host(host)->setParams(params); }