Fix bug for lsslp on AIX
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3485 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -106,6 +106,9 @@ sub connect {
 | 
			
		||||
             return( "Unable to redirect STDERR: $!" );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    $IO::Socket::SSL::VERSION = undef;
 | 
			
		||||
    eval { require Net::SSL };
 | 
			
		||||
 | 
			
		||||
    ##################################
 | 
			
		||||
    # Turn on tracing
 | 
			
		||||
    ##################################
 | 
			
		||||
@@ -1727,11 +1730,16 @@ sub set_netcfg
 | 
			
		||||
 | 
			
		||||
    return ( [RC_ERROR,"Cannot find interface $inc_name"]) if ( ! exists ($$interfaces{ $real_inc_name}));
 | 
			
		||||
 | 
			
		||||
    $interfaces->{ $real_inc_name}->{'selected'}->check();
 | 
			
		||||
 | 
			
		||||
#not work on AIX
 | 
			
		||||
#    $interfaces->{ $real_inc_name}->{'selected'}->check();
 | 
			
		||||
    my @tmp_options = $interfaces->{ $real_inc_name}->{'selected'}->possible_values();
 | 
			
		||||
    $interfaces->{ $real_inc_name}->{'selected'}->value(@tmp_options[1] );
 | 
			
		||||
    if ( $interfaces->{ $real_inc_name}->{'type'})
 | 
			
		||||
    {
 | 
			
		||||
        $interfaces->{ $real_inc_name}->{'type'}->value('Static');
 | 
			
		||||
        @tmp_options =  $interfaces->{ $real_inc_name}->{'type'}->possible_values();
 | 
			
		||||
        $interfaces->{ $real_inc_name}->{'type'}->value(@tmp_options[0]);
 | 
			
		||||
#not work on AIX
 | 
			
		||||
#        $interfaces->{ $real_inc_name}->{'type'}->value('Static');
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
@@ -1773,7 +1781,7 @@ sub set_netcfg
 | 
			
		||||
 | 
			
		||||
    #Go to the confirm page
 | 
			
		||||
    $form = HTML::Form->parse( $res->content, $res->base );
 | 
			
		||||
#    $data = $form->click('submit');
 | 
			
		||||
    $data = $form->click('submit');
 | 
			
		||||
    $res = $ua->request( $data);
 | 
			
		||||
    if ($res->is_success())
 | 
			
		||||
    {
 | 
			
		||||
@@ -1798,16 +1806,27 @@ sub format_netcfg
 | 
			
		||||
        $output .= "\n\t" . $inc . ":\n";
 | 
			
		||||
        $output =~ s/interface(\d)/eth$1/;
 | 
			
		||||
        # There are 2 possible value for $type, 
 | 
			
		||||
        # 1 means "Dynamic", 2 means "Static"
 | 
			
		||||
        # the first means "Dynamic", 2nd means "Static"
 | 
			
		||||
        # Now to find the correct type name
 | 
			
		||||
	my $curr_type = $interfaces->{$inc}->{'type'}->value();
 | 
			
		||||
        my @possible_values = $interfaces->{$inc}->{'type'}->possible_values();
 | 
			
		||||
        my @possible_names  = $interfaces->{$inc}->{'type'}->value_names();
 | 
			
		||||
        my %value_names = {};
 | 
			
		||||
        for ( my $i = 0; $i < scalar( @possible_values); $i++)
 | 
			
		||||
        my $type;
 | 
			
		||||
        if ($curr_type == @possible_values[0])
 | 
			
		||||
        {
 | 
			
		||||
            $value_names{ @possible_values[$i]} = @possible_names[$i];
 | 
			
		||||
            $type = "Dynamic";
 | 
			
		||||
        }
 | 
			
		||||
        my $type = $interfaces->{$inc}->{'type'} ? $value_names{ $interfaces->{$inc}->{'type'}->value()} : undef;;
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            $type = "Static";
 | 
			
		||||
        } 
 | 
			
		||||
#not work on AIX
 | 
			
		||||
        #my @possible_names  = $interfaces->{$inc}->{'type'}->value_names();
 | 
			
		||||
        #my %value_names = {};
 | 
			
		||||
        #for ( my $i = 0; $i < scalar( @possible_values); $i++)
 | 
			
		||||
        #{
 | 
			
		||||
        #    $value_names{ @possible_values[$i]} = @possible_names[$i];
 | 
			
		||||
        #}
 | 
			
		||||
        #my $type = $interfaces->{$inc}->{'type'} ? $value_names{ $interfaces->{$inc}->{'type'}->value()} : undef;;
 | 
			
		||||
        $type = "Static" if ( $type == 2);
 | 
			
		||||
        my $ip = $interfaces->{$inc}->{'ip'} ? $interfaces->{$inc}->{'ip'}->value() : undef;
 | 
			
		||||
        my $hostname = $interfaces->{$inc}->{'hostname'} ? $interfaces->{$inc}->{'hostname'}->value() : undef;
 | 
			
		||||
 
 | 
			
		||||
@@ -14,14 +14,8 @@ if ($^O =~ /^linux/i) {
 | 
			
		||||
}
 | 
			
		||||
use xCAT::PPCdb;
 | 
			
		||||
 | 
			
		||||
#######################################
 | 
			
		||||
# Perl::SNMP not working on AIX yet
 | 
			
		||||
#######################################
 | 
			
		||||
if ($^O =~ /^linux/i) {
 | 
			
		||||
  eval { require xCAT::MacMap };
 | 
			
		||||
  eval { require xCAT_plugin::blade };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
require xCAT::MacMap;
 | 
			
		||||
require xCAT_plugin::blade;
 | 
			
		||||
 | 
			
		||||
#######################################
 | 
			
		||||
# Constants
 | 
			
		||||
@@ -120,9 +114,7 @@ my $macmap;
 | 
			
		||||
##########################################################################
 | 
			
		||||
sub handled_commands {
 | 
			
		||||
 | 
			
		||||
    if ($^O =~ /^linux/i) {
 | 
			
		||||
        $macmap = xCAT::MacMap->new();
 | 
			
		||||
    }
 | 
			
		||||
    $macmap = xCAT::MacMap->new();
 | 
			
		||||
    return( {lsslp=>"lsslp"} );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -663,7 +655,7 @@ sub invoke_cmd {
 | 
			
		||||
        }
 | 
			
		||||
        else #The rest must be fsp or bpa
 | 
			
		||||
        {
 | 
			
		||||
            @cmds = ("network=$target_dev->{args}");
 | 
			
		||||
            @cmds = ("network=$ip,$target_dev->{args}");
 | 
			
		||||
            trace( $request, "update config on $target_dev->{'type'} $ip");
 | 
			
		||||
            $result = xCAT::PPC::updconf_in_asm(
 | 
			
		||||
                    $ip,
 | 
			
		||||
@@ -1915,14 +1907,10 @@ sub preprocess_request {
 | 
			
		||||
    # find all the service nodes for xCAT cluster
 | 
			
		||||
    # build an individual request for each service node
 | 
			
		||||
    ###########################################
 | 
			
		||||
    my $nrtab=xCAT::Table->new("noderes", -create =>0);  
 | 
			
		||||
    my %sv_hash=();
 | 
			
		||||
    if ( $nrtab)
 | 
			
		||||
    {
 | 
			
		||||
	    my @all=$nrtab->getAllNodeAttribs(['servicenode']);
 | 
			
		||||
	    foreach (@all) {
 | 
			
		||||
		    if ($_->{servicenode}) {$sv_hash{$_->{servicenode}}=1;}
 | 
			
		||||
	    }
 | 
			
		||||
    my @all = xCAT::Utils::getAllSN();
 | 
			
		||||
    foreach (@all) {
 | 
			
		||||
	    if ($_->{servicenode}) {$sv_hash{$_->{servicenode}}=1;}
 | 
			
		||||
    }
 | 
			
		||||
    ###########################################
 | 
			
		||||
    # build each request for each service node
 | 
			
		||||
@@ -2064,6 +2052,19 @@ sub switch_cmd {
 | 
			
		||||
        if ( $^O eq 'aix' && $arpent =~ /\((\S+)\)\s+at\s+(\S+)/)
 | 
			
		||||
        {
 | 
			
		||||
            ($ip, $mac) = ($1,$2);
 | 
			
		||||
            ######################################################
 | 
			
		||||
            # Change mac format to be same as linux. For example:
 | 
			
		||||
            # '0:d:60:f4:f8:22' to '00:0d:60:f4:f8:22'
 | 
			
		||||
            ######################################################
 | 
			
		||||
            if ( $mac)
 | 
			
		||||
            {
 | 
			
		||||
                my @mac_sections = split /:/, $mac;
 | 
			
		||||
                for (@mac_sections)
 | 
			
		||||
                {
 | 
			
		||||
                    $_ = "0$_" if ( length($_) == 1);
 | 
			
		||||
                }
 | 
			
		||||
                $mac = join ':', @mac_sections;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        elsif ( $arpent =~ /^(\S+)+\s+\S+\s+(\S+)\s/)
 | 
			
		||||
        {
 | 
			
		||||
@@ -2116,7 +2117,7 @@ sub switch_cmd {
 | 
			
		||||
            $name = disti_multi_node( $req, $names, $slp_all->{$ip});
 | 
			
		||||
            if ( ! $name)
 | 
			
		||||
            {
 | 
			
		||||
                trace( $req, "Cannot distinguish $names.");
 | 
			
		||||
                trace( $req, "Cannot identify node $ip.");
 | 
			
		||||
                next;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user