| 1084 | } |
| 1085 | |
| 1086 | static GHashTable * |
| 1087 | generate_resource_params(resource_t *rsc, pe_working_set_t * data_set) |
| 1088 | { |
| 1089 | GHashTable *params = NULL; |
| 1090 | GHashTable *meta = NULL; |
| 1091 | GHashTable *combined = NULL; |
| 1092 | GHashTableIter iter; |
| 1093 | |
| 1094 | if (!rsc) { |
| 1095 | crm_err("Resource does not exist in config"); |
| 1096 | return NULL; |
| 1097 | } |
| 1098 | |
| 1099 | params = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); |
| 1100 | meta = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); |
| 1101 | combined = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str); |
| 1102 | |
| 1103 | get_rsc_attributes(params, rsc, NULL/* TODO: Pass in local node */, data_set); |
| 1104 | get_meta_attributes(meta, rsc, NULL/* TODO: Pass in local node */, data_set); |
| 1105 | |
| 1106 | if (params) { |
| 1107 | char *key = NULL; |
| 1108 | char *value = NULL; |
| 1109 | |
| 1110 | g_hash_table_iter_init(&iter, params); |
| 1111 | while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) { |
| 1112 | g_hash_table_insert(combined, strdup(key), strdup(value)); |
| 1113 | } |
| 1114 | g_hash_table_destroy(params); |
| 1115 | } |
| 1116 | |
| 1117 | if (meta) { |
| 1118 | char *key = NULL; |
| 1119 | char *value = NULL; |
| 1120 | |
| 1121 | g_hash_table_iter_init(&iter, meta); |
| 1122 | while (g_hash_table_iter_next(&iter, (gpointer *) & key, (gpointer *) & value)) { |
| 1123 | char *crm_name = crm_meta_name(key); |
| 1124 | |
| 1125 | g_hash_table_insert(combined, crm_name, strdup(value)); |
| 1126 | } |
| 1127 | g_hash_table_destroy(meta); |
| 1128 | } |
| 1129 | |
| 1130 | return combined; |
| 1131 | } |
| 1132 | |
| 1133 | |
| 1134 | /* *INDENT-OFF* */ |
no test coverage detected