We need to be able to seal the netzone too.
Sealing a netzone, seals its children and hosts.
Add protection to avoid sealing twice.
s4u::Link* create_link(const std::string& name, const std::vector<std::string>& bandwidths,
Link::SharingPolicy policy = Link::SharingPolicy::SHARED);
+ /**
+ * @brief Seal this netzone configuration
+ */
+ void seal();
+
private:
/** @brief Auxiliary function to get list of LinkImpl */
static std::vector<kernel::resource::LinkImpl*> get_link_list_impl(const std::vector<Link*> link_list);
void NetZoneImpl::seal()
{
+ /* already sealed netzone */
+ if (sealed_)
+ return;
do_seal(); // derived class' specific sealing procedure
+
+ /* seals sub-netzones and hosts */
+ for (auto* host : get_all_hosts()) {
+ host->seal();
+ }
+ for (auto* sub_net : *get_children()) {
+ sub_net->seal();
+ }
sealed_ = true;
}
void Host::seal()
{
- kernel::actor::simcall([this]() { this->pimpl_cpu->seal(); });
kernel::actor::simcall([this]() { this->pimpl_->seal(); });
}
pimpl_->get_graph(graph, nodes, edges);
}
+void NetZone::seal()
+{
+ kernel::actor::simcall([this] { pimpl_->seal(); });
+}
+
s4u::Host* NetZone::create_host(const std::string& name, const std::vector<double>& speed_per_pstate)
{
return kernel::actor::simcall(
void HostImpl::seal()
{
+ if (sealed_) {
+ return;
+ }
+ // seals host's CPU
+ get_iface()->pimpl_cpu->seal();
sealed_ = true;
}
} // namespace surf
void Cpu::seal()
{
+ if (is_sealed()) {
+ return;
+ }
lmm::System* lmm = get_model()->get_maxmin_system();
if (dynamic_cast<CpuTiModel*>(get_model()) == nullptr)
this->set_constraint(lmm->constraint_new(this, core_count_ * speed_per_pstate_.front()));