#include "xbt/asserts.h"
namespace simgrid {
-
namespace s4u {
VirtualMachine::VirtualMachine(const char* name, s4u::Host* Pm) : Host(name)
onDestruction(*this);
}
+/** @brief Retrieve a copy of the parameters of that VM/PM
+ * @details The ramsize and overcommit fields are used on the PM too */
void VirtualMachine::parameters(vm_params_t params)
{
- this->pimpl_->getParams(params);
+ static_cast<surf::VirtualMachineImpl*>(pimpl_)->getParams(params);
}
-
+/** @brief Sets the params of that VM/PM */
void VirtualMachine::setParameters(vm_params_t params)
{
- simgrid::simix::kernelImmediate([&]() { this->pimpl_->setParams(params); });
+ simgrid::simix::kernelImmediate([&]() { static_cast<surf::VirtualMachineImpl*>(pimpl_)->setParams(params); });
}
} // namespace simgrid
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "mc/mc.h"
+#include "simgrid/s4u/VirtualMachine.hpp"
#include "smx_private.h"
#include "src/surf/HostImpl.hpp"
#include "src/surf/VirtualMachineImpl.hpp"
static long host_get_ramsize(sg_host_t vm, int *overcommit)
{
s_vm_params_t params;
- vm->pimpl_->getParams(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->parameters(¶ms);
if (overcommit)
*overcommit = params.overcommit;
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 */
return dyn;
}
-void HostImpl::getParams(vm_params_t params)
-{
- *params = params_;
-}
-
-void HostImpl::setParams(vm_params_t params)
-{
- /* may check something here. */
- params_ = *params;
-}
-
}}
/** @brief Get the list of virtual machines on the current Host */
xbt_dynar_t getVms();
- /* common with vm */
- /** @brief Retrieve a copy of the parameters of that VM/PM
- * @details The ramsize and overcommit fields are used on the PM too */
- void getParams(vm_params_t params);
- /** @brief Sets the params of that VM/PM */
- void setParams(vm_params_t params);
simgrid::s4u::Host* getHost() { return piface_; }
-private:
- s_vm_params_t params_;
};
}
/* FIXME: TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */
action_ = sub_cpu->execution_start(0);
+ /* Initialize the VM parameters */
+ params_.ramsize = 0;
+
XBT_VERB("Create VM(%s)@PM(%s) with %ld mounted disks", piface->name().c_str(), hostPM_->name().c_str(),
xbt_dynar_length(storage_));
}
{
action_->setBound(bound);
}
+
+void VirtualMachineImpl::getParams(vm_params_t params)
+{
+ *params = params_;
+}
+
+void VirtualMachineImpl::setParams(vm_params_t params)
+{
+ /* may check something here. */
+ params_ = *params;
+}
}
}
*/
class VirtualMachineImpl : public HostImpl {
public:
- VirtualMachineImpl(s4u::Host* piface, s4u::Host* host);
+ explicit VirtualMachineImpl(s4u::Host* piface, s4u::Host* host);
~VirtualMachineImpl();
/** @brief Suspend the VM */
virtual void setBound(double bound);
+ void getParams(vm_params_t params);
+ void setParams(vm_params_t params);
+
/* The vm object of the lower layer */
CpuAction* action_ = nullptr;
void setState(e_surf_vm_state_t state);
static std::deque<VirtualMachineImpl*> allVms_;
+private:
+ s_vm_params_t params_;
+
protected:
e_surf_vm_state_t vmState_ = SURF_VM_STATE_CREATED;
};