mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-30 09:36:41 +00:00
Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
6bcca682a3
@ -4476,24 +4476,23 @@ sub cleanup_for_powerLE_hardware_discovery {
|
||||
#This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E").
|
||||
#This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1").
|
||||
sub parseMacTabEntry{
|
||||
|
||||
my $macString=shift;
|
||||
if( $macString =~ /xCAT::Utils/) {
|
||||
if( $macString =~ /xCAT::Utils/){
|
||||
$macString=shift;
|
||||
}
|
||||
my $HostName=shift;
|
||||
|
||||
my $HostName=shift;
|
||||
my $mac_ret;
|
||||
my @macEntry=split(/\|/,$macString);
|
||||
|
||||
foreach my $mac_t (@macEntry){
|
||||
if($mac_t =~ /!/){
|
||||
if($mac_t =~ /(.+)!$HostName$/){
|
||||
$mac_ret=$1;
|
||||
}
|
||||
}else{
|
||||
unless($mac_t =~ /!/){
|
||||
$mac_ret=$mac_t;
|
||||
}
|
||||
|
||||
if($HostName and $mac_t =~ /(.+)\!$HostName$/){
|
||||
$mac_ret=$1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($mac_ret) {
|
||||
@ -4501,10 +4500,11 @@ sub parseMacTabEntry{
|
||||
$mac_ret =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $mac_ret;
|
||||
}
|
||||
|
||||
|
||||
#The splitkcmdline subroutine is used to split the "persistent kernel options"
|
||||
#and "provision-time kernel options" out of the kernel cmdline string
|
||||
#Arguments:
|
||||
|
@ -14,7 +14,6 @@ require xCAT::TableUtils;
|
||||
require xCAT::NetworkUtils;
|
||||
use File::Basename;
|
||||
use File::Path;
|
||||
|
||||
use strict;
|
||||
use Exporter;
|
||||
our @ISA = qw/Exporter/;
|
||||
@ -640,7 +639,7 @@ sub update_tables_with_templates
|
||||
|
||||
#now get all the profile names for full installation
|
||||
my %profiles=();
|
||||
my @tmplfiles=glob($cuspath."/*.tmpl");
|
||||
my @tmplfiles=glob($cuspath."/{compute,service}.*tmpl");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
@ -654,7 +653,7 @@ sub update_tables_with_templates
|
||||
#print "$tmpf\n";
|
||||
$profiles{$tmpf}=1;
|
||||
}
|
||||
@tmplfiles=glob($defpath."/*.tmpl");
|
||||
@tmplfiles=glob($defpath."/{compute,service}.*tmpl");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
@ -845,7 +844,7 @@ sub update_tables_with_mgt_image
|
||||
|
||||
#now get all the profile names for full installation
|
||||
my %profiles=();
|
||||
my @tmplfiles=glob($cuspath."/*.tmpl");
|
||||
my @tmplfiles=glob($cuspath."/{compute,service}.*tmpl");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
@ -854,7 +853,7 @@ sub update_tables_with_mgt_image
|
||||
#print "$tmpf\n";
|
||||
$profiles{$tmpf}=1;
|
||||
}
|
||||
@tmplfiles=glob($defpath."/*.tmpl");
|
||||
@tmplfiles=glob($defpath."/{compute,service}.*tmpl");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
@ -1049,7 +1048,7 @@ sub update_tables_with_diskless_image
|
||||
if ($profile) {
|
||||
$profiles{$profile} = 1;
|
||||
} else {
|
||||
my @tmplfiles=glob($cuspath."/*.pkglist");
|
||||
my @tmplfiles=glob($cuspath."/compute.*pkglist");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
@ -1057,7 +1056,7 @@ sub update_tables_with_diskless_image
|
||||
$tmpf = $1;
|
||||
$profiles{$tmpf}=1;
|
||||
}
|
||||
@tmplfiles=glob($defpath."/*.pkglist");
|
||||
@tmplfiles=glob($defpath."/compute.*pkglist");
|
||||
foreach (@tmplfiles) {
|
||||
my $tmpf=basename($_);
|
||||
#get the profile name out of the file, TODO: this does not work if the profile name contains the '.'
|
||||
|
@ -335,6 +335,7 @@ sub subvars {
|
||||
$inc =~ s/#HOSTNAME#/$node/g;
|
||||
$inc =~ s/#SHORTNAME#/$shortname/g;
|
||||
$inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg;
|
||||
$inc =~ s/#GETPRINICMAC:([^#]+)#/xCAT::Utils::parseMacTabEntry(tabdb("mac",$1,"mac"),$1)/eg;
|
||||
|
||||
my $nrtab = xCAT::Table->new("noderes");
|
||||
my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']);
|
||||
|
@ -2337,10 +2337,6 @@ sub copycd
|
||||
#$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]});
|
||||
#}
|
||||
|
||||
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname);
|
||||
#if ($ret[0] != 0) {
|
||||
#$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]});
|
||||
#}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,8 @@ sub bmcdiscovery_usage {
|
||||
push @{ $rsp->{data} }, "\t If there is bmc,bmcdiscover returns bmc ip or hostname, or else, it returns null. \n ";
|
||||
push @{ $rsp->{data} }, "\t Ex: scanme.nmap.org, microsoft.com/24, 192.168.0.1; 10.0.0-255.1-254 \n ";
|
||||
push @{ $rsp->{data} }, "\t2, bmcdiscover -i <bmc_ip> -u <bmcusername> -p <bmcpassword> -c\n ";
|
||||
push @{ $rsp->{data} }, "\t Note : check if bmc username and password are correct or not ";
|
||||
push @{ $rsp->{data} }, "\t Note : check if bmc username and password are correct or not. If bmc has no username,\n";
|
||||
push @{ $rsp->{data} }, "\t use none instead, Ex: bmcdiscover -i p8bmc -u none -p passw0rd -c\n";
|
||||
|
||||
xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK );
|
||||
return 0;
|
||||
@ -262,7 +263,15 @@ sub check_auth_process{
|
||||
my $bmstr4 = "BMC Session ID";
|
||||
|
||||
my $callback = $::CALLBACK;
|
||||
my $icmd = "/opt/xcat/bin/ipmitool-xcat -vv -I lanplus -U $bmcuser -P $bmcpw -H $bmcip chassis status ";
|
||||
my $icmd;
|
||||
if ( $bmcuser eq "none" )
|
||||
{
|
||||
$icmd = "/opt/xcat/bin/ipmitool-xcat -vv -I lanplus -P $bmcpw -H $bmcip chassis status ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$icmd = "/opt/xcat/bin/ipmitool-xcat -vv -I lanplus -U $bmcuser -P $bmcpw -H $bmcip chassis status ";
|
||||
}
|
||||
my $output = xCAT::Utils->runcmd("$icmd", -1);
|
||||
if ( $output =~ $bmstr1 )
|
||||
{
|
||||
|
@ -430,10 +430,6 @@ sub copycd
|
||||
if ($ret[0] != 0) {
|
||||
$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]});
|
||||
}
|
||||
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite", $temppath, $osdistroname);
|
||||
if ($ret[0] != 0) {
|
||||
$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2042,10 +2042,6 @@ sub copycd
|
||||
$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]});
|
||||
}
|
||||
|
||||
my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname);
|
||||
if ($ret[0] != 0) {
|
||||
$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ chmod 755 /tmp/updateflag.awk
|
||||
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
export PRINIC='#GETPRINICMAC:THISNODE#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
|
@ -6,7 +6,7 @@ echo "post scripts" >/root/post.log
|
||||
export PRINIC=#TABLE:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
export PRINIC='#GETPRINICMAC:THISNODE#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
|
@ -7,7 +7,7 @@ echo "post scripts" >/root/post.log
|
||||
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
export PRINIC='#GETPRINICMAC:THISNODE#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
|
@ -6,7 +6,7 @@ echo "post scripts" >/root/post.log
|
||||
export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic#
|
||||
if [ "$PRINIC" == "mac" ]
|
||||
then
|
||||
export PRINIC='#TABLE:mac:THISNODE:mac#'
|
||||
export PRINIC='#GETPRINICMAC:THISNODE#'
|
||||
fi
|
||||
if [ -z "$PRINIC" ]
|
||||
then
|
||||
|
@ -41,14 +41,14 @@ function usage {
|
||||
echo " xcatws-test.sh -u <USER> -p <pw> [-t]"
|
||||
echo " xcatws-test.sh -u <USER> -p <pw> -h <FQDN - Full hostname of server> [-c] [-t]"
|
||||
echo " -u The username of xCAT user which is used to access xCAT resource"
|
||||
echo " -p The password of username"
|
||||
echo " -p The userPW of username"
|
||||
echo " <FQDN of xCAT MN> The fully qualified hostname of xCAT management node. It can be an IP if using -k."
|
||||
echo " -c Check the server identity. The server certificate authentication must be enabled."
|
||||
echo " -t Using token authentication method."
|
||||
}
|
||||
|
||||
if [ "$USER" = "" ] || [ "$PW" = "" ]; then
|
||||
echo "Error: Miss username or password"
|
||||
echo "Error: Miss username or userPW"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
@ -78,13 +78,13 @@ function REST {
|
||||
if [ "$token" = "yes" ]; then
|
||||
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
|
||||
else
|
||||
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
|
||||
CMD="curl -X $METHOD --cacert /tmp/ca-cert.pem $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&passwor=$PW"
|
||||
fi
|
||||
else
|
||||
if [ "$token" = "yes" ]; then
|
||||
CMD="curl -X $METHOD -k -H X-Auth-Token:$TOKENID $datamsg https://$HOST/xcatws$SRC?pretty=1"
|
||||
else
|
||||
CMD="curl -X $METHOD -k $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&password=$PW"
|
||||
CMD="curl -X $METHOD -k $datamsg https://$HOST/xcatws$SRC?pretty=1&userName=$USER&userPW=$PW"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -125,7 +125,7 @@ fi
|
||||
|
||||
# get a token
|
||||
if [ "$token" = "yes" ]; then
|
||||
TOKENID=$(curl -X POST -k "https://$HOST/xcatws/tokens?pretty=1" -H Content-Type:application/json --data "{\"userName\":\"$USER\",\"password\":\"$PW\"}" 2>/dev/null | grep '"id"' | awk -F: {'print $2'} | awk -F \" {'print $2'})
|
||||
TOKENID=$(curl -X POST -k "https://$HOST/xcatws/tokens?pretty=1" -H Content-Type:application/json --data "{\"userName\":\"$USER\",\"userPW\":\"$PW\"}" 2>/dev/null | grep '"id"' | awk -F: {'print $2'} | awk -F \" {'print $2'})
|
||||
echo "** Using Token: $TOKENID to authenticate"
|
||||
fi
|
||||
|
||||
|
@ -73,11 +73,11 @@ check:rc==0
|
||||
end
|
||||
|
||||
start:xdsh_i_linux
|
||||
cmd:XCATBYPASS=1 copycds $$ISO
|
||||
cmd: copycds $$ISO
|
||||
check:rc==0
|
||||
cmd:XCATBYPASS=1 genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
|
||||
cmd: genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute
|
||||
check:rc==0
|
||||
cmd:XCATBYPASS=1 xdsh -i /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg "rpm -qa|grep uuid"
|
||||
cmd: xdsh -i /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg "rpm -qa|grep uuid"
|
||||
check:rc==0
|
||||
check:output=~libuuid
|
||||
end
|
||||
|
@ -632,9 +632,17 @@ sub getnodeattr
|
||||
{
|
||||
my ($node, $attr) = @_;
|
||||
my @output = runcmd("lsdef -t node -o $node -i $attr");
|
||||
my $t ;
|
||||
if($::RUNCMD_RC){
|
||||
return "Unknown";
|
||||
}else{
|
||||
# return "Unknown";
|
||||
foreach $t (1 .. 40) {
|
||||
log_this("could not get node attr $attr ");
|
||||
@output = runcmd("lsdef -t node -o $node -i $attr");
|
||||
last if ($::RUNCMD_RC == 0);
|
||||
}
|
||||
|
||||
}
|
||||
if($::RUNCMD_RC == 0){
|
||||
foreach my $output1 (@output){
|
||||
if($output1 =~ /$attr=(\w.+)/){
|
||||
log_this("$attr is $1");
|
||||
|
Loading…
x
Reference in New Issue
Block a user