From 6993dc7dbaf11486f4c925fb9355b8ad262e6486 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 30 Mar 2009 10:26:51 +0000 Subject: [PATCH] make local lpar_netboot work for getmacs git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3042 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/PPCmac.pm | 33 ++++++++++------------------ xCAT-server/sbin/lpar_netboot.expect | 4 ++-- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/perl-xCAT/xCAT/PPCmac.pm b/perl-xCAT/xCAT/PPCmac.pm index 2bf90632f..d138a73b7 100644 --- a/perl-xCAT/xCAT/PPCmac.pm +++ b/perl-xCAT/xCAT/PPCmac.pm @@ -131,6 +131,7 @@ sub ivm_getmacs { my $d = shift; my $exp = shift; my $name = shift; + my $node = shift; my $opt = $request->{opt}; my $ssh = @$exp[0]; my $userid = @$exp[4]; @@ -197,7 +198,7 @@ sub ivm_getmacs { ####################################### # Add command options ####################################### - $cmd.= " -t ent -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp $fname"; + $cmd.= " -t ent -f -M -A -n \"$name\" \"$pprofile\" \"$fsp\" $id $hcp $fname \"$node\""; ####################################### # Execute command @@ -248,7 +249,7 @@ sub getmacs { my $opt = $request->{opt}; my $hwtype = @$exp[2]; my $result; - my $node; + my $name; ######################################### # Get node data @@ -256,13 +257,13 @@ sub getmacs { my $lparid = @$d[0]; my $mtms = @$d[2]; my $type = @$d[4]; - my $name = @$d[6]; + my $node = @$d[6]; ######################################### # Invalid target hardware ######################################### if ( $type ne "lpar" ) { - return( [[$name,"Node must be LPAR",RC_ERROR]] ); + return( [[$node,"Node must be LPAR",RC_ERROR]] ); } ######################################### # Get name known by HCP @@ -275,39 +276,27 @@ sub getmacs { # Return error ######################################### if ( $Rc != SUCCESS ) { - return( [[$name,@$values[0],$Rc]] ); + return( [[$node,@$values[0],$Rc]] ); } ######################################### # Find LPARs by lpar_id ######################################### foreach ( @$values ) { if ( /^(.*),$lparid$/ ) { - $node = $1; + $name = $1; last; } } ######################################### # Node not found by lpar_id ######################################### - if ( !defined( $node )) { - return( [[$name,"Node not found, lparid=$lparid",RC_ERROR]] ); + if ( !defined( $name )) { + return( [[$node,"Node not found, lparid=$lparid",RC_ERROR]] ); } ######################################### - # IVM does not have lpar_netboot command - # so we have to manually collect MAC - # addresses. + # Manually collect MAC addresses. ######################################### - if ( $hwtype eq "ivm" ) { - $result = ivm_getmacs( $request, $d, $exp, $node ); - } - else { - $result = xCAT::PPCcli::lpar_netboot( - $exp, - $request->{verbose}, - $node, - $d, - $opt ); - } + $result = ivm_getmacs( $request, $d, $exp, $name, $node ); $Rc = shift(@$result); ################################## diff --git a/xCAT-server/sbin/lpar_netboot.expect b/xCAT-server/sbin/lpar_netboot.expect index c95c6afbe..b9580fc23 100644 --- a/xCAT-server/sbin/lpar_netboot.expect +++ b/xCAT-server/sbin/lpar_netboot.expect @@ -30,7 +30,7 @@ proc read_credentials {} { global PROGRAM if [catch { open $filename "r" } fhandle ] { - send_user "$PROGRAM: Error opening temporary password file\n" + send_user "$PROGRAM: Error opening temporary password file $filename\n" exit 1 } ############################################### @@ -2569,7 +2569,7 @@ if { $noboot } { # Display information for all supported adapters set rc $expect_out(2,string) set msg $expect_out(1,string) } - -re "\r\nRc=(\[0-9]*)\r\n(.*$prompt)" { + -re "\r\nRc=(\[0-9]*)\r\n(.*)" { set rc $expect_out(1,string) } timeout {