the feature:enhancement of rspconfig for blacktip blade
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16349 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
e3cbfd954f
commit
2a8e95b4e8
@ -66,14 +66,19 @@ sub setupIMM {
|
||||
unless (defined $child) { die "error spawining process" }
|
||||
|
||||
#ok, with all ip addresses in hand, time to enable IPMI and set all the ip addresses (still static only, TODO: dhcp
|
||||
my $ssh = new xCAT::SSHInteract(-username=>$args{cliusername},
|
||||
my $ssh;
|
||||
eval {$ssh = new xCAT::SSHInteract(-username=>$args{cliusername},
|
||||
-password=>$args{clipassword},
|
||||
-host=>$sship,
|
||||
-nokeycheck=>1,
|
||||
-output_record_separator=>"\r",
|
||||
Timeout=>15,
|
||||
Errmode=>'return',
|
||||
Prompt=>'/> $/');
|
||||
Prompt=>'/> $/');};
|
||||
my $errmsg = $@;
|
||||
if ($errmsg) {
|
||||
exit(0);
|
||||
}
|
||||
if ($ssh and $ssh->atprompt) { #we are in and good to issue commands
|
||||
$ssh->cmd("accseccfg -pe 0 -rc 0 -ci 0 -lf 0 -lp 0"); #disable the more insane password rules, this isn't by and large a human used interface
|
||||
$ssh->cmd("users -1 -n ".$ipmiauthmap->{$node}->{username}." -p ".$ipmiauthmap->{$node}->{password}." -a super"); #this gets ipmi going
|
||||
|
@ -4259,11 +4259,11 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
}
|
||||
my $bladeuser = 'USERID';
|
||||
my $bladepass = 'PASSW0RD';
|
||||
#my $bladeuser = 'USERID';
|
||||
#my $bladepass = 'PASSW0RD';
|
||||
my $blademaxp = 64;
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $mpatab = xCAT::Table->new('mpa');
|
||||
#my $mpatab = xCAT::Table->new('mpa');
|
||||
my $mptab = xCAT::Table->new('mp');
|
||||
my $tmp;
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("blademaxp");
|
||||
@ -4275,19 +4275,19 @@ sub process_request {
|
||||
# ($tmp)=$sitetab->getAttribs({'key'=>'blademaxp'},'value');
|
||||
# if (defined($tmp)) { $blademaxp=$tmp->{value}; }
|
||||
#}
|
||||
if ($request->{environment}->[0]->{XCAT_BLADEUSER}) {
|
||||
$bladeuser=$request->{environment}->[0]->{XCAT_BLADEUSER}->[0];
|
||||
$bladepass=$request->{environment}->[0]->{XCAT_BLADEPASS}->[0];
|
||||
} else {
|
||||
my $passtab = xCAT::Table->new('passwd');
|
||||
if ($passtab) {
|
||||
($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password');
|
||||
if (defined($tmp)) {
|
||||
$bladeuser = $tmp->{username};
|
||||
$bladepass = $tmp->{password};
|
||||
}
|
||||
}
|
||||
}
|
||||
#if ($request->{environment}->[0]->{XCAT_BLADEUSER}) {
|
||||
# $bladeuser=$request->{environment}->[0]->{XCAT_BLADEUSER}->[0];
|
||||
# $bladepass=$request->{environment}->[0]->{XCAT_BLADEPASS}->[0];
|
||||
#} else {
|
||||
#my $passtab = xCAT::Table->new('passwd');
|
||||
# if ($passtab) {
|
||||
# ($tmp)=$passtab->getAttribs({'key'=>'blade'},'username','password');
|
||||
# if (defined($tmp)) {
|
||||
# $bladeuser = $tmp->{username};
|
||||
# $bladepass = $tmp->{password};
|
||||
# }
|
||||
# }
|
||||
#}
|
||||
if ($request->{command}->[0] eq "findme") {
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
unless ($mptab) { return 2; }
|
||||
@ -4400,24 +4400,25 @@ sub process_request {
|
||||
my @nodes=split(',', $2);
|
||||
my @ids=split(',', $3);
|
||||
my @mptypes=split(',', $4);
|
||||
my $user=$bladeuser;
|
||||
my $pass=$bladepass;
|
||||
#my $user=$bladeuser;
|
||||
#my $pass=$bladepass;
|
||||
my $ent;
|
||||
if (defined($mpatab)) {
|
||||
my @user_array = $mpatab->getNodeAttribs($mpa, qw(username password));
|
||||
foreach my $entry (@user_array) {
|
||||
if ($entry->{username}) {
|
||||
if ($entry->{username} =~ /^USERID$/ or $entry->{username} !~ /^HMC$/) {
|
||||
$ent = $entry;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
}
|
||||
$mpahash{$mpa}->{username} = $user;
|
||||
$mpahash{$mpa}->{password} = $pass;
|
||||
#if (defined($mpatab)) {
|
||||
# my @user_array = $mpatab->getNodeAttribs($mpa, qw(username password));
|
||||
# foreach my $entry (@user_array) {
|
||||
# if ($entry->{username}) {
|
||||
# if ($entry->{username} =~ /^USERID$/ or $entry->{username} !~ /^HMC$/) {
|
||||
# $ent = $entry;
|
||||
# last;
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# if (defined($ent->{password})) { $pass = $ent->{password}; }
|
||||
# if (defined($ent->{username})) { $user = $ent->{username}; }
|
||||
#}
|
||||
my $authdata = xCAT::PasswordUtils::getIPMIAuth(noderange=>[$mpa]);
|
||||
$mpahash{$mpa}->{username} = $authdata->{$mpa}->{username};
|
||||
$mpahash{$mpa}->{password} = $authdata->{$mpa}->{password};
|
||||
my $nodehmtab = xCAT::Table->new('nodehm');
|
||||
my $hmdata = $nodehmtab->getNodesAttribs(\@nodes, ['node', 'mgt']);
|
||||
for (my $i=0; $i<@nodes; $i++) {
|
||||
@ -4925,7 +4926,7 @@ sub updateBMC {
|
||||
my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['bmc']);
|
||||
foreach (@nodes) {
|
||||
if (defined($ipmihash->{$_}->[0]) && defined ($ipmihash->{$_}->[0]->{'bmc'})) {
|
||||
xCAT::IMMUtils::setupIMM($_,skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$user,clipassword=>$pass,callback=>$CALLBACK);
|
||||
xCAT::IMMUtils::setupIMM($_,curraddr=>$ipmihash->{$_}->[0]->{'bmc'},skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$user,clipassword=>$pass,callback=>$CALLBACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5638,8 +5639,8 @@ sub dompa {
|
||||
push @cfgtext, "Hardware type $mptype is not supported. Valid types(mm,cmm).\n";
|
||||
$rc = 1;
|
||||
$args = [];
|
||||
} elsif ($mpa ne $node && grep /updateBMC/, @exargs) {
|
||||
push @cfgtext, "The option updateBMC only supported for the CMM";
|
||||
} elsif ($mpa ne $node && grep /(updateBMC|USERID)/, @exargs) {
|
||||
push @cfgtext, "The option $1 only supported for the CMM";
|
||||
$rc = 1;
|
||||
$args = [];
|
||||
} else {
|
||||
|
@ -23,6 +23,7 @@ use POSIX qw(ceil floor);
|
||||
use Storable qw(nstore_fd retrieve_fd thaw freeze);
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::IMMUtils;
|
||||
use xCAT::ServiceNodeUtils;
|
||||
use xCAT::SvrUtils;
|
||||
use xCAT::Usage;
|
||||
@ -6107,6 +6108,25 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($request->{command}->[0] eq "rspconfig") {
|
||||
my $updatepasswd = 0;
|
||||
my $index = 0;
|
||||
foreach (@{$request->{arg}}) {
|
||||
if ($_ =~ /^USERID=\*$/) {
|
||||
$updatepasswd = 1;
|
||||
last;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
if ($updatepasswd) {
|
||||
splice(@{$request->{arg}}, $index, 1);
|
||||
@exargs=($request->{arg});
|
||||
foreach (@donargs) {
|
||||
xCAT::IMMUtils::setupIMM($_->[0],curraddr=>$_->[1],skipbmcidcheck=>1,skipnetconfig=>1,cliusername=>$_->[2],clipassword=>$_->[3],callback=>$callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#get new node status
|
||||
my %oldnodestatus=(); #saves the old node status
|
||||
my $check=0;
|
||||
|
Loading…
Reference in New Issue
Block a user