- for (int i = 0; i < host_nb * host_nb; i++) {
- if (has_cost(bytes_amount, i) > 0.0) {
- nb++;
- value = has_cost(bytes_amount, i);
+/** Kill all actors hosted here */
+void HostImpl::turn_off(const actor::ActorImpl* issuer)
+{
+ /* turn_off VMs running on host */
+ for (const auto& [_, vm] : vms_) {
+ // call s4u functions to generate the good on_state_change signal, maybe one day this wont be necessary
+ vm->get_iface()->shutdown();
+ vm->get_iface()->turn_off();
+ }
+ for (auto& actor : actor_list_) {
+ XBT_DEBUG("Killing Actor %s@%s on behalf of %s which turned off that host.", actor.get_cname(),
+ actor.get_host()->get_cname(), issuer->get_cname());
+ issuer->kill(&actor);
+ }
+ for (const auto& activity : EngineImpl::get_instance()->get_maestro()->activities_) {
+ auto* exec = dynamic_cast<activity::ExecImpl*>(activity.get());
+ if (exec != nullptr) {
+ auto hosts = exec->get_hosts();
+ if (std::find(hosts.begin(), hosts.end(), &piface_) != hosts.end()) {
+ exec->cancel();
+ exec->set_state(activity::State::FAILED);