#include "simgrid/s4u/Exec.hpp"
#include "simgrid/s4u/VirtualMachine.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
-#include "src/simix/smx_private.hpp"
#include "src/surf/HostImpl.hpp"
#include <algorithm>
Host* Host::current()
{
- kernel::actor::ActorImpl* self = SIMIX_process_self();
+ kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
if (self == nullptr)
xbt_die("Cannot call Host::current() from the maestro context");
return self->get_host();
void Host::turn_off()
{
if (is_on()) {
- kernel::actor::ActorImpl* self = SIMIX_process_self();
+ kernel::actor::ActorImpl* self = kernel::actor::ActorImpl::self();
kernel::actor::simcall([this, self] {
for (VirtualMachine* const& vm : vm::VirtualMachineImpl::allVms_)
if (vm->get_pm() == this) {
std::vector<kernel::resource::LinkImpl*> linkImpls;
this->route_to(dest, linkImpls, latency);
for (kernel::resource::LinkImpl* const& l : linkImpls)
- links.push_back(&l->piface_);
+ links.push_back(l->get_iface());
}
/** @brief Just like Host::routeTo, but filling an array of link implementations */
if (mounts_ == nullptr) {
mounts_ = new std::unordered_map<std::string, Storage*>();
for (auto const& m : this->pimpl_->storage_) {
- mounts_->insert({m.first, &m.second->piface_});
+ mounts_->insert({m.first, m.second->get_iface()});
}
}
return *mounts_;
sg_host_t sg_host_self()
{
- simgrid::kernel::actor::ActorImpl* self = SIMIX_process_self();
- return (self == nullptr) ? nullptr : self->get_host();
+ return SIMIX_is_maestro() ? nullptr : simgrid::kernel::actor::ActorImpl::self()->get_host();
}
/* needs to be public and without simcall for exceptions and logging events */
const char* sg_host_self_get_name()
{
- sg_host_t host = sg_host_self();
- if (host == nullptr || SIMIX_process_self() == simix_global->maestro_process)
- return "";
-
- return host->get_cname();
+ return SIMIX_is_maestro() ? "" : simgrid::kernel::actor::ActorImpl::self()->get_host()->get_cname();
}
double sg_host_load(sg_host_t host)