From 5b4186afc59b21b326fbe3128e4c39b487dd2c36 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 25 Jan 2015 23:54:30 +0100 Subject: [PATCH] properly pass the cluster's properties to the created hosts --- ChangeLog | 3 ++- src/surf/surf_routing.cpp | 11 +++++++++++ src/surf/surfxml_parse.c | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 250996cbc5..73adeb9777 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,7 +51,8 @@ SimGrid (3.12) NOT RELEASED; urgency=low * Bug fixes - "Full" network optimization flag was broken since Surf++ - Better handling of precision flags in maxmin - - Fix bug causing sometimes "Impossible" errors + - Fix bug causing sometimes "Impossible" errors + - Properly pass cluster properties to included hosts XBT * New functions - Add a xbt_heap_update function, to avoid costly xbt_heap_remove+xbt_heap_insert use diff --git a/src/surf/surf_routing.cpp b/src/surf/surf_routing.cpp index 48caddead1..32e238a19f 100644 --- a/src/surf/surf_routing.cpp +++ b/src/surf/surf_routing.cpp @@ -894,6 +894,17 @@ static void routing_parse_cluster(sg_platf_cluster_cbarg_t cluster) memset(&host, 0, sizeof(host)); host.id = host_id; + if ((cluster->properties != NULL) && (!xbt_dict_is_empty(cluster->properties))) { + xbt_dict_cursor_t cursor=NULL; + char *key,*data; + host.properties = xbt_dict_new(); + + xbt_dict_foreach(cluster->properties,cursor,key,data) { + xbt_dict_set(host.properties, key, xbt_strdup(data),free); + } + } else { + XBT_INFO("Null properties for %s: %p",host_id,cluster->properties); + } if (cluster->availability_trace && strcmp(cluster->availability_trace, "")) { xbt_dict_set(patterns, "radical", bprintf("%d", i), NULL); char *avail_file = xbt_str_varsubst(cluster->availability_trace, patterns); diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 98f90f9f73..90c3711c97 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -414,15 +414,17 @@ void STag_surfxml_prop(void) as_current_property_set = xbt_dict_new_homogeneous(xbt_free_f); // Maybe, it should raise an error as_name_tab[as_prop_nb] = xbt_strdup(A_surfxml_AS_id); as_dict_tab[as_prop_nb] = as_current_property_set; - XBT_DEBUG("PUSH prop %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); + XBT_DEBUG("PUSH prop set %p for AS '%s'",as_dict_tab[as_prop_nb],as_name_tab[as_prop_nb]); as_prop_nb++; } + XBT_DEBUG("add prop %s=%s into current AS property set", A_surfxml_prop_id, A_surfxml_prop_value); xbt_dict_set(as_current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), NULL); } else{ if (!current_property_set) current_property_set = xbt_dict_new(); // Maybe, it should raise an error xbt_dict_set(current_property_set, A_surfxml_prop_id, xbt_strdup(A_surfxml_prop_value), xbt_free_f); + XBT_DEBUG("add prop %s=%s into current property set", A_surfxml_prop_id, A_surfxml_prop_value); } } @@ -503,7 +505,7 @@ void STag_surfxml_router(void){ void ETag_surfxml_cluster(void){ s_sg_platf_cluster_cbarg_t cluster; memset(&cluster,0,sizeof(cluster)); - cluster.properties = current_property_set; + cluster.properties = as_current_property_set; cluster.id = A_surfxml_cluster_id; cluster.prefix = A_surfxml_cluster_prefix; -- 2.20.1