vm->getParameters(params);
}
+void MSG_vm_set_ramsize(msg_vm_t vm, size_t size)
+{
+ vm->setRamsize(size);
+}
+size_t MSG_vm_get_ramsize(msg_vm_t vm)
+{
+ return vm->getRamsize();
+}
+
/* **** Check state of a VM **** */
static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state)
{
/* For the moment, intensity_rate is the percentage against the migration bandwidth */
- msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount);
+ msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount, static_cast<sg_size_t>(ramsize) * 1024 * 1024);
s_vm_params_t params;
- params.ncpus = 0;
- params.ramsize = static_cast<sg_size_t>(ramsize) * 1024 * 1024;
- params.overcommit = 0;
params.devsize = 0;
params.skip_stage1 = 0;
params.skip_stage2 = 0;
params.max_downtime = 0.03;
params.mig_speed = static_cast<double>(mig_netspeed) * 1024 * 1024; // mig_speed
params.dp_intensity = static_cast<double>(dp_intensity) / 100;
- params.dp_cap = params.ramsize * 0.9; // assume working set memory is 90% of ramsize
+ params.dp_cap = vm->getRamsize() * 0.9; // assume working set memory is 90% of ramsize
XBT_DEBUG("migspeed : %f intensity mem : %d", params.mig_speed, dp_intensity);
vm->setParameters(¶ms);
xbt_assert(sg_host_by_name(name) == nullptr,
"Cannot create a VM named %s: this name is already used by an host or a VM", name);
- return new simgrid::s4u::VirtualMachine(name, pm, 1);
+ msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, 1);
+ s_vm_params_t params;
+ memset(¶ms, 0, sizeof(params));
+ vm->setParameters(¶ms);
+ return vm;
}
/** @brief Create a new VM object with the default parameters, but with a specified amount of cores
* @ingroup msg_VMs*
xbt_assert(sg_host_by_name(name) == nullptr,
"Cannot create a VM named %s: this name is already used by an host or a VM", name);
- return new simgrid::s4u::VirtualMachine(name, pm, coreAmount);
+ msg_vm_t vm = new simgrid::s4u::VirtualMachine(name, pm, coreAmount);
+ s_vm_params_t params;
+ memset(¶ms, 0, sizeof(params));
+ vm->setParameters(¶ms);
+ return vm;
}
/** @brief Destroy a VM. Destroy the VM object from the simulation.
double host_speed = ms->vm->pimpl_vm_->getPm()->getSpeed();
s_vm_params_t params;
ms->vm->getParameters(¶ms);
- const sg_size_t ramsize = params.ramsize;
+ const sg_size_t ramsize = ms->vm->getRamsize();
const sg_size_t devsize = params.devsize;
const int skip_stage1 = params.skip_stage1;
int skip_stage2 = params.skip_stage2;