VirtualMachineImpl::VirtualMachineImpl(const std::string& name, s4u::VirtualMachine* piface,
simgrid::s4u::Host* host_PM, int core_amount, size_t ramsize)
- : HostImpl(name), piface_(piface), physical_host_(host_PM), core_amount_(core_amount), ramsize_(ramsize)
+ : VirtualMachineImpl(name, host_PM, core_amount, ramsize)
+{
+ set_piface(piface);
+}
+
+VirtualMachineImpl::VirtualMachineImpl(const std::string& name, simgrid::s4u::Host* host_PM, int core_amount,
+ size_t ramsize)
+ : HostImpl(name), physical_host_(host_PM), core_amount_(core_amount), ramsize_(ramsize)
{
- /* Register this VM to the list of all VMs */
- allVms_.push_back(piface);
/* We create cpu_action corresponding to a VM process on the host operating system. */
/* TODO: we have to periodically input GUESTOS_NOISE to the system? how ?
* The value for GUESTOS_NOISE corresponds to the cost of the global action associated to the VM. It corresponds to
XBT_VERB("Create VM(%s)@PM(%s)", name.c_str(), physical_host_->get_cname());
}
+void VirtualMachineImpl::set_piface(s4u::VirtualMachine* piface)
+{
+ xbt_assert(not piface_, "Pointer to interface already configured for this VM (%s)", get_cname());
+ piface_ = piface;
+ /* Register this VM to the list of all VMs */
+ allVms_.push_back(piface);
+}
+
/** @brief A physical host does not disappear in the current SimGrid code, but a VM may disappear during a simulation */
void VirtualMachineImpl::vm_destroy()
{