[padb-devel] [padb] r209 committed - Check that at least one process has been found in check_signon and abo...

codesite-noreply at google.com codesite-noreply at google.com
Tue Sep 8 20:16:46 BST 2009


Revision: 209
Author: apittman
Date: Tue Sep  8 12:16:20 2009
Log: Check that at least one process has been found in check_signon and  
abort with a friendly error
message if none are found.

http://code.google.com/p/padb/source/detail?r=209

Modified:
  /branches/cleanup/src/padb

=======================================
--- /branches/cleanup/src/padb	Tue Sep  8 11:40:20 2009
+++ /branches/cleanup/src/padb	Tue Sep  8 12:16:20 2009
@@ -3442,14 +3442,18 @@
      push @commands, \%cmd;
      return;
  }
+
+sub last_command {
+    my $req;
+    $req->{mode} = 'exit';
+    return $req;
+}

  sub next_command {
      my $comm_data = shift;

      if ( $#commands == -1 ) {
-        my $req;
-        $req->{mode} = 'exit';
-        return $req;
+        return last_command();
      }

      my $cmd;
@@ -3512,9 +3516,19 @@
      return;
  }

+# Check all processes are detected and report an error to the user.   
Return true if
+# there is no processes are detected.
  sub check_signon {
      my ( $comm_data, $data ) = @_;
      return if ( $conf{check_signon} eq 'none' );
+
+    if ( not defined $data->{target_data}{found}{yes}
+        or rng_empty( $data->{target_data}{found}{yes} ) )
+    {
+        printf "Warning, failed to locate any ranks\n";
+        return 1;
+    }
+
      my %here;
      while (
          defined( my $proc = rng_shift( $data->{target_data}{found}{yes} )  
) )
@@ -3594,10 +3608,19 @@

      # The inner process has signed on.
      if ( $comm_data->{current_req}->{mode} eq 'signon' ) {
-        $comm_data->{current_req} = next_command($comm_data);
+
+        # Check the signon messages, reporting minor errors to the user,  
if no
+        # processes are found then don't bother processing any commands  
but just
+        # tell the inner to exit.
+        my $error = check_signon( $comm_data, $d );
+        if ($error) {
+            $comm_data->{current_req} = last_command();
+        } else {
+            $comm_data->{current_req} = next_command($comm_data);
+        }
+
          issue_command_to_inner( $cdata, $comm_data->{current_req} );
          $comm_data->{state} = 'live';
-        check_signon( $comm_data, $d );
          return;
      }





More information about the padb-devel mailing list