Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
surf::Host don't need no netcard
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 11 Jan 2016 21:08:35 +0000 (22:08 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 11 Jan 2016 21:09:14 +0000 (22:09 +0100)
src/surf/host_interface.cpp
src/surf/host_interface.hpp
src/surf/surf_c_bindings.cpp
src/surf/vm_hl13.cpp

index b2a6700..bc4e286 100644 (file)
@@ -42,8 +42,7 @@ simgrid::xbt::Extension<simgrid::Host, Host> Host::EXTENSION_ID =
 Host *HostModel::createHost(const char *name,NetCard *netElm, Cpu *cpu, xbt_dict_t props){
   xbt_dynar_t storageList = (xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL);
 
-  Host *host = new simgrid::surf::Host(surf_host_model, name, props,
-                 storageList, netElm, cpu);
+  Host *host = new simgrid::surf::Host(surf_host_model, name, props, storageList, cpu);
   XBT_DEBUG("Create host %s with %ld mounted disks", name, xbt_dynar_length(host->p_storage));
   return host;
 }
@@ -91,19 +90,19 @@ simgrid::surf::signal<void(simgrid::surf::Host*)> Host::onDestruction;
 simgrid::surf::signal<void(simgrid::surf::Host*)> Host::onStateChange;
 
 Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
-                                xbt_dynar_t storage, NetCard *netElm, Cpu *cpu)
+                                xbt_dynar_t storage, Cpu *cpu)
  : Resource(model, name)
  , PropertyHolder(props)
- , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
+ , p_storage(storage), p_cpu(cpu)
 {
   p_params.ramsize = 0;
 }
 
 Host::Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
-                                        xbt_dynar_t storage, NetCard *netElm, Cpu *cpu)
+                                        xbt_dynar_t storage, Cpu *cpu)
  : Resource(model, name, constraint)
  , PropertyHolder(props)
- , p_storage(storage), p_netElm(netElm), p_cpu(cpu)
+ , p_storage(storage), p_cpu(cpu)
 {
   p_params.ramsize = 0;
 }
index 4c2a174..a907656 100644 (file)
@@ -91,11 +91,10 @@ public:
    * @param name The name of the Host
    * @param props Dictionary of properties associated to this Host
    * @param storage The Storage associated to this Host
-   * @param netElm The RoutingEdge associated to this Host
    * @param cpu The Cpu associated to this Host
    */
   Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
-                     xbt_dynar_t storage, NetCard *netElm, Cpu *cpu);
+                     xbt_dynar_t storage, Cpu *cpu);
 
   /**
    * @brief Host constructor
@@ -105,12 +104,10 @@ public:
    * @param props Dictionary of properties associated to this Host
    * @param constraint The lmm constraint associated to this Host if it is part of a LMM component
    * @param storage The Storage associated to this Host
-   * @param netElm The RoutingEdge associated to this Host
    * @param cpu The Cpu associated to this Host
    */
   Host(simgrid::surf::Model *model, const char *name, xbt_dict_t props,
-      lmm_constraint_t constraint, xbt_dynar_t storage, NetCard *netElm,
-      Cpu *cpu);
+      lmm_constraint_t constraint, xbt_dynar_t storage, Cpu *cpu);
 
   /* Host destruction logic */
   /**************************/
@@ -243,7 +240,6 @@ public:
 
 public:
   xbt_dynar_t p_storage;
-  NetCard *p_netElm;
   Cpu *p_cpu;
   simgrid::Host* p_host = nullptr;
 
index 82cd73b..37ed364 100644 (file)
@@ -225,9 +225,7 @@ surf_action_t surf_host_model_execute_parallel_task(surf_host_model_t model,
 xbt_dynar_t surf_host_model_get_route(surf_host_model_t /*model*/,
                                              sg_host_t src, sg_host_t dst){
   xbt_dynar_t route = NULL;
-  routing_platf->getRouteAndLatency(
-    get_casted_host(src)->p_netElm,
-               get_casted_host(dst)->p_netElm, &route, NULL);
+  routing_platf->getRouteAndLatency(src->pimpl_netcard, dst->pimpl_netcard, &route, NULL);
   return route;
 }
 
index 95bc2db..b982795 100644 (file)
@@ -176,9 +176,8 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos
    * 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. */
-  p_netElm = host_PM->pimpl_netcard;
   sg_host_t host_VM = sg_host_by_name_or_create(name);
-  host_VM->pimpl_netcard = p_netElm;
+  host_VM->pimpl_netcard = host_PM->pimpl_netcard;
 
   p_vm_state = SURF_VM_STATE_CREATED;
 
@@ -244,7 +243,7 @@ void VMHL13::migrate(sg_host_t host_dest)
    const char *pm_name_dst = surfHost_dst->getName();
 
    /* update net_elm with that of the destination physical host */
-   sg_host_by_name(vm_name)->pimpl_netcard = p_netElm = sg_host_by_name(pm_name_dst)->pimpl_netcard;
+   sg_host_by_name(vm_name)->pimpl_netcard = sg_host_by_name(pm_name_dst)->pimpl_netcard;
 
    p_hostPM = host_dest;