* Resource *
************/
HostImpl::HostImpl(simgrid::surf::HostModel* model, const char* name, xbt_dynar_t storage)
- : Resource(model, name), PropertyHolder(nullptr), storage_(storage)
+ : PropertyHolder(nullptr), storage_(storage)
{
params_.ramsize = 0;
}
HostImpl::HostImpl(simgrid::surf::HostModel* model, const char* name, lmm_constraint_t constraint, xbt_dynar_t storage)
- : Resource(model, name, constraint), PropertyHolder(nullptr), storage_(storage)
+ : PropertyHolder(nullptr), storage_(storage)
{
params_.ramsize = 0;
}
s_mount_t mnt;
unsigned int cursor;
- XBT_DEBUG("Search for storage name '%s' on '%s'", mount, getName());
+ XBT_DEBUG("Search for storage name '%s' on '%s'", mount, piface_->name().c_str());
xbt_dynar_foreach(storage_,cursor,mnt){
XBT_DEBUG("See '%s'",mnt.name);
if(!strcmp(mount,mnt.name)){
}
}
if(!st)
- xbt_die("Can't find mount '%s' for '%s'", mount, getName());
+ xbt_die("Can't find mount '%s' for '%s'", mount, piface_->name().c_str());
return st;
}
void **data;
xbt_dynar_t result = xbt_dynar_new(sizeof(void*), nullptr);
xbt_lib_foreach(storage_lib, cursor, key, data) {
- if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
- simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
- if(!strcmp((const char*)storage->attach_,this->getName())){
- xbt_dynar_push_as(result, void *, (void*)storage->getName());
- }
+ if (xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
+ simgrid::surf::Storage* storage = static_cast<simgrid::surf::Storage*>(
+ xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+ if (!strcmp((const char*)storage->attach_, piface_->name().c_str())) {
+ xbt_dynar_push_as(result, void*, (void*)storage->getName());
+ }
}
}
return result;
char *file_mount_name = nullptr;
char *mount_name = nullptr;
- XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, getName());
+ XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, piface_->name().c_str());
xbt_dynar_foreach(storage_,cursor,mnt)
{
XBT_DEBUG("See '%s'",mnt.name);
mount_name[longest_prefix_length] = '\0';
}
else
- xbt_die("Can't find mount point for '%s' on '%s'", fullpath, getName());
+ xbt_die("Can't find mount point for '%s' on '%s'", fullpath, piface_->name().c_str());
XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
Action *action = st->open((const char*)mount_name, (const char*)path);
* @brief SURF Host interface class
* @details An host represents a machine with a aggregation of a Cpu, a RoutingEdge and a Storage
*/
-class HostImpl
-: public simgrid::surf::Resource,
- public simgrid::surf::PropertyHolder {
+class HostImpl : public simgrid::surf::PropertyHolder {
public:
/**
/* Host destruction logic */
/**************************/
- ~HostImpl() override;
+ virtual ~HostImpl();
public:
- // Overload the method for covariant return type:
- HostModel *getModel()
- {
- return static_cast<HostModel*>(Resource::getModel());
- }
void attach(simgrid::s4u::Host* host);
/** @brief Return the storage of corresponding mount point */
*/
virtual int fileMove(surf_file_t fd, const char* fullpath);
- bool isUsed() override {DIE_IMPOSSIBLE;} // FIXME: Host should not be a Resource
- void apply_event(tmgr_trace_iterator_t event, double value) override
- {THROW_IMPOSSIBLE;} // FIXME: Host should not be a Resource
-
public:
xbt_dynar_t storage_ = nullptr;
simgrid::s4u::Host* piface_ = nullptr;
xbt_assert(cpu, "cpu-less host");
double solved_value = ws_vm->action_->getVariable()->value;
- XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->getName(), ws_vm->getPm()->name().c_str());
+ XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->piface_->name().c_str(),
+ ws_vm->getPm()->name().c_str());
// TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
// cpu_cas01->constraint->bound = solved_value;
/* Update the physical host of the given VM */
void VirtualMachine::migrate(sg_host_t host_dest)
{
- HostImpl* surfHost_dst = host_dest->pimpl_;
- const char* vm_name = getName();
+ const char* vm_name = piface_->name().c_str();
const char* pm_name_src = hostPM_->name().c_str();
- const char* pm_name_dst = surfHost_dst->getName();
+ const char* pm_name_dst = host_dest->name().c_str();
/* update net_elm with that of the destination physical host */
- sg_host_by_name(vm_name)->pimpl_netcard = sg_host_by_name(pm_name_dst)->pimpl_netcard;
+ piface_->pimpl_netcard = host_dest->pimpl_netcard;
hostPM_ = host_dest;