Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Remove signal-related #defines
[simgrid.git] / src / surf / vm_hl13.cpp
index c2ff00a..90be65c 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <algorithm>
 
+#include <simgrid/host.h>
+
 #include "cpu_cas01.hpp"
 #include "vm_hl13.hpp"
 
@@ -36,7 +38,7 @@ void VMHL13Model::updateActionsState(double /*now*/, double /*delta*/) {}
 VirtualMachine *VMHL13Model::createVM(const char *name, sg_host_t host_PM)
 {
   VirtualMachine* vm = new VMHL13(this, name, NULL, host_PM);
-  surf_callback_emit(VMCreatedCallbacks, vm);
+  VMCreatedCallbacks(vm);
   return vm;
 }
 
@@ -177,9 +179,9 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
    * from the VM name, we have to make sure that the system does not call the
    * free callback for the network resource object. The network resource object
    * is still used by the physical machine. */
-  sg_host_t sg_sub_ws = sg_host_by_name_or_create(sub_ws->getName());
-  p_netElm = new RoutingEdgeWrapper(sg_host_edge(sg_sub_ws));
-  sg_host_edge_set(sg_host_by_name_or_create(name), p_netElm);
+  p_netElm = new RoutingEdgeWrapper(sg_host_edge(host_PM));
+  sg_host_t host = sg_host_by_name_or_create(name);
+  sg_host_edge_set(host, p_netElm);
 
   p_subWs = sub_ws;
   p_currentState = SURF_VM_STATE_CREATED;
@@ -195,8 +197,8 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
       NULL,                       // host->power_trace,
       1,                          // host->core_amount,
       SURF_RESOURCE_ON,           // host->initial_state,
-      NULL                      // host->state_trace,
-      NULL);                       // host->properties,
+      NULL);                      // host->state_trace,
+  p_cpu->plug(host);
 
   /* 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 ? */
@@ -337,8 +339,7 @@ void VMHL13::setAffinity(Cpu *cpu, unsigned long mask){
  **/
 sg_host_t VMHL13::getPm()
 {
-  // TODO, store pointer to the PM?
-  return simgrid::Host::find_host(p_subWs->getName());
+  return p_subWs->getHost();
 }
 
 /* Adding a task to a VM updates the VCPU task on its physical machine. */