From: Bruno Donassolo Date: Tue, 6 Apr 2021 08:01:21 +0000 (+0200) Subject: Copy models from parent netzone X-Git-Tag: v3.28~455^2~153 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4dbd704e34c6e2b2efe96150d83e12d425c5bafd Copy models from parent netzone Allows user creating new netzones without explicitly setting models --- diff --git a/src/kernel/routing/NetZoneImpl.cpp b/src/kernel/routing/NetZoneImpl.cpp index 6caa24615a..9ce2ab479b 100644 --- a/src/kernel/routing/NetZoneImpl.cpp +++ b/src/kernel/routing/NetZoneImpl.cpp @@ -487,6 +487,14 @@ void NetZoneImpl::set_parent(NetZoneImpl* parent) xbt_assert(not sealed_, "Impossible to set parent to an already sealed NetZone(%s)", this->get_cname()); parent_ = parent; netpoint_->set_englobing_zone(parent_); + /* copying models from parent host, to be reviewed when we allow multi-models */ + if (parent) { + set_network_model(parent->get_network_model()); + set_cpu_pm_model(parent->get_cpu_pm_model()); + set_cpu_vm_model(parent->get_cpu_vm_model()); + set_disk_model(parent->get_disk_model()); + set_host_model(parent->get_host_model()); + } } void NetZoneImpl::set_network_model(std::shared_ptr netmodel) diff --git a/src/s4u/s4u_Netzone.cpp b/src/s4u/s4u_Netzone.cpp index 4111435738..7645d5d3fb 100644 --- a/src/s4u/s4u_Netzone.cpp +++ b/src/s4u/s4u_Netzone.cpp @@ -75,7 +75,7 @@ NetZone* NetZone::get_parent() const NetZone* NetZone::set_parent(const NetZone* parent) { - pimpl_->set_parent(parent->get_impl()); + kernel::actor::simcall([this, parent] { pimpl_->set_parent(parent->get_impl()); }); return this; } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index 154b2b82f7..12cc56a2a6 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -479,12 +479,6 @@ sg_platf_create_zone(const simgrid::kernel::routing::ZoneCreationArgs* zone) current_routing->hierarchy_ = simgrid::kernel::routing::NetZoneImpl::RoutingMode::recursive; /* add to the sons dictionary */ current_routing->add_child(new_zone); - /* set models from parent netzone */ - new_zone->set_network_model(current_routing->get_network_model()); - new_zone->set_cpu_pm_model(current_routing->get_cpu_pm_model()); - new_zone->set_cpu_vm_model(current_routing->get_cpu_vm_model()); - new_zone->set_disk_model(current_routing->get_disk_model()); - new_zone->set_host_model(current_routing->get_host_model()); } return new_zone; }