-/* Copyright (c) 2015-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2015-2019. 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. */
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_shutdown;
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_suspend;
simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_resume;
+simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_migration_start;
+simgrid::xbt::signal<void(VirtualMachine&)> VirtualMachine::on_migration_end;
-VirtualMachine::VirtualMachine(const char* name, s4u::Host* physical_host, int core_amount)
- : VirtualMachine(name, physical_host, core_amount, 1024)
+VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount)
+ : VirtualMachine(std::move(name), physical_host, core_amount, 1024)
{
}
-VirtualMachine::VirtualMachine(const char* name, s4u::Host* physical_host, int core_amount, size_t ramsize)
- : Host(name), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
+VirtualMachine::VirtualMachine(std::string name, s4u::Host* physical_host, int core_amount, size_t ramsize)
+ : Host(std::move(name)), pimpl_vm_(new vm::VirtualMachineImpl(this, physical_host, core_amount, ramsize))
{
- XBT_DEBUG("Create VM %s", name);
+ // 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;
*/
sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int coreAmount)
{
- xbt_assert(sg_host_by_name(name) == nullptr,
- "Cannot create a VM named %s: this name is already used by an host or a VM", name);
-
return new simgrid::s4u::VirtualMachine(name, pm, coreAmount);
}