X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dccf1b41e9c7b5a696f01abceaa2779fe65f154f..5c38e05edaea94056953229fbe8b2f3349813c4b:/src/plugins/vm/s4u_VirtualMachine.cpp?ds=sidebyside diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index d648250ae8..3400a3b623 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -3,29 +3,23 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "simgrid/datatypes.h" -#include "simgrid/s4u/VirtualMachine.hpp" -#include "simgrid/s4u/host.hpp" -#include "simgrid/simix.hpp" #include "src/instr/instr_private.h" #include "src/plugins/vm/VirtualMachineImpl.hpp" #include "src/simix/smx_host_private.h" -#include "src/surf/HostImpl.hpp" #include "src/surf/cpu_cas01.hpp" -#include "xbt/asserts.h" XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_vm, "S4U virtual machines"); namespace simgrid { namespace s4u { -VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm) : Host(name) +VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm) + : Host(name), pimpl_vm_(new vm::VirtualMachineImpl(this, pm)) { XBT_DEBUG("Create VM %s", name); - pimpl_vm_ = new vm::VirtualMachineImpl(this, pm); /* Currently, a VM uses the network resource of its physical host */ - pimpl_netcard = pm->pimpl_netcard; + pimpl_netpoint = pm->pimpl_netpoint; // Create a VCPU for this VM surf::CpuCas01* sub_cpu = dynamic_cast(pm->pimpl_cpu); @@ -46,7 +40,7 @@ VirtualMachine::~VirtualMachine() { onDestruction(*this); - XBT_DEBUG("destroy %s", name().c_str()); + XBT_DEBUG("destroy %s", cname()); /* FIXME: this is really strange that everything fails if the next line is removed. * This is as if we shared these data with the PM, which definitely should not be the case... @@ -57,7 +51,7 @@ VirtualMachine::~VirtualMachine() extension_set(nullptr); /* Don't free these things twice: they are the ones of my physical host */ - pimpl_netcard = nullptr; + pimpl_netpoint = nullptr; } bool VirtualMachine::isMigrating() @@ -68,6 +62,14 @@ double VirtualMachine::getRamsize() { return pimpl_vm_->params_.ramsize; } +simgrid::s4u::Host* VirtualMachine::pm() +{ + return pimpl_vm_->getPm(); +} +e_surf_vm_state_t VirtualMachine::getState() +{ + return pimpl_vm_->getState(); +} /** @brief Retrieve a copy of the parameters of that VM/PM * @details The ramsize and overcommit fields are used on the PM too */