Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Keep the capping setting of a VM after migration.
authorTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Thu, 21 Nov 2013 12:05:20 +0000 (13:05 +0100)
committerTakahiro Hirofuchi <t.hirofuchi+sg@aist.go.jp>
Wed, 18 Dec 2013 15:15:51 +0000 (16:15 +0100)
Cherry-pick from the hypervisor branch.
Manually fix conflicts around c++ surf.

Conflicts:
src/surf/vm_workstation.c

examples/msg/cloud/bound.c
src/msg/msg_vm.c
src/surf/surf_interface.hpp
src/surf/vm_workstation_hl13.cpp

index 854f1af..2d4a6b6 100644 (file)
@@ -273,6 +273,7 @@ static int master_main(int argc, char *argv[])
 {
   xbt_dynar_t hosts_dynar = MSG_hosts_as_dynar();
   msg_host_t pm0 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t);
+  msg_host_t pm1 = xbt_dynar_get_as(hosts_dynar, 0, msg_host_t);
 
 
   {
@@ -339,7 +340,46 @@ static int master_main(int argc, char *argv[])
   }
 
 
-  XBT_INFO("# 10. Change a bound dynamically.");
+  {
+    msg_host_t vm0 = MSG_vm_create_core(pm0, "VM0");
+
+    s_ws_params_t params;
+    memset(&params, 0, sizeof(params));
+    params.ramsize = 1L * 1000 * 1000 * 1000; // 1Gbytes
+    MSG_host_set_params(vm0, &params);
+    MSG_vm_start(vm0);
+
+    const double cpu_speed = MSG_get_host_speed(pm0);
+    MSG_vm_start(vm0);
+
+    XBT_INFO("# 10. Test migration");
+    const double computation_amount = cpu_speed * 10;
+
+    XBT_INFO("# 10. (a) Put a task on a VM without any bound.");
+    launch_worker(vm0, "worker0", computation_amount, 0, 0);
+    MSG_process_sleep(1000);
+    XBT_INFO(" ");
+
+    XBT_INFO("# 10. (b) set 10%% bound to the VM, and then put a task on the VM.");
+    MSG_vm_set_bound(vm0, cpu_speed / 10);
+    launch_worker(vm0, "worker0", computation_amount, 0, 0);
+    MSG_process_sleep(1000);
+    XBT_INFO(" ");
+
+    XBT_INFO("# 10. (c) migrate");
+    MSG_vm_migrate(vm0, pm1);
+    XBT_INFO(" ");
+
+    XBT_INFO("# 10. (d) Put a task again on the VM.");
+    launch_worker(vm0, "worker0", computation_amount, 0, 0);
+    MSG_process_sleep(1000);
+    XBT_INFO(" ");
+
+    MSG_vm_destroy(vm0);
+  }
+
+
+  XBT_INFO("# 11. Change a bound dynamically.");
   test_dynamic_change();
 
   return 0;
index 454a02e..ff50676 100644 (file)
@@ -975,7 +975,7 @@ static int migration_tx_fun(int argc, char *argv[])
     double clock_post_send = MSG_get_clock();
     double bandwidth = ramsize / (clock_post_send - clock_prev_send);
     threshold = get_threshold_value(bandwidth, max_downtime);
-    XBT_INFO("actual banwdidth %f, threshold %f", bandwidth / 1024 / 1024, threshold);
+    XBT_INFO("actual banwdidth %f (MB/s), threshold %f", bandwidth / 1024 / 1024, threshold);
   }
 
 
index 74db479..fd87a11 100644 (file)
@@ -240,7 +240,6 @@ protected:
   double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */
 
   ModelPtr getModel() {return p_model;}
-  double getBound() {return m_bound;}
 
 public:
 
@@ -253,6 +252,7 @@ public:
 
   e_surf_action_state_t getState(); /**< get the state*/
   virtual void setState(e_surf_action_state_t state); /**< Change state*/
+  double getBound() {return m_bound;}
   double getStartTime(); /**< Return the start time of an action */
   double getFinishTime(); /**< Return the finish time of an action */
   void *getData() {return p_data;}
index 473c66e..b9dd19b 100644 (file)
@@ -383,6 +383,13 @@ void WorkstationVMHL13Lmm::migrate(surf_resource_t ind_dst_pm)
      int ret = p_action->unref();
      xbt_assert(ret == 1, "Bug: some resource still remains");
 
+     /* keep the bound value of the cpu action of the VM. */
+     double old_bound = p_action->getBound();
+     if (old_bound != 0) {
+       XBT_INFO("migrate VM(%s): set bound (%lf) at %s", vm_name, old_bound, pm_name_dst);
+       new_cpu_action->setBound(old_bound);
+     }
+
      p_action = new_cpu_action;
    }