-/* Copyright (c) 2015-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
EXTENSION_ID = Host::extension_create<VmHostExt>();
}
-VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount)
- : VirtualMachine(name, physical_host, core_amount, 1024)
-{
-}
-
VirtualMachine::VirtualMachine(const std::string& name, s4u::Host* physical_host, int core_amount, size_t ramsize)
: Host(new kernel::resource::VirtualMachineImpl(name, this, physical_host, core_amount, ramsize))
, pimpl_vm_(dynamic_cast<kernel::resource::VirtualMachineImpl*>(Host::get_impl()))
void VirtualMachine::suspend()
{
on_suspend(*this);
- kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ const kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
kernel::actor::simcall([this, issuer]() { pimpl_vm_->suspend(issuer); });
}
shutdown();
XBT_DEBUG("destroy %s", get_cname());
-
+ on_destruction(*this);
/* Then, destroy the VM object */
kernel::actor::simcall([this]() {
get_vm_impl()->vm_destroy();
return this;
}
+void VirtualMachine::start_migration() const
+{
+ pimpl_vm_->start_migration();
+ on_migration_start(*this);
+}
+
+void VirtualMachine::end_migration() const
+{
+ pimpl_vm_->end_migration();
+ on_migration_end(*this);
+}
+
} // namespace s4u
} // namespace simgrid