/*********
* Model *
*********/
-HostImpl *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
+HostImpl *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu){
xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
- HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, props, storageList, cpu);
+ HostImpl *host = new simgrid::surf::HostImpl(surf_host_model, name, storageList, cpu);
XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
return host;
}
}
}
-HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props,
- xbt_dynar_t storage, Cpu *cpu)
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dynar_t storage, Cpu *cpu)
: Resource(model, name)
- , PropertyHolder(props)
+ , PropertyHolder(nullptr)
, p_storage(storage), p_cpu(cpu)
{
p_params.ramsize = 0;
}
-HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
+HostImpl::HostImpl(simgrid::surf::HostModel *model, const char *name, lmm_constraint_t constraint,
xbt_dynar_t storage, Cpu *cpu)
: Resource(model, name, constraint)
- , PropertyHolder(props)
+ , PropertyHolder(nullptr)
, p_storage(storage), p_cpu(cpu)
{
p_params.ramsize = 0;
HostModel() : Model() {}
~HostModel() override {}
- HostImpl *createHost(const char *name, NetCard *net, Cpu *cpu, xbt_dict_t props);
+ HostImpl *createHost(const char *name, NetCard *net, Cpu *cpu);
virtual void adjustWeightOfDummyCpuActions();
virtual Action *executeParallelTask(int host_nb, sg_host_t *host_list,
* @param storage The Storage associated to this Host
* @param cpu The Cpu associated to this Host
*/
- HostImpl(HostModel *model, const char *name, xbt_dict_t props, xbt_dynar_t storage, Cpu *cpu);
+ HostImpl(HostModel *model, const char *name, xbt_dynar_t storage, Cpu *cpu);
/**
* @brief Host constructor
* @param storage The Storage associated to this Host
* @param cpu The Cpu associated to this Host
*/
- HostImpl(HostModel *model, const char *name, xbt_dict_t props,
+ HostImpl(HostModel *model, const char *name,
lmm_constraint_t constraint, xbt_dynar_t storage, Cpu *cpu);
/* Host destruction logic */
cpu->setStateTrace(host->state_trace);
if (host->speed_trace)
cpu->setSpeedTrace(host->speed_trace);
- surf_host_model->createHost(host->id, netcard, cpu, host->properties)->attach(h);
+ surf_host_model->createHost(host->id, netcard, cpu)->attach(h);
+
+ if (host->properties) {
+ xbt_dict_cursor_t cursor=NULL;
+ char *key,*data;
+ xbt_dict_foreach(host->properties,cursor,key,data)
+ h->setProperty(key,data);
+ }
if (host->pstate != 0)
cpu->setPState(host->pstate);
* Resource *
************/
-VirtualMachine::VirtualMachine(HostModel *model, const char *name, xbt_dict_t props, simgrid::s4u::Host *hostPM)
-: HostImpl(model, name, props, NULL, NULL, NULL)
+VirtualMachine::VirtualMachine(HostModel *model, const char *name, simgrid::s4u::Host *hostPM)
+: HostImpl(model, name, NULL, NULL, NULL)
, p_hostPM(hostPM)
{
VMModel::ws_vms.push_back(*this);
*
* @param model VMModel associated to this VM
* @param name The name of the VM
- * @param props Dictionary of properties associated to this VM
* @param host The host
*/
- VirtualMachine(simgrid::surf::HostModel *model, const char *name, xbt_dict_t props, simgrid::s4u::Host *host);
+ VirtualMachine(simgrid::surf::HostModel *model, const char *name, simgrid::s4u::Host *host);
/** @brief Destructor */
~VirtualMachine();
VirtualMachine *VMHL13Model::createVM(const char *name, sg_host_t host_PM)
{
- VirtualMachine* vm = new VMHL13(this, name, NULL, host_PM);
+ VirtualMachine* vm = new VMHL13(this, name, host_PM);
VMCreatedCallbacks(vm);
return vm;
}
/************
* Resource *
************/
-VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t host_PM)
- : VirtualMachine(model, name, props, host_PM)
+VMHL13::VMHL13(VMModel *model, const char* name, sg_host_t host_PM)
+ : VirtualMachine(model, name, host_PM)
{
/* Currently, we assume a VM has no storage. */
p_storage = NULL;
class VMHL13 : public VirtualMachine {
public:
- VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t host_PM);
+ VMHL13(VMModel *model, const char* name, sg_host_t host_PM);
~VMHL13() {}
void suspend() override;