X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/16bbb8a8212497d9c44c81333ed2c0e689e0c5af..5a9c845da2c148a5e6319c698b0e539ee3351164:/src/simix/smx_vm.cpp diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 69088f1809..e74974f444 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -5,12 +5,9 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "smx_private.h" -#include "xbt/sysdep.h" -#include "xbt/log.h" -#include "xbt/dict.h" #include "mc/mc.h" -#include "src/surf/host_interface.hpp" #include "src/surf/virtual_machine.hpp" +#include "src/surf/HostImpl.hpp" //If you need to log some stuffs, just uncomment these two lines and uses XBT_DEBUG for instance XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_vm, simix, "Logging specific to SIMIX (vms)"); @@ -40,7 +37,7 @@ sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host) static long host_get_ramsize(sg_host_t vm, int *overcommit) { s_vm_params_t params; - surf_host_get_params(vm, ¶ms); + vm->extension()->getParams(¶ms); if (overcommit) *overcommit = params.overcommit; @@ -63,12 +60,12 @@ static int __can_be_started(sg_host_t vm) } if (pm_overcommit) { - XBT_INFO("%s allows memory overcommit.", sg_host_get_name(pm)); + XBT_VERB("%s allows memory overcommit.", sg_host_get_name(pm)); return 1; } long total_ramsize_of_vms = 0; - xbt_dynar_t dyn_vms = surf_host_get_vms(pm); + xbt_dynar_t dyn_vms = pm->extension()->getVms(); { unsigned int cursor = 0; sg_host_t another_vm; @@ -86,7 +83,6 @@ static int __can_be_started(sg_host_t vm) return 0; } - xbt_dynar_free(&dyn_vms); return 1; } @@ -94,7 +90,7 @@ void SIMIX_vm_start(sg_host_t ind_vm) { if (__can_be_started(ind_vm)) static_cast( - ind_vm->extension() + ind_vm->extension() )->setState(SURF_VM_STATE_RUNNING); else THROWF(vm_error, 0, "The VM %s cannot be started", sg_host_get_name(ind_vm)); @@ -104,7 +100,7 @@ void SIMIX_vm_start(sg_host_t ind_vm) e_surf_vm_state_t SIMIX_vm_get_state(sg_host_t ind_vm) { return static_cast( - ind_vm->extension() + ind_vm->extension() )->getState(); } @@ -349,7 +345,7 @@ void SIMIX_vm_shutdown(sg_host_t ind_vm, smx_process_t issuer) /* FIXME: we may have to do something at the surf layer, e.g., vcpu action */ static_cast( - ind_vm->extension() + ind_vm->extension() )->setState(SURF_VM_STATE_CREATED); } @@ -362,19 +358,19 @@ void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm) /** * \brief Function to destroy a SIMIX VM host. * - * \param host the vm host to destroy (a sg_host_t) + * \param vm the vm host to destroy (a sg_host_t) */ -void SIMIX_vm_destroy(sg_host_t ind_vm) +void SIMIX_vm_destroy(sg_host_t vm) { /* this code basically performs a similar thing like SIMIX_host_destroy() */ - const char *hostname = sg_host_get_name(ind_vm); + const char *hostname = sg_host_get_name(vm); XBT_DEBUG("destroy %s", hostname); /* this will call the registered callback function, i.e., SIMIX_host_destroy(). */ - sg_host_simix_destroy(ind_vm); + sg_host_simix_destroy(vm); /* jump to vm_ws_destroy(). The surf level resource will be freed. */ - surf_vm_destroy(ind_vm); + surf_vm_destroy(vm); }