* under the terms of the license (GNU LGPL) which comes with this package. */
#include "simgrid/s4u.hpp"
+#include "simgrid/plugins/live_migration.h"
#include "simgrid/s4u/VirtualMachine.hpp"
+
XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example");
static void computation_fun()
double clock_end = simgrid::s4u::Engine::getClock();
XBT_INFO("%s:%s task executed %g", simgrid::s4u::this_actor::getHost()->getCname(),
- simgrid::s4u::this_actor::getName().c_str(), clock_end - clock_sta);
+ simgrid::s4u::this_actor::getCname(), clock_end - clock_sta);
}
static void launch_computation_worker(s4u_Host* host)
static void launch_communication_worker(s4u_Host* tx_host, s4u_Host* rx_host)
{
- std::string mbox_name = std::string("MBOX:") + tx_host->getName() + "-" + rx_host->getName();
+ std::string mbox_name = std::string("MBOX:") + tx_host->getCname() + "-" + rx_host->getCname();
std::vector<std::string> args;
args.push_back(mbox_name);
{
s4u_Host* pm0 = simgrid::s4u::Host::by_name("Fafard");
s4u_Host* pm1 = simgrid::s4u::Host::by_name("Tremblay");
+ s4u_Host* pm2 = simgrid::s4u::Host::by_name("Bourassa");
XBT_INFO("## Test 1 (started): check computation on normal PMs");
vm1->destroy();
XBT_INFO("## Test 5 (ended)");
-}
+ XBT_INFO("## Test 6 (started): Check migration impact (not yet implemented neither on the CPU resource nor on the"
+ " network one");
+ XBT_INFO("### Relocate VM0 between PM0 and PM1");
+ vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
+ vm0->setRamsize(1L * 1024 * 1024 * 1024); // 1GiB
-static void launch_master(s4u_Host* host)
-{
- simgrid::s4u::Actor::createActor("master_", host, master_main);
+ vm0->start();
+ launch_communication_worker(vm0, pm2);
+ simgrid::s4u::this_actor::sleep_for(0.01);
+ sg_vm_migrate(vm0, pm1);
+ simgrid::s4u::this_actor::sleep_for(0.01);
+ sg_vm_migrate(vm0, pm0);
+ simgrid::s4u::this_actor::sleep_for(5);
+ vm0->destroy();
+ XBT_INFO("## Test 6 (ended)");
}
int main(int argc, char* argv[])
{
- simgrid::s4u::Engine* e = new simgrid::s4u::Engine(&argc, argv);
- e->loadPlatform(argv[1]); /* - Load the platform description */
+ simgrid::s4u::Engine e(&argc, argv);
+ sg_vm_live_migration_plugin_init();
+ e.loadPlatform(argv[1]); /* - Load the platform description */
- launch_master(simgrid::s4u::Host::by_name("Fafard"));
+ simgrid::s4u::Actor::createActor("master_", simgrid::s4u::Host::by_name("Fafard"), master_main);
- e->run();
+ e.run();
- XBT_INFO("Simulation time %g", e->getClock());
+ XBT_INFO("Simulation time %g", e.getClock());
return 0;
}