Disable 'recovery' button if all nodes are down.
authorYoshiyuki Asaba <y-asaba at pgfoundry.org>
Wed, 26 Dec 2007 08:05:06 +0000 (08:05 +0000)
committerYoshiyuki Asaba <y-asaba at pgfoundry.org>
Wed, 26 Dec 2007 08:05:06 +0000 (08:05 +0000)
nodeStatus.php

index 48ce7f5e1d84a171c1cc42a75d8d554f02ad8539..10c4a577029aac5496ea58cabeb9e4d11e59a975 100644 (file)
@@ -50,6 +50,7 @@ $isReplicationMode = isReplicationMode();
 $isMasterSlaveMode = isMasterSlaveMode();
 
 $nodeInfo = array();
+$node_alive = false;
 
 for($i=0; $i<$nodeCount; $i++) {
     $ret = execPcp('PCP_NODE_INFO', $i);
@@ -63,7 +64,18 @@ for($i=0; $i<$nodeCount; $i++) {
     }
     $nodeInfo[$i] = split(" ", $ret);
     $nodeInfo[$i][3] =  sprintf('%.3f', $nodeInfo[$i][3] / $MAX_VALUE);
-    if( $isParallelMode ) {
+       /* node is active? */
+       if ($nodeInfo[$i][2] != 3)
+               $node_alive = true;
+}
+
+for ($i = 0; $i < $nodeCount; $i++) {
+       if ($node_alive == false) {
+               if ($isReplicationMode || $isMasterSlaveMode)
+                       array_push($nodeInfo[$i], 'return');
+               else
+                       array_push($nodeInfo[$i], 'none');
+       } else if( $isParallelMode ) {
         array_push($nodeInfo[$i], 'none');
     } else {
         switch($nodeInfo[$i][2]) {