From 9390066188883a7f78e9e6c2013d5482fd224f98 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 12 Feb 2016 00:55:23 +0100 Subject: [PATCH] sg_platf_new_netcard was creating hostlinks. Fix it --- include/simgrid/platf.h | 2 +- src/bindings/lua/lua_platf.cpp | 2 +- src/surf/surf_routing.cpp | 33 +++++++++++++++------------------ src/surf/surfxml_parse.cpp | 2 +- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/include/simgrid/platf.h b/include/simgrid/platf.h index 5f2d8b8ddb..c9eae8d45f 100644 --- a/include/simgrid/platf.h +++ b/include/simgrid/platf.h @@ -267,7 +267,7 @@ XBT_PUBLIC(void) sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS); // Begin descrip XBT_PUBLIC(void) sg_platf_new_AS_end(void); // That AS is fully described XBT_PUBLIC(void) sg_platf_new_host (sg_platf_host_cbarg_t host); // Add an host to the currently described AS -XBT_PUBLIC(void) sg_platf_new_netcard(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS +XBT_PUBLIC(void) sg_platf_new_hostlink(sg_platf_host_link_cbarg_t h); // Add an host_link to the currently described AS XBT_PUBLIC(void) sg_platf_new_router (sg_platf_router_cbarg_t router); // Add a router to the currently described AS XBT_PUBLIC(void) sg_platf_new_link (sg_platf_link_cbarg_t link); // Add a link to the currently described AS XBT_PUBLIC(void) sg_platf_new_peer (sg_platf_peer_cbarg_t peer); // Add a peer to the currently described AS diff --git a/src/bindings/lua/lua_platf.cpp b/src/bindings/lua/lua_platf.cpp index 41c9a2cb4d..71a7589105 100644 --- a/src/bindings/lua/lua_platf.cpp +++ b/src/bindings/lua/lua_platf.cpp @@ -152,7 +152,7 @@ int console_add_host___link(lua_State *L) { lua_pop(L, 1); XBT_DEBUG("Create a host_link for host %s", netcard.id); - sg_platf_new_netcard(&netcard); + sg_platf_new_hostlink(&netcard); return 0; } diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 34b7ecf2f4..73a9d74e2f 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -106,32 +106,29 @@ struct s_model_type routing_models[] = { {NULL, NULL, NULL} }; -/** - * \brief Add a netcard connecting an host to the network element list - * FIXME: integrate into host constructor - */ -void sg_platf_new_netcard(sg_platf_host_link_cbarg_t netcard) +/** @brief Add a link connecting an host to the rest of its AS (which must be cluster or vivaldi) */ +void sg_platf_new_hostlink(sg_platf_host_link_cbarg_t netcard_arg) { - simgrid::surf::NetCard *info = sg_host_by_name(netcard->id)->pimpl_netcard; - xbt_assert(info, "Host '%s' not found!", netcard->id); + simgrid::surf::NetCard *netcard = sg_host_by_name(netcard_arg->id)->pimpl_netcard; + xbt_assert(netcard, "Host '%s' not found!", netcard_arg->id); xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] || current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI], "You have to be in model Cluster to use tag host_link!"); s_surf_parsing_link_up_down_t link_up_down; - link_up_down.link_up = Link::byName(netcard->link_up); - link_up_down.link_down = Link::byName(netcard->link_down); + link_up_down.link_up = Link::byName(netcard_arg->link_up); + link_up_down.link_down = Link::byName(netcard_arg->link_down); - xbt_assert(link_up_down.link_up, "Link '%s' not found!",netcard->link_up); - xbt_assert(link_up_down.link_down, "Link '%s' not found!",netcard->link_down); + xbt_assert(link_up_down.link_up, "Link '%s' not found!",netcard_arg->link_up); + xbt_assert(link_up_down.link_down, "Link '%s' not found!",netcard_arg->link_down); // If dynar is is greater than netcard id and if the host_link is already defined - if((int)xbt_dynar_length(current_routing->p_linkUpDownList) > info->getId() && - xbt_dynar_get_as(current_routing->p_linkUpDownList, info->getId(), void*)) - surf_parse_error("Host_link for '%s' is already defined!",netcard->id); + if((int)xbt_dynar_length(current_routing->p_linkUpDownList) > netcard->getId() && + xbt_dynar_get_as(current_routing->p_linkUpDownList, netcard->getId(), void*)) + surf_parse_error("Host_link for '%s' is already defined!",netcard_arg->id); - XBT_DEBUG("Push Host_link for host '%s' to position %d", info->getName(), info->getId()); - xbt_dynar_set_as(current_routing->p_linkUpDownList, info->getId(), s_surf_parsing_link_up_down_t, link_up_down); + XBT_DEBUG("Push Host_link for host '%s' to position %d", netcard->getName(), netcard->getId()); + xbt_dynar_set_as(current_routing->p_linkUpDownList, netcard->getId(), s_surf_parsing_link_up_down_t, link_up_down); } void sg_platf_new_trace(sg_platf_trace_cbarg_t trace) @@ -553,7 +550,7 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet) host_link.id = host_id; host_link.link_up = link_up; host_link.link_down = link_down; - sg_platf_new_netcard(&host_link); + sg_platf_new_hostlink(&host_link); free(host_id); free(link_id); @@ -629,7 +626,7 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer) host_link.id = host_id; host_link.link_up = link_up; host_link.link_down = link_down; - sg_platf_new_netcard(&host_link); + sg_platf_new_hostlink(&host_link); XBT_DEBUG("", router_id); s_sg_platf_router_cbarg_t router = SG_PLATF_ROUTER_INITIALIZER; diff --git a/src/surf/surfxml_parse.cpp b/src/surf/surfxml_parse.cpp index 15fa5f2970..02b205bf75 100644 --- a/src/surf/surfxml_parse.cpp +++ b/src/surf/surfxml_parse.cpp @@ -507,7 +507,7 @@ void STag_surfxml_host___link(void){ host_link.id = A_surfxml_host___link_id; host_link.link_up = A_surfxml_host___link_up; host_link.link_down = A_surfxml_host___link_down; - sg_platf_new_netcard(&host_link); + sg_platf_new_hostlink(&host_link); } void STag_surfxml_router(void){ -- 2.20.1