| 601 | } |
| 602 | |
| 603 | static gboolean |
| 604 | try_corosync(int command, enum cluster_type_e stack) |
| 605 | { |
| 606 | int rc = 0; |
| 607 | int quorate = 0; |
| 608 | uint32_t quorum_type = 0; |
| 609 | unsigned int nodeid = 0; |
| 610 | cpg_handle_t c_handle = 0; |
| 611 | quorum_handle_t q_handle = 0; |
| 612 | |
| 613 | mainloop_io_t *ipc = NULL; |
| 614 | GMainLoop *amainloop = NULL; |
| 615 | |
| 616 | struct ipc_client_callbacks node_callbacks = |
| 617 | { |
| 618 | .dispatch = node_mcp_dispatch, |
| 619 | .destroy = node_mcp_destroy |
| 620 | }; |
| 621 | |
| 622 | switch (command) { |
| 623 | case 'R': |
| 624 | if (crmd_remove_node_cache(target_uname)) { |
| 625 | crm_err("Failed to connect to crmd to remove node id %s", target_uname); |
| 626 | } |
| 627 | break; |
| 628 | |
| 629 | case 'e': |
| 630 | /* Age makes no sense (yet) in an AIS cluster */ |
| 631 | fprintf(stdout, "1\n"); |
| 632 | crm_exit(0); |
| 633 | |
| 634 | case 'q': |
| 635 | /* Go direct to the Quorum API */ |
| 636 | rc = quorum_initialize(&q_handle, NULL, &quorum_type); |
| 637 | if (rc != CS_OK) { |
| 638 | crm_err("Could not connect to the Quorum API: %d\n", rc); |
| 639 | return FALSE; |
| 640 | } |
| 641 | |
| 642 | rc = quorum_getquorate(q_handle, &quorate); |
| 643 | if (rc != CS_OK) { |
| 644 | crm_err("Could not obtain the current Quorum API state: %d\n", rc); |
| 645 | return FALSE; |
| 646 | } |
| 647 | |
| 648 | if (quorate) { |
| 649 | fprintf(stdout, "1\n"); |
| 650 | } else { |
| 651 | fprintf(stdout, "0\n"); |
| 652 | } |
| 653 | quorum_finalize(q_handle); |
| 654 | crm_exit(0); |
| 655 | |
| 656 | case 'i': |
| 657 | /* Go direct to the CPG API */ |
| 658 | rc = cpg_initialize(&c_handle, NULL); |
| 659 | if (rc != CS_OK) { |
| 660 | crm_err("Could not connect to the Cluster Process Group API: %d\n", rc); |
no test coverage detected