From 3e0c19b51995dedb551e2f7f7af05e2f20f29845 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 11 Jan 2016 22:08:35 +0100 Subject: [PATCH] surf::Host don't need no netcard --- src/surf/host_interface.cpp | 11 +++++------ src/surf/host_interface.hpp | 8 ++------ src/surf/surf_c_bindings.cpp | 4 +--- src/surf/vm_hl13.cpp | 5 ++--- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/surf/host_interface.cpp b/src/surf/host_interface.cpp index b2a6700ad9..bc4e28650b 100644 --- a/src/surf/host_interface.cpp +++ b/src/surf/host_interface.cpp @@ -42,8 +42,7 @@ simgrid::xbt::Extension 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 Host::onDestruction; simgrid::surf::signal 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; } diff --git a/src/surf/host_interface.hpp b/src/surf/host_interface.hpp index 4c2a174ad6..a907656cbd 100644 --- a/src/surf/host_interface.hpp +++ b/src/surf/host_interface.hpp @@ -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; diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index 82cd73b735..37ed364ebb 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -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; } diff --git a/src/surf/vm_hl13.cpp b/src/surf/vm_hl13.cpp index 95bc2db8aa..b982795595 100644 --- a/src/surf/vm_hl13.cpp +++ b/src/surf/vm_hl13.cpp @@ -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; -- 2.20.1