for NGP, fix some bugs found by UT
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11757 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -2901,6 +2901,9 @@ sub getIPaddress | ||||
|     require xCAT::Table; | ||||
|     my $nodetocheck = shift; | ||||
|     my $port        = shift; | ||||
|     if (isIpaddr($nodetocheck)) { | ||||
|         return $nodetocheck; | ||||
|     } | ||||
|     my $side = "[A|B]"; | ||||
|     if (!defined($port)) { | ||||
|         $port = "[0|1]"; | ||||
|   | ||||
| @@ -1787,9 +1787,13 @@ sub getmacs { | ||||
|                $mkey="primarynic"; | ||||
|            } | ||||
|            if ($mkey) { | ||||
| 	     while ( $nent->{$mkey} =~ /(\d+)/g ) { | ||||
| 	       push @midxary,$1; | ||||
| 	     } | ||||
| 	           while ( $nent->{$mkey} =~ /(\d+)/g ) { | ||||
|                    my $nic = $1; | ||||
|                    if ($nic !~ /[1234]/) { | ||||
|                        return -1, "noderes.$mkey is not correct"; | ||||
|                    } | ||||
|                    push @midxary,$nic; | ||||
| 	           } | ||||
|            } | ||||
|        } else { | ||||
|            $nrtab->close; | ||||
| @@ -1804,7 +1808,7 @@ sub getmacs { | ||||
|  | ||||
|      my @allmacs; | ||||
|      foreach my $midx ( @midxary) { | ||||
|        (my $macd,my $mac) = split (/:/,$macs[$midx],2); | ||||
|        (my $macd,my $mac) = split (/:/,$macs[$midx-1],2); | ||||
|        $mac =~ s/\s+//g; | ||||
|        if ($macd !~ /mac address \d/i) { | ||||
|            return 1,"Unable to retrieve MAC address for interface $midx from Management Module"; | ||||
| @@ -3662,8 +3666,12 @@ sub filter_nodes{ | ||||
|  | ||||
|     push @{$mpnodes}, @mp; | ||||
|     push @{$fspnodes}, @commonfsp; | ||||
|     if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) { | ||||
|       push @{$mpnodes}, @ngpfsp; | ||||
|     if (@args && ($cmd eq "rspconfig")) { | ||||
|       if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args))  { | ||||
|           push @{$mpnodes}, @ngpfsp; | ||||
|       } else { | ||||
|           push @{$fspnodes}, @ngpfsp; | ||||
|       } | ||||
|     } elsif($cmd eq "getmacs") { | ||||
|       if (@args && (grep /^-D$/,@args)) { | ||||
|         push @{$fspnodes}, @ngpfsp; | ||||
| @@ -4173,9 +4181,8 @@ sub passwd { | ||||
|   my $pass = shift; | ||||
|   my $mm = shift; | ||||
|   my $cmd = "users -n $user -p $pass -T system:$mm"; | ||||
|   print "===>$cmd\n"; | ||||
|   if (!$pass) { | ||||
|     return ([1, "No param specified"]); | ||||
|     return ([1, "No param specified for '$user'"]); | ||||
|   } | ||||
|   my @data = $t->cmd($cmd); | ||||
|   if (!grep(/OK/i, @data)) { | ||||
| @@ -4363,7 +4370,7 @@ sub swnet { | ||||
|   } | ||||
|  | ||||
|   if (!$value) { | ||||
|     my @data = $t->cmd("ifconfig -T system::$switch"); | ||||
|     my @data = $t->cmd("ifconfig -T system:$switch"); | ||||
|     my $s = join('',@data); | ||||
|     if ($s =~ /-i\s+(\S+)/) { $ip = $1; } | ||||
|     if ($s =~ /-g\s+(\S+)/) { $gateway = $1; } | ||||
|   | ||||
| @@ -162,8 +162,12 @@ sub filter_nodes{ | ||||
|  | ||||
|     push @{$mpnodes}, @mp; | ||||
|     push @{$fspnodes}, @commonfsp; | ||||
|     if (@args && ($cmd eq "rspconfig") && (grep /^(network|network=.*)$/, @args)) { | ||||
|       push @{$mpnodes}, @ngpfsp; | ||||
|     if (@args && ($cmd eq "rspconfig")) { | ||||
|       if (!(grep /^(cec_off_policy|pending_power_on_side)/, @args)) { | ||||
|         push @{$mpnodes}, @ngpfsp; | ||||
|       } else { | ||||
|         push @{$fspnodes}, @ngpfsp; | ||||
|       } | ||||
|     } elsif($cmd eq "getmacs") { | ||||
|       if (@args && (grep /^-D$/,@args)) { | ||||
|         push @{$fspnodes}, @ngpfsp; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user