MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / native_parameter

Function native_parameter

lib/pengine/native.c:190–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190char *
191native_parameter(resource_t * rsc, node_t * node, gboolean create, const char *name,
192 pe_working_set_t * data_set)
193{
194 char *value_copy = NULL;
195 const char *value = NULL;
196 GHashTable *hash = rsc->parameters;
197 GHashTable *local_hash = NULL;
198
199 CRM_CHECK(rsc != NULL, return NULL);
200 CRM_CHECK(name != NULL && strlen(name) != 0, return NULL);
201
202 pe_rsc_trace(rsc, "Looking up %s in %s", name, rsc->id);
203
204 if (create || g_hash_table_size(rsc->parameters) == 0) {
205 if (node != NULL) {
206 pe_rsc_trace(rsc, "Creating hash with node %s", node->details->uname);
207 } else {
208 pe_rsc_trace(rsc, "Creating default hash");
209 }
210
211 local_hash = g_hash_table_new_full(crm_str_hash, g_str_equal,
212 g_hash_destroy_str, g_hash_destroy_str);
213
214 get_rsc_attributes(local_hash, rsc, node, data_set);
215
216 hash = local_hash;
217 }
218
219 value = g_hash_table_lookup(hash, name);
220 if (value == NULL) {
221 /* try meta attributes instead */
222 value = g_hash_table_lookup(rsc->meta, name);
223 }
224
225 if (value != NULL) {
226 value_copy = strdup(value);
227 }
228 if (local_hash != NULL) {
229 g_hash_table_destroy(local_hash);
230 }
231 return value_copy;
232}
233
234gboolean
235native_active(resource_t * rsc, gboolean all)

Callers

nothing calls this directly

Calls 1

get_rsc_attributesFunction · 0.85

Tested by

no test coverage detected