-Fix to work with BPET42R and 46C with all required parameters
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2536 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -1,9 +1,28 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
 | 
			
		||||
set
 | 
			
		||||
fwpref=${rvid_fwrev%%???}
 | 
			
		||||
fwver=${rvid_fwrev##????}
 | 
			
		||||
fwmaj=${fwver%%?}
 | 
			
		||||
if [ -z "$fwmaj" ]; then
 | 
			
		||||
    echo "Unable to recognize AMM firmware revision"
 | 
			
		||||
    exit 1
 | 
			
		||||
fi
 | 
			
		||||
mkdir -p /tmp/xcat
 | 
			
		||||
if [ ! -f /tmp/xcat/$rvid_server.remotekvm.jar ]; then 
 | 
			
		||||
    wget -O /tmp/xcat/$rvid_server.remotekvm.jar http://$rvid_server/private/remotekvm.jar
 | 
			
		||||
fi
 | 
			
		||||
if [ $fwpref == 'BPET' ]; then
 | 
			
		||||
    if [ $fwmaj -ge 46 ]; then
 | 
			
		||||
        java -jar /tmp/xcat/$rvid_server.remotekvm.jar -s $rvid_server -r $rvid_authtoken -b $rvid_slot >& /dev/null
 | 
			
		||||
    elif [ $fwmaj -ge 42 ]; then
 | 
			
		||||
        java -jar /tmp/xcat/$rvid_server.remotekvm.jar $rvid_server -rbs $rvid_authtoken -ba $rvid_ba -port $rvid_port >& /dev/null
 | 
			
		||||
    else 
 | 
			
		||||
        echo "Unknown method for firmware $rvid_fwrev, ensure it is at least BPET42R";
 | 
			
		||||
    fi
 | 
			
		||||
else
 | 
			
		||||
    echo "Unknown semantics for $fwpref, trying a particular way, may not work."
 | 
			
		||||
   java -jar /tmp/xcat/$rvid_server.remotekvm.jar $rvid_server -rbs $rvid_authtoken -ba $rvid_ba -b $rvid_slot >& /dev/null
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
java -jar /tmp/xcat/$rvid_server.remotekvm.jar -s $rvid_server -r $rvid_authtoken -b $rvid_slot >& /dev/null
 | 
			
		||||
rm /tmp/xcat/rvid_server.remotekvm.jar
 | 
			
		||||
rm /tmp/xcat/$rvid_server.remotekvm.jar
 | 
			
		||||
 
 | 
			
		||||
@@ -1783,30 +1783,41 @@ sub get_kvm_params {
 | 
			
		||||
    my $html = $response->{_content};
 | 
			
		||||
    my $destip;
 | 
			
		||||
    my $rbs;
 | 
			
		||||
    my $fwrev;
 | 
			
		||||
    my $port;
 | 
			
		||||
    foreach (split /\n/,$html) {
 | 
			
		||||
        if (/<param\s+name\s*=\s*"([^"]*)"\s+value\s*=\s*"([^"]*)"/) {
 | 
			
		||||
           if ($1 eq 'ip') {
 | 
			
		||||
               $destip=$2;
 | 
			
		||||
           } elsif ($1 eq 'rbs') {
 | 
			
		||||
                $rbs = $2;
 | 
			
		||||
           } elsif ($1 eq 'cdl') {
 | 
			
		||||
               $fwrev=$2;
 | 
			
		||||
           }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    my $ba;
 | 
			
		||||
    unless (defined $destip and defined $rbs) { #Try another way
 | 
			
		||||
        $response = $browser->get("http://$mpa/private/remotecontrol.js.php");
 | 
			
		||||
        $html = $response->{_content};
 | 
			
		||||
        foreach (split /\n/,$html) {
 | 
			
		||||
            if (/<param\s+name\s*=\s*"([^"]*)"\s+value\s*=\s*"([^"]*)"/i) {
 | 
			
		||||
            if (/<param\s+name\s*=\s*"?([^"]*)"?\s+value\s*=\s*"?([^"]*)"?/i) {
 | 
			
		||||
               if ($1 eq 'ip') {
 | 
			
		||||
                   $destip=$2;
 | 
			
		||||
               } elsif ($1 eq 'rbs') {
 | 
			
		||||
                    $rbs = $2;
 | 
			
		||||
               } elsif ($1 eq 'ba') {
 | 
			
		||||
                   $ba=$2; #NOTE: This is the username and password.  The client seems to required it for this version of firmware.
 | 
			
		||||
               } elsif ($1 eq 'cdl') {
 | 
			
		||||
                   $fwrev=$2;
 | 
			
		||||
               } elsif ($1 eq 'port') {
 | 
			
		||||
                   $port=$2;
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return ($destip,$rbs);
 | 
			
		||||
    return ($destip,$rbs,$fwrev,$port,$ba);
 | 
			
		||||
}
 | 
			
		||||
       
 | 
			
		||||
 | 
			
		||||
@@ -2650,7 +2661,7 @@ sub dompa {
 | 
			
		||||
      my $user = $mpahash->{$mpa}->{username};
 | 
			
		||||
      my $pass = $mpahash->{$mpa}->{password};
 | 
			
		||||
      httplogin($mpa,$user,$pass);
 | 
			
		||||
      (my $target, my $authtoken) = get_kvm_params($mpa);
 | 
			
		||||
      (my $target, my $authtoken, my $fwrev, my $port, my $ba) = get_kvm_params($mpa);
 | 
			
		||||
      #an http logoff would invalidate the KVM token, so we can't do it here
 | 
			
		||||
      #For the instant in time, banking on the http session timeout to cleanup for us
 | 
			
		||||
      #It may be possible to provide the session id to client so it can logoff when done, but
 | 
			
		||||
@@ -2662,6 +2673,13 @@ sub dompa {
 | 
			
		||||
          push(@output,"server:$target");
 | 
			
		||||
          push(@output,"authtoken:$authtoken");
 | 
			
		||||
          push(@output,"slot:$slot");
 | 
			
		||||
          push(@output,"fwrev:$fwrev");
 | 
			
		||||
          if ($port) {
 | 
			
		||||
            push(@output,"ba:$ba");
 | 
			
		||||
          }
 | 
			
		||||
          if ($ba) {
 | 
			
		||||
            push(@output,"ba:$ba");
 | 
			
		||||
          }
 | 
			
		||||
          my %outh;
 | 
			
		||||
          $outh{node}->[0]->{name}=[$node];
 | 
			
		||||
          $outh{node}->[0]->{data}=[];
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user