[this, &name, core_amount, ramsize] { return this->pimpl_->create_vm(name, core_amount, ramsize); });
}
+VirtualMachine* Host::vm_by_name_or_null(const std::string& name) {
+ simgrid::kernel::resource::VirtualMachineImpl* vm=this->pimpl_->get_vm_by_name_or_null(name);
+ return vm ? vm->get_iface() : nullptr;
+}
+
ExecPtr Host::exec_init(double flops) const
{
return this_actor::exec_init(flops);
return simgrid::s4u::Host::by_name_or_null(name);
}
+/** @brief Retrieve a VM running on a given host from its name, or return NULL if no VM matches*/
+sg_vm_t sg_vm_by_name(sg_host_t host, const char* name)
+{
+ return host->vm_by_name_or_null(name);
+}
+
// ========= Layering madness ==============*
// ========== User data Layer ==========
if (props == nullptr)
return nullptr;
- for (auto const& elm : *props) {
- xbt_dict_set(as_dict, elm.first.c_str(), xbt_strdup(elm.second.c_str()));
+ for (auto const& [key, value] : *props) {
+ xbt_dict_set(as_dict, key.c_str(), xbt_strdup(value.c_str()));
}
return as_dict;
}
if (not props->empty()) {
XBT_INFO(" - properties:");
- for (auto const& elm : *props) {
- XBT_INFO(" %s->%s", elm.first.c_str(), elm.second.c_str());
+ for (auto const& [key, value] : *props) {
+ XBT_INFO(" %s->%s", key.c_str(), value.c_str());
}
}
}