/************
* Resource *
************/
-HostImpl::HostImpl(simgrid::surf::HostModel* model, const char* name, xbt_dynar_t storage)
- : PropertyHolder(nullptr), storage_(storage)
+HostImpl::HostImpl(s4u::Host* host, xbt_dynar_t storage) : PropertyHolder(nullptr), storage_(storage), piface_(host)
{
+ piface_->pimpl_ = this;
params_.ramsize = 0;
}
/** @brief use destroy() instead of this destructor */
HostImpl::~HostImpl() = default;
-void HostImpl::attach(simgrid::s4u::Host* host)
-{
- if (piface_ != nullptr)
- xbt_die("Already attached to host %s", host->name().c_str());
- host->pimpl_ = this;
- piface_ = host;
-}
-
simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
{
simgrid::surf::Storage *st = nullptr;
/**
* @brief Host constructor
*
- * @param model HostModel associated to this Host
- * @param name The name of the Host
* @param storage The Storage associated to this Host
*/
- HostImpl(HostModel* model, const char* name, xbt_dynar_t storage);
+ HostImpl(s4u::Host* host, xbt_dynar_t storage);
/* Host destruction logic */
/**************************/
virtual ~HostImpl();
public:
- void attach(simgrid::s4u::Host* host);
-
/** @brief Return the storage of corresponding mount point */
virtual simgrid::surf::Storage *findStorageOnMountList(const char* storage);
if (host->speed_trace)
cpu->setSpeedTrace(host->speed_trace);
- simgrid::surf::HostImpl* hi = new simgrid::surf::HostImpl(surf_host_model, host->id, mount_list);
- hi->attach(h);
+ new simgrid::surf::HostImpl(h, mount_list);
xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void*)mount_list);
mount_list = nullptr;
************/
VirtualMachine::VirtualMachine(HostModel* model, const char* name, simgrid::s4u::Host* host_PM)
- : HostImpl(model, name, nullptr /*storage*/), hostPM_(host_PM)
+ : HostImpl(new simgrid::s4u::Host(name), nullptr /*storage*/), hostPM_(host_PM)
{
/* Register this VM to the list of all VMs */
allVms_.push_back(this);
- piface_ = new simgrid::s4u::Host(name);
- piface_->pimpl_ = this;
-
/* Currently, a VM uses the network resource of its physical host. In
* host_lib, this network resource object is referred from two different keys.
* When deregistering the reference that points the network resource object