Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factorize some code between NS3 cluster creation and other clusters
[simgrid.git] / src / surf / virtual_machine.cpp
index 13b0e67..31de254 100644 (file)
@@ -50,7 +50,7 @@ s4u::Host *VMModel::createVM(const char *name, sg_host_t host_PM)
 // const double virt_overhead = 0.95;
 const double virt_overhead = 1;
 
-double VMModel::next_occuring_event(double now)
+double VMModel::nextOccuringEvent(double now)
 {
   /* TODO: update action's cost with the total cost of processes on the VM. */
 
@@ -95,7 +95,7 @@ double VMModel::next_occuring_event(double now)
   adjustWeightOfDummyCpuActions();
 
   /* 3. Ready. Get the next occuring event */
-  return surf_cpu_model_vm->next_occuring_event(now);
+  return surf_cpu_model_vm->nextOccuringEvent(now);
 }
 
 
@@ -221,29 +221,27 @@ void VirtualMachine::migrate(sg_host_t host_dest)
    hostPM_ = host_dest;
 
    /* Update vcpu's action for the new pm */
-   {
-     /* create a cpu action bound to the pm model at the destination. */
-     CpuAction *new_cpu_action = static_cast<CpuAction*>(host_dest->pimpl_cpu->execution_start(0));
-
-     Action::State state = action_->getState();
-     if (state != Action::State::done)
-       XBT_CRITICAL("FIXME: may need a proper handling, %d", static_cast<int>(state));
-     if (action_->getRemainsNoUpdate() > 0)
-       XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate());
-
-     /* keep the bound value of the cpu action of the VM. */
-     double old_bound = action_->getBound();
-     if (old_bound != 0) {
-       XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst);
-       new_cpu_action->setBound(old_bound);
-     }
-
-     XBT_ATTRIB_UNUSED int ret = action_->unref();
-     xbt_assert(ret == 1, "Bug: some resource still remains");
-
-     action_ = new_cpu_action;
+   /* create a cpu action bound to the pm model at the destination. */
+   CpuAction *new_cpu_action = static_cast<CpuAction*>(host_dest->pimpl_cpu->execution_start(0));
+
+   Action::State state = action_->getState();
+   if (state != Action::State::done)
+     XBT_CRITICAL("FIXME: may need a proper handling, %d", static_cast<int>(state));
+   if (action_->getRemainsNoUpdate() > 0)
+     XBT_CRITICAL("FIXME: need copy the state(?), %f", action_->getRemainsNoUpdate());
+
+   /* keep the bound value of the cpu action of the VM. */
+   double old_bound = action_->getBound();
+   if (old_bound != 0) {
+     XBT_DEBUG("migrate VM(%s): set bound (%f) at %s", vm_name, old_bound, pm_name_dst);
+     new_cpu_action->setBound(old_bound);
    }
 
+   XBT_ATTRIB_UNUSED int ret = action_->unref();
+   xbt_assert(ret == 1, "Bug: some resource still remains");
+
+   action_ = new_cpu_action;
+
    XBT_DEBUG("migrate VM(%s): change PM (%s to %s)", vm_name, pm_name_src, pm_name_dst);
 }