| 526 | } |
| 527 | |
| 528 | int |
| 529 | main(int argc, char **argv) |
| 530 | { |
| 531 | int flag = 0; |
| 532 | int argerr = 0; |
| 533 | crm_cluster_t cluster; |
| 534 | gboolean was_err = FALSE; |
| 535 | qb_ipcs_connection_t *c = NULL; |
| 536 | qb_ipcs_service_t *ipcs = NULL; |
| 537 | |
| 538 | crm_log_init(T_ATTRD, LOG_NOTICE, TRUE, FALSE, argc, argv, FALSE); |
| 539 | mainloop_add_signal(SIGTERM, attrd_shutdown); |
| 540 | |
| 541 | while ((flag = getopt(argc, argv, OPTARGS)) != EOF) { |
| 542 | switch (flag) { |
| 543 | case 'V': |
| 544 | crm_bump_log_level(argc, argv); |
| 545 | break; |
| 546 | case 'h': /* Help message */ |
| 547 | usage(T_ATTRD, EX_OK); |
| 548 | break; |
| 549 | default: |
| 550 | ++argerr; |
| 551 | break; |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | if (optind > argc) { |
| 556 | ++argerr; |
| 557 | } |
| 558 | |
| 559 | if (argerr) { |
| 560 | usage(T_ATTRD, EX_USAGE); |
| 561 | } |
| 562 | |
| 563 | attr_hash = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free_hash_entry); |
| 564 | |
| 565 | crm_info("Starting up"); |
| 566 | |
| 567 | if (was_err == FALSE) { |
| 568 | |
| 569 | #if SUPPORT_COROSYNC |
| 570 | if (is_openais_cluster()) { |
| 571 | cluster.destroy = attrd_ais_destroy; |
| 572 | cluster.cs_dispatch = attrd_ais_dispatch; |
| 573 | } |
| 574 | #endif |
| 575 | |
| 576 | #if SUPPORT_HEARTBEAT |
| 577 | if (is_heartbeat_cluster()) { |
| 578 | cluster.hb_conn = NULL; |
| 579 | cluster.hb_dispatch = attrd_ha_callback; |
| 580 | cluster.destroy = attrd_ha_connection_destroy; |
| 581 | } |
| 582 | #endif |
| 583 | |
| 584 | if (FALSE == crm_cluster_connect(&cluster)) { |
| 585 | crm_err("HA Signon failed"); |
nothing calls this directly
no test coverage detected