Przeglądaj źródła

quorumtool: fix return codes for show_status and monitor

correct return codes should be:
 1 if node is quorate
 0 if node is not quorate
-1 if there is any error gather info on the node

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Fabio M. Di Nitto 14 lat temu
rodzic
commit
9fa86486e9
1 zmienionych plików z 8 dodań i 6 usunięć
  1. 8 6
      tools/corosync-quorumtool.c

+ 8 - 6
tools/corosync-quorumtool.c

@@ -385,13 +385,13 @@ static int show_status(nodeid_format_t nodeid_format, name_format_t name_format)
 	}
 
 quorum_err:
-	if (err < 0) {
-		return err;
+	if (err != CS_OK) {
+		return -1;
 	}
 
 	err = display_quorum_data(is_quorate, 0);
 	if (err != CS_OK) {
-		return err;
+		return -1;
 	}
 	display_nodes_data(nodeid_format, name_format);
 
@@ -403,9 +403,8 @@ static int monitor_status(nodeid_format_t nodeid_format, name_format_t name_form
 	int loop = 0;
 
 	if (q_type == QUORUM_FREE) {
-		show_status(nodeid_format, name_format);
 		printf("\nQuorum is not configured - cannot monitor\n");
-		return 0;
+		return show_status(nodeid_format, name_format);
 	}
 
 	err=quorum_trackstart(q_handle, CS_TRACK_CHANGES);
@@ -435,7 +434,10 @@ static int monitor_status(nodeid_format_t nodeid_format, name_format_t name_form
 	}
 
 quorum_err:
-	return err;
+	if (err != CS_OK) {
+		return -1;
+	}
+	return g_quorate;
 }
 
 static int show_nodes(nodeid_format_t nodeid_format, name_format_t name_format)