| 334 | } |
| 335 | |
| 336 | static int |
| 337 | generate_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); |
no test coverage detected