* Model *
*********/
-std::deque<VirtualMachineImpl*> VirtualMachineImpl::allVms_;
+std::deque<s4u::VirtualMachine*> VirtualMachineImpl::allVms_;
/* In the real world, processes on the guest operating system will be somewhat degraded due to virtualization overhead.
* The total CPU share these processes get is smaller than that of the VM process gets on a host operating system. */
**/
/* iterate for all virtual machines */
- for (VirtualMachineImpl* ws_vm : VirtualMachineImpl::allVms_) {
- Cpu* cpu = ws_vm->piface_->pimpl_cpu;
+ for (s4u::VirtualMachine* ws_vm : VirtualMachineImpl::allVms_) {
+ Cpu* cpu = ws_vm->pimpl_cpu;
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->piface_->name().c_str(),
- ws_vm->getPm()->name().c_str());
+ double solved_value = ws_vm->pimpl_vm_->action_->getVariable()->value;
+ XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value, ws_vm->name().c_str(),
+ ws_vm->pimpl_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;
* Resource *
************/
-VirtualMachineImpl::VirtualMachineImpl(simgrid::s4u::Host* piface, simgrid::s4u::Host* host_PM)
+VirtualMachineImpl::VirtualMachineImpl(simgrid::s4u::VirtualMachine* piface, simgrid::s4u::Host* host_PM)
: HostImpl(piface, nullptr /*storage*/), hostPM_(host_PM)
{
/* Register this VM to the list of all VMs */
- allVms_.push_back(this);
+ allVms_.push_back(piface);
/* We create cpu_action corresponding to a VM process on the host operating system. */
/* FIXME: TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */
VirtualMachineImpl::~VirtualMachineImpl()
{
onVmDestruction(this);
- allVms_.erase(find(allVms_.begin(), allVms_.end(), this));
+ allVms_.erase(find(allVms_.begin(), allVms_.end(), piface_));
/* dirty page tracking */
unsigned int size = xbt_dict_size(dp_objs);
*/
class VirtualMachineImpl : public HostImpl {
public:
- explicit VirtualMachineImpl(s4u::Host* piface, s4u::Host* host);
+ explicit VirtualMachineImpl(s4u::VirtualMachine* piface, s4u::Host* host);
~VirtualMachineImpl();
/** @brief Suspend the VM */
public:
e_surf_vm_state_t getState();
void setState(e_surf_vm_state_t state);
- static std::deque<VirtualMachineImpl*> allVms_;
+ static std::deque<s4u::VirtualMachine*> allVms_;
bool isMigrating = false;
if (pm_ramsize && !pm_overcommit) { /* Only verify that we don't overcommit on need */
/* Retrieve the memory occupied by the VMs on that host. Yep, we have to traverse all VMs of all hosts for that */
long total_ramsize_of_vms = 0;
- for (simgrid::surf::VirtualMachineImpl* ws_vm : simgrid::surf::VirtualMachineImpl::allVms_)
- if (pm == ws_vm->getPm())
- total_ramsize_of_vms += ws_vm->getRamsize();
+ for (simgrid::s4u::VirtualMachine* ws_vm : simgrid::surf::VirtualMachineImpl::allVms_)
+ if (pm == ws_vm->pimpl_vm_->getPm())
+ total_ramsize_of_vms += ws_vm->pimpl_vm_->getRamsize();
if (vm_ramsize > pm_ramsize - total_ramsize_of_vms) {
XBT_WARN("cannnot start %s@%s due to memory shortage: vm_ramsize %ld, free %ld, pm_ramsize %ld (bytes).",
void HostModel::adjustWeightOfDummyCpuActions()
{
/* iterate for all virtual machines */
- for (VirtualMachineImpl* ws_vm : VirtualMachineImpl::allVms_) {
+ for (s4u::VirtualMachine* ws_vm : VirtualMachineImpl::allVms_) {
- Cpu* cpu = ws_vm->piface_->pimpl_cpu;
+ Cpu* cpu = ws_vm->pimpl_cpu;
int is_active = lmm_constraint_used(cpu->getModel()->getMaxminSystem(), cpu->getConstraint());
/* FIXME: we should use lmm_update_variable_weight() ? */
/* FIXME: If we assign 1.05 and 0.05, the system makes apparently wrong values. */
- ws_vm->action_->setPriority(1);
+ ws_vm->pimpl_vm_->action_->setPriority(1);
} else {
/* no task exits on this VM */
XBT_DEBUG("set the weight of the dummy CPU action on PM to 0");
- ws_vm->action_->setPriority(0);
+ ws_vm->pimpl_vm_->action_->setPriority(0);
}
}
}