From: Bruno Donassolo Date: Thu, 8 Apr 2021 16:33:03 +0000 (+0200) Subject: s4u::Host: moving create_disk impl to HostImpl X-Git-Tag: v3.28~455^2~101 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/663d16d1e0cf09a3a955488ebc1bd9520e326524 s4u::Host: moving create_disk impl to HostImpl --- diff --git a/src/s4u/s4u_Host.cpp b/src/s4u/s4u_Host.cpp index 0d114fdf86..44ef6a1aa1 100644 --- a/src/s4u/s4u_Host.cpp +++ b/src/s4u/s4u_Host.cpp @@ -312,9 +312,9 @@ std::vector Host::get_disks() const Disk* Host::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) { - auto disk = - this->get_netpoint()->get_englobing_zone()->get_disk_model()->create_disk(name, read_bandwidth, write_bandwidth); - return disk->set_host(this)->get_iface(); + return kernel::actor::simcall([this, &name, read_bandwidth, write_bandwidth] { + return this->pimpl_->create_disk(name, read_bandwidth, write_bandwidth); + }); } void Host::add_disk(const Disk* disk) diff --git a/src/surf/HostImpl.cpp b/src/surf/HostImpl.cpp index 5be123b3da..7b34661afc 100644 --- a/src/surf/HostImpl.cpp +++ b/src/surf/HostImpl.cpp @@ -3,6 +3,7 @@ /* 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/kernel/routing/NetPoint.hpp" #include "simgrid/s4u/Engine.hpp" #include "simgrid/s4u/Host.hpp" #include "src/plugins/vm/VirtualMachineImpl.hpp" @@ -135,6 +136,13 @@ HostImpl* HostImpl::set_disks(const std::vector& di return this; } +s4u::Disk* HostImpl::create_disk(const std::string& name, double read_bandwidth, double write_bandwidth) +{ + auto disk = piface_.get_netpoint()->get_englobing_zone()->get_disk_model()->create_disk(name, read_bandwidth, + write_bandwidth); + return disk->set_host(&piface_)->get_iface(); +} + void HostImpl::add_disk(const s4u::Disk* disk) { disks_.push_back(disk->get_impl()); diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 67dd918812..1601eca115 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -65,6 +65,7 @@ public: std::vector get_disks() const; HostImpl* set_disks(const std::vector& disks); + s4u::Disk* create_disk(const std::string& name, double read_bandwidth, double write_bandwidth); void add_disk(const s4u::Disk* disk); void remove_disk(const std::string& disk_name);