MCPcopy Create free account
hub / github.com/corosync/corosync / nodestatusget_do

Function nodestatusget_do

tools/corosync-cfgtool.c:93–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93static int
94nodestatusget_do (enum user_action action, int brief)
95{
96 cs_error_t result;
97 corosync_cfg_handle_t handle;
98 cmap_handle_t cmap_handle;
99 char iter_key[CMAP_KEYNAME_MAXLEN];
100 cmap_iter_handle_t iter;
101 unsigned int local_nodeid;
102 unsigned int local_nodeid_index=0;
103 unsigned int other_nodeid_index=0;
104 unsigned int nodeid;
105 int nodeid_match_guard;
106 cmap_value_types_t type;
107 size_t value_len;
108 char *str;
109 char *transport_str = NULL;
110 uint32_t nodeid_list[KNET_MAX_HOST];
111 const char *link_transport[KNET_MAX_LINK];
112 int s = 0;
113 int rc = EXIT_SUCCESS;
114 int transport_number = TOTEM_TRANSPORT_KNET;
115 int i,j;
116 struct corosync_cfg_node_status_v1 node_status;
117
118 result = corosync_cfg_initialize (&handle, NULL);
119 if (result != CS_OK) {
120 fprintf (stderr, "Could not initialize corosync configuration API error %d\n", result);
121 exit (EXIT_FAILURE);
122 }
123
124 result = cmap_initialize (&cmap_handle);
125 if (result != CS_OK) {
126 fprintf (stderr, "Could not initialize corosync cmap API error %d\n", result);
127 exit (EXIT_FAILURE);
128 }
129
130 result = cmap_get_string(cmap_handle, "totem.transport", &str);
131 if (result == CS_OK) {
132 if (strcmp (str, "udpu") == 0) {
133 transport_number = TOTEM_TRANSPORT_UDPU;
134 }
135 if (strcmp (str, "udp") == 0) {
136 transport_number = TOTEM_TRANSPORT_UDP;
137 }
138 transport_str = str;
139 }
140 if (!transport_str) {
141 transport_str = strdup("knet"); /* It's the default */
142 }
143
144 result = corosync_cfg_local_get(handle, &local_nodeid);
145 if (result != CS_OK) {
146 fprintf (stderr, "Could not get the local node id, the error is: %d\n", result);
147 free(transport_str);
148 cmap_finalize(cmap_handle);
149 corosync_cfg_finalize(handle);
150 return EXIT_FAILURE;

Callers 1

mainFunction · 0.85

Calls 11

corosync_cfg_initializeFunction · 0.85
cmap_initializeFunction · 0.85
cmap_get_stringFunction · 0.85
corosync_cfg_local_getFunction · 0.85
cmap_finalizeFunction · 0.85
corosync_cfg_finalizeFunction · 0.85
cmap_iter_initFunction · 0.85
cmap_iter_nextFunction · 0.85
cmap_get_uint32Function · 0.85
cmap_iter_finalizeFunction · 0.85

Tested by

no test coverage detected