X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/128ea0e762c5eb7cd5c5a4be1cb7f745592be979..e13d26773d3aa31c3d0eb24816470bcf8ccc26c0:/src/msg/msg_vm.cpp diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 8c5a0803cb..35efaa791e 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -11,7 +11,7 @@ #include -#include "src/surf/VirtualMachineImpl.hpp" +#include "src/plugins/vm/VirtualMachineImpl.hpp" #include #include @@ -20,46 +20,13 @@ #include "xbt/log.h" #include "simgrid/host.h" +#include "src/simix/smx_host_private.h" /* don't ask me why the VM functions are in there (FIXME:KILLME) */ + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API"); /* **** ******** GENERAL ********* **** */ -/** \ingroup m_vm_management - * \brief Returns the value of a given vm property - * - * \param vm a vm - * \param name a property name - * \return value of a property (or nullptr if property not set) - */ -const char *MSG_vm_get_property_value(msg_vm_t vm, const char *name) -{ - return MSG_host_get_property_value(vm, name); -} - -/** \ingroup m_vm_management - * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this host - * - * \param vm a vm - * \return a dict containing the properties - */ -xbt_dict_t MSG_vm_get_properties(msg_vm_t vm) -{ - xbt_assert((vm != nullptr), "Invalid parameters (vm is nullptr)"); - return vm->properties(); -} -/** \ingroup m_host_management - * \brief Change the value of a given host property - * - * \param vm a vm - * \param name a property name - * \param value what to change the property to - * \param free_ctn the freeing function to use to kill the value on need - */ -void MSG_vm_set_property_value(msg_vm_t vm, const char *name, void *value, void_f_pvoid_t free_ctn) -{ - xbt_dict_set(MSG_host_get_properties(vm), name, value, free_ctn); -} /** \ingroup m_vm_management * \brief Set the parameters of a given host * @@ -82,35 +49,10 @@ 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. - * - * This is a name directory service - * \param name the name of a vm. - * \return the corresponding vm - * - * Please note that a VM is a specific host. Hence, you should give a different name for each VM/PM. - */ -msg_vm_t MSG_vm_get_by_name(const char *name) -{ - return MSG_host_by_name(name); -} - -/** \ingroup m_vm_management - * - * \brief Return the name of the #msg_host_t. - * - * This functions checks whether \a host is a valid pointer or not and return its name. - */ -const char *MSG_vm_get_name(msg_vm_t vm) -{ - return MSG_host_get_name(vm); -} - /* **** Check state of a VM **** */ static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state) { - return simcall_vm_get_state(vm) == state; + return static_cast(vm)->pimpl_vm_->getState() == state; } /** @brief Returns whether the given VM has just created, not running. @@ -402,11 +344,17 @@ static int migration_rx_fun(int argc, char *argv[]) // /* Resume the VM */ // simcall_vm_resume(vm); // - simcall_vm_migratefrom_resumeto(vm, src_pm, dst_pm); + simgrid::simix::kernelImmediate([vm, src_pm, dst_pm]() { + /* Update the vm location */ + SIMIX_vm_migrate(vm, dst_pm); + + /* Resume the VM */ + SIMIX_vm_resume(vm); + }); { // Now the VM is running on the new host (the migration is completed) (even if the SRC crash) - static_cast(vm->pimpl_)->isMigrating = false; + vm->pimpl_vm_->isMigrating = false; XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", sg_host_get_name(ms->vm), sg_host_get_name(ms->src_pm), sg_host_get_name(ms->dst_pm)); TRACE_msg_vm_change_host(ms->vm, ms->src_pm, ms->dst_pm); @@ -455,16 +403,14 @@ static void reset_dirty_pages(msg_vm_t vm) static void start_dirty_page_tracking(msg_vm_t vm) { - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm->pimpl_); - pimpl->dp_enabled = 1; + static_cast(vm)->pimpl_vm_->dp_enabled = 1; reset_dirty_pages(vm); } static void stop_dirty_page_tracking(msg_vm_t vm) { - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm->pimpl_); - pimpl->dp_enabled = 0; + static_cast(vm)->pimpl_vm_->dp_enabled = 0; } static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remaining, double clock) @@ -480,7 +426,7 @@ static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remai static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug, int stage2_round_for_fancy_debug) { - simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm->pimpl_); + simgrid::surf::VirtualMachineImpl* pimpl = static_cast(vm)->pimpl_vm_; double total = 0; char *key = nullptr;