Fix bug 3492997 Hierachical deployment issue on AIX; 3497212 getmacs -o -D gives no warning message when node state
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11764 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -448,18 +448,21 @@ sub get_phandle { | ||||
|         [qr/]/=> | ||||
|         sub { | ||||
|             nc_msg($verbose, "Unexpected prompt\n"); | ||||
|             $rconsole->clear_accum(); | ||||
|             $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [timeout => | ||||
|         sub { | ||||
|             $rconsole->send("\r"); | ||||
|             $rconsole->clear_accum(); | ||||
|             $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [eof => | ||||
|         sub { | ||||
|             nc_msg($verbose, "Cannot connect to $node"); | ||||
|             $rconsole->clear_accum(); | ||||
|             $rc = 1; | ||||
|             } | ||||
|         ], | ||||
| @@ -514,28 +517,33 @@ sub get_phandle { | ||||
|         # | ||||
|         # All other lines are ignored. | ||||
|         # | ||||
|         @result = (); | ||||
|         @result = $rconsole->expect( | ||||
|             $timeout, | ||||
|             [qr/(\n)([^\r]*)(\r)/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "begin to parse network adapters \n"); | ||||
|                 #$rconsole->clear_accum(); | ||||
|                 } | ||||
|             ], | ||||
|             [qr/>/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "finished \n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $done = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [timeout=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Timeout isolating single line of ls output\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof => | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Cannot connect to $node"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -678,35 +686,41 @@ sub  get_adap_prop    { | ||||
|     while($done[$state] eq 0) { | ||||
|         nc_msg($verbose, "Status: command is $cmd[$state]\n"); | ||||
|         send_command($verbose, $rconsole, $cmd[$state]); | ||||
|         @result = (); | ||||
|         @result = $rconsole->expect( | ||||
|         $timeout, | ||||
|         [ qr/$pattern[$state]/i, | ||||
|             sub { | ||||
|                 nc_msg($verbose, $msg[$state]); | ||||
|                 $state = $newstate[$state]; | ||||
|                 $rconsole->clear_accum(); | ||||
|             } | ||||
|         ], | ||||
|         [ qr/]/, | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [ qr/(.*)DEFAULT(.*)/, | ||||
|             sub { | ||||
|                 nc_msg($verbose, " Default catch error\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [ timeout=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Timeout in getting adapter properpties\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [ eof => | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Cannot connect to $node\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ] | ||||
| @@ -858,6 +872,7 @@ sub get_mac_addr { | ||||
|     $done[4] = 1; | ||||
|  | ||||
|     while($done[$state] eq 0) { | ||||
|         @result = (); | ||||
|         send_command($verbose, $rconsole, $cmd[$state]); | ||||
|         @result = $rconsole->expect( | ||||
|             $timeout, | ||||
| @@ -865,10 +880,12 @@ sub get_mac_addr { | ||||
|             sub { | ||||
|                 nc_msg($verbose, $msg[$state]); | ||||
|                 $state = $newstate[$state]; | ||||
|                 $rconsole->clear_accum(); | ||||
|                 } | ||||
|             ], | ||||
|             [qr/1 > /=> | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 if( $state eq 0 ) { | ||||
|                     # An error occurred while obtaining the mac address.  Log the error, | ||||
|                     # but don't quit nodecond.  instead, return NA for the address | ||||
| @@ -882,18 +899,21 @@ sub get_mac_addr { | ||||
|                                 #$mac_rc = $expect_out; | ||||
|                                 nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle. RC=$mac_rc.\n"); | ||||
|                                 nc_msg($verbose, "Could not obtain MAC address; setting MAX to NA\n" ); | ||||
|                                 $rconsole->clear_accum(); | ||||
|                                 $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [ timeout=> | ||||
|                             sub { | ||||
|                                 nc_msg($verbose, "Timeout when getting mac address\n"); | ||||
|                                 $rconsole->clear_accum(); | ||||
|                                 $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [ eof => | ||||
|                             sub { | ||||
|                                 nc_msg($verbose, " Cannot connect to $node\n"); | ||||
|                                 $rconsole->clear_accum(); | ||||
|                                 $rc = 1; | ||||
|                             } | ||||
|                         ] | ||||
| @@ -904,12 +924,14 @@ sub get_mac_addr { | ||||
|             [qr/]/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)DEFAULT(.*)/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Default catch error\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -917,12 +939,14 @@ sub get_mac_addr { | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Timeout in getting mac address\n"); | ||||
|                 nc_msg($verbose, "timeout state is $state\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof => | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Cannot connect to $node"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -1021,6 +1045,7 @@ sub get_mac_addr { | ||||
|     $done[3] = 1; | ||||
|  | ||||
|     while($done[$state] eq 0) { | ||||
|         @result = (); | ||||
|         nc_msg($verbose, "PROGRAM Status: command is $cmd[$state]\n"); | ||||
|         send_command($verbose, $rconsole, $cmd[$state]); | ||||
|         @result = $rconsole->expect( | ||||
| @@ -1028,11 +1053,13 @@ sub get_mac_addr { | ||||
|             [qr/$pattern[$state]/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, $msg[$state]); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $state = $newstate[$state]; | ||||
|             } | ||||
|             ], | ||||
|             [qr/1 >/=> | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 my $exp = shift; | ||||
|                 if($state eq 0) { | ||||
|                     send_command($verbose, $rconsole, ".\r"); | ||||
| @@ -1040,6 +1067,7 @@ sub get_mac_addr { | ||||
|                         #[qr/(-*\[0-9\]*)  ok(.*)0 >(.*)/=> | ||||
|                         [qr/0 >/=> | ||||
|                         sub { | ||||
|                             $rconsole->clear_accum(); | ||||
|                             my $loc_rc = shift; | ||||
|                             nc_msg($verbose, "Error getting adapter physical location.\n"); | ||||
|                             nc_msg($verbose, "Status: Error getting physical location for phandle=$phandle. RC=$loc_rc.\n"); | ||||
| @@ -1048,12 +1076,14 @@ sub get_mac_addr { | ||||
|                         ], | ||||
|                         [timeout=> | ||||
|                         sub { | ||||
|                             $rconsole->clear_accum(); | ||||
|                             nc_msg($verbose, "Timeout when openning console\n"); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [eof=> | ||||
|                         sub { | ||||
|                             $rconsole->clear_accum(); | ||||
|                             nc_msg($verbose, "Cannot connect to the $node\n"); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
| @@ -1065,24 +1095,28 @@ sub get_mac_addr { | ||||
|             ], | ||||
|             [qr/]/=> | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)DEFAULT(.*)/=> | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Default catch error\n"); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [timeout=> | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Timeout when openning console\n"); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof => | ||||
|             sub { | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Cannot connect to the $node\n"); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
| @@ -1295,30 +1329,35 @@ sub  ping_server{ | ||||
|             [qr/$pattern[$state]/s=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, $msg[$state]); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $state = $newstate[$state]; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/]/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)DEFAULT(.*)/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Default catch error\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [timeout=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Timeout when openning console\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Cannot connect to the $node\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -1383,34 +1422,40 @@ sub  ping_server{ | ||||
|                 my $matchexp = 0; | ||||
|                 my @exp_out; | ||||
|                 while ( $stack_level != 0 ) { | ||||
|                     @exp_out = (); | ||||
|                     send_command($verbose, $rconsole, ".\r"); | ||||
|                     @exp_out = $rconsole->expect( | ||||
|                         [qr/(\[0-9\]*)  ok(.*)(\[0-1\]) >(.*)/s=> | ||||
|                         sub { | ||||
|                             $rconsole->clear_accum(); | ||||
|                             $matchexp = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [qr/]/=> | ||||
|                         sub { | ||||
|                             nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                             $rconsole->clear_accum(); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [qr/(.*)DEFAULT(.*)/=> | ||||
|                         sub { | ||||
|                             nc_msg($verbose, "Default catch error\n"); | ||||
|                             $rconsole->clear_accum(); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [timeout=> | ||||
|                         sub { | ||||
|                             nc_msg($verbose, "Timeout in ping server\n"); | ||||
|                             $rconsole->clear_accum(); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
|                         [eof => | ||||
|                         sub { | ||||
|                             nc_msg($verbose, "Cannot connect to $node\n"); | ||||
|                             $rconsole->clear_accum(); | ||||
|                             $rc = 1; | ||||
|                             } | ||||
|                         ], | ||||
| @@ -1579,6 +1624,7 @@ sub set_disk_boot { | ||||
|         $rconsole->expect( | ||||
|             [qr/$pattern[$state]/=> | ||||
|                 sub { | ||||
|                     $rconsole->clear_accum(); | ||||
|                     if ( $state eq 4 ) { | ||||
|                         if ( $expect_out[6] eq "None" ) { | ||||
|                             $state = 8; | ||||
| @@ -1592,18 +1638,21 @@ sub set_disk_boot { | ||||
|             ], | ||||
|             [qr/THE SELECTED DEVICES WERE NOT DETECTED IN THE SYSTEM/=> | ||||
|                 sub { | ||||
|                     $rconsole->clear_accum(); | ||||
|                     nc_msg($verbose, " Status: THE hard disk WERE NOT DETECTED IN THE SYSTEM!\n"); | ||||
|                     $rc = 1; | ||||
|                  } | ||||
|             ], | ||||
|             [timeout => | ||||
|                 sub { | ||||
|                     $rconsole->clear_accum(); | ||||
|                     nc_msg($verbose, "Timeout in settin boot order\n"); | ||||
|                     $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof => | ||||
|                 sub { | ||||
|                     $rconsole->clear_accum(); | ||||
|                     nc_msg($verbose, "Cannot connect to $node\n"); | ||||
|                     $rc = 1; | ||||
|                 } | ||||
| @@ -1761,6 +1810,7 @@ sub boot_network { | ||||
|         $rconsole->expect( | ||||
|             [qr/$pattern[$state]/=> | ||||
|                 sub { | ||||
|                     $rconsole->clear_accum(); | ||||
|                     my @expect_out = shift; | ||||
|                     if ( $state eq 2 ) { | ||||
|                         if ( $set_boot_order eq 1 ) { | ||||
| @@ -1795,30 +1845,35 @@ sub boot_network { | ||||
|             [qr/----/=> | ||||
|                 sub { | ||||
|                 nc_msg ($verbose, $msg[$state]); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $state = $newstate[$state]; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/]/=> | ||||
|                 sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)DEFAULT(.*)/=> | ||||
|                 sub { | ||||
|                     nc_msg($verbose, "Default catch error\n"); | ||||
|                     $rconsole->clear_accum(); | ||||
|                     $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [timeout=> | ||||
|                 sub { | ||||
|                     nc_msg($verbose, "Timeout when openning console\n"); | ||||
|                     $rconsole->clear_accum(); | ||||
|                     $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof=> | ||||
|                 sub { | ||||
|                     nc_msg($verbose, "Cannot connect to the $node\n"); | ||||
|                     $rconsole->clear_accum(); | ||||
|                     $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -1849,6 +1904,7 @@ sub Boot { | ||||
|                 # If we see a "problem doing RESTART-CMD" message, we re-hit the OPEN-DEV | ||||
|                 # issue after firmware rebooted itself and we need to retry the netboot once more | ||||
|                 nc_msg($verbose, "The network boot ended in an error.\nError : RESTART-CMD\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
| @@ -1862,11 +1918,13 @@ sub Boot { | ||||
|         [qr/BOOTP/=>      #-ex | ||||
|             sub { | ||||
|                 nc_msg($verbose, "# Network boot proceeding, exiting.\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|             } | ||||
|         ], | ||||
|         [qr/------/=>      #-ex | ||||
|             sub { | ||||
|                 nc_msg($verbose, "# Network boot proceeding, exiting.\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|             } | ||||
|         ], | ||||
|         [timeout=> | ||||
| @@ -1877,6 +1935,7 @@ sub Boot { | ||||
|                   \nEither the boot up has taken longer than expected or \ | ||||
|                   \nthere is a problem with system boot.  Check the boot \ | ||||
|                   \nof the node to determine if there is a problem.\n"); | ||||
|             $rconsole->clear_accum(); | ||||
|             #nc_msg($verbose, $expect_out[buffer]); | ||||
|             $rc = 1; | ||||
|             } | ||||
| @@ -1884,6 +1943,7 @@ sub Boot { | ||||
|         [eof=> | ||||
|         sub { | ||||
|             nc_msg($verbose, "Port closed waiting for boot image to boot.\n"); | ||||
|             $rconsole->clear_accum(); | ||||
|             $rc = 1; | ||||
|             } | ||||
|         ], | ||||
| @@ -1971,24 +2031,28 @@ sub multiple_open_dev { | ||||
|         [qr/>/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Status: at End of multiple_open_dev \n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 return 0; | ||||
|              } | ||||
|         ], | ||||
|         [qr/]/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|              } | ||||
|         ], | ||||
|         [timeout => | ||||
|             sub { | ||||
|                 send_user(2, "Timeout\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
|         [eof => | ||||
|             sub { | ||||
|                 send_user(2, "Cannot connect to $node\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|             } | ||||
|         ], | ||||
| @@ -2108,18 +2172,21 @@ sub  Firmware_Dump { | ||||
|             [qr/$pattern[$state]/ => | ||||
|             sub { | ||||
|                 nc_msg($verbose, $msg[$state]); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $state = $newstate[$state]; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/]/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Unexpected prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)DEFAULT(.*)/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Default catch error\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -2127,12 +2194,14 @@ sub  Firmware_Dump { | ||||
|                 sub { | ||||
|                 nc_msg($verbose, "Timeout\n"); | ||||
|                 nc_msg($verbose, "Status: timeout state is $state\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [eof => | ||||
|                 sub { | ||||
|                 nc_msg($verbose, "Cannot connect to $node\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -2414,7 +2483,7 @@ sub lparnetbootexp | ||||
|     #################################### | ||||
|     $rc = xCAT::LparNetbootExp->ck_args($opt, $node, $verbose); | ||||
|     if ($rc != 0) { | ||||
|         nc_msg($verbose,, "ck_args failed. \n"); | ||||
|         nc_msg($verbose, "ck_args failed. \n"); | ||||
|         return [1]; | ||||
|     } | ||||
|  | ||||
| @@ -2458,7 +2527,7 @@ sub lparnetbootexp | ||||
|     #$rconsole->log_file("/tmp/consolelog"); | ||||
|     my $console_pid = $rconsole->pid; | ||||
|     unless ($console_pid) { | ||||
|         nc_msg($verbose,, "Unable to open console.\n"); | ||||
|         nc_msg($verbose, "Unable to open console.\n"); | ||||
|         return [1]; | ||||
|     } | ||||
|     nc_msg($verbose, "spawn_id is $console_pid.\n"); | ||||
| @@ -2477,19 +2546,22 @@ sub lparnetbootexp | ||||
|         [ qr/Enter.* for help.*/i => | ||||
|             sub { | ||||
|                 $rc = 0; | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Connected.\n"); | ||||
|             } | ||||
|         ], | ||||
|         [ timeout => | ||||
|             sub { | ||||
|                 $rc = 1; | ||||
|                 nc_msg($verbose,, "Timeout waiting for console connection.\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Timeout waiting for console connection.\n"); | ||||
|             } | ||||
|         ], | ||||
|         [ eof => | ||||
|             sub { | ||||
|                 $rc = 2; | ||||
|                 nc_msg($verbose,, "Please make sure rcons $node works.\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 nc_msg($verbose, "Please make sure rcons $node works.\n"); | ||||
|             } | ||||
|         ], | ||||
|     ); | ||||
| @@ -2504,7 +2576,7 @@ sub lparnetbootexp | ||||
|     my $subreq = $req->{subreq}; | ||||
|     $output = xCAT::LparNetbootExp->run_lssyscfg($subreq, $verbose, $node); | ||||
|     if ($output =~ /Not Available/) { | ||||
|         nc_msg($verbose,, "LPAR is Not Available. Please make sure the CEC's state.\n"); | ||||
|         nc_msg($verbose, "LPAR is Not Available. Please make sure the CEC's state.\n"); | ||||
|         return [1]; | ||||
|     } else { | ||||
|         nc_msg($verbose, "The lpar state is $output.\n"); | ||||
| @@ -2512,7 +2584,7 @@ sub lparnetbootexp | ||||
|  | ||||
|     if ($from_of) { | ||||
|         unless($output =~ /open firmware/i){ | ||||
|             nc_msg($verbose,, "You are using the -o option. Please make sure the LPAR's initial state is open firmware.\n"); | ||||
|             nc_msg(2, "You are using the -o option. Please make sure the LPAR's initial state is open firmware.\n"); | ||||
|             return [1]; | ||||
|         } | ||||
|  | ||||
| @@ -2535,12 +2607,12 @@ sub lparnetbootexp | ||||
|             $subreq, 0, 1); | ||||
|             $output = join ',', @$sysoutput; | ||||
|             if ($::RUNCMD_RC != 0) {    #$::RUNCMD_RC  will get its value from runxcmd_output | ||||
|                 nc_msg($verbose,, "Unable to run rpower $node off.\n"); | ||||
|                 nc_msg($verbose, "Unable to run rpower $node off.\n"); | ||||
|                 return [1]; | ||||
|             } | ||||
|  | ||||
|             unless ($output =~ /Success/) { | ||||
|                 nc_msg($verbose,, "Power off failed.\n"); | ||||
|                 nc_msg($verbose, "Power off failed.\n"); | ||||
|                 return [1]; | ||||
|             } else { | ||||
|                 nc_msg($verbose, "Wait for power off.\n"); | ||||
| @@ -2557,7 +2629,7 @@ sub lparnetbootexp | ||||
|                 } | ||||
|                 $query_count++; | ||||
|                 if ($query_count > 300) { | ||||
|                     nc_msg($verbose,, "Power off failed.\n"); | ||||
|                     nc_msg($verbose, "Power off failed.\n"); | ||||
|                     return [1]; | ||||
|                 } | ||||
|                 sleep 1; | ||||
| @@ -2586,12 +2658,12 @@ sub lparnetbootexp | ||||
|                 nc_msg($verbose, "Waiting for power on...\n"); | ||||
|  | ||||
|                 if ($::RUNCMD_RC != 0) { | ||||
|                     nc_msg($verbose,, "Unable to run rpower $node sms\n"); | ||||
|                     nc_msg($verbose, "Unable to run rpower $node sms\n"); | ||||
|                     return [1]; | ||||
|                 } | ||||
|                 unless ($output =~ /Success/) { | ||||
|                     if ($retry_count eq 3) { | ||||
|                         nc_msg($verbose,, "Power off failed, msg is $output.\n"); | ||||
|                         nc_msg($verbose, "Power off failed, msg is $output.\n"); | ||||
|                         return [1]; | ||||
|                     } | ||||
|                     sleep 1; | ||||
| @@ -2614,12 +2686,12 @@ sub lparnetbootexp | ||||
|                 nc_msg($verbose, "Waiting for power on...\n"); | ||||
|  | ||||
|                 if ($::RUNCMD_RC != 0) { | ||||
|                     nc_msg($verbose,, "Unable to run rpower $node open firmware.\n"); | ||||
|                     nc_msg($verbose, "Unable to run rpower $node open firmware.\n"); | ||||
|                     return [1]; | ||||
|                 } | ||||
|                 unless ($output =~ /Success/) { | ||||
|                     if ($retry_count eq 3) { | ||||
|                         nc_msg($verbose,, "Power off failed, msg is $output.\n"); | ||||
|                         nc_msg($verbose, "Power off failed, msg is $output.\n"); | ||||
|                         return [1]; | ||||
|                     } | ||||
|                     sleep 1; | ||||
| @@ -2654,14 +2726,14 @@ sub lparnetbootexp | ||||
|                 [ qr/(.*)elect this consol(.*)/=> | ||||
|                 sub { | ||||
|                     $rconsole->send("0\r"); | ||||
|                     #$rconsole->clear_accum(); | ||||
|                     $rconsole->clear_accum(); | ||||
|                     #$rconsole->exp_continue(); | ||||
|                     } | ||||
|                 ], | ||||
|             ); | ||||
|  | ||||
|             if ($query_count > 300 ) { | ||||
|                 nc_msg($verbose,, "Timed out waiting for power on of $node"); | ||||
|                 nc_msg($verbose, "Timed out waiting for power on of $node"); | ||||
|                 nc_msg($verbose, "error from rpower command : \"$output\" \n"); | ||||
|                 return [1]; | ||||
|             } | ||||
| @@ -2684,18 +2756,21 @@ sub lparnetbootexp | ||||
|             [qr/0(.*)ok/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, " at ok prompt\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $done = 1; | ||||
|                 } | ||||
|             ], | ||||
|             [qr/(.*)elect this consol(.*)/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, " selecting active console\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rconsole->send("0\r"); | ||||
|                 } | ||||
|             ], | ||||
|             [qr/English|French|German|Italian|Spanish|Portuguese|Chinese|Japanese|Korean/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "Languagae Selection Panel received\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $rconsole->send("2\r"); | ||||
|                 } | ||||
|             ], | ||||
| @@ -2716,6 +2791,7 @@ sub lparnetbootexp | ||||
|             [qr/SMS(.*)Navigation Keys/=> | ||||
|             sub { | ||||
|                 nc_msg($verbose, "SMS\n"); | ||||
|                 $rconsole->clear_accum(); | ||||
|                 $done = 1; | ||||
|                 } | ||||
|             ], | ||||
| @@ -2724,7 +2800,7 @@ sub lparnetbootexp | ||||
|                 $rconsole->send("\r"); | ||||
|                 $retry_count++; | ||||
|                 if ($retry_count eq 9) { | ||||
|                     nc_msg($verbose,, "Timeout waiting for ok prompt; exiting.\n"); | ||||
|                     nc_msg($verbose, "Timeout waiting for ok prompt; exiting.\n"); | ||||
|                     $rconsole->soft_close(); | ||||
|                     $rc = 1; | ||||
|                     } | ||||
| @@ -2732,7 +2808,7 @@ sub lparnetbootexp | ||||
|             ], | ||||
|             [eof => | ||||
|             sub { | ||||
|                 nc_msg($verbose,, "Cannot connect to $node"); | ||||
|                 nc_msg($verbose, "Cannot connect to $node"); | ||||
|                 $rconsole->soft_close(); | ||||
|                 $rc = 1; | ||||
|                 } | ||||
| @@ -2751,7 +2827,7 @@ sub lparnetbootexp | ||||
|         nc_msg($verbose, "begin to set disk boot"); | ||||
|         my $result = set_disk_boot( $rconsole, $node, $verbose);#@expect_out, $rconsole, $node, $verbose); | ||||
|         unless( $result ) { | ||||
|             nc_msg($verbose,, "Unable to set $node boot order"); | ||||
|             nc_msg($verbose, "Unable to set $node boot order"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -2772,7 +2848,7 @@ sub lparnetbootexp | ||||
|             $retry_count++; | ||||
|             $rconsole->send("\r"); | ||||
|             if ( $retry_count eq 3) { | ||||
|                 nc_msg($verbose,, "Unable to obtain network adapter information.  Quitting.\n"); | ||||
|                 nc_msg($verbose, "Unable to obtain network adapter information.  Quitting.\n"); | ||||
|                 return [1]; | ||||
|             } | ||||
|         } else { | ||||
| @@ -2788,7 +2864,7 @@ sub lparnetbootexp | ||||
|     nc_msg($verbose, "begin to run multiple_open_dev"); | ||||
|     my $result = xCAT::LparNetbootExp->multiple_open_dev($rconsole, $node, $verbose); | ||||
|     if ( $result eq 1) { | ||||
|        nc_msg($verbose,, "Unable to obtain network adapter information.  Quitting.\n"); | ||||
|        nc_msg($verbose, "Unable to obtain network adapter information.  Quitting.\n"); | ||||
|        return [1]; | ||||
|     } | ||||
|  | ||||
| @@ -2824,8 +2900,8 @@ sub lparnetbootexp | ||||
|             $outputarray[$outputarrayindex] = "# Type \tLocation Code \tMAC Address\t Full Path Name\t Ping Result"; | ||||
|         } | ||||
|  | ||||
|         if ( $discover_all ) { | ||||
|             for( $i = 0; $i <= $adapter_found; $i++) { | ||||
|         if ( $discover_all ) {    #getmacs here | ||||
|             for( $i = 0; $i < $adapter_found; $i++) { | ||||
|                 if ($adap_type[$i] =~ /$match_pat/) { | ||||
|                     if (!($adap_type[$i] eq "hfi-ent")) { | ||||
|                         $mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose); | ||||
| @@ -2865,7 +2941,7 @@ sub lparnetbootexp | ||||
|                 } | ||||
|             } | ||||
|         } else { | ||||
|             for( $i = 0; $i <= $adapter_found; $i++) { | ||||
|             for( $i = 0; $i < $adapter_found; $i++) { | ||||
|                 if ($adap_type[$i] =~ /$match_pat/) { | ||||
|                     if ($adap_type[$i] eq "hfi-ent") { | ||||
|                         $mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose); | ||||
| @@ -2913,9 +2989,9 @@ sub lparnetbootexp | ||||
|             $subreq, 0, 1); | ||||
|             $output = join ',', @$sysoutput; | ||||
|             if ($::RUNCMD_RC != 0) { | ||||
|                 nc_msg($verbose,, "Unable to run rpower $node sms.\n"); | ||||
|                 nc_msg($verbose, "Unable to run rpower $node sms.\n"); | ||||
|                 nc_msg($verbose, "Status: error from rpower command\n"); | ||||
|                 nc_msg($verbose,, "Error : $output\n"); | ||||
|                 nc_msg($verbose, "Error : $output\n"); | ||||
|                 return [1]; | ||||
|             } | ||||
|         } | ||||
| @@ -2923,7 +2999,7 @@ sub lparnetbootexp | ||||
|     # Loop throught the adapters and perform a ping test to discover an | ||||
|     # adapter that pings successfully, then use that adapter to network boot. | ||||
|         if ($discover_all) {  #rnetboot should not use -A | ||||
|             for ($i = 0; $i <= $adapter_found; $i ++) { | ||||
|             for ($i = 0; $i < $adapter_found; $i++) { | ||||
|                 $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); | ||||
|  | ||||
|  | ||||
| @@ -2934,9 +3010,9 @@ sub lparnetbootexp | ||||
|                     last; | ||||
|                 } | ||||
|             } | ||||
|         } elsif ( $macaddress ne "" ) { | ||||
|         } elsif ( $macaddress ne "" ) {          #rnetboot here      | ||||
|             $match = 0; | ||||
|             for ($i = 0; $i <= $adapter_found; $i++) { | ||||
|             for ($i = 0; $i < $adapter_found; $i++) { | ||||
|                 if ($adap_type[$i] =~ /hfi-ent/) { | ||||
|                     $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); | ||||
|                 } | ||||
| @@ -2947,7 +3023,7 @@ sub lparnetbootexp | ||||
|                            $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); | ||||
|                         } | ||||
|                         unless ( $ping_rc eq 0) { | ||||
|                             nc_msg($verbose,, "Unable to boot network adapter.\n" ); | ||||
|                             nc_msg($verbose, "Unable to boot network adapter.\n" ); | ||||
|                             return [1]; | ||||
|                         } | ||||
|                     } | ||||
| @@ -2959,18 +3035,18 @@ sub lparnetbootexp | ||||
|                 } | ||||
|             } | ||||
|             unless($match) { | ||||
|                 nc_msg($verbose,, "Can not find mac address '$macaddress'\n"); | ||||
|                 nc_msg($verbose, "Can not find mac address '$macaddress'\n"); | ||||
|                 return [1]; | ||||
|             } | ||||
|         } elsif ( $phys_loc ne "") { | ||||
|             $match = 0; | ||||
|             for ($i = 0; $i <= $adapter_found; $i++) { | ||||
|             for ($i = 0; $i < $adapter_found; $i++) { | ||||
|                 $loc_code = get_adaptr_loc($phandle_array[$i], $rconsole, $node, $verbose); | ||||
|                 if ($loc_code =~ /$phys_loc/) { | ||||
|                     if ($discovery) { | ||||
|                         $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); | ||||
|                         unless ($ping_rc eq 0) { | ||||
|                             nc_msg($verbose,, "Unable to boot network adapter.\n"); | ||||
|                             nc_msg($verbose, "Unable to boot network adapter.\n"); | ||||
|                             return [1]; | ||||
|                         } | ||||
|                     } | ||||
| @@ -2982,7 +3058,7 @@ sub lparnetbootexp | ||||
|                 } | ||||
|             } | ||||
|             if (!$match) { | ||||
|                 nc_msg($verbose,, "Can not find physical location '$phys_loc'\n"); | ||||
|                 nc_msg($verbose, "Can not find physical location '$phys_loc'\n"); | ||||
|                 return [1]; | ||||
|             } | ||||
|         } else { | ||||
| @@ -3008,7 +3084,7 @@ sub lparnetbootexp | ||||
|         } | ||||
|         my $result; | ||||
|         if ($full_path_name eq "") { | ||||
|             nc_msg($verbose,, "Unable to boot network adapter.\n"); | ||||
|             nc_msg($verbose, "Unable to boot network adapter.\n"); | ||||
|             return [1]; | ||||
|         } else { | ||||
|             nc_msg($verbose, "# Network booting install adapter.\n"); | ||||
| @@ -3020,7 +3096,7 @@ sub lparnetbootexp | ||||
|             nc_msg($verbose, "bootp sent over netowrk.\n"); | ||||
|             my $res = Boot($rconsole, $node, $verbose);#, @expect_out); | ||||
|             unless ($res eq 0) { | ||||
|                 nc_msg($verbose,, "Can not boot, result = $res. \n"); | ||||
|                 nc_msg($verbose, "Can not boot, result = $res. \n"); | ||||
|             } | ||||
|         } else { | ||||
|             nc_msg($verbose, "return code $result from boot_network\n"); | ||||
| @@ -3038,18 +3114,21 @@ sub lparnetbootexp | ||||
|                 [ qr/keyboard/i, | ||||
|                     sub { | ||||
|                         $rconsole->send("8\r"); | ||||
|                         $rconsole->clear_accum(); | ||||
|                         sleep 10; | ||||
|                     } | ||||
|                 ], | ||||
|                 [ qr/timeout/i, | ||||
|                     sub { | ||||
|                         nc_msg($verbose,, "Timeout; exiting.\n"); | ||||
|                         nc_msg($verbose, "Timeout; exiting.\n"); | ||||
|                         $rconsole->clear_accum(); | ||||
|                         $rc = 1; | ||||
|                     } | ||||
|                 ], | ||||
|                 [ eof => | ||||
|                     sub { | ||||
|                         nc_msg($verbose,, "cannot connect to $node.\n"); | ||||
|                         nc_msg($verbose, "cannot connect to $node.\n"); | ||||
|                         $rconsole->clear_accum(); | ||||
|                         $rc = 1; | ||||
|                     } | ||||
|                 ], | ||||
| @@ -3074,7 +3153,7 @@ sub lparnetbootexp | ||||
|         nc_msg($verbose, "# bootp sent over network.\n"); | ||||
|         $rc = Boot($rconsole, $node, $verbose);#, @expect_out); | ||||
|         unless ($rc eq 0) { | ||||
|             nc_msg($verbose,, "Can't boot here. \n"); | ||||
|             nc_msg($verbose, "Can't boot here. \n"); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user