|
@@ -106,6 +106,8 @@ linkstatusget_do (char *interface_name, int brief)
|
|
|
int rc = 0;
|
|
int rc = 0;
|
|
|
int len, s = 0, t;
|
|
int len, s = 0, t;
|
|
|
char stat_ch;
|
|
char stat_ch;
|
|
|
|
|
+ char *str;
|
|
|
|
|
+ totem_transport_t transport_number = TOTEM_TRANSPORT_KNET;
|
|
|
|
|
|
|
|
printf ("Printing link status.\n");
|
|
printf ("Printing link status.\n");
|
|
|
result = corosync_cfg_initialize (&handle, NULL);
|
|
result = corosync_cfg_initialize (&handle, NULL);
|
|
@@ -113,12 +115,23 @@ linkstatusget_do (char *interface_name, int brief)
|
|
|
printf ("Could not initialize corosync configuration API error %d\n", result);
|
|
printf ("Could not initialize corosync configuration API error %d\n", result);
|
|
|
exit (1);
|
|
exit (1);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
result = cmap_initialize (&cmap_handle);
|
|
result = cmap_initialize (&cmap_handle);
|
|
|
if (result != CS_OK) {
|
|
if (result != CS_OK) {
|
|
|
printf ("Could not initialize corosync cmap API error %d\n", result);
|
|
printf ("Could not initialize corosync cmap API error %d\n", result);
|
|
|
exit (1);
|
|
exit (1);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ result = cmap_get_string(cmap_handle, "totem.transport", &str);
|
|
|
|
|
+ if (result == CS_OK) {
|
|
|
|
|
+ if (strcmp (str, "udpu") == 0) {
|
|
|
|
|
+ transport_number = TOTEM_TRANSPORT_UDPU;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (strcmp (str, "udp") == 0) {
|
|
|
|
|
+ transport_number = TOTEM_TRANSPORT_UDP;
|
|
|
|
|
+ }
|
|
|
|
|
+ free(str);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/* Get a list of nodes. We do it this way rather than using votequorum as cfgtool
|
|
/* Get a list of nodes. We do it this way rather than using votequorum as cfgtool
|
|
|
* needs to be independent of quorum type
|
|
* needs to be independent of quorum type
|
|
|
*/
|
|
*/
|
|
@@ -192,7 +205,7 @@ linkstatusget_do (char *interface_name, int brief)
|
|
|
* UDP(U) interface_status is always OK and doesn't contain
|
|
* UDP(U) interface_status is always OK and doesn't contain
|
|
|
* detailed information (only knet does).
|
|
* detailed information (only knet does).
|
|
|
*/
|
|
*/
|
|
|
- if ((!brief) && (strcmp(interface_status[i], "OK") != 0)) {
|
|
|
|
|
|
|
+ if ((!brief) && (transport_number == TOTEM_TRANSPORT_KNET)) {
|
|
|
len = strlen(interface_status[i]);
|
|
len = strlen(interface_status[i]);
|
|
|
printf ("\tstatus:\n");
|
|
printf ("\tstatus:\n");
|
|
|
while (s < len) {
|
|
while (s < len) {
|
|
@@ -200,6 +213,13 @@ linkstatusget_do (char *interface_name, int brief)
|
|
|
printf("\t\tnodeid %2d:\t", nodeid);
|
|
printf("\t\tnodeid %2d:\t", nodeid);
|
|
|
stat_ch = interface_status[i][s];
|
|
stat_ch = interface_status[i][s];
|
|
|
|
|
|
|
|
|
|
+ /* Set return code to 1 if status is not localhost or connected. */
|
|
|
|
|
+ if (rc == 0) {
|
|
|
|
|
+ if ((stat_ch != 'n') && (stat_ch != '3')) {
|
|
|
|
|
+ rc = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (stat_ch >= '0' && stat_ch <= '9') {
|
|
if (stat_ch >= '0' && stat_ch <= '9') {
|
|
|
t = stat_ch - '0';
|
|
t = stat_ch - '0';
|
|
|
|
|
|
|
@@ -231,6 +251,19 @@ linkstatusget_do (char *interface_name, int brief)
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
printf ("\tstatus\t= %s\n", interface_status[i]);
|
|
printf ("\tstatus\t= %s\n", interface_status[i]);
|
|
|
|
|
+
|
|
|
|
|
+ /* Set return code to 1 if status is not localhost or connected. */
|
|
|
|
|
+ if ((rc == 0) && (transport_number == TOTEM_TRANSPORT_KNET)) {
|
|
|
|
|
+ len = strlen(interface_status[i]);
|
|
|
|
|
+ while (s < len) {
|
|
|
|
|
+ stat_ch = interface_status[i][s];
|
|
|
|
|
+ if ((stat_ch != 'n') && (stat_ch != '3')) {
|
|
|
|
|
+ rc = 1;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ s++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|