Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change the way VMs are created.
[simgrid.git] / examples / cpp / cloud-capping / s4u-cloud-capping.cpp
index b091001..02bbafd 100644 (file)
@@ -56,8 +56,8 @@ static void test_dynamic_change()
 {
   simgrid::s4u::Host* pm0 = simgrid::s4u::Host::by_name("Fafard");
 
-  auto* vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
-  auto* vm1 = new simgrid::s4u::VirtualMachine("VM1", pm0, 1);
+  auto* vm0 = pm0->create_vm("VM0", 1);
+  auto* vm1 = pm0->create_vm("VM1", 1);
   vm0->start();
   vm1->start();
 
@@ -165,7 +165,7 @@ static void master_main()
   test_two_activities(pm0, pm0);
   XBT_INFO(".");
 
-  auto* vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
+  auto* vm0 = pm0->create_vm("VM0", 1);
   vm0->start();
 
   XBT_INFO("# 3. Put a single activity on a VM.");
@@ -178,7 +178,7 @@ static void master_main()
 
   vm0->destroy();
 
-  vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
+  vm0 = pm0->create_vm("VM0", 1);
   vm0->start();
 
   XBT_INFO("# 6. Put an activity on a PM and an activity on a VM.");
@@ -187,7 +187,7 @@ static void master_main()
 
   vm0->destroy();
 
-  vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
+  vm0 = pm0->create_vm("VM0", 1);
   vm0->set_bound(pm0->get_speed() / 10);
   vm0->start();
 
@@ -205,7 +205,7 @@ static void master_main()
 
   vm0->destroy();
 
-  vm0 = new simgrid::s4u::VirtualMachine("VM0", pm0, 1);
+  vm0 = pm0->create_vm("VM0", 1);
   vm0->set_ramsize(1e9); // 1GB
   vm0->start();