| 823 | */ |
| 824 | |
| 825 | static int init_all(void) { |
| 826 | cmap_handle = 0; |
| 827 | q_handle = 0; |
| 828 | v_handle = 0; |
| 829 | c_handle = 0; |
| 830 | |
| 831 | if (cmap_initialize(&cmap_handle) != CS_OK) { |
| 832 | fprintf(stderr, "Cannot initialize CMAP service\n"); |
| 833 | cmap_handle = 0; |
| 834 | goto out; |
| 835 | } |
| 836 | |
| 837 | if (quorum_initialize(&q_handle, &q_callbacks, &q_type) != CS_OK) { |
| 838 | fprintf(stderr, "Cannot initialize QUORUM service\n"); |
| 839 | q_handle = 0; |
| 840 | goto out; |
| 841 | } |
| 842 | |
| 843 | if (corosync_cfg_initialize(&c_handle, &c_callbacks) != CS_OK) { |
| 844 | fprintf(stderr, "Cannot initialise CFG service\n"); |
| 845 | c_handle = 0; |
| 846 | goto out; |
| 847 | } |
| 848 | |
| 849 | if (using_votequorum() <= 0) { |
| 850 | return 0; |
| 851 | } |
| 852 | |
| 853 | if (votequorum_initialize(&v_handle, &v_callbacks) != CS_OK) { |
| 854 | fprintf(stderr, "Cannot initialise VOTEQUORUM service\n"); |
| 855 | v_handle = 0; |
| 856 | goto out; |
| 857 | } |
| 858 | |
| 859 | if (cmap_get_uint32(cmap_handle, "runtime.votequorum.this_node_id", &our_nodeid) != CS_OK) { |
| 860 | fprintf(stderr, "Unable to retrieve this_node_id\n"); |
| 861 | goto out; |
| 862 | } |
| 863 | |
| 864 | return 0; |
| 865 | out: |
| 866 | return -1; |
| 867 | } |
| 868 | |
| 869 | static void close_all(void) { |
| 870 | if (cmap_handle) { |
no test coverage detected