Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move all VM+energy code into callbacks
[simgrid.git] / src / surf / vm_hl13.cpp
index 3553f5d..82c3591 100644 (file)
@@ -132,35 +132,6 @@ double VMHL13Model::shareResources(double now)
   if (min_by_sto >= 0.0 && min_by_sto < ret)
        ret = min_by_sto;
 
-  /* FIXME: 3. do we have to re-initialize our cpu_action object? */
-#if 0
-  /* iterate for all virtual machines */
-  for (VMModel::vm_list_t::iterator iter =
-         VMModel::ws_vms.begin();
-       iter !=  VMModel::ws_vms.end(); ++iter) {
-
-    {
-#if 0
-      VM2013 *ws_vm2013 = static_cast<VM2013Ptr>(&*iter);
-      XBT_INFO("cost %f remains %f start %f finish %f", ws_vm2013->cpu_action->cost,
-          ws_vm2013->cpu_action->remains,
-          ws_vm2013->cpu_action->start,
-          ws_vm2013->cpu_action->finish
-          );
-#endif
-#if 0
-      void *ind_sub_host = xbt_lib_get_elm_or_null(host_lib, ws_vm2013->sub_ws->generic_resource.getName);
-      surf_cpu_model_pm->action_unref(ws_vm2013->cpu_action);
-      /* FIXME: this means busy loop? */
-      // ws_vm2013->cpu_action = surf_cpu_model_pm->extension.cpu.execute(ind_sub_host, GUESTOS_NOISE);
-      ws_vm2013->cpu_action = surf_cpu_model_pm->extension.cpu.execute(ind_sub_host, 0);
-#endif
-
-    }
-  }
-#endif
-
-
   return ret;
 }
 
@@ -205,7 +176,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
                                                   surf_resource_t host_PM)
  : VirtualMachine(model, name, props, NULL, NULL)
 {
-  Host *sub_ws = static_cast<Host*>(surf_host_resource_priv(host_PM));
+  Host *sub_ws = surf_host_resource_priv(host_PM);
 
   /* Currently, we assume a VM has no storage. */
   p_storage = NULL;
@@ -237,8 +208,6 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
       NULL,                       // host->state_trace,
       NULL);                       // host->properties,
 
-       p_cpu->setVirtual(sub_cpu);
-
   /* We create cpu_action corresponding to a VM process on the host operating system. */
   /* FIXME: TODO: we have to periodically input GUESTOS_NOISE to the system? how ? */
   // vm_ws->cpu_action = surf_cpu_model_pm->extension.cpu.execute(host_PM, GUESTOS_NOISE);
@@ -246,6 +215,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
 
   XBT_INFO("Create VM(%s)@PM(%s) with %ld mounted disks", name, sub_ws->getName(), xbt_dynar_length(p_storage));
 
+  surf_callback_emit(VMCreatedCallbacks, this);
 }
 
 /*
@@ -400,10 +370,3 @@ Action *VMHL13::execute(double size)
 Action *VMHL13::sleep(double duration) {
   return p_cpu->sleep(duration);
 }
-
-/**********
- * Action *
- **********/
-
-//FIME:: handle action cancel
-