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

Function generate_params

lrmd/test.c:336–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336static int
337generate_params(void)
338{
339 int rc = 0;
340 pe_working_set_t data_set;
341 xmlNode *cib_xml_copy = NULL;
342 resource_t *rsc = NULL;
343 GHashTable *params = NULL;
344 GHashTable *meta = NULL;
345 GHashTableIter iter;
346
347 if (options.params) {
348 return 0;
349 }
350
351 set_working_set_defaults(&data_set);
352
353 cib_conn = cib_new();
354 rc = cib_conn->cmds->signon(cib_conn, "lrmd_test", cib_query);
355 if (rc != pcmk_ok) {
356 crm_err("Error signing on to the CIB service: %s\n", pcmk_strerror(rc));
357 rc = -1;
358 goto param_gen_bail;
359 }
360
361 cib_xml_copy = get_cib_copy(cib_conn);
362
363 if (!cib_xml_copy) {
364 crm_err("Error retrieving cib copy.");
365 rc = -1;
366 goto param_gen_bail;
367 }
368
369 if (cli_config_update(&cib_xml_copy, NULL, FALSE) == FALSE) {
370 crm_err("Error updating cib configuration");
371 rc = -1;
372 goto param_gen_bail;
373 }
374
375 data_set.input = cib_xml_copy;
376 data_set.now = crm_time_new(NULL);
377
378 cluster_status(&data_set);
379 if (options.rsc_id) {
380 rsc = find_rsc_or_clone(options.rsc_id, &data_set);
381 }
382
383 if (!rsc) {
384 crm_err("Resource does not exist in config");
385 rc = -1;
386 goto param_gen_bail;
387 }
388
389 params = g_hash_table_new_full(crm_str_hash,
390 g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
391 meta = g_hash_table_new_full(crm_str_hash, g_str_equal, g_hash_destroy_str, g_hash_destroy_str);
392
393 get_rsc_attributes(params, rsc, NULL, &data_set);

Callers 1

mainFunction · 0.85

Calls 15

set_working_set_defaultsFunction · 0.85
cib_newFunction · 0.85
pcmk_strerrorFunction · 0.85
get_cib_copyFunction · 0.85
cli_config_updateFunction · 0.85
crm_time_newFunction · 0.85
cluster_statusFunction · 0.85
get_rsc_attributesFunction · 0.85
get_meta_attributesFunction · 0.85
g_hash_table_iter_initFunction · 0.85
g_hash_table_iter_nextFunction · 0.85
lrmd_key_value_addFunction · 0.85

Tested by

no test coverage detected