X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1357f314d4641a38be7b639b472b8f2611fe0930..22d91fbd6a4ef77ea6dd2e181a937344ca6fdb5f:/src/surf/HostImpl.cpp diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 5ba84b961c..d64628809e 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -7,6 +7,7 @@ #include #include +#include "xbt/asserts.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/kernel/resource/VirtualMachineImpl.hpp" @@ -28,7 +29,7 @@ namespace simgrid::kernel::resource { ************/ HostImpl::HostImpl(const std::string& name) : piface_(this), name_(name) { - xbt_assert(s4u::Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname()); + xbt_enforce(s4u::Host::by_name_or_null(name_) == nullptr, "Refusing to create a second host named '%s'.", get_cname()); } HostImpl::~HostImpl() @@ -95,7 +96,7 @@ void HostImpl::turn_off(const actor::ActorImpl* issuer) issuer->kill(&actor); } for (const auto& activity : EngineImpl::get_instance()->get_maestro()->activities_) { - auto hosts = activity->get_hosts(); + auto const& hosts = activity->get_hosts(); if (std::find(hosts.begin(), hosts.end(), &piface_) != hosts.end()) { activity->cancel(); activity->set_state(activity::State::FAILED); @@ -158,11 +159,12 @@ s4u::VirtualMachine* HostImpl::create_vm(const std::string& name, s4u::VirtualMa auto* cpu = englobing_zone_->get_cpu_vm_model()->create_cpu(vm, speeds)->set_core_count(vm->get_vm_impl()->get_core_amount()); - if (get_iface()->get_pstate() != 0) - cpu->set_pstate(get_iface()->get_pstate()); - cpu->seal(); + if (get_iface()->get_pstate() != 0) { + cpu->set_pstate(get_iface()->get_pstate()); + } + /* Currently, a VM uses the network resource of its physical host */ vm->set_netpoint(get_iface()->get_netpoint());