From: Martin Quinson Date: Sat, 22 Oct 2016 00:14:15 +0000 (+0200) Subject: rename MSG_host_(get/set)_params into MSG_vm_(get/set)_params X-Git-Tag: v3_14~292 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/3d84d912367df838e8580499c35f9630fae2cdbf rename MSG_host_(get/set)_params into MSG_vm_(get/set)_params --- diff --git a/ChangeLog b/ChangeLog index 480bfaed47..0970f49de4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,13 +25,15 @@ SimGrid (3.14) UNRELEASED; urgency=low * smpi/cpu-threshold:-1 should become smpi/simulate-computation:no smpi/running-power is renamed to smpi/host-speed - Dropped functions and features + Dropped / renamed functions and features * msg_mailbox_t and associated functions. Use s4u::Mailbox instead. - MSG_mailbox_is_empty() -> Mailbox::empty() - MSG_mailbox_front() -> Mailbox::front() - MSG_mailbox_get_by_alias() -> simgrid::s4u::Mailbox::byName(name) - MSG_mailbox_get_task_ext() -> MSG_task_receive_ext() - MSG_mailbox_get_task_ext_bounded -> MSG_task_receive_ext_bounded + - MSG_host_(get/set)_params -> MSG_vm_(get/set)_params + * Task affinity. Its intended behavior (that was very badly tested and probably not really working) was deceiving what most users would have hoped here. diff --git a/examples/msg/cloud-capping/cloud-capping.c b/examples/msg/cloud-capping/cloud-capping.c index dcfcc7208d..5ecfd7bdb4 100644 --- a/examples/msg/cloud-capping/cloud-capping.c +++ b/examples/msg/cloud-capping/cloud-capping.c @@ -249,7 +249,7 @@ static int master_main(int argc, char *argv[]) s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes - MSG_host_set_params(vm0, ¶ms); + MSG_vm_set_params(vm0, ¶ms); MSG_vm_start(vm0); cpu_speed = MSG_host_get_speed(pm0); diff --git a/examples/msg/cloud-masterworker/cloud-masterworker.c b/examples/msg/cloud-masterworker/cloud-masterworker.c index 181b22e822..0c13cc2380 100644 --- a/examples/msg/cloud-masterworker/cloud-masterworker.c +++ b/examples/msg/cloud-masterworker/cloud-masterworker.c @@ -87,7 +87,7 @@ static int master_fun(int argc, char *argv[]) s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes - MSG_host_set_params(vm, ¶ms); + MSG_vm_set_params(vm, ¶ms); MSG_vm_start(vm); xbt_dynar_push(vms, &vm); diff --git a/examples/msg/cloud-migration/cloud-migration.c b/examples/msg/cloud-migration/cloud-migration.c index c9c7108728..32015e7675 100644 --- a/examples/msg/cloud-migration/cloud-migration.c +++ b/examples/msg/cloud-migration/cloud-migration.c @@ -61,7 +61,7 @@ static int master_main(int argc, char *argv[]) vm0 = MSG_vm_create_core(pm0, "VM0"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes - MSG_host_set_params(vm0, ¶ms); + MSG_vm_set_params(vm0, ¶ms); MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %llu Mbytes RAM", params.ramsize / 1000 / 1000); @@ -71,7 +71,7 @@ static int master_main(int argc, char *argv[]) vm0 = MSG_vm_create_core(pm0, "VM0"); params.ramsize = 1L * 1000 * 1000 * 100; // 100Mbytes - MSG_host_set_params(vm0, ¶ms); + MSG_vm_set_params(vm0, ¶ms); MSG_vm_start(vm0); XBT_INFO("Test: Migrate a VM with %llu Mbytes RAM", params.ramsize / 1000 / 1000); @@ -83,8 +83,8 @@ static int master_main(int argc, char *argv[]) vm1 = MSG_vm_create_core(pm0, "VM1"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes - MSG_host_set_params(vm0, ¶ms); - MSG_host_set_params(vm1, ¶ms); + MSG_vm_set_params(vm0, ¶ms); + MSG_vm_set_params(vm1, ¶ms); MSG_vm_start(vm0); MSG_vm_start(vm1); @@ -100,8 +100,8 @@ static int master_main(int argc, char *argv[]) vm1 = MSG_vm_create_core(pm0, "VM1"); params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes - MSG_host_set_params(vm0, ¶ms); - MSG_host_set_params(vm1, ¶ms); + MSG_vm_set_params(vm0, ¶ms); + MSG_vm_set_params(vm1, ¶ms); MSG_vm_start(vm0); MSG_vm_start(vm1); diff --git a/examples/msg/cloud-simple/cloud-simple.c b/examples/msg/cloud-simple/cloud-simple.c index 7129ee5c9d..7c633ad735 100644 --- a/examples/msg/cloud-simple/cloud-simple.c +++ b/examples/msg/cloud-simple/cloud-simple.c @@ -239,7 +239,7 @@ static int master_main(int argc, char *argv[]) s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = 1L * 1024 * 1024 * 1024; // 1Gbytes - MSG_host_set_params(vm0, ¶ms); + MSG_vm_set_params(vm0, ¶ms); MSG_vm_start(vm0); launch_communication_worker(vm0, pm2); diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 2427604410..a7f1ad3537 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -258,8 +258,6 @@ XBT_PUBLIC(int) MSG_host_get_nb_pstates(msg_host_t h); #define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(); XBT_PUBLIC(int) MSG_get_host_number(); -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); @@ -484,6 +482,9 @@ XBT_PUBLIC(int) MSG_vm_is_restoring(msg_vm_t vm); XBT_PUBLIC(const char*) MSG_vm_get_name(msg_vm_t vm); +XBT_PUBLIC(void) MSG_vm_get_params(msg_vm_t vm, vm_params_t params); +XBT_PUBLIC(void) MSG_vm_set_params(msg_vm_t vm, vm_params_t params); + // TODO add VDI later XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name); XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t ind_pm, const char *name, diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 968090b051..de7123b313 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -36,8 +36,8 @@ private: virtual ~VirtualMachine(); public: - void parameters(vm_params_t params) override; - void setParameters(vm_params_t params) override; + void parameters(vm_params_t params); + void setParameters(vm_params_t params); }; } } // namespace simgrid::s4u diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index b197b726e6..9a794400b4 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -90,8 +90,6 @@ public: int pstatesCount() const; void setPstate(int pstate_index); int pstate(); - virtual void parameters(vm_params_t params); - virtual void setParameters(vm_params_t params); xbt_dict_t mountedStoragesAsDict(); // HACK xbt_dynar_t attachedStorages(); diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 92358c2dbb..856b7f8434 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -237,28 +237,6 @@ int MSG_host_is_off(msg_host_t host) return host->isOff(); } -/** \ingroup m_host_management - * \brief Set the parameters of a given host - * - * \param host a host - * \param params a prameter object - */ -void MSG_host_set_params(msg_host_t host, vm_params_t params) -{ - host->setParameters(params); -} - -/** \ingroup m_host_management - * \brief Get the parameters of a given host - * - * \param host a host - * \param params a prameter object - */ -void MSG_host_get_params(msg_host_t host, vm_params_t params) -{ - host->parameters(params); -} - /** \ingroup m_host_management * \brief Return the speed of the processor (in flop/s) at a given pstate. See also @ref SURF_plugin_energy. * diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 46dae391f7..0b985ba8ca 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -11,6 +11,7 @@ #include +#include #include #include "msg_private.h" @@ -58,6 +59,27 @@ void MSG_vm_set_property_value(msg_vm_t vm, const char *name, void *value, void_ { xbt_dict_set(MSG_host_get_properties(vm), name, value, free_ctn); } +/** \ingroup m_vm_management + * \brief Set the parameters of a given host + * + * \param vm a vm + * \param params a parameter object + */ +void MSG_vm_set_params(msg_vm_t vm, vm_params_t params) +{ + static_cast(vm)->setParameters(params); +} + +/** \ingroup m_vm_management + * \brief Get the parameters of a given host + * + * \param host a host + * \param params a prameter object + */ +void MSG_vm_get_params(msg_vm_t vm, vm_params_t params) +{ + static_cast(vm)->parameters(params); +} /** \ingroup msg_vm_management * \brief Finds a msg_vm_t using its name. @@ -182,7 +204,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char *name, int ncpus, int ramsize, //XBT_INFO("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f",params.dp_rate, // params.mig_speed, dp_intensity, update_speed, host_speed); - vm->setParameters(¶ms); + static_cast(vm)->setParameters(¶ms); return vm; } @@ -332,7 +354,7 @@ static int migration_rx_fun(int argc, char *argv[]) struct migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self()); s_vm_params_t params; - ms->vm->parameters(¶ms); + static_cast(ms->vm)->parameters(¶ms); int need_exit = 0; @@ -636,7 +658,7 @@ static int migration_tx_fun(int argc, char *argv[]) migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self()); s_vm_params_t params; - ms->vm->parameters(¶ms); + static_cast(ms->vm)->parameters(¶ms); const sg_size_t ramsize = params.ramsize; const sg_size_t devsize = params.devsize; const int skip_stage1 = params.skip_stage1; diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index ae52217f91..b2c1fb9638 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -194,16 +194,6 @@ int Host::pstate() return pimpl_cpu->getPState(); } -void Host::parameters(vm_params_t params) -{ - THROW_IMPOSSIBLE; // This should only be used on VMs -} - -void Host::setParameters(vm_params_t params) -{ - THROW_IMPOSSIBLE; // This should only be used on VMs -} - /** * \ingroup simix_storage_management * \brief Returns the list of storages mounted on an host.