VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, size_t ramsize)
: Host(name), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
{
- // xbt_assert(s4u::Host::by_name(name) == nullptr,
- // "Cannot create a VM named %s: this name is already used by a host or a VM", get_cname());
-
XBT_DEBUG("Create VM %s", get_cname());
/* Currently, a VM uses the network resource of its physical host */
- pimpl_netpoint = physical_host->pimpl_netpoint;
+ set_netpoint(physical_host->get_netpoint());
// Create a VCPU for this VM
std::vector<double> speeds;
XBT_DEBUG("destroy %s", get_cname());
/* Don't free these things twice: they are the ones of my physical host */
- pimpl_netpoint = nullptr;
+ set_netpoint(nullptr);
}
void VirtualMachine::start()
{
on_start(*this);
- simgrid::simix::simcall([this]() {
+ simgrid::kernel::actor::simcall([this]() {
simgrid::vm::VmHostExt::ensureVmExtInstalled();
simgrid::s4u::Host* pm = this->pimpl_vm_->get_physical_host();
{
on_suspend(*this);
smx_actor_t issuer = SIMIX_process_self();
- simgrid::simix::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); });
+ simgrid::kernel::actor::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); });
}
void VirtualMachine::resume()
void VirtualMachine::shutdown()
{
smx_actor_t issuer = SIMIX_process_self();
- simgrid::simix::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); });
+ simgrid::kernel::actor::simcall([this, issuer]() { pimpl_vm_->shutdown(issuer); });
on_shutdown(*this);
}
void VirtualMachine::set_pm(simgrid::s4u::Host* pm)
{
- simgrid::simix::simcall([this, pm]() { pimpl_vm_->set_physical_host(pm); });
+ simgrid::kernel::actor::simcall([this, pm]() { pimpl_vm_->set_physical_host(pm); });
}
VirtualMachine::state VirtualMachine::get_state()
{
- return simgrid::simix::simcall([this]() { return pimpl_vm_->get_state(); });
+ return simgrid::kernel::actor::simcall([this]() { return pimpl_vm_->get_state(); });
}
size_t VirtualMachine::get_ramsize()
*/
void VirtualMachine::set_bound(double bound)
{
- simgrid::simix::simcall([this, bound]() { pimpl_vm_->set_bound(bound); });
+ simgrid::kernel::actor::simcall([this, bound]() { pimpl_vm_->set_bound(bound); });
}
} // namespace simgrid