From e45fb254c65fc3c91b4ab71152561408bc3945d4 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 28 Jan 2016 22:34:29 -0500 Subject: [PATCH 001/391] complete --- xCAT-test/autotest/testcase/xcatconfig/case0 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 993e494799..9cf8dcd160 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -87,3 +87,21 @@ check:output=~version|Version cmd:xcatconfig --version check:output=~version|Version end + +start:xcatconfig_f_check_xcatsslversion +description:after xcatconfig -f the site.xcatsslversion will not be changed +cmd:tabdump site | grep xcatsslversion +check:output=~TLSv1 +cmd:if cat /etc/*-release | grep SUSE >/dev/null; then chtab key=xcatsslversion site.value=TLSv12;elif cat /etc/*release |grep "Red Hat" >/dev/null;then chtab key=xcatsslversion site.value=TLSv12;elif cat /etc/*release |grep "Ubuntu" >/dev/null;then chtab key=xcatsslversion site.value=TLSv1_2;fi +check:rc==0 +cmd:tabdump site | grep "xcatsslversion" +check:output=~TLSv12|TLSv1_2 +cmd:xcatconfig -u +check:rc==0 +cmd:tabdump site | grep "xcatsslversion" +check:output=~TLSv12 +cmd:chtab key=xcatsslversion site.value=TLSv1 +check:rc==0 +cmd:tabdump site | grep "xcatsslversion" +check:output=~TLSv1 +end From 2a4b3e89c58eebe1fed789fb071875aad4f77d23 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 6 May 2016 04:50:52 -0400 Subject: [PATCH 002/391] new version of xcat test main script in jenkins environment --- .../share/xcat/tools/jenkins/xcatjktest | 1313 +++++++++++++++++ 1 file changed, 1313 insertions(+) create mode 100755 xCAT-server/share/xcat/tools/jenkins/xcatjktest diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest new file mode 100755 index 0000000000..cb28293a80 --- /dev/null +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -0,0 +1,1313 @@ +#!/usr/bin/env perl + +$ENV{PATH} = "/opt/xcat/bin:/opt/xcat/sbin:/opt/xcat/share/xcat/tools:/usr/sbin:/usr/bin:/sbin:/bin"; + +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; +use Term::ANSIColor; +use Time::Local; +use IO::Select; +use File::Path; +use File::Spec; +use File::Basename; +use POSIX qw(WNOHANG setsid :errno_h); + +#global arguments +my $date; +my $pro_name=basename($0); +my $homedir = dirname(File::Spec->rel2abs(__FILE__)); +my $logfiledir = ""; +my $logfile=""; +my $globalconffile="$homedir/global.conf"; +my $xcatpackagesdir=""; +my $mailfile=""; +my %confkeys; #global conf file +my %config; #cluster conf file +my $arch; +my $mn; +my $err_record=""; +my $installlog="/var/log/xcat/autotest.log"; +my $isodir="$homedir/iso"; +my $orgclusterconffile=""; +my $newclusterconffile=""; +my $all_reg_time_consumption=0; +my $env_dply_time_consumption=0; +my $totalcase=0; +my $alltestpass=0; +my $teststopflag=0; +my $lastcase; +#my $defaultmail="huweihua\@cn.ibm.com,litingt\@cn.ibm.com,junxiaw\@cn.ibm.com,wxp\@cn.ibm.com,gongjie\@cn.ibm.com,bjcaomm\@cn.ibm.com,vhu\@us.ibm.com"; +my $defaultmail="huweihua\@cn.ibm.com,litingt\@cn.ibm.com"; +my $sub_process_rt=0; +my $proid; + +# command line arguments +my $cluster_name; +my $os; +my $xcatcore_addr; +my $xcatdep_addr; +my $bucket; +my $mail_list = ""; +my $quiet=0; +my $hold=0; +my $needhelp = 0; +my $proname=""; +my $proruntime=""; + + +####################################### +# send messages +####################################### +sub send_msg { + my $num = shift; + my $msg = shift; + my $content; + if ($num == 0) { + $content = "Fatal error:"; + } elsif($num == 1) { + $content = "Warning:"; + } elsif($num == 2) { + $content = "Notice:"; + } + my $timestamp = `date +"%Y%m%d%H%M%S"`; + chomp($timestamp); + if ( !open (LOGFILE, ">> $logfiledir/$logfile") ) { + return 1; + } + print LOGFILE "$timestamp $$ $content $msg\n"; + close LOGFILE; + + if(!$quiet){ + print "$timestamp $$ $content $msg\n"; + } +} + +####################################### +# runcmd +####################################### +sub runcmd { + my ($cmd) = @_; + my $rc = 0; + $::RUNCMD_RC = 0; + my $outref = []; + + @$outref = `$cmd 2>&1`; + if ($?) + { + $rc = $? ; + $::RUNCMD_RC = $rc; + } + chomp(@$outref); + return @$outref; +} +####################################### +# parse cluser.conf file +####################################### +sub load_cluster_conf { + my $type = undef; #Script_Prev,Script_Post,Table,Object,System,Custom + my $sub_type = undef; # The string after $type_ + my $name = undef; + my $attr = undef; + my $value = undef; + my $c = 0; + + open(FILE, "$orgclusterconffile") or die "can't to open $orgclusterconffile"; + while(my $line = ) { + $line =~ s/^\s+|#.+|\s+$//g; + next if(length($line) == 0); + + #Table name can not contain "_" + if($line =~ /\[\s*(\w+)\_(\w+)\s*\]/) { + $type = $1; + $sub_type = $2; + $name = undef; + $c = 0; + }elsif($line =~ /\[\s*System|Custom\s*\]/){ + $type = "Varible"; + }elsif ($type eq "Table") { + ##TABLE BLOCK## + if($line =~ /(\w+)\s*=\s*([\w\.\-]+)/) { + $attr = $1; + $value = $2; + if($name&&($config{table}{$sub_type}{$name}{__KEY__} ne $attr)){ + $config{table}{$sub_type}{$name}{$attr}=$value; + } else { + $name = $value; + $config{table}{$sub_type}{$name}{__KEY__}=$attr; + } + } + }elsif ($type eq "Object") { + ##OBJECT BLOCK## + if($line =~ /(\w+)\s*=\s*([:\w\.\-\/]+)/) { + $attr = $1; + $value = $2; + if($attr eq "Name"){ + $name = $value; + } elsif(!defined($name)){ + #print "Please give name for Object\n"; + close FILE; + return 1; + } else { + $config{object}{$sub_type}{$name}{$attr}=$value; + } + } + }elsif ($type eq "Script") { + ##SCRIPT_BLOCK## + if($sub_type eq "Prev") { + $config{script_prev}->[$c] = $line; + $c = $c + 1; + } + elsif ($sub_type eq "Post") { + $config{script_post}->[$c] = $line; + $c = $c + 1; + } + } elsif ($type eq "Varible") { + ##NODE_BLOCK## + if($line =~ /(\w+)\s*=\s*([\w\.\-\+\/:]+)/) { + $config{var}{$1} = $2; + } + } + } + + close FILE; + return 0; +} +####################################### +# rewrite cluster.conf file +####################################### +sub reset_cluster_conf{ + if(exists $config{object}){ + foreach my $type (keys %{$config{object}}){ + foreach my $name (keys %{$config{object}{$type}}){ + &runcmd("echo \"[Object_node]\" >> $newclusterconffile"); + &runcmd("echo \"Name=$name\" >> $newclusterconffile"); + foreach my $attr (keys %{$config{object}{$type}{$name}}){ + &runcmd("echo \"$attr=$config{object}{$type}{$name}{$attr}\" >> $newclusterconffile"); + } + } + } + } + + if(exists $config{table}){ + foreach my $type (keys %{$config{table}}){ + &runcmd("echo \"[Table_$type]\" >> $newclusterconffile"); + foreach my $name (keys %{$config{table}{$type}}){ + &runcmd("echo \"$config{table}{$type}{$name}{__KEY__} = $name\" >> $newclusterconffile"); + foreach my $attr (keys %{$config{table}{$type}{$name}}){ + if($attr ne '__KEY__'){ + &runcmd("echo \"$attr=$config{table}{$type}{$name}{$attr}\" >> $newclusterconffile"); + } + } + } + } + } + + if(exists $config{var}){ + &runcmd("echo \"[System]\" >> $newclusterconffile"); + foreach my $varname (keys %{$config{var}}){ + &runcmd("echo \"$varname=$config{var}{$varname}\" >> $newclusterconffile"); + } + } + + return 0; +} +####################################### +# get netboot value +####################################### +sub get_netboot_value{ + my $osv=shift; + my $archv=shift; + my $mgtv=shift; + my $netbootv="none"; + if($archv =~ /x86/i){ + $netbootv="xnba"; + }elsif($archv =~ /^ppc64$/i){ + $osv =~ /(\D+)(.+)/; + my $version=$2; + if($1 =~ /rhel/i){ + if($version>=7){ + $netbootv="grub2"; + }else{ + $netbootv="yaboot"; + } + }elsif($1 =~ /sles/i){ + if($version<11.4){ + $netbootv="yaboot"; + }else{ + $netbootv="grub2"; + } + } + }elsif($archv =~ /ppc64le/i || $archv =~ /ppc64el/i){ + if($mgtv =~ /^ipmi$/i){ + $netbootv="petitboot"; + }else{ + $netbootv="grub2"; + } + } + return $netbootv; +} +####################################### +# init +####################################### +sub init{ + + $proid="$proname-$proruntime"; + $logfile="log.$proid"; + $logfiledir="$homedir/log/$proname/$proruntime"; + $xcatpackagesdir="$homedir/xcatpackages/$proname/$proruntime"; + $orgclusterconffile="$homedir/$cluster_name/default.conf"; + $newclusterconffile="$logfiledir/cluster.conf"; + $mailfile="$logfiledir/mail.$proid"; + + mkpath("$logfiledir") unless(-d "$logfiledir"); + mkpath("$xcatpackagesdir") unless(-d "$xcatpackagesdir"); + + return 0; +} + +####################################### +# read global conf file +####################################### +sub read_conf{ + my $myfile=undef; + my $line=undef; + + if (!open($myfile, "$globalconffile")) { + send_msg(0, "Open $globalconffile failed"); + return 1; + } + while ($line = <$myfile>) { + $line =~ s/\s//g; + next if($line =~ /^#/); + next if($line eq ""); + my @attr=split(/=/,$line); + $confkeys{$attr[0]} = $attr[1]; + } + close($myfile); + + #for support both 'le' and 'el' + foreach my $k (keys %confkeys) { + if($k =~ /ppc64el/i || $k =~ /ppc64le/i){ + if($k =~ /(.+)-(.+)-(.+)/){ + my $newarch=$2; + my $tmp=$2; + my $os=$1; + my $flag=$3; + $newarch=~ s/ppc64el/ppc64le/g if($tmp =~ /ppc64el/i); + $newarch=~ s/ppc64le/ppc64el/g if($tmp =~ /ppc64le/i); + $confkeys{"$os-$newarch-iso"}=$confkeys{$k} if($flag=~/^iso$/); + $confkeys{"$os-$newarch-image"}=$confkeys{$k} if($flag=~/image/); + $confkeys{"$os-$newarch-miniiso"}=$confkeys{$k} if($flag=~/^miniiso$/); + } + } + } + return 0; +} + +####################################### +# usage for arguments +####################################### +sub usage{ + print "Usage:$pro_name - Run xcat test cases with jenkins.\n + Explanation for the options: + --os: Required, specify the test operating system and version\n + --cluster: Required, specify the cluster where to run the test.\n + --testcase: Required, specify the test case list. value \"all\" means running daily regression test\n + --project-name: Required, specify the project name.\n + --num: Required, specifys this is how many times does this project run.\n + --xcat-core: Required, a web address, specify where to download the xcat-core package\n + --xcat-dep: Required, a web address, specify where to download the xcat-dep package\n + --email: a mail address, sepcify who should receive the test result report\n + --quiet: don't output to screen, just keep output in log file. output to screen by default\n + --hold: hold environment for 24 hours if some case stop and need to hold environment\n\n"; + + print " $pro_name [-?|-h]\n"; + print " $pro_name --os --cluster --testcase --project-name --num --xcat-core --xcat-dep --email \n"; + print "\n"; + return; +} + +####################################### +# get build from build server +####################################### +sub get_build{ + send_msg(2, "start to get xcat build........"); + + &runcmd("cd $xcatpackagesdir >/dev/null 2>&1 && wget $xcatcore_addr >/dev/null 2>&1"); + if($?){ + send_msg(0, "[get_build] Can't download xcat-core from $xcatcore_addr"); + return 1; + } + + &runcmd("cd $xcatpackagesdir >/dev/null 2>&1 && wget $xcatdep_addr >/dev/null 2>&1"); + if($?){ + send_msg(0, "[get_build] Can't download xcat-dep from $xcatcore_addr"); + return 1; + } + + send_msg(2, "get xcat build........[done]"); + return 0; +} + +####################################### +# do clean uo job when exit +####################################### +sub cleanup{ + unlink("/tmp/totalcase.$proid") if(-e "/tmp/totalcase.$proid"); + unlink("/tmp/failed_case_detail.$proid") if(-e "/tmp/failed_case_detail.$proid"); + #rmdir("$xcatpackagesdir") if(-d "$xcatpackagesdir"); +} + +####################################### +# exit +####################################### +sub exit_test{ + my $rst=shift; + &cleanup; + send_msg(2, "project $proid exit $rst"); + exit $rst; +} + +####################################### +# environment check +####################################### +sub env_check { + send_msg(2, "start to environment checking.........."); + + if(! -d "$homedir/$cluster_name"){ + send_msg(0, "can't find $cluster_name under $homedir"); + return 1; + } + + if(! -e "$orgclusterconffile"){ + send_msg(0, "can't find $orgclusterconffile"); + return 1; + } + + if($cluster_name =~ /(.+)-(.+)/){ + $mn=$1; + #$arch=$2; + }else{ + send_msg(0, "the name of $cluster_name is invalid"); + return 1; + } + + + &load_cluster_conf; + if(!exists($config{object}{node}{$config{var}{CN}}{arch})){ + send_msg(0, "can't fine arch of CN in $orgclusterconffile"); + return 1; + } + + $arch=$config{object}{node}{$config{var}{CN}}{arch}; + + if($arch !~ /^x86/i && + $arch !~ /^ppc64$/i && + $arch !~ /^ppc64le$/i && + $arch !~ /^ppc64el$/i){ + send_msg(0, "the arch $arch is invalid"); + return 1; + } + + send_msg(2, "environment checking..........[done]"); + return 0; +} + +####################################### +# install mn +###################################### +sub mn_install { + send_msg(2, "[mn_install] start to install mn $mn......."); + + &runcmd("lsdef|grep $mn"); + if($?){ + send_msg(0, "[mn_install] Can't find definition of $mn in current control node"); + return 1; + } + + if(!exists($confkeys{"$os-$arch-image"}) || !defined($confkeys{"$os-$arch-image"})){ + send_msg(0, "[mn_install] Can't find image definition for $mn in global conf file"); + return 1; + } + + my $osimage= $confkeys{"$os-$arch-image"}; + &runcmd("lsdef -t osimage|grep $osimage"); + if($?){ + send_msg(0, "[mn_install] Can't find definition of $osimage in current control node"); + return 1; + } + send_msg(2, "[mn_install] plan to install $osimage on mn $mn................"); + + my $mgt = `lsdef $mn |grep mgt|awk -F'=' '{print \$2}'`; + chomp($mgt); + my $netboot=get_netboot_value("$os","$arch","$mgt"); + send_msg(2, "[mn_install] plan to set netboot of $mn [mgt=$mgt] to $netboot......"); + &runcmd("chdef $mn netboot=$netboot"); + if($?){ + send_msg(0, "[mn_install] set netboot of $mn to $netboot failed"); + return 1; + } + send_msg(2, "[mn_install] set netboot of $mn to $netboot..[done]"); + + &runcmd("lsdef $mn -i postscripts|grep setupntp"); + if($?){ + send_msg(2, "[mn_install] plan to set setupntp as $mn 's postscript......"); + &runcmd("chdef $mn -p postscripts=setupntp"); + if($?){ + send_msg(0, "[mn_install] set setupntp as $mn 's postscript failed"); + return 1; + } + send_msg(2, "[mn_install] set setupntp as $mn 's postscript...[done]"); + } + + if($os =~ /ubuntu/i){ + if($arch =~ /le/i || $arch =~ /el/i){ + my $miniisopath=$logfiledir; + my $downloadpath=$confkeys{"$os-$arch-miniiso"}; + &runcmd("cd $miniisopath >/dev/null 2>&1 && wget $downloadpath >/dev/null 2>&1"); + if($?){ + send_msg(0, "[mn_install] Can't download mini.iso from $downloadpath"); + return 1; + } + send_msg(2, "[mn_install] download mini.iso from $downloadpath ....[done]"); + mkpath("/install/$os/ppc64el/install/netboot") if(! -e "/install/$os/ppc64el/install/netboot"); + rename("/install/$os/ppc64el/install/netboot/initrd.gz", "/install/$os/ppc64el/install/netboot/initrd.gz.bakupby$proid") if(-e "/install/$os/ppc64el/install/netboot/initrd.gz"); + mkpath("$miniisopath/mountpoint"); + &runcmd("mount -o loop $miniisopath/mini.iso $miniisopath/mountpoint"); + &runcmd("cp $miniisopath/mountpoint/install/initrd.gz /install/$os/ppc64el/install/netboot/"); + &runcmd("umount $miniisopath/mountpoint"); + unlink("$miniisopath/mountpoint"); + } + } + + &runcmd("nodeset $mn osimage=$osimage"); + if($?){ + send_msg(0, "[mn_install] running nodeset error, please checking your configuration"); + return 1; + } + send_msg(2, "[mn_install] nodeset $mn osimage=$osimage...[done]"); + + if( $arch !~ /^ppc64$/i){ + &runcmd("rpower $mn boot"); + if($?){ + send_msg(0, "[mn_install] rpower $mn boot error, please checking your configuration"); + return 1; + } + }else{ + &runcmd("rnetboot $mn"); + if($?){ + send_msg(0, "[mn_install] rnetboot $mn error, please checking your configuration"); + return 1; + } + } + send_msg(2, "[mn_install] reboot $mn ...[done]"); + + #sleep while for installation. + &runcmd("sleep 360"); + &runcmd("a=0;while ! `lsdef -l $mn|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ \$a -gt 400 ];then break;fi done"); + + &runcmd("lsdef -l $mn|grep status|grep booted >/dev/null"); + if($?){ + send_msg(0, "[mn_install] install $osimage on mn $mn failed"); + return 1; + } + + &runcmd("ping -c 2 $mn > /dev/null"); + if($?){ + send_msg(0, "[mn_install] ping $mn failed after installation"); + return 1; + } + + &runcmd("xdsh $mn date > /dev/null"); + if($?){ + send_msg(0, "[mn_install] xdsh $mn date failed after installation"); + return 1; + } + + send_msg(2, "install mn $mn .....[done]"); + return 0; +} + + +####################################### +# prepare mn +# copy all necessary file to MN +###################################### +sub prepare_mn { + send_msg(2, "[prepare_mn] start to prepare mn $mn......."); + + if($os =~ /rhels7/i){ + &runcmd("xdsh $mn \"yum -y install bzip2 \" >/dev/null 2>&1"); + } + + my $xcatcore=`ls -l /$xcatpackagesdir |grep core |awk '{print \$9}'`; + my $xcatdep=`ls -l /$xcatpackagesdir |grep dep|awk '{print \$9}'`; + chomp($xcatcore); + chomp($xcatdep); + if($xcatcore eq ""){ + send_msg(0, "[prepare_mn] can't find xcat core under /$xcatpackagesdir"); + return 1; + } + if($xcatdep eq ""){ + send_msg(0, "[prepare_mn] can't find xcat dep under /$xcatpackagesdir"); + return 1; + } + + send_msg(2, "[prepare_mn] starting to copy $xcatcore and $xcatdep to $mn"); + &runcmd("scp /$xcatpackagesdir/$xcatcore /$xcatpackagesdir/$xcatdep root\@$mn:/ >/dev/null"); + if($?){ + send_msg(0, "[prepare_mn] copy $xcatcore and $xcatdep to $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] copy $xcatcore and $xcatdep to $mn...[done]"); + + send_msg(2, "[prepare_mn] starting to decompress xcat packages....."); + &runcmd("xdsh $mn 'cd / && tar xvf /$xcatcore' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[prepare_mn] decompress $xcatcore on $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'cd / && tar xvf /$xcatdep' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[prepare_mn] decompress $xcatdep on $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] decompress xcat packages....[done]"); + + #prepare /etc/hosts file on MN + &runcmd("scp /etc/hosts root\@$mn:/etc >/dev/null"); + if ($?){ + send_msg(0, "[prepare_mn] generate /etc/hosts on $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] generate /etc/hosts on $mn...[done]"); + + #prepare specific files on mn for each platform + if($os =~ /rhel/i){ + if($arch =~ /ppc64le/i || $arch =~ /ppc64el/i){ + &runcmd("scp /install/$os/ppc64le/RPM-GPG-KEY-redhat-release root\@$mn:/ >/dev/null"); + }else{ + &runcmd("scp /install/$os/$arch/RPM-GPG-KEY-redhat-release root\@$mn:/ >/dev/null"); + } + if($?){ + send_msg(0, "[prepare_mn] copy RPM-GPG-KEY-redhat-release to $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] copy RPM-GPG-KEY-redhat-release to $mn...[done]"); + } + + my $iso= $confkeys{"$os-$arch-iso"}; + if ($iso eq ""){ + send_msg(0, "[prepare_mn] can't find iso for $mn in golbal conf file"); + return 1; + } + if(! -e "$isodir/$iso"){ + send_msg(0, "[prepare_mn] can't find $iso under $isodir"); + return 1; + } + send_msg(2, "[prepare_mn] find $iso for os=$os and arch=$arch"); + + &runcmd("scp $isodir/$iso root\@$mn:/ >/dev/null"); + if($?){ + send_msg(0, "[prepare_mn] copy $iso to $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] copy $iso to $mn...[done]"); + + if($os =~ /ubuntu/i){ + if($arch =~ /le/i || $arch =~ /el/i){ + my $miniisopath=$logfiledir; + &runcmd("scp $miniisopath/mini.iso root\@$mn:/ >/dev/null 2>&1"); + if($?){ + send_msg(0, "[prepare_mn] copy $miniisopath/mini.iso to $mn failed"); + return 1; + } + send_msg(2, "[prepare_mn] copy $miniisopath/mini.iso to $mn...[done]"); + } + } + + &load_cluster_conf; + if(exists ($config{var}{SN})){ + if(!exists($config{object}{node}{$config{var}{SN}}{arch})){ + send_msg(0, "[prepare_mn] SN without arch attribute in $orgclusterconffile"); + return 1; + } + if(!exists($config{object}{node}{$config{var}{SN}}{mgt})){ + send_msg(0, "[prepare_mn] SN without mgt attribute in $orgclusterconffile"); + return 1; + } + $config{object}{node}{$config{var}{SN}}{netboot}=get_netboot_value("$os","$config{object}{node}{$config{var}{SN}}{arch}","$config{object}{node}{$config{var}{SN}}{mgt}"); + if($config{object}{node}{$config{var}{SN}}{netboot} eq "none"){ + send_msg(0, "[prepare_mn] can't find appropriate netboot value for $os+$config{object}{node}{$config{var}{SN}}{arch}+$config{object}{node}{$config{var}{SN}}{mgt} scenario"); + return 1; + } + $config{object}{node}{$config{var}{SN}}{os}=$os; + + if($arch =~ /ppc64le/i || $arch =~ /ppc64el/i){ + if($os =~ /ubuntu/i){ + $config{object}{node}{$config{var}{SN}}{arch}="ppc64el"; + }else{ + $config{object}{node}{$config{var}{SN}}{arch}="ppc64le"; + } + } + } + + if(exists ($config{var}{CN})){ + if(!exists($config{object}{node}{$config{var}{CN}}{arch})){ + send_msg(0, "[prepare_mn] CN without arch attribute in $orgclusterconffile"); + return 1; + } + if(!exists($config{object}{node}{$config{var}{CN}}{mgt})){ + send_msg(0, "[prepare_mn] CN without mgt attribute in $orgclusterconffile"); + return 1; + } + $config{object}{node}{$config{var}{CN}}{netboot}=get_netboot_value("$os","$config{object}{node}{$config{var}{CN}}{arch}","$config{object}{node}{$config{var}{CN}}{mgt}"); + if($config{object}{node}{$config{var}{CN}}{netboot} eq "none"){ + send_msg(0, "[prepare_mn] can't find appropriate netboot value for $os+$config{object}{node}{$config{var}{CN}}{arch}+$config{object}{node}{$config{var}{CN}}{mgt} scenario"); + return 1; + } + $config{object}{node}{$config{var}{CN}}{os}=$os; + + if($arch =~ /ppc64le/i || $arch =~ /ppc64el/i){ + if($os =~ /ubuntu/i){ + $config{object}{node}{$config{var}{CN}}{arch}="ppc64el"; + }else{ + $config{object}{node}{$config{var}{CN}}{arch}="ppc64le"; + } + } + } + + if(exists ($config{var}{ISO})){ + $config{var}{ISO}="/$iso"; + } + + if(exists ($config{var}{OS})){ + if($os =~ /(\D+)\d.*/){ + $config{var}{OS}="$1"; + } + } + &reset_cluster_conf; + + send_msg(2, "prepare mn $mn .....[done]"); + return 0; +} + + +####################################### +# install xcat +####################################### +sub install_xcat { + send_msg(2, "[install_xcat] starting to install xcat in $mn"); + + if($os =~ /rhel/i){ + $os =~ /(\D+)(\d+)\.?(\d?)/; + &runcmd("xdsh $mn \"cd /xcat-core && ./mklocalrepo.sh\" >/dev/null 2>&1"); + my $version=$2; + if($arch =~ /ppc64le/i || $arch =~ /ppc64el/i){ + &runcmd("xdsh $mn \"cd /xcat-dep/rh$version/ppc64le && ./mklocalrepo.sh\" >/dev/null 2>&1"); + }else{ + &runcmd("xdsh $mn \"cd /xcat-dep/rh$version/$arch && ./mklocalrepo.sh\" >/dev/null 2>&1"); + } + &runcmd("xdsh $mn \"rpm --import /RPM-GPG-KEY-redhat-release\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"yum -y install xCAT xCAT-test > $installlog 2>&1\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"yum -y install createrepo expect\" >/dev/null 2>&1"); + + if($os =~ /rhels7/i){ + &runcmd("xdsh $mn \"yum -y install mariadb-devel mariadb-libs mariadb-server mariadb-bench mariadb perl-DBD-MySQL mysql-connector-odbc unixODBC\">/dev/null 2>&1"); + }elsif($os =~ /rhels6/i){ + &runcmd("xdsh $mn \"yum -y install mysql-server mysql mysql-bench mysql-devel mysql-connector-odbc\" >/dev/null 2>&1"); + } + + &runcmd("xdsh $mn \"source /etc/profile.d/xcat.sh\" >/dev/null 2>&1"); + if($arch =~ /x86/i){ + &runcmd("xdsh $mn \"yum install -y perl-Sys-Virt\" >/dev/null 2>&1"); + } + }elsif($os =~ /sles/i){ + $os =~ /(\D+)(\d+)\.?(\d?)/; + my $version=$2; + if($arch =~ /ppc64le/i || $arch =~ /ppc64el/i){ + &runcmd("xdsh $mn \"zypper ar file:///xcat-dep/sles$version/ppc64le xCAT-dep\" >/dev/null 2>&1"); + }else{ + &runcmd("xdsh $mn \"zypper ar file:///xcat-dep/sles$version/$arch xCAT-dep\" >/dev/null 2>&1"); + } + &runcmd("xdsh $mn \"zypper ar file:///xcat-core xCAT-core\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"zypper sl -U\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"zypper --gpg-auto-import-keys search --match-exact -s screen\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"zypper -n install xCAT xCAT-test > $installlog 2>&1\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"zypper -n install createrepo expect\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"zypper -n install mysql-client libmysqlclient_r15 libqt4-sql-mysql libmysqlclient15 perl-DBD-mysql mysql unixODBC\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"source /etc/profile.d/xcat.sh\" >/dev/null 2>&1"); + + if($arch =~ /le/i || $arch =~ /el/i){ + &runcmd ("xdsh $mn \"zypper -n install perl-Net-DNS-0.80-1.ppc64le\">/dev/null 2>&1"); + } + if($arch =~ /x86/i){ + &runcmd("xdsh $mn \"zypper -n install perl-Sys-Virt\" >/dev/null 2>&1"); + } + }elsif($os =~ /ubuntu/i){ + &runcmd("xdsh $mn \"echo \"nameserver 9.0.2.1\" >> /etc/resolv.conf\" >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get -y install software-properties-common' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] apt-get -y install software-properties-common in $mn failed"); + return 1; + } + + if($arch =~ /x86/i){ + &runcmd("xdsh $mn 'add-apt-repository \"deb http://archive.ubuntu.com/ubuntu \$(lsb_release -sc) main\"' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'add-apt-repository \"deb http://archive.ubuntu.com/ubuntu \$(lsb_release -sc)-updates main\"' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'add-apt-repository \"deb http://archive.ubuntu.com/ubuntu \$(lsb_release -sc) universe\"' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'add-apt-repository \"deb http://archive.ubuntu.com/ubuntu \$(lsb_release -sc)-updates universe\"' >/dev/null 2>&1"); + }elsif($arch =~ /le/i || $arch =~ /el/i){ + &runcmd("xdsh $mn 'add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc) main\"' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc) main\" in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc)-updates main\"' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc)-updates main\" in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc) universe\"' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc) universe\" in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc)-updates universe\"' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] add-apt-repository \"deb http://ports.ubuntu.com/ubuntu-ports \$(lsb_release -sc)-updates universe\" in $mn failed"); + return 1; + } + } + + &runcmd("xdsh $mn \"wget -O - \"http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download\" | apt-key add -\" >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] \"wget -O - \"http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download\" | apt-key add -\" in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'apt-get clean all' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] apt-get clean all in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'apt-get update' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get -y install build-essential dpkg-dev dh-make debhelper fakeroot gnupg lintian pbuilder quilt reprepro libsoap-lite-perl libdbi-perl' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] apt-get -y install build-essential dpkg-dev dh-make debhelper fakeroot gnupg lintian pbuilder quilt reprepro libsoap-lite-perl libdbi-perl in $mn failed"); + return 1; + } + + if($arch=~ /x86/i){ + &runcmd("xdsh $mn \"/xcat-core/mklocalrepo.sh\" >/dev/null 2>&1"); + &runcmd("xdsh $mn \"/xcat-dep/mklocalrepo.sh\" >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get clean all' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get update' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get -y install xcat xcat-test > $installlog 2>&1' >/dev/null 2>&1"); + }elsif($arch =~ /le/i || $arch =~ /el/i){ + &runcmd("xdsh $mn \"/xcat-core/mklocalrepo.sh\" >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] /xcat-core/mklocalrepo.sh in $mn failed"); + return 1; + } + &runcmd("xdsh $mn \"/xcat-dep/mklocalrepo.sh\" >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] /xcat-dep/mklocalrepo.sh in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'apt-get clean all' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] apt-get clean all in $mn failed"); + return 1; + } + &runcmd("xdsh $mn 'apt-get update' >/dev/null 2>&1"); + &runcmd("xdsh $mn 'apt-get -y install xcat xcat-test > $installlog 2>&1' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[install_xcat] apt-get -y install xcat xCAT-test in $mn failed"); + return 1; + } + + &runcmd("xdsh $mn 'mkdir -p /install/$os/%arch/install/netboot '"); + &runcmd("scp /install/$os/%arch/install/netboot/initrd.gz $mn:/install/%os/%arch/install/netboot "); + } + } + + &runcmd("scp $mn:/$installlog $logfiledir/new_xcat_installation.log >/dev/null 2>&1"); + + #check if MN is installed successful + my $lsdefout = `ssh -t $mn 'bash -l -i -c "lsdef -v"'`; + chomp($lsdefout); + if($lsdefout !~ /^lsdef - Version/ ){ + send_msg(0, "[install_xcat] install xcat in $mn failed"); + return 1; + } + + send_msg(2, "[install_xcat] install xcat in $mn successfully"); + return 0; + +} + +####################################### +# do test +####################################### +sub do_test { + my $casestop=0; + + send_msg(2, "[do_test] starting to run regression test in $mn"); + + &runcmd("scp $newclusterconffile root\@$mn:/opt/xcat/share/xcat/tools/autotest/default.conf >/dev/null"); + if ($?){ + send_msg(0, "[do_test] copy $newclusterconffile to $mn failed"); + return 1; + } + send_msg(2, "[do_test] copy $newclusterconffile to $mn successfully"); + + #this is a workaround in ubuntu environment + if($os =~ /ubuntu/i){ + send_msg(2, "[do_test] change /bin/sh setting in ubuntu environment"); + runcmd("xdsh $mn \"rm -rf /bin/sh\" >/dev/null 2>&1"); + runcmd("xdsh $mn \"ln -s /bin/bash /bin/sh\""); + } + + if($bucket =~ /^all$/i){ + my $bundle=$os."_".$arch.".bundle"; + + &runcmd("xdsh $mn 'ls -l /opt/xcat/share/xcat/tools/autotest/bundle/|grep $bundle' >/dev/null 2>&1"); + if($?){ + send_msg(0, "[do_test] can't find $bundle under $mn:/opt/xcat/share/xcat/tools/autotest/bundle/ "); + return 1; + } + + &runcmd("scp -r $mn:/opt/xcat/share/xcat/tools/autotest/bundle/$bundle $logfiledir >/dev/null 2>&1"); + if($?){ + send_msg(0, "[do_test] can't copy $mn:/opt/xcat/share/xcat/tools/autotest/bundle/$bundle back"); + return 1; + } + + if(!open(FILE, "<$logfiledir/$bundle")){ + send_msg(0, "[do_test] can't open $logfiledir/$bundle"); + return 1; + } + + my $casecnt=0; + my $line=""; + while($line=){ + $line =~ s/^\s+|#.+|\s+$//g; + next if(length($line) == 0); + $casecnt++; + } + close(FILE); + &runcmd("echo $casecnt > /tmp/totalcase.$proid"); + + my $rst=0; + my @output; + send_msg(2, "[do_test] doing test [$bundle] in $mn....."); + if($os !~ /ubuntu/i){ + @output=runcmd("xdsh $mn \"xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -b $bundle\" >/dev/null 2>&1"); + $rst=$?; + }else{ + @output=runcmd("ssh -t $mn 'exec bash -l -i -c \"xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -b $bundle\"' >/dev/null 2>&1"); + $rst=$?; + } + my $tmpoutput=join(' ', @output); + send_msg(2, "[do_test] output of trigger xcattest: $tmpoutput"); + if($rst){ + $casestop=1; + send_msg(2, "[do_test] the regression job in $mn was STOPPED for some one case"); + }else{ + send_msg(2, "[do_test] run the whole regression test in $mn finished"); + } + + &runcmd("scp -r $mn:/opt/xcat/share/xcat/tools/autotest/result/* $logfiledir >/dev/null 2>&1"); + if ($?){ + send_msg(0, "[do_test] copy regression result to $logfiledir failed"); + return 1; + } + send_msg(2, "[do_test] copy regression result to $logfiledir successfully"); + }else{ + #to do part + } + + return 2 if($casestop); + return 0; +} + +####################################### +# creat report +####################################### +sub create_report{ + send_msg(2, "[create_report] start to create test report"); + + my $mailreport .= "======================================\n"; + $mailreport .= " Test Result for Project $proid\n"; + $mailreport .= "======================================\n\n"; + $mailreport .= "[$os+$arch]\n\n"; + + if($sub_process_rt){ + my $h=int($all_reg_time_consumption/3600); + my $m=int(($all_reg_time_consumption - $h*3600)/60); + my $s=($all_reg_time_consumption - $h*3600)%60; + $mailreport .= "\tAll time consumption: $h hours $m minutes $s seconds\n\n"; + + if($env_dply_time_consumption){ + $h=int($env_dply_time_consumption/3600); + $m=int(($env_dply_time_consumption - $h*3600)/60); + $s=($env_dply_time_consumption- $h*3600)%60; + $mailreport .= "\tDeploy test environment time consumption: $h hours $m minutes $s seconds\n\n"; + } + + if($err_record ne ""){ + $mailreport .= "\tDeploy MN result: $err_record\n\n"; + }else{ + if(-e "/tmp/totalcase.$proid"){ + my $tmp = `cat /tmp/totalcase.$proid`; + chomp($tmp); + $totalcase=$tmp; + } + + my $totalcnt=0; + my $failcnt=0; + my $faillist=""; + opendir(DIR, "$logfiledir"); + foreach my $file (readdir DIR){ + next if($file !~ /xcattest.log/); + my $cnt = `cat $logfiledir/$file |grep -- "------END::"|wc -l`; + $totalcnt+=int($cnt); + for(my $i=1;$i<$cnt+1;$i++){ + my $line=`cat $logfiledir/$file |grep -- "------END::"|sed -n ${i}p`; + chomp($line); + if($line =~ /------END::([a-zA-Z0-9_-]+)::([a-zA-Z0-9_-]+)::Time.+/){ + my $failedcase=$1; + if($2 =~ /Failed/){ + $failcnt++; + $faillist.=$failedcase.", "; + } + } + } + } + closedir(DIR); + $mailreport .= "\tTotalCase $totalcase TotalRun $totalcnt Failed $failcnt\n\n\tFailed cases: $faillist\n\n"; + + if($teststopflag){ + my $lastfile = `ls -l $logfiledir|grep "xcattest.log"|tail -1|awk '{print \$9}'`; + chomp($lastfile); + my $lastline=`cat $logfiledir/$lastfile |grep -- "------END::"|tail -1`; + chomp($lastline); + $lastcase=$1 if($lastline =~ /------END::([a-zA-Z0-9_-]+)::([a-zA-Z0-9_-]+)::Time.+/); + $mailreport .= "\tFinal environment stop at $lastcase\n"; + } + + $alltestpass=1 if($totalcase!=0 && $failcnt==0 && $totalcnt==$totalcase); + } + }else{ + $mailreport .= "\tTime consumption: Out of 8 hours!!!!!!\n"; + } + + $mailreport .= "\n-------------------------------------------\nCluster Information:\n"; + $mailreport .= "\t MN: $mn\n"; + $mailreport .= "\t SN: $config{var}{SN}\n"; + $mailreport .= "\t CN: $config{var}{CN}\n"; + $mailreport .= "\t Test result are saved under $mn:/opt/xcat/share/xcat/tools/autotest/result/\n" if($teststopflag && $hold); + + &runcmd("touch $mailfile && echo \"$mailreport\" > $mailfile"); + send_msg(2, "[create_report] created test report.....[done]"); + return 0; +} + +sub send_mail{ + my $totalcnt=0; + my $failcnt=0; + my $subject=""; + my $attachfile=""; + + if($err_record ne ""){ + $subject = "[JK][$proid][FAILED] $err_record"; + }else{ + my $output = `cat $mailfile |grep "Total"|grep "Failed"`; + chomp($output); + if($output =~ /TotalCase (\d+) TotalRun (\d+) Failed (\d+)/){ + $totalcnt=$2; + $failcnt=$3; + } + + if($failcnt > 0){ + $attachfile="/tmp/failed_case_detail.$proid"; + opendir(DIR, "$logfiledir"); + foreach my $file (readdir DIR){ + next if($file !~ /^failedcases/); + next if(-z "$logfiledir/$file"); + &runcmd("cat $logfiledir/$file >> $attachfile"); + } + close(DIR); + } + + if($teststopflag){ + $subject = "[JK][$proid][STOP for $lastcase] TotalCase:$totalcase TotalRun:$totalcnt Fail:$failcnt"; + }else{ + if($alltestpass){ + $subject = "[JK][$proid][SUCCESS] TotalCase:$totalcase TotalRun:$totalcnt Fail:$failcnt"; + }else{ + $subject = "[JK][$proid][FAILED] TotalCase:$totalcase TotalRun:$totalcnt Fail:$failcnt"; + } + } + } + + my $sendto = "$mail_list $defaultmail"; + if($failcnt > 0){ + &runcmd("cat $mailfile | /bin/mail -s \"$subject\" -a $attachfile \"$sendto\""); + }else{ + &runcmd("cat $mailfile | /bin/mail -s \"$subject\" \"$sendto\""); + } + unlink($attachfile); +} +############################################################### +# Mainfunction +############################################################### +if ( + !GetOptions("--help|h|?" => \$needhelp, + "--quiet" => \$quiet, + "--hold" => \$hold, + "os=s" => \$os, + "cluster=s" => \$cluster_name, + "testcase=s" => \$bucket, + "project-name=s" => \$proname, + "num=s" => \$proruntime, + "xcat-core=s" => \$xcatcore_addr, + "xcat-dep=s" => \$xcatdep_addr, + "email=s" => \$mail_list) +){ + &usage; + send_msg(0, "step 0, PARSE ARGUMENTS returns error, exit"); + exit 1; +} + +if ($needhelp) +{ + &usage; + exit 0; +} + +unless(defined($os) && defined($proname) && defined($proruntime) && defined($bucket) && defined($cluster_name) && defined($xcatcore_addr) && defined($xcatdep_addr)){ + &usage; + exit 1; +} + +&init; + +my $rst=0; +my $progname=\$0;; +$$progname="$pro_name ($proid): main"; + +send_msg(2,"........................"); +send_msg(2,"........................"); +send_msg(2,".....ooooO.............."); +send_msg(2,"....(....)....Ooooo....."); +send_msg(2,".....\\..(.....(....)...."); +send_msg(2,"......\\__).....)../....."); +send_msg(2,"..............(_ /......"); +send_msg(2,"........................"); +send_msg(2,".........START ........."); +send_msg(2,"........................"); +send_msg(2,"........................"); +send_msg(2,"project $proid description:"); +send_msg(2,"cluster => $cluster_name"); +send_msg(2,"os => $os"); +send_msg(2,"case => $bucket"); +send_msg(2,"xcatcore => $xcatcore_addr"); +send_msg(2,"xcatdep => $xcatdep_addr"); +send_msg(2,"user => $mail_list"); +if($hold){ + send_msg(2,"hold => ON"); +}else{ + send_msg(2,"hold => OFF"); +} +send_msg(2,"........................"); +####################################### + +$rst = env_check(); +if($rst) { + send_msg(0, "environment check failed...........exit"); + exit_test 1; +} + +$rst = read_conf(); +if($rst) { + send_msg(0, "read global configuration file failed...........exit"); + exit_test 1; +} + +=pod +foreach my $k (keys %confkeys) { + print "$k = $confkeys{$k}\n"; +} +=cut + +$rst = get_build(); +if($rst) { + send_msg(0, "get xcat build failed...........exit"); + exit_test 1; +} + +pipe CONTROLREAD,MNWRITE; +my $pid = fork(); +if ( !defined($pid) ) { + send_msg(0, "fork process for auto test error"); + exit_test 1; +} elsif ( $pid == 0 ) { # child process + $$progname="$pro_name ($proid): test on $cluster_name"; + + $SIG{INT} = sub { + send_msg(2, "sub proc $$ recrive INT signal to exit"); + exit 0; + }; + + send_msg(2, "..........fork process[pid=$$] for doing test.........."); + close CONTROLREAD; + my $res; + + #install mn + send_msg(2, "[$$]:Running mn_install..............."); + $res = mn_install(); + if ($res) { + syswrite MNWRITE,"[$$]:install $mn failed\n"; + exit 1; + } + send_msg(2, "[$$]:Run mn_install...............[OK]"); + + #prepare for installing xcat on mn + send_msg(2, "[$$]:Running prepare_mn..............."); + $res = prepare_mn(); + if ($res) { + syswrite MNWRITE,"[$$]:prepare $mn failed\n"; + exit 1; + } + send_msg(2, "[$$]:Run prepare_mn...............[OK]"); + + #install xcat on mn + send_msg(2, "[$$]:Running install_xcat............."); + $res = install_xcat(); + if ($res) { + syswrite MNWRITE,"[$$]:install xcat on $mn failed\n"; + exit 1; + } + send_msg(2, "[$$]:Run install_xcat...............[OK]"); + + my $deployenvtime=time(); + + send_msg(2, "[$$] Running do_test..............."); + $res = do_test(); + if ($res) { + if($res == 2){ + syswrite MNWRITE,"[$$][$deployenvtime]:do test stopped for some case\n"; + }else{ + syswrite MNWRITE,"[$$][$deployenvtime]:do test error\n"; + } + exit 1; + } + send_msg(2, "[$$] Run do_test...............[OK]"); + + send_msg(2, "[$$]:whole regression test on $cluster_name finished"); + syswrite MNWRITE,"[$$][$deployenvtime]:whole regression test are successful\n"; + close MNWRITE; + exit 0; +} + +$SIG{TERM} = $SIG{INT} = sub { + if($pid) { + my $try=1; + do{ + kill 'INT', $pid; + send_msg(2, "send INT to subprocess $pid...[$try]"); + $try++; + sleep 1; + }while(waitpid($pid, WNOHANG)==0) + } + + &cleanup; + send_msg(2, "receive TERM or INT signal to exit"); + exit 0; +}; + +close MNWRITE; +my $regstarttime = time(); +my $select = new IO::Select; +$select->add(\*CONTROLREAD); +while(! $sub_process_rt) { + my @hdls; + if (@hdls = $select->can_read(0)) { + my $hdl; + foreach $hdl (@hdls) { + if ($hdl == \*CONTROLREAD) { + my $line=""; + chomp($line=); + if ($line){ + my $tmp=$line; + if($line =~ /successful/){ + send_msg(2, "[[main]]: $line"); + } + if($line =~ /failed/){ + $line =~ s/(.+):(.+)/$2/g; + send_msg(0, "[[main]]: $line"); + $err_record = $line; + } + if($tmp =~ /\[(.+)\]\[(.+)\]:(.+)/){ + $env_dply_time_consumption= $2 - $regstarttime; + $teststopflag=1 if($3 =~ /do test stopped for some case/); + } + $sub_process_rt=1; + } + } + } + } + + if(time() - $regstarttime > 28800) { + send_msg(1, "[timing] 8 hours is expired"); + last; + } + sleep 1; +} + +close CONTROLREAD; + +if($sub_process_rt) { + send_msg(2, "[[main]]: regression test return on time"); +}else{ + send_msg(0, "[[main]]: regression test return out of time"); + if($pid) { + my $try=1; + do{ + kill 'INT', $pid; + send_msg(2, "[[main]]: send INT to subprocess $pid...[$try]"); + $try++; + sleep 1; + }while(waitpid($pid, WNOHANG)==0) + } +} + +$all_reg_time_consumption=time()-$regstarttime; + +send_msg(2, "[[main]]: creat test result report..........."); +$rst = create_report(); +if($rst){ + send_msg(0, "[[main]]: creat test result report failed"); + exit_test 1; +}else{ + send_msg(2, "[[main]]: creat test result report....[done]"); + send_msg(2, "[[main]]: send test result by mail......."); + send_mail(); + send_msg(2, "[[main]]: send test result........[done]"); +} + +#used to hold the stop environment for developer to debug +if($teststopflag && $hold){ + send_msg(2, "[[main]]: hold environment for 24 hours.........."); + sleep(86400); + send_msg(2, "[[main]]: hold environment for 24 hours..........[done]"); +} + +if($alltestpass){ + exit_test 0; +}else{ + exit_test 1; +} From f29110e24e097c8d722555abf429162b87d9510e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Fri, 20 May 2016 05:28:58 -0400 Subject: [PATCH 003/391] complete --- .../get_install_disk/fresh_install_test | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 xCAT-test/autotest/testcase/get_install_disk/fresh_install_test diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_test b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_test new file mode 100644 index 0000000000..8112af7aa7 --- /dev/null +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_test @@ -0,0 +1,72 @@ +start:fresh_install_disk +os:Linux + +cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" +cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +check:rc=0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:sleep 10 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +check:output=~$$CN + +cmd:if cat /etc/*release |grep "7.2" |grep "Red Hat">/dev/null;then mkdef $$STATELITE -u profile=compute provmethod=statelite osvers=rhels7.2;else mkdef $$STATELITE -u profile=compute provmethod=statelite; fi +cmd:chdef $$CN status= +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:lsdef $$CN |grep provmethod +check:rc==0 +check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi +check:rc==0 +cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +check:rc==0 + +cmd:sleep 600 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 30;((a++));if [ $a -gt 100 ];then break;fi done + +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +cmd:sleep 120 +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:xdsh $$CN "cat /proc/partitions" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_log_$$NO +cmd:xdsh $$CN "cat /etc/*release" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_log_$$NO +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log | grep get_install_disk" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_log_$$NO +cmd:xdsh $$CN "scp /var/log/xcat/xcat.log root@$$MN:/tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO" +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "disk_wwn=" +check:output=~0x500a0751036d9e61 +check:output=~0x500a0751036d9e83 +check:output=~0x500a0751036d9e7a +check:output=~0x500a0751036d9c24 +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "into wwn secondchoicedisks" +check:output=~sda 0x500a0751036d9e61 +check:output=~sdb 0x500a0751036d9c24 +check:output=~sdc 0x500a0751036d9e7a +check:output=~sdd 0x500a0751036d9e83 +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "by sorting wwn and DRIVER" +check:output=~sdb +end From e7b75f31de87a51d7d13dcf416c3d7ce366efee3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 24 May 2016 14:14:50 -0400 Subject: [PATCH 004/391] Update site man page with more info about installdir usage --- docs/source/guides/admin-guides/references/man5/site.5.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index b93dd663e1..5ca6a08a26 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -259,6 +259,7 @@ site Attributes: them. installdir: The local directory name used to hold the node deployment packages. + It must be the full path including the leading '/'. installloc: The location from which the service nodes should mount the deployment packages in the format hostname:/path. If hostname is From 6b3c4d9cd74e85b4f13cd30a14807e2067f372d3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 24 May 2016 14:14:50 -0400 Subject: [PATCH 005/391] Update site man page with more info about installdir usage --- docs/source/guides/admin-guides/references/man5/site.5.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 35c59d2b70..6adab15b4b 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -259,6 +259,7 @@ site Attributes: them. installdir: The local directory name used to hold the node deployment packages. + It must be the full path including the leading '/'. installloc: The location from which the service nodes should mount the deployment packages in the format hostname:/path. If hostname is From f55ba5c860de8c8981cbece3c53115cc76658f30 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 13 Jun 2016 05:24:20 -0400 Subject: [PATCH 006/391] updated --- ...{fresh_install_test => fresh_install_disk} | 1 + .../testcase/get_install_disk/reinstall_disk | 93 +++++++++++++++++++ 2 files changed, 94 insertions(+) rename xCAT-test/autotest/testcase/get_install_disk/{fresh_install_test => fresh_install_disk} (96%) create mode 100644 xCAT-test/autotest/testcase/get_install_disk/reinstall_disk diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_test b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk similarity index 96% rename from xCAT-test/autotest/testcase/get_install_disk/fresh_install_test rename to xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk index 8112af7aa7..888e8fece0 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_test +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk @@ -1,5 +1,6 @@ start:fresh_install_disk os:Linux +description:check fresh install disk, usded for x86 multi disk only, and not check RH7.2 for RH os wwn isue. cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" diff --git a/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk b/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk new file mode 100644 index 0000000000..b9fb128258 --- /dev/null +++ b/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk @@ -0,0 +1,93 @@ +start:reinstall_disk +os:Linux +description:check reinstall disk, usded for x86 multi disk only, and not check RH7.2 for RH os wwn isue. + +cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" +cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +check:rc=0 +cmd:makedns -n +check:rc==0 +cmd:makeconservercf +check:rc==0 +cmd:cat /etc/conserver.cf | grep $$CN +check:output=~$$CN +cmd:sleep 20 +cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi +check:rc==0 +cmd:makedhcp -n +check:rc==0 +cmd:makedhcp -a +check:rc==0 +cmd:sleep 10 +cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +check:output=~$$CN + +cmd:if cat /etc/*release |grep "7.2" |grep "Red Hat">/dev/null;then mkdef $$STATELITE -u profile=compute provmethod=statelite osvers=rhels7.2;else mkdef $$STATELITE -u profile=compute provmethod=statelite; fi +cmd:chdef $$CN status= +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:lsdef $$CN |grep provmethod +check:rc==0 +check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi +check:rc==0 +cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +check:rc==0 + +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 30;((a++));if [ $a -gt 100 ];then break;fi done +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted + +cmd:xdsh $$CN "scp /var/log/xcat/xcat.log root@$$MN:/tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_before_re_$$NO" +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "by sorting wwn and DRIVER" +check:output=~sdb + +cmd:chdef $$CN status= +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +cmd:lsdef $$CN |grep provmethod +check:rc==0 +check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +cmd:if [[ "__GETNODEATTR($$CN,mgt)__" = "ipmi" ]]; then rsetboot $$CN net; fi +check:rc==0 +cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi +check:rc==0 + +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 30;((a++));if [ $a -gt 100 ];then break;fi done +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted + +md:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +cmd:sleep 120 + +cmd:xdsh $$CN "cat /proc/partitions" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO +cmd:xdsh $$CN "cat /etc/*release" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log | grep get_install_disk" >> /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_log_$$NO +cmd:xdsh $$CN "scp /var/log/xcat/xcat.log root@$$MN:/tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__re_$$NO" + +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "partition" +check:output=~Check the partition sdb1 +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "The disks which have kernel" +check:output=~The disks which have kernel +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "The disk sdb information" +check:output=~The disk sdb information +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "disk_wwn=" +check:output=~0x500a0751036d9c24 +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "into wwn" +check:output=~sdb 0x500a0751036d9c24 into wwn +cmd:cat /tmp/__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__fr_$$NO | grep "by sorting wwn and DRIVER" +check:output=~sdb + +end From 1d52847d4c9d97b4736275a5e09bc8a40eb92c1c Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 21 Jun 2016 01:46:31 -0400 Subject: [PATCH 007/391] completed --- xCAT-test/autotest/testcase/runcmdinstaller/cases0 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 index 94eb7aacd0..4ab17ef209 100644 --- a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 +++ b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 @@ -12,9 +12,8 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ins check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi check:rc==0 -cmd:sleep 300 -cmd:xdsh $$CN date -check:output=~$$DATE +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep installing >/dev/null`; do sleep 20;((a++));if [ $a -gt 30 ];then break;fi done +cmd:lsdef -l $$CN | grep status cmd:runcmdinstaller $$CN "ls -al /tmp" check:rc==0 check:output=~yum From ef8af4231e53ac13a8036666e594c63f2337f24a Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 28 Jun 2016 04:56:20 -0400 Subject: [PATCH 008/391] update the case according to the comments --- xCAT-test/autotest/testcase/go-xcat/case0 | 263 ++++++++++++++++++ xCAT-test/autotest/testcase/go-xcat/case1 | 129 +++++++++ xCAT-test/autotest/testcase/go-xcat/case2 | 184 ++++++++++++ .../go-xcat/trusty-ppc64el.sources.list | 2 + .../go-xcat/trusty-x86_64.sources.list | 2 + .../go-xcat/xenial-ppc64el.sources.list | 3 + .../go-xcat/xenial-x86_64.sources.list | 3 + 7 files changed, 586 insertions(+) create mode 100644 xCAT-test/autotest/testcase/go-xcat/case0 create mode 100644 xCAT-test/autotest/testcase/go-xcat/case1 create mode 100644 xCAT-test/autotest/testcase/go-xcat/case2 create mode 100644 xCAT-test/autotest/testcase/go-xcat/trusty-ppc64el.sources.list create mode 100644 xCAT-test/autotest/testcase/go-xcat/trusty-x86_64.sources.list create mode 100644 xCAT-test/autotest/testcase/go-xcat/xenial-ppc64el.sources.list create mode 100644 xCAT-test/autotest/testcase/go-xcat/xenial-x86_64.sources.list diff --git a/xCAT-test/autotest/testcase/go-xcat/case0 b/xCAT-test/autotest/testcase/go-xcat/case0 new file mode 100644 index 0000000000..b5ff284e5b --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/case0 @@ -0,0 +1,263 @@ +start:go_xcat_local_repo_case1 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core.repo install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /xcat-core; ./mklocalrepo.sh" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/zypp/repos.d/xCAT-core.repo -y install"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/yum.repos.d/xCAT-core.repo -y install"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/apt/sources.list.d/xcat-core.list -y install";else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +end + +start:go_xcat_local_repo_case2 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=/xcat-core -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +end + +start:go_xcat_local_repo_case3 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; bunzip2 /xcat-core.tar.bz2" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=/xcat-core.tar -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /go-xcat" +end + +start:go_xcat_local_repo_case4 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar.bz2 --xcat-dep=/path/to/xcat-dep.tar.bz2 install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=/xcat-core.tar.bz2 --xcat-dep=/xcat-dep.tar.bz2 -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +end + +start:go_xcat_local_repo_case5 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core.repo --xcat-dep=/path/to/xcat-dep.repo install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-dep.tar.bz2" +check:rc==0 +cmd:dir="__GETNODEATTR($$CN,os)__"; if grep SUSE /etc/*release;then os=`echo $dir |cut -c 1-6` && xdsh $$CN "cd /xcat-dep/$os/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh" ; elif grep "Red Hat" /etc/*release;then os=`echo $dir |cut -c 1-2` && xdsh $$CN "cd /xcat-dep/$os`echo __GETNODEATTR($$CN,os)__ | cut -c6`/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cd /xcat-dep; ./mklocalrepo.sh"; else echo "Sorry,this is not supported os"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /xcat-core; ./mklocalrepo.sh" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/zypp/repos.d/xCAT-core.repo --xcat-dep=/etc/zypp/repos.d/xCAT-dep.repo -y install"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/yum.repos.d/xCAT-core.repo --xcat-dep=/etc/yum.repos.d/xCAT-dep.repo -y install"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=/etc/apt/sources.list.d/xcat-core.list --xcat-dep=/etc/apt/sources.list.d/xcat-dep.list -y install"; else echo "Sorry,this is not supported os"; fi +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +end + +start:go_xcat_local_repo_case6 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core --xcat-dep=/path/to/xcat-dep install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-dep.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=/xcat-core --xcat-dep=/xcat-dep -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep*" +end + +start:go_xcat_local_repo_case7 +description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar.bz2 --xcat-dep=/path/to/xcat-dep.tar.bz2 install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/core-*-snap.tar.bz2 /xcat-core.tar.bz2" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=/xcat-core.tar.bz2 --xcat-dep=/xcat-dep.tar.bz2 -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep*" +end + diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 new file mode 100644 index 0000000000..3a3433307e --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -0,0 +1,129 @@ +start:go_xcat_noinput +description:test go_xcat without any input parameters +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --yes install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_with_x +description:test go_xcat with the option -x version -y install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat -x 2.11 -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:output=~Version 2.11 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_with_xcat-version-1 +description:test go_xcat with the option --xcat-version=devel install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-version=devel -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_with_xcat-version-2 +description:test go_xcat with the option --xcat-version=$MIGRATION2_VERSION install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-version=$$MIGRATION2_VERSION -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +check:output=~Version $$MIGRATION2_VERSION +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + diff --git a/xCAT-test/autotest/testcase/go-xcat/case2 b/xCAT-test/autotest/testcase/go-xcat/case2 new file mode 100644 index 0000000000..6729f55f50 --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/case2 @@ -0,0 +1,184 @@ +start:go_xcat_online_repo_case1 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.repo install. This case is only for rh and suse +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/yum/$$BRANCH/core-snap/xCAT-core.repo -y install" +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +check:output=~Version $$BRANCH +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_online_repo_case2 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/apt/$$BRANCH/core-snap/";else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/yum/$$BRANCH/core-snap/ -y install"; fi +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +check:output=~Version $$BRANCH +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_online_repo_case3 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Ubuntu/core-snap/core-debs-snap.tar.bz2";else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Linux/core-snap/core-rpms-snap.tar.bz2 -y install"; fi +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +check:output=~Version 2.12 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + +start:go_xcat_online_repo_case4 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.repo --xcat-dep=http://xcat.org/path/to/xcat-dep.repo install. This is for rh and suse. +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:dir="__GETNODEATTR($$CN,os)__"; if grep SUSE /etc/*release;then os=`echo $dir |cut -c 1-6` && xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/yum/devel/core-snap/xCAT-core.repo --xcat-dep=http://xcat.org/files/xcat/repos/yum/xcat-dep/$os/__GETNODEATTR($$CN,arch)__/xCAT-dep.repo -y install" ; elif grep "Red Hat" /etc/*release;then os=`echo $dir |cut -c 1-2` && xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/yum/devel/core-snap/xCAT-core.repo --xcat-dep=http://xcat.org/files/xcat/repos/yum/xcat-dep/$os`echo __GETNODEATTR($$CN,os)__ | cut -c6`/__GETNODEATTR($$CN,arch)__/xCAT-dep.repo -y install";fi +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end + + +start:go_xcat_online_repo_case5 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core --xcat-dep=http://xcat.org/path/to/xcat-dep install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:dir="__GETNODEATTR($$CN,os)__"; if grep SUSE /etc/*release;then os=`echo $dir |cut -c 1-6` && xdsh $$CN "cd /xcat-dep/$os/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh" ; elif grep "Red Hat" /etc/*release;then os=`echo $dir |cut -c 1-2` && xdsh $$CN "cd /xcat-dep/$os`echo __GETNODEATTR($$CN,os)__ | cut -c6`/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cd /xcat-dep; ./mklocalrepo.sh"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/apt/devel/core-snap/ --xcat-dep=http://xcat.org/files/xcat/repos/apt/xcat-dep/ -y install"; else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/repos/yum/devel/core-snap/ --xcat-dep=http://xcat.org/files/xcat/repos/yum/xcat-dep/ -y install"; fi +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /xcat-core* /xcat-dep* /go-xcat" +end + +start:go_xcat_online_repo_case6 +description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 --xcat-dep=http://xcat.org/path/to/xcat-dep.tar.bz2 install +os:Linux +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi +check:rc!=0 +cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi +check:rc==0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +check:rc==0 +cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Ubuntu/core-snap/core-debs-snap.tar.bz2 --xcat-dep=http://xcat.org/files/xcat/xcat-dep/2.x_Ubuntu/xcat-dep-2.12-ubuntu.tar.bz2 -y install"; else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Linux/core-snap/core-rpms-snap.tar.bz2 --xcat-dep=http://xcat.org/files/xcat/xcat-dep/2.x_Linux/xcat-dep-2.12-linux.tar.bz2 -y install"; fi +check:rc==0 +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" +check:rc==0 +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running +cmd:xdsh $$CN "service xcatd stop" +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi +check:rc!=0 +cmd:xdsh $$CN "cd /; rm -rf /go-xcat" +end diff --git a/xCAT-test/autotest/testcase/go-xcat/trusty-ppc64el.sources.list b/xCAT-test/autotest/testcase/go-xcat/trusty-ppc64el.sources.list new file mode 100644 index 0000000000..7902877306 --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/trusty-ppc64el.sources.list @@ -0,0 +1,2 @@ +deb http://ports.ubuntu.com/ubuntu-ports trusty main universe +deb http://ports.ubuntu.com/ubuntu-ports trusty-updates main universe diff --git a/xCAT-test/autotest/testcase/go-xcat/trusty-x86_64.sources.list b/xCAT-test/autotest/testcase/go-xcat/trusty-x86_64.sources.list new file mode 100644 index 0000000000..ac675b2347 --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/trusty-x86_64.sources.list @@ -0,0 +1,2 @@ +deb http://archive.ubuntu.com/ubuntu trusty main universe +deb http://archive.ubuntu.com/ubuntu trusty-updates universe main diff --git a/xCAT-test/autotest/testcase/go-xcat/xenial-ppc64el.sources.list b/xCAT-test/autotest/testcase/go-xcat/xenial-ppc64el.sources.list new file mode 100644 index 0000000000..c19218c89d --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/xenial-ppc64el.sources.list @@ -0,0 +1,3 @@ +deb http://ports.ubuntu.com/ubuntu-ports xenial-security main restricted +deb http://ports.ubuntu.com/ubuntu-ports xenial universe main +deb http://ports.ubuntu.com/ubuntu-ports xenial-updates universe main diff --git a/xCAT-test/autotest/testcase/go-xcat/xenial-x86_64.sources.list b/xCAT-test/autotest/testcase/go-xcat/xenial-x86_64.sources.list new file mode 100644 index 0000000000..d9f8a8cfda --- /dev/null +++ b/xCAT-test/autotest/testcase/go-xcat/xenial-x86_64.sources.list @@ -0,0 +1,3 @@ +deb http://security.ubuntu.com/ubuntu xenial-security main restricted +deb http://archive.ubuntu.com/ubuntu xenial universe main +deb http://archive.ubuntu.com/ubuntu xenial-updates universe main From 91d803ec389c3b42f9928a5d00ecf021dbab0424 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 11 Jul 2016 17:03:00 -0400 Subject: [PATCH 009/391] Switch-based switch discovery for BNT and Mellanox --- .../lib/xcat/plugins/switchdiscover.pm | 189 ++++++++++++++- xCAT-server/share/xcat/tools/configBNT | 224 ++++++++++++++++++ xCAT-server/share/xcat/tools/configMellanox | 115 +++++++++ 3 files changed, 527 insertions(+), 1 deletion(-) create mode 100755 xCAT-server/share/xcat/tools/configBNT create mode 100755 xCAT-server/share/xcat/tools/configMellanox diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index f9f5719097..e789b577f2 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -14,11 +14,13 @@ use xCAT::NodeRange; use xCAT::NetworkUtils; use xCAT::Utils; use xCAT::SvrUtils; +use xCAT::MacMap; use xCAT::Table; use XML::Simple; no strict; use Data::Dumper; use Socket; +use Expect; #global variables for this module my %globalopt; @@ -37,6 +39,7 @@ my %global_switch_type = ( cisco => "Cisco", BNT => "BNT", Blade => "BNT", + G8052 => "BNT", Mellanox => "Mellanox", mellanox => "Mellanox", MLNX => "Mellanox", @@ -153,7 +156,7 @@ sub parse_args { # Process command-line flags ############################################# if (!GetOptions( \%opt, - qw(h|help V|Verbose v|version x z w r n range=s s=s))) { + qw(h|help V|Verbose v|version x z w r n range=s s=s setup))) { return( usage() ); } @@ -261,6 +264,14 @@ sub parse_args { $globalopt{n} = 1; } + ######################################################### + # setup discover switch + ######################################################### + if ( exists( $opt{setup} )) { + $globalopt{setup} = 1; + } + + return; } @@ -460,6 +471,16 @@ sub process_request { xCATdB($result, \%request, $sub_req); } + if (exists($globalopt{setup})) { + #discovered switches need to write to xcatdb before we can set them up + # It will be removed once we found predefine switch. + if (!exists($globalopt{w})) { + xCATdB($result, \%request, $sub_req); + } + switchsetup($result, \%request, $sub_req); + } + + return; } @@ -1328,5 +1349,171 @@ sub format_xml { return ($xml); } +#-------------------------------------------------------------------------------- +=head3 switchsetup + find discovered switches with predefine switches + Arguments: + outhash: a hash containing the switches discovered + Returns: + result: +=cut +#-------------------------------------------------------------------------------- + +sub switchsetup { + my $outhash = shift; + my $request = shift; + my $sub_req = shift; + my $ret; + my @switchnode = (); + my $switchInfo; + my $output; + my $dshcmd; + + #print Dumper($outhash); + my $macmap = xCAT::MacMap->new(); + + ################################################# + # call find_mac to match pre-defined switch and + # discovery switch + ################################################## + + foreach my $mac ( keys %$outhash ) { + my $ip = $outhash->{$mac}->{ip}; + my $vendor = $outhash->{$mac}->{vendor}; + my $node = $macmap->find_mac($mac,0); + + # get predefine node ip address + $static_ip = xCAT::NetworkUtils->getipaddr($node); + + # issue makehosts so we can use xdsh + my $dswitch = get_hostname($outhash->{$mac}->{name}, $ip); + + + #add discovered switch to /etc/hosts + $output = xCAT::Utils->runxcmd({command => ["makehosts"], + node =>[$dswitch]}, $sub_req, 0, 1); + + #run xdsh command to set discover ip address to static ip address + #each switch type has different CLI for setup ip address + my $stype = get_switchtype($vendor); + + if (exists($globalopt{verbose})) { + send_msg($request, 0, "Found Discovery switch $dswitch, $ip, $mac with predefine switch $node, $static_ip $stype switch\n" ); + } + + if ( $stype =~ /BNT/ ) { + # BNT switches + #xdsh switch-192-168-5-152 --devicetype EthSwitch::BNT + # "enable;configure terminal;show interface ip;interface ip 1;ip address 192.168.5.22" + $dshcmd="enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$dswitch], + arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); + #send_msg($request, 0, Dumper($output)); + + #set up hostname + $dshcmd="enable;configure terminal;hostname $node;write memory"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$node], + arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); + } + elsif ( $stype =~ /Mellanox/ ) { + #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now + #NOTE: this expect routine will timeout after set up address + + my $myexp = new Expect; + my $timeout = 10; + my $login_cmd = "ssh -ladmin $dswitch\r"; + my $first_prompt = "^.*>"; + my $config_prompt="^.*#"; + my $cfg_ip="mgmt0\r"; + my $cfg_ip="no interface mgmt0 dhcp\r"; + my $cfg_ip1="interface mgmt0 ip address $static_ip 255.255.0.0\r"; + + unless ($myexp->spawn($login_cmd)) + { + $myexp->soft_close(); + send_msg($request, 0, "Unable to run $login_cmd\n"); + next; + } + my @result = $myexp->expect( + $timeout, + [ + $first_prompt, + sub { + $myexp->clear_accum(); + $myexp->send("enable\r"); + $myexp->clear_accum(); + $myexp->send("configure terminal\r"); + $myexp->clear_accum(); + $myexp->exp_continue(); + } + ], + [ + "-re", $config_prompt, + sub { + $myexp->clear_accum(); + $myexp->send($cfg_ip); + $myexp->send($cfg_ip1); + $myexp->clear_accum(); + $myexp->send("configuration write\r"); + $myexp->send("exit\r"); + $myexp->send("exit\r"); + } + ], + ); + if (defined($result[1])) + { + my $errmsg = $result[1]; + $myexp->soft_close(); + send_msg($request,0,"Failed expect command $errmsg\n"); + } + + + $myexp->soft_close(); + + #set up hostname + $dshcmd="enable;configure terminal;hostname $node;configuration write"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$node], + arg => ["-l", "admin", "--devicetype", "IBSwitch::Mellanox", "$dshcmd"] }, $sub_req, 0, 1); + } + else { + send_msg($request, 0, "the switch type $stype is not support\n"); + } + + #after switch ip address is setup to static ip + #remove discover switch definition + if (exists($globalopt{verbose})) { + send_msg($request, 0, "remove discover switch $dswitch from xCAT"); + } + $output = xCAT::Utils->runxcmd({command => ["makehosts"], + node =>[$dswitch], + arg => ['-d'] }, $sub_req, 0, 1); + + my $ccmd = "rmdef $dswitch"; + $output = xCAT::Utils->runcmd($ccmd, 0); + #send_msg($request, 0, Dumper($output)); + + #add mac to predefine switch + if (exists($globalopt{verbose})) { + send_msg($request, 0, "Update Mac address for switch $node"); + } + + my $mactab = xCAT::Table->new('mac'); + my $upmac; + if ($mactab) { + $upmac->{$node}->{mac} = $mac; + $mactab->setNodesAttribs($upmac); + } + + } + + return; + + +} + + 1; diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/tools/configBNT new file mode 100755 index 0000000000..80bd15bb89 --- /dev/null +++ b/xCAT-server/share/xcat/tools/configBNT @@ -0,0 +1,224 @@ +#!/usr/bin/env perl + +#--------------------------------------------------------- +# Configure Ethnet BNT switches +#--------------------------------------------------------- + +use strict; +use Getopt::Long; +use Expect; + +my $args = join ' ', @ARGV; +$::command = "$0 $args"; + +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; + + +#--------------------------------------------------------- +#Main + +# parse the options +if ( + !GetOptions( + 'h|help' => \$::HELP, + 'r|range=s' => \$::SWITCH, + 'p|port=s' => \$::PORT, + 'v|vlan=s' => \$::VLAN, + 'u|user=s' => \$::USER, + 'w|password=s' => \$::PASSWORD, + 'g|group=s' => \$::GROUP, + 'snmp' => \$::SNMP, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +my $switch; +if ($::SWITCH) +{ + $switch = $::SWITCH; +} else { + &usage; + exit(1); +} + +my $cmd; + +#default root/password and protcol for BNT switch +my $cmd = `chdef $switch protocol=telnet username=root password=admin`; + +my $vlan; +my $port; +if ($::VLAN) +{ + if ($::PORT) { + $port = $::PORT; + } else { + print "Need port number to set up VLAN\n"; + &usage; + exit(1); + } + $vlan = $::VLAN; + print "Tagging VLAN=$vlan for $switch port $port\n"; + #create vlan + #tagged vlan + $cmd = `xdsh $switch --devicetype EthSwitch::BNT "enable;configure terminal;vlan $vlan;exit;interface port $port;switchport mode trunk;switchport trunk allowed vlan $vlan;write memory;exit;exit"`; +} + +#setup secure SNMP v3 +if ($::SNMP){ + my $mysw; + my $enable_cmd="enable\r"; + my $config_cmd="configure terminal\r"; + my $exit_cmd="exit\r"; + + my $pwd_prompt = "password: "; + my $sw_prompt = "$switch>"; + my $enable_prompt="$switch#"; + my $config_prompt="^.*\\\(config\\\)\#"; + + $mysw = new Expect; + my $timeout = 20; + my $login_cmd = "telnet $switch\r"; + my $passwd = "admin\r"; + my $snmp_user; + my $snmp_passwd; + my $snmp_group; + if ($::USER) { + $snmp_user = $::USER; + } else { + $snmp_user = "xcatadmin\r"; + } + if ($::PASSWORD) { + $snmp_passwd = $::PASSWORD; + } else { + # Need a special character + $snmp_passwd = "xcatadminpassw0rd\@snmp\r"; + } + if ($::GROUP) { + $snmp_group = $::GROUP; + } else { + $snmp_group = "xcatgroup\r"; + } + print "Setup SNMP server for user=$snmp_user, password=$snmp_passwd, group=$snmp_group\n"; + #create a SNMP user + my $cfg_user1="snmp-server user 5 name $snmp_user\r"; + my $cfg_user2="snmp-server user 5 authentication-protocol sha authentication-password\r"; + #create a SNMP group + my $cfg_group1="snmp-server group 5 group-name $snmp_group\r"; + my $cfg_group2="snmp-server group 5 user-name $snmp_user\r"; + my $cfg_group3="snmp-server group 5 security usm\r"; + #Add access permission + my $cfg_access1="snmp-server access 5 name $snmp_group\r"; + my $cfg_access2="snmp-server access 5 level authNoPriv\r"; + my $cfg_access3="snmp-server access 5 security usm\r"; + my $cfg_access4="snmp-server access 5 read-view iso\r"; + + $mysw->slave->stty(qw(sane -echo)); + + unless ($mysw->spawn($login_cmd)) + { + $mysw->soft_close(); + print "Unable to run $login_cmd\n"; + next; + } + my @result = $mysw->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysw->clear_accum(); + $mysw->send("$passwd\r"); + $mysw->clear_accum(); + $mysw->exp_continue(); + } + ], + [ + "-re", $sw_prompt, + sub { + #print "$switch: sending enable command: $enable_cmd\n"; + $mysw->clear_accum(); + $mysw->send($enable_cmd); + $mysw->exp_continue(); + } + ], + [ + "-re", $enable_prompt, + sub { + #print "$switch: sending config command: $config_cmd\n"; + $mysw->clear_accum(); + $mysw->send($config_cmd); + $mysw->exp_continue(); + } + ], + [ + "-re", $config_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($cfg_user1); + $mysw->send($cfg_user2); + $mysw->send($passwd); + $mysw->send($snmp_passwd); + $mysw->send($snmp_passwd); + sleep 1; + $mysw->clear_accum(); + # create snmp group + $mysw->send($cfg_group1); + $mysw->send($cfg_group2); + $mysw->send($cfg_group3); + $mysw->clear_accum(); + $mysw->send($cfg_access1); + $mysw->send($cfg_access2); + $mysw->send($cfg_access3); + $mysw->send($cfg_access4); + $mysw->clear_accum(); + $mysw->send("write memory\r"); + $mysw->send($exit_cmd); + $mysw->send($exit_cmd); + } + ], + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysw->soft_close(); + print "Failed expect command $errmsg\n"; + exit(1); + } + $mysw->soft_close(); + + +} + +#--------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#--------------------------------------------------------- +sub usage +{ + print "Usage: + configBNT [-?│-h│--help] + configBNT [--range switchnames] [-p|--port port] [-v|--vlan vlan] + configBNT [--range switchnames] [--snmp] [-u|--user snmp_user] [-w|--password snmp_password] [-g|--group snmp_group] + \n"; +} + + diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/tools/configMellanox new file mode 100755 index 0000000000..be79c17a47 --- /dev/null +++ b/xCAT-server/share/xcat/tools/configMellanox @@ -0,0 +1,115 @@ +#!/usr/bin/env perl + +#--------------------------------------------------------- +# Configure Ethnet Mellonax switches +#--------------------------------------------------------- + +use strict; +use Getopt::Long; +use Expect; + +my $args = join ' ', @ARGV; +$::command = "$0 $args"; + +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; + + +#--------------------------------------------------------- +#Main + +# parse the options +if ( + !GetOptions( + 'h|help' => \$::HELP, + 'r|range=s' => \$::SWITCH, + 'u|user=s' => \$::USER, + 'i|ip=s' => \$::IP, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +my $switch; +if ($::SWITCH) +{ + $switch = $::SWITCH; +} else { + &usage; + exit(1); +} + +my $user; + +if ($::USER) +{ + $user = $::USER; +} else { + &usage; + exit(1); +} + +my $ip; +if ($::IP) +{ + $ip = $::IP; +} else { + &usage; + exit(1); +} + + +my $cmd; + +#default root/password and protcol for Mellonax switch +$cmd = `chtab switch=$switch switches.sshusername=$user`; +print $cmd; + +#call rspconfig command to setup switch +#enable ssh +$cmd=`rscpconfig $switch sshcfg=enable`; +print $cmd; + +#enable snmp function on the switch +$cmd=`rscpconfig $switch snmpcfg=enable`; +print $cmd; + +#enable the snmp trap +$cmd=`rscpconfig $switch alert=enable`; +print $cmd; + +#Logging destination: +$cmd=`rscpconfig $switch logdest=$ip`; +print $cmd; + +#config ntp +$cmd = `xdsh $switch -l $user --devicetype IBSwitch::Mellanox "enable;configure terminal;ntp enable;ntpdate $ip; ntp server $ip;configuration write;show ntp" `; +print $cmd; + +#--------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#--------------------------------------------------------- +sub usage +{ + print "Usage: + configMellonax [-?│-h│--help] + configMellonax [--range switchnames] [-u|--user sshusername] [-i|--ip xcatMN_ip_address] + \n"; +} + + From ab3a735edeffeae435132d24593e9a7c3b2ce695 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 12 Jul 2016 16:38:32 -0400 Subject: [PATCH 010/391] Create subroute for configBNT and configMerllanox --- .../lib/xcat/plugins/switchdiscover.pm | 253 ++++++++++++------ xCAT-server/share/xcat/tools/configBNT | 3 - xCAT-server/share/xcat/tools/configMellanox | 8 +- 3 files changed, 177 insertions(+), 87 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index e789b577f2..2319bdc30d 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1352,6 +1352,11 @@ sub format_xml { #-------------------------------------------------------------------------------- =head3 switchsetup find discovered switches with predefine switches + for each discovered switches: + 1) matching mac to a predefined node + 2) if get predefined node, config the discovered switch, if failed, update + 'otherinterface' attribute of predefined node + 3) remove hosts record and node definition for the discovered switch Arguments: outhash: a hash containing the switches discovered Returns: @@ -1380,106 +1385,45 @@ sub switchsetup { foreach my $mac ( keys %$outhash ) { my $ip = $outhash->{$mac}->{ip}; my $vendor = $outhash->{$mac}->{vendor}; - my $node = $macmap->find_mac($mac,0); - - # get predefine node ip address - $static_ip = xCAT::NetworkUtils->getipaddr($node); # issue makehosts so we can use xdsh my $dswitch = get_hostname($outhash->{$mac}->{name}, $ip); - #add discovered switch to /etc/hosts $output = xCAT::Utils->runxcmd({command => ["makehosts"], node =>[$dswitch]}, $sub_req, 0, 1); - #run xdsh command to set discover ip address to static ip address - #each switch type has different CLI for setup ip address + my $node = $macmap->find_mac($mac,0); + if (!$node) { + send_message($request, 0, "NO predefined switch matched this switch $dswitch with mac address $mac"); + next; + } + + # get predefine node ip address + $static_ip = xCAT::NetworkUtils->getipaddr($node); my $stype = get_switchtype($vendor); if (exists($globalopt{verbose})) { send_msg($request, 0, "Found Discovery switch $dswitch, $ip, $mac with predefine switch $node, $static_ip $stype switch\n" ); } - if ( $stype =~ /BNT/ ) { - # BNT switches - #xdsh switch-192-168-5-152 --devicetype EthSwitch::BNT - # "enable;configure terminal;show interface ip;interface ip 1;ip address 192.168.5.22" - $dshcmd="enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$dswitch], - arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); - #send_msg($request, 0, Dumper($output)); + #run xdsh command to set discover ip address to static ip address + #each switch type has different CLI for setup ip address - #set up hostname - $dshcmd="enable;configure terminal;hostname $node;write memory"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$node], - arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); + # BNT switches + if ( $stype =~ /BNT/ ) { + config_BNT($dswitch, $node, $ip, $request, $sub_req); } + # Mellanox switches elsif ( $stype =~ /Mellanox/ ) { #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now #NOTE: this expect routine will timeout after set up address + config_Mellanox($dswitch, $node, $ip, $request, $sub_req); - my $myexp = new Expect; - my $timeout = 10; - my $login_cmd = "ssh -ladmin $dswitch\r"; - my $first_prompt = "^.*>"; - my $config_prompt="^.*#"; - my $cfg_ip="mgmt0\r"; - my $cfg_ip="no interface mgmt0 dhcp\r"; - my $cfg_ip1="interface mgmt0 ip address $static_ip 255.255.0.0\r"; - - unless ($myexp->spawn($login_cmd)) - { - $myexp->soft_close(); - send_msg($request, 0, "Unable to run $login_cmd\n"); - next; - } - my @result = $myexp->expect( - $timeout, - [ - $first_prompt, - sub { - $myexp->clear_accum(); - $myexp->send("enable\r"); - $myexp->clear_accum(); - $myexp->send("configure terminal\r"); - $myexp->clear_accum(); - $myexp->exp_continue(); - } - ], - [ - "-re", $config_prompt, - sub { - $myexp->clear_accum(); - $myexp->send($cfg_ip); - $myexp->send($cfg_ip1); - $myexp->clear_accum(); - $myexp->send("configuration write\r"); - $myexp->send("exit\r"); - $myexp->send("exit\r"); - } - ], - ); - if (defined($result[1])) - { - my $errmsg = $result[1]; - $myexp->soft_close(); - send_msg($request,0,"Failed expect command $errmsg\n"); - } - - - $myexp->soft_close(); - - #set up hostname - $dshcmd="enable;configure terminal;hostname $node;configuration write"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$node], - arg => ["-l", "admin", "--devicetype", "IBSwitch::Mellanox", "$dshcmd"] }, $sub_req, 0, 1); } else { - send_msg($request, 0, "the switch type $stype is not support\n"); + send_msg($request, 0, "the switch $dswitch type $stype is not support\n"); + next; } #after switch ip address is setup to static ip @@ -1510,10 +1454,159 @@ sub switchsetup { } return; - - } +#-------------------------------------------------------------------------------- +=head3 config_BNT + config BNT switches + ---setup static ip address + ---setup hostname + ---set default user/password + Arguments: + dswitch: discovered switch + node: predefine switch + ip: static ip address + Returns: + result: +=cut +#-------------------------------------------------------------------------------- + +sub config_BNT { + my $dswitch=shift; + my $node = shift; + my $ip = shift; + my $request = shift; + my $sub_req = shift; + my $dshcmd; + + #xdsh switch-192-168-5-152 --devicetype EthSwitch::BNT + # "enable;configure terminal;show interface ip;interface ip 1;ip address 192.168.5.22" + $dshcmd="enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$dswitch], + arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); + #send_msg($request, 0, Dumper($output)); + + #add default attribute for BNT switch + my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT'] }, $sub_req, 0, 1); + #send_msg($request, 0, Dumper($ret)); + + #set up hostname + $dshcmd="enable;configure terminal;hostname $node;write memory"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$node], + arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); + #send_msg($request, 0, "hostname changed\n"); + + return; +} + +#-------------------------------------------------------------------------------- +=head3 config_Mellanox + config Mellanox switches + ---setup static ip address + ---setup hostname + ---set default user/password + Arguments: + dswitch: discovered switch + node: predefine switch + ip: static ip address + Returns: + result: +=cut +#-------------------------------------------------------------------------------- + +sub config_Mellanox { + my $dswitch=shift; + my $node = shift; + my $ip = shift; + my $request = shift; + my $sub_req = shift; + my $dshcmd; + my $mask; + + # get netmask from network table + my $nettab = xCAT::Table->new("networks"); + if ($nettab) { + my @nets = $nettab->getAllAttribs('net','mask'); + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + } + } + } + + send_msg($request, 0, "setup Mellanox switch $node, $static_ip, $mask\n"); + #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now + #NOTE: this expect routine will timeout after set up address + + my $myexp = new Expect; + my $timeout = 10; + my $login_cmd = "ssh -ladmin $dswitch\r"; + my $first_prompt = "^.*>"; + my $config_prompt="^.*#"; + my $cfg_ip="no interface mgmt0 dhcp\r"; + my $cfg_ip1="interface mgmt0 ip address $static_ip $mask\r"; + + unless ($myexp->spawn($login_cmd)) + { + $myexp->soft_close(); + send_msg($request, 0, "Unable to run $login_cmd\n"); + next; + } + + my @result = $myexp->expect( + $timeout, + [ + "-re", $first_prompt, + sub { + $myexp->clear_accum(); + $myexp->send("enable\r"); + $myexp->clear_accum(); + $myexp->send("configure terminal\r"); + $myexp->clear_accum(); + $myexp->exp_continue(); + } + ], + [ + "-re", $config_prompt, + sub { + $myexp->clear_accum(); + $myexp->send($cfg_ip); + $myexp->send($cfg_ip1); + $myexp->clear_accum(); + $myexp->send("configuration write\r"); + $myexp->send("exit\r"); + $myexp->send("exit\r"); + } + ], + ); + if (defined($result[1])) + { + my $errmsg = $result[1]; + $myexp->soft_close(); + send_msg($request,0,"Failed expect command $errmsg\n"); + } + + $myexp->soft_close(); + + #add default attribute for Mellanox switch + $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox'] }, $sub_req, 0, 1); + send_msg($request, 0, Dumper($output)); + + + #set up hostname + $dshcmd="enable;configure terminal;hostname $node;configuration write"; + $output = xCAT::Utils->runxcmd({command => ["xdsh"], + node =>[$node], + arg => ["-l", "admin", "--devicetype", "IBSwitch::Mellanox", "$dshcmd"] }, $sub_req, 0, 1); + + return; +} + + + + 1; diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/tools/configBNT index 80bd15bb89..89e3801039 100755 --- a/xCAT-server/share/xcat/tools/configBNT +++ b/xCAT-server/share/xcat/tools/configBNT @@ -54,9 +54,6 @@ if ($::SWITCH) my $cmd; -#default root/password and protcol for BNT switch -my $cmd = `chdef $switch protocol=telnet username=root password=admin`; - my $vlan; my $port; if ($::VLAN) diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/tools/configMellanox index be79c17a47..647a3c2d67 100755 --- a/xCAT-server/share/xcat/tools/configMellanox +++ b/xCAT-server/share/xcat/tools/configMellanox @@ -76,19 +76,19 @@ print $cmd; #call rspconfig command to setup switch #enable ssh -$cmd=`rscpconfig $switch sshcfg=enable`; +$cmd=`rspconfig $switch sshcfg=enable`; print $cmd; #enable snmp function on the switch -$cmd=`rscpconfig $switch snmpcfg=enable`; +$cmd=`rspconfig $switch snmpcfg=enable`; print $cmd; #enable the snmp trap -$cmd=`rscpconfig $switch alert=enable`; +$cmd=`rspconfig $switch alert=enable`; print $cmd; #Logging destination: -$cmd=`rscpconfig $switch logdest=$ip`; +$cmd=`rspconfig $switch logdest=$ip`; print $cmd; #config ntp From 8207f11ae8c8269ae1c3c1fc71b1df9cc1508ad5 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 7 Jun 2016 15:55:24 +0800 Subject: [PATCH 011/391] [xCAT Jenkins Email Report] xCAT Jenkins Log Analyzer with email report --- .../xcat/tools/jenkins/testreport/email.sh | 398 +++++++++++++ .../tools/jenkins/testreport/send-report.sh | 333 +++++++++++ .../jenkins/testreport/xCATjkLogAnalyzer.sql | 545 ++++++++++++++++++ .../jenkins/testreport/xcatjk-log2sql.sh | 459 +++++++++++++++ .../testreport/xcatjk-scanlogs-last3days.sh | 33 ++ .../xcatjk-scanlogs-redo-everything.sh | 43 ++ .../jenkins/testreport/xcatjk-scanlogs.sh | 249 ++++++++ 7 files changed, 2060 insertions(+) create mode 100644 xCAT-server/share/xcat/tools/jenkins/testreport/email.sh create mode 100755 xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh create mode 100644 xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql create mode 100755 xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh create mode 100755 xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-scanlogs-last3days.sh create mode 100755 xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-scanlogs-redo-everything.sh create mode 100755 xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-scanlogs.sh diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh new file mode 100644 index 0000000000..9c4d9c9d1c --- /dev/null +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh @@ -0,0 +1,398 @@ +#!/bin/bash + +# +# Author: GONG Jie +# Create: 2016-05-27 +# Update: 2016-06-07 +# Version: 0.99 +# +# EXAMPLE +# #!/bin/bash +# +# source /path/to/email.sh +# +# Email report +# +# $report_setTo bob@example.org +# $report_setTo charlie@example.org +# $report_setTo Dave dave@example.org +# $report_setCc trent@example.org +# $report_setBcc eve@example.org +# $report_setFrom Alice alice@example.org +# $report_setSubject "A Sample Email Report" +# +# $report_setText <<-EOF +# Blah blah blah... +# EOF +# +# $report_addAttachmentFile /path/to/doc/document-a4.pdf +# $report_addAttachmentFile /path/to/doc/onepage-a4.pdf +# +# $report_send +# +# SEE ALSO +# RFC 2045, RFC 2046, RFC 2047, RFC 2822, RFC 5322, RFC 5321 +# + +function Email() +{ + local base="${FUNCNAME}" + local this="$1" + + ! type base64 >/dev/null 2>&1 && + echo "${c}: command not found" >&2 && + return 1 + + declare -g base64_encode=base64 + + [[ "$(base64 --help)" =~ GNU ]] && + declare -g base64_encode="base64 -w 0" + + declare -g ${this}_mailTo="" + declare -g ${this}_mailCc="" + declare -g ${this}_mailBcc="" + declare -g ${this}_mailFrom="" + declare -g ${this}_mailReplyTo="" + declare -g ${this}_mailSubject="" + declare -g -a ${this}_mailAttachmentContentTypes + declare -g -a ${this}_mailAttachmentMessages + declare -g -a ${this}_mailAttachmentNames + + eval "${this}_mailAttachmentContentTypes=()" + eval "${this}_mailAttachmentMessages=()" + eval "${this}_mailAttachmentNames=()" + + local method + + for method in $(compgen -A function "${base}_") + do + declare -g ${method/#$base\_/$this\_}="${method} ${this}" + done +} + +function Email_setTo() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="" + [ -n "$3" ] && inName="$2" && shift + local inAddress="$2" + + local mailTo="${this}_mailTo" + + # The format of Email address, + # see RFC 5322, sections 3.2.3 and 3.4.1, and RFC 5321 + + [[ "${inAddress}" =~ ^[0-9A-Za-z._%+-]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$ ]] || + return 1 + [ -n "${!mailTo}" ] && declare -g ${mailTo}+=","$'\n'" " + [ -n "${inName}" ] && + declare -g ${mailTo}+="=?UTF-8?B?$(echo -n "${inName}" | + ${base64_encode})?="$'\n'" <${inAddress}>" || + declare -g ${mailTo}+="${inAddress}" + + return 0 +} + +function Email_setCc() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="" + [ -n "$3" ] && inName="$2" && shift + local inAddress="$2" + + local mailCc="${this}_mailCc" + + [[ "${inAddress}" =~ ^[0-9A-Za-z._%+-]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$ ]] || + return 1 + [ -n "${!mailCc}" ] && declare -g ${mailCc}+=","$'\n'" " + [ -n "${inName}" ] && + declare -g ${mailCc}+="=?UTF-8?B?$(echo -n "${inName}" | + ${base64_encode})?="$'\n'" <${inAddress}>" || + declare -g ${mailCc}+="${inAddress}" + + return 0 +} + +function Email_setBcc() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="" + [ -n "$3" ] && inName="$2" && shift + local inAddress="$2" + + local mailBcc="${this}_mailBcc" + + [[ "${inAddress}" =~ ^[0-9A-Za-z._%+-]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$ ]] || + return 1 + [ -n "${!mailBcc}" ] && declare -g ${mailBcc}+=","$'\n'" " + [ -n "${inName}" ] && + declare -g ${mailBcc}+="=?UTF-8?B?$(echo -n "${inName}" | + ${base64_encode})?="$'\n'" <${inAddress}>" || + declare -g ${mailBcc}+="${inAddress}" + + return 0 +} + +function Email_setFrom() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="" + [ -n "$3" ] && inName="$2" && shift + local inAddress="$2" + + local mailFrom="${this}_mailFrom" + + [[ "${inAddress}" =~ ^[0-9A-Za-z._%+-]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$ ]] || + return 1 + [ -n "${inName}" ] && + declare -g ${mailFrom}="=?UTF-8?B?$(echo -n "${inName}" | + ${base64_encode})?="$'\n'" <${inAddress}>" || + declare -g ${mailFrom}="${inAddress}" + + return 0 +} + +function Email_setReplyTo() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="" + [ -n "$3" ] && inName="$2" && shift + local inAddress="$2" + + local mailReplyTo="${this}_mailReplyTo" + + [[ "${inAddress}" =~ ^[0-9A-Za-z._%+-]+@([0-9A-Za-z][0-9A-Za-z-]+\.)+[A-Za-z]{2,3}$ ]] || + return 1 + [ -n "${inName}" ] && + declare -g ${mailReplyTo}="=?UTF-8?B?$(echo -n "${inName}" | + ${base64_encode})?="$'\n'" <${inAddress}>" || + declare -g ${mailReplyTo}="${inAddress}" + + return 0 +} + +function Email_setSubject() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inSubject="$2" + + local mailSubject="${this}_mailSubject" + + local oLANG="${LANG}" + LANG=C + + [[ "${#inSubject}" -le 66 && "${inSubject}" =~ ^[0-9A-Za-z\ ._/=+-]+$ ]] && + declare -g ${mailSubject}="${inSubject}" && + return 0 + + # See RFC 5355 + + declare -g ${mailSubject}="=?UTF-8?B?" + + local c="" + local w="" + local -i limit=39 + + while : + do + read -n 1 + [[ -z "${REPLY}" || "${REPLY}" =~ [\x00-\x7f\xc0-\xff] ]] && + (( ${#w} + ${#c} > limit )) && + declare -g ${mailSubject}+="$(echo -n "${w}" | + ${base64_encode})?="$'\n'" =?UTF-8?B?" && + w="" && limit=45 + w+="${c}" && c="" + [ -n "${REPLY}" ] && c+="${REPLY}" || break + done < <(echo -n "${inSubject}") + declare -g ${mailSubject}+="$(echo -n "${w}" | ${base64_encode})?=" + + LANG="${oLANG}" + + return 0 +} + +function Email_setText() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + + Email_addAttachment "${this}" "" "text/plain; charset=UTF-8" +} + +function Email_setHTML() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + + Email_addAttachment "${this}" "" "text/html; charset=UTF-8" +} + +function Email_addAttachment() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inName="$2" + local inContentType="$3" + local inMessage="" + + # 76 is a magic number, see RFC 2045 + + while read -n 76 + do + inMessage+="${REPLY}" + inMessage+=$'\n' + done < <(${base64_encode} && echo) + + local mailAttachmentContentTypes="${this}_mailAttachmentContentTypes" + local mailAttachmentMessages="${this}_mailAttachmentMessages" + local mailAttachmentNames="${this}_mailAttachmentNames" + + eval "${mailAttachmentContentTypes}+=(\"${inContentType}\")" + eval "${mailAttachmentMessages}+=(\"${inMessage}\")" + eval "${mailAttachmentNames}+=(\"${inName}\")" +} + +function Email_addAttachmentFile() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + local inFileName="$2" + + [ -f "${inFileName}" ] || return 1 + [ -r "${inFileName}" ] || return 1 + + local inContentType="" + + # These are magic strings, see RFC 2046 + + case "${inFileName##*.}" in + "7z") inContentType="application/x-7z-compressed" ;; + "bz"|"bz2") + inContentType="application/x-bzip2" ;; + "bpg") inContentType="image/bpg" ;; + "cpio") inContentType="application/x-cpio" ;; + "gif") inContentType="image/gif" ;; + "gz") inContentType="application/x-gzip" ;; + "htm"|"html") + inContentType="text/html" ;; + "jpe"|"jpeg"|"jpg") + inContentType="image/jpeg" ;; + "png") inContentType="image/png" ;; + "rar") inContentType="application/x-rar-compressed" ;; + "tar") inContentType="application/x-tar" ;; + "txt") inContentType="text/plain" ;; + "xz") inContentType="application/x-xz" ;; + "zip") inContentType="application/x-zip-compressed" ;; + *) inContentType="application/octet-stream" ;; + esac + + Email_addAttachment "${this}" "${inFileName##*/}" "${inContentType}" <"${inFileName}" +} + +function Email_send() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + + local mailTo="${this}_mailTo" + local mailCc="${this}_mailCc" + local mailBcc="${this}_mailBcc" + local mailFrom="${this}_mailFrom" + local mailReplyTo="${this}_mailReplyTo" + local mailSubject="${this}_mailSubject" + + # Sendmail is here, see Linux Standard Base Core Specification + # - Generic 5.0 Edition, section 17.2 + + local SENDMAIL="/usr/sbin/sendmail" + + ! type "${SENDMAIL}" >/dev/null 2>&1 && + echo "${SENDMAIL}: command not found" >&2 && + return 1 + + # Email headers, see RFC 2076 + + "${SENDMAIL}" -t -i <<-EOF + To: ${!mailTo} + Cc: ${!mailCc} + Bcc: ${!mailBcc} + From: ${!mailFrom} + Reply-To: ${!mailReplyTo} + Subject: ${!mailSubject} + X-Mailer: Flying Nimbus 0.0.1 + MIME-Version: 1.0 + $(Email_buildMultipart "${this}") + EOF +} + +function Email_buildMultipart() +{ + local base="${FUNCNAME%%_*}" + local this="$1" + + local mailAttachmentContentTypes="${this}_mailAttachmentContentTypes" + local mailAttachmentMessages="${this}_mailAttachmentMessages" + local mailAttachmentNames="${this}_mailAttachmentNames" + + local boundary="-=0xdeadbeef${RANDOM}${RANDOM}=-" + + # See RFC 2046, section 5.1.3 + + echo "Content-Type: multipart/mixed; boundary=0__${boundary}" + echo + echo "This is a message with multiple parts in MIME format." + echo "--0__${boundary}" + + local -i i + + # See RFC 2046, section 5.1.4 + + echo "Content-Type: multipart/alternative; boundary=1__${boundary}" + echo + echo -n "--1__${boundary}" + for (( i = 0; i < $(eval "echo \"\${#${mailAttachmentNames}[@]}\""); ++i )) + do + local mailAttachmentContentType="${mailAttachmentContentTypes}[${i}]" + local mailAttachmentMessage="${mailAttachmentMessages}[${i}]" + local mailAttachmentName="${mailAttachmentNames}[${i}]" + + [ -n "${!mailAttachmentName}" ] && continue + + echo + echo "Content-Type: ${!mailAttachmentContentType}" + echo "Content-Disposition: inline" + echo "Content-Transfer-Encoding: base64" + echo + echo "${!mailAttachmentMessage}" + echo + echo -n "--1__${boundary}" + done + echo "--" + echo -n "--0__${boundary}" + + for (( i = 0; i < $(eval "echo \"\${#${mailAttachmentNames}[@]}\""); ++i )) + do + local mailAttachmentContentType="${mailAttachmentContentTypes}[${i}]" + local mailAttachmentMessage="${mailAttachmentMessages}[${i}]" + local mailAttachmentName="${mailAttachmentNames}[${i}]" + + [ -z "${!mailAttachmentName}" ] && continue + + echo + echo "Content-Type: ${!mailAttachmentContentType}; name=\"${!mailAttachmentName}\"" + echo "Content-Disposition: attachment; filename=${!mailAttachmentName}" + echo "Content-Transfer-Encoding: base64" + echo + echo "${!mailAttachmentMessage}" + echo + echo -n "--0__${boundary}" + done + echo "--" +} +# End of file diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh new file mode 100755 index 0000000000..60e1ff1b72 --- /dev/null +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -0,0 +1,333 @@ +#!/bin/bash + +SCRIPT="$0" +! type readlink >/dev/null 2>&1 && + echo "Command \"readlink\" not found" >&2 && exit 1 +while [ -L "${SCRIPT}" ] +do + LINK="$(readlink "${SCRIPT}")" + if [ "/" = "${LINK:0:1}" ] + then + SCRIPT="${LINK}" + else + SCRIPT="${SCRIPT%/*}/${LINK}" + fi +done +BASE_DIR="${SCRIPT%/*}" + +! source "${BASE_DIR}/email.sh" >/dev/null 2>&1 && + echo "File \"${BASE_DIR}/email.sh\" not found" >&2 && exit 1 + +# The configuration part + +MYSQL_HOST="localhost" +MYSQL_USER="root" +MYSQL_PASS="password" +MYSQL_DB="xCATjkLogAnalyzer" + +# The main part + +for c in mysql tail sed grep +do + ! type "${c}" >/dev/null 2>&1 && + echo "Command \"${c}\" not found" >&2 && exit 1 +done + +Email report + +$report_setTo "Alice" alice@example.org + +$report_setFrom "xCATjk Mail Bot" root@localhost.localdomain + +DateTime="$(date -R)" + +MYSQL_COMMAND=("mysql" "-h" "${MYSQL_HOST}" -u "${MYSQL_USER}" -p"${MYSQL_PASS}" "${MYSQL_DB}") +Subject="$("${MYSQL_COMMAND[@]}" <<<"SELECT CONCAT('Passed: ', SUM(Passed), ' Failed: ', SUM(Failed), ' No run: ', SUM(\`No run\`)) AS Summary FROM LatestDailyReport;" | tail -n 1)" + +$report_setSubject "[xCATjk] ${Subject}" + +$report_setHTML <<-EOF + + + + + +xCATjk Test Report + + + + + + + +

xCATjk Test Report

xCAT Logo
+

+ + + + + + + + + + + +$( +LatestDailyReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, Duration, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM LatestDailyReport;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n title arch os duration passed failed no_run subtotal pass_rate n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${LatestDailyReport}" | sed -e '1d' -e 's/ *| */|/g') +IFS="${oIFS}" + +LatestDailyReportSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))) AS Duration, SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM LatestDailyReport;")" +oIFS="${IFS}" +IFS="|" +read n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g') +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +IFS="${oIFS}" +) +
ArchOSDurationPassedFailedNo runSubtotalPass rate
${arch}${os}${duration}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${duration}${passed}${failed}${no_run}${total}${pass_rate}
+
+

Failed Test Cases

+ + + + + + +$( +FailedTestCasesReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, \`Failed test cases\` FROM LatestDailyReport;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n title arch os failed_test_cases n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${FailedTestCasesReport}" | sed -e '1d' -e 's/ *| */|/g') +) +
ArchOSFailed test cases
${arch}${os}${failed_test_cases}
+

Seven-day Look Back

+ + + + + + + + + + + +$( +SevenDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM SevenDayLookBack;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n arch os test_runs passed failed no_run subtotal pass_rate n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${SevenDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') +IFS="${oIFS}" + +SevenDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM SevenDayLookBack;")" +oIFS="${IFS}" +IFS="|" +read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +IFS="${oIFS}" +) +
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
+

Thirty-day Look Back

+ + + + + + + + + + + +$( +ThirtyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM ThirtyDayLookBack;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n arch os test_runs passed failed no_run subtotal pass_rate n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${ThirtyDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') +IFS="${oIFS}" + +ThirtyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM ThirtyDayLookBack;")" +oIFS="${IFS}" +IFS="|" +read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +IFS="${oIFS}" +) +
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
+

Ninety-day Look Back

+ + + + + + + + + + + +$( +NinetyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM NinetyDayLookBack;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n arch os test_runs passed failed no_run subtotal pass_rate n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${NinetyDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') +IFS="${oIFS}" + +NinetyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM NinetyDayLookBack;")" +oIFS="${IFS}" +IFS="|" +read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +echo "" +IFS="${oIFS}" +) +
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
+

Top 50 Failed Test Cases

+ + + + + + + + + +$( +Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList LIMIT 50;")" +oIFS="${IFS}" +IFS="|" +color="" +while read n test_case arch os last_seven_days last_thirty_days last_ninety_days n +do + [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" + [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" + echo "" +done < <(grep -v -- ---- <<<"${Top50FailedTestCases}" | sed -e '1d' -e 's/ *| */|/g') +IFS="${oIFS}" +) +
Test caseArchOSLast 7 daysLast 30 daysLast 90 days
${test_case}${arch}${os}${last_seven_days}${last_thirty_days}${last_ninety_days}
+
+ + + + +

✻This email has been sent to you by xCATjk Mail Bot.
+†This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message. If you have received this email in error, please delete it.
+‡All the times shown in this test report are the local times of the testing environment.

+

${DateTime}

+ + +EOF + +$report_send diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql new file mode 100644 index 0000000000..d2f9a90d09 --- /dev/null +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -0,0 +1,545 @@ +-- MySQL dump 10.14 Distrib 5.5.47-MariaDB, for Linux (ppc64) +-- +-- Host: localhost Database: xcatjkloganalyzer +-- ------------------------------------------------------ +-- Server version 5.5.47-MariaDB + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `ArchDict` +-- + +DROP TABLE IF EXISTS `ArchDict`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ArchDict` ( + `ArchId` int(11) NOT NULL AUTO_INCREMENT, + `ArchName` varchar(255) NOT NULL, + PRIMARY KEY (`ArchId`), + UNIQUE KEY `ArchName` (`ArchName`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `FailedTestCasesTopList` +-- + +DROP TABLE IF EXISTS `FailedTestCasesTopList`; +/*!50001 DROP VIEW IF EXISTS `FailedTestCasesTopList`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `FailedTestCasesTopList` ( + `Test case` tinyint NOT NULL, + `Arch` tinyint NOT NULL, + `OS` tinyint NOT NULL, + `Last seven days` tinyint NOT NULL, + `Last thirty days` tinyint NOT NULL, + `Last ninety days` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `LatestDailyReport` +-- + +DROP TABLE IF EXISTS `LatestDailyReport`; +/*!50001 DROP VIEW IF EXISTS `LatestDailyReport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `LatestDailyReport` ( + `Title` tinyint NOT NULL, + `Arch` tinyint NOT NULL, + `OS` tinyint NOT NULL, + `Duration` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL, + `Pass rate` tinyint NOT NULL, + `Failed test cases` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `NinetyDayFailed` +-- + +DROP TABLE IF EXISTS `NinetyDayFailed`; +/*!50001 DROP VIEW IF EXISTS `NinetyDayFailed`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `NinetyDayFailed` ( + `TestCaseId` tinyint NOT NULL, + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Failed` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `NinetyDayLookBack` +-- + +DROP TABLE IF EXISTS `NinetyDayLookBack`; +/*!50001 DROP VIEW IF EXISTS `NinetyDayLookBack`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `NinetyDayLookBack` ( + `Arch` tinyint NOT NULL, + `OS` tinyint NOT NULL, + `Test runs` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL, + `Pass rate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `NinetyDayReport` +-- + +DROP TABLE IF EXISTS `NinetyDayReport`; +/*!50001 DROP VIEW IF EXISTS `NinetyDayReport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `NinetyDayReport` ( + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `OSDict` +-- + +DROP TABLE IF EXISTS `OSDict`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `OSDict` ( + `OSId` int(11) NOT NULL AUTO_INCREMENT, + `OSName` varchar(255) NOT NULL, + PRIMARY KEY (`OSId`), + UNIQUE KEY `OSName` (`OSName`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ResultDict` +-- + +DROP TABLE IF EXISTS `ResultDict`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ResultDict` ( + `ResultId` int(11) NOT NULL AUTO_INCREMENT, + `ResultName` varchar(255) NOT NULL, + PRIMARY KEY (`ResultId`), + UNIQUE KEY `ResultName` (`ResultName`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `SevenDayFailed` +-- + +DROP TABLE IF EXISTS `SevenDayFailed`; +/*!50001 DROP VIEW IF EXISTS `SevenDayFailed`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `SevenDayFailed` ( + `TestCaseId` tinyint NOT NULL, + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Failed` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `SevenDayLookBack` +-- + +DROP TABLE IF EXISTS `SevenDayLookBack`; +/*!50001 DROP VIEW IF EXISTS `SevenDayLookBack`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `SevenDayLookBack` ( + `Arch` tinyint NOT NULL, + `OS` tinyint NOT NULL, + `Test runs` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL, + `Pass rate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `SevenDayReport` +-- + +DROP TABLE IF EXISTS `SevenDayReport`; +/*!50001 DROP VIEW IF EXISTS `SevenDayReport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `SevenDayReport` ( + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `TestCase` +-- + +DROP TABLE IF EXISTS `TestCase`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `TestCase` ( + `TestCaseId` int(11) NOT NULL AUTO_INCREMENT, + `TestCaseName` varchar(255) NOT NULL, + `Memo` text NOT NULL, + PRIMARY KEY (`TestCaseId`), + UNIQUE KEY `TestCaseName` (`TestCaseName`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `TestResult` +-- + +DROP TABLE IF EXISTS `TestResult`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `TestResult` ( + `TestRunId` int(11) NOT NULL, + `TestCaseId` int(11) NOT NULL, + `ResultId` int(11) NOT NULL, + `DurationTime` int(11) NOT NULL, + PRIMARY KEY (`TestRunId`,`TestCaseId`), + KEY `Result` (`ResultId`), + KEY `TestCaseId` (`TestCaseId`), + CONSTRAINT `ResutId` FOREIGN KEY (`ResultId`) REFERENCES `ResultDict` (`ResultId`), + CONSTRAINT `TestCaseId` FOREIGN KEY (`TestCaseId`) REFERENCES `TestCase` (`TestCaseId`), + CONSTRAINT `TestRunId` FOREIGN KEY (`TestRunId`) REFERENCES `TestRun` (`TestRunId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `TestRun` +-- + +DROP TABLE IF EXISTS `TestRun`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `TestRun` ( + `TestRunId` int(11) NOT NULL AUTO_INCREMENT, + `TestRunName` varchar(255) NOT NULL, + `StartTime` datetime NOT NULL, + `EndTime` datetime NOT NULL, + `ArchId` int(11) NOT NULL, + `OSId` int(11) NOT NULL, + `xCATgitCommit` varchar(255) NOT NULL, + `Memo` text NOT NULL, + PRIMARY KEY (`TestRunId`), + UNIQUE KEY `TestRunName` (`TestRunName`), + KEY `ArchId` (`ArchId`), + KEY `OSId` (`OSId`), + CONSTRAINT `ArchId` FOREIGN KEY (`ArchId`) REFERENCES `ArchDict` (`ArchId`), + CONSTRAINT `OSId` FOREIGN KEY (`OSId`) REFERENCES `OSDict` (`OSId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ThirtyDayFailed` +-- + +DROP TABLE IF EXISTS `ThirtyDayFailed`; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayFailed`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ThirtyDayFailed` ( + `TestCaseId` tinyint NOT NULL, + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Failed` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ThirtyDayLookBack` +-- + +DROP TABLE IF EXISTS `ThirtyDayLookBack`; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayLookBack`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ThirtyDayLookBack` ( + `Arch` tinyint NOT NULL, + `OS` tinyint NOT NULL, + `Test runs` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL, + `Pass rate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ThirtyDayReport` +-- + +DROP TABLE IF EXISTS `ThirtyDayReport`; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayReport`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ThirtyDayReport` ( + `ArchId` tinyint NOT NULL, + `OSId` tinyint NOT NULL, + `Passed` tinyint NOT NULL, + `Failed` tinyint NOT NULL, + `No run` tinyint NOT NULL, + `Subtotal` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Final view structure for view `FailedTestCasesTopList` +-- + +/*!50001 DROP TABLE IF EXISTS `FailedTestCasesTopList`*/; +/*!50001 DROP VIEW IF EXISTS `FailedTestCasesTopList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`NinetyDayFailed`.`OSId` desc,`NinetyDayFailed`.`ArchId` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `LatestDailyReport` +-- + +/*!50001 DROP TABLE IF EXISTS `LatestDailyReport`*/; +/*!50001 DROP VIEW IF EXISTS `LatestDailyReport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `LatestDailyReport` AS select `TestRun`.`TestRunName` AS `Title`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,timediff(`TestRun`.`EndTime`,`TestRun`.`StartTime`) AS `Duration`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal`,ifnull(concat(round((((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) / ((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) + (select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))))) * 100),2),'%'),'N/A') AS `Pass rate`,(select ifnull(group_concat(`TestCase`.`TestCaseName` separator ' '),'') from (`TestResult` left join `TestCase` on((`TestResult`.`TestCaseId` = `TestCase`.`TestCaseId`))) where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed test cases` from ((`TestRun` left join `ArchDict` on((`TestRun`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`TestRun`.`OSId` = `OSDict`.`OSId`))) where `TestRun`.`TestRunId` in (select max(`TestRun`.`TestRunId`) AS `TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 2 day)) group by `TestRun`.`ArchId`,`TestRun`.`OSId` order by max(`TestRun`.`TestRunId`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `NinetyDayFailed` +-- + +/*!50001 DROP TABLE IF EXISTS `NinetyDayFailed`*/; +/*!50001 DROP VIEW IF EXISTS `NinetyDayFailed`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `NinetyDayFailed` AS select `TestResult`.`TestCaseId` AS `TestCaseId`,`TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,count(0) AS `Failed` from (`TestResult` left join `TestRun` on((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`))) where (`TestResult`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 90 day))) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed'))) group by `TestResult`.`TestCaseId`,`TestRun`.`ArchId`,`TestRun`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `NinetyDayLookBack` +-- + +/*!50001 DROP TABLE IF EXISTS `NinetyDayLookBack`*/; +/*!50001 DROP VIEW IF EXISTS `NinetyDayLookBack`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `NinetyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`NinetyDayReport`.`Passed`) AS `Passed`,sum(`NinetyDayReport`.`Failed`) AS `Failed`,sum(`NinetyDayReport`.`No run`) AS `No run`,sum(`NinetyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`NinetyDayReport`.`Passed`) / (sum(`NinetyDayReport`.`Passed`) + sum(`NinetyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`NinetyDayReport` left join `ArchDict` on((`NinetyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `NinetyDayReport`.`ArchId`,`NinetyDayReport`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `NinetyDayReport` +-- + +/*!50001 DROP TABLE IF EXISTS `NinetyDayReport`*/; +/*!50001 DROP VIEW IF EXISTS `NinetyDayReport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `NinetyDayReport` AS select `TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal` from `TestRun` where `TestRun`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 90 day))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `SevenDayFailed` +-- + +/*!50001 DROP TABLE IF EXISTS `SevenDayFailed`*/; +/*!50001 DROP VIEW IF EXISTS `SevenDayFailed`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `SevenDayFailed` AS select `TestResult`.`TestCaseId` AS `TestCaseId`,`TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,count(0) AS `Failed` from (`TestResult` left join `TestRun` on((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`))) where (`TestResult`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 7 day))) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed'))) group by `TestResult`.`TestCaseId`,`TestRun`.`ArchId`,`TestRun`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `SevenDayLookBack` +-- + +/*!50001 DROP TABLE IF EXISTS `SevenDayLookBack`*/; +/*!50001 DROP VIEW IF EXISTS `SevenDayLookBack`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `SevenDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`SevenDayReport`.`Passed`) AS `Passed`,sum(`SevenDayReport`.`Failed`) AS `Failed`,sum(`SevenDayReport`.`No run`) AS `No run`,sum(`SevenDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`SevenDayReport`.`Passed`) / (sum(`SevenDayReport`.`Passed`) + sum(`SevenDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`SevenDayReport` left join `ArchDict` on((`SevenDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`SevenDayReport`.`OSId` = `OSDict`.`OSId`))) group by `SevenDayReport`.`ArchId`,`SevenDayReport`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `SevenDayReport` +-- + +/*!50001 DROP TABLE IF EXISTS `SevenDayReport`*/; +/*!50001 DROP VIEW IF EXISTS `SevenDayReport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `SevenDayReport` AS select `TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal` from `TestRun` where `TestRun`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 7 day))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ThirtyDayFailed` +-- + +/*!50001 DROP TABLE IF EXISTS `ThirtyDayFailed`*/; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayFailed`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ThirtyDayFailed` AS select `TestResult`.`TestCaseId` AS `TestCaseId`,`TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,count(0) AS `Failed` from (`TestResult` left join `TestRun` on((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`))) where (`TestResult`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 30 day))) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed'))) group by `TestResult`.`TestCaseId`,`TestRun`.`ArchId`,`TestRun`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ThirtyDayLookBack` +-- + +/*!50001 DROP TABLE IF EXISTS `ThirtyDayLookBack`*/; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayLookBack`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ThirtyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`ThirtyDayReport`.`Passed`) AS `Passed`,sum(`ThirtyDayReport`.`Failed`) AS `Failed`,sum(`ThirtyDayReport`.`No run`) AS `No run`,sum(`ThirtyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`ThirtyDayReport`.`Passed`) / (sum(`ThirtyDayReport`.`Passed`) + sum(`ThirtyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`ThirtyDayReport` left join `ArchDict` on((`ThirtyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`ThirtyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `ThirtyDayReport`.`ArchId`,`ThirtyDayReport`.`OSId` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ThirtyDayReport` +-- + +/*!50001 DROP TABLE IF EXISTS `ThirtyDayReport`*/; +/*!50001 DROP VIEW IF EXISTS `ThirtyDayReport`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ThirtyDayReport` AS select `TestRun`.`ArchId` AS `ArchId`,`TestRun`.`OSId` AS `OSId`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal` from `TestRun` where `TestRun`.`TestRunId` in (select `TestRun`.`TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 30 day))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-06-07 1:14:01 diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh new file mode 100755 index 0000000000..1dc323efaf --- /dev/null +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh @@ -0,0 +1,459 @@ +#!/bin/bash + +function usage() +{ + local script="${0##*/}" + + while read ; do echo "${REPLY}" ; done <<-EOF + Usage: ${script} [OPTIONS] DIRECTORY + + Options: + --help display this help and exit + + Examples: + + ${script} /xCATjk/log/ubuntu16.04-ppc64el/8 + EOF +} + +PATH="/usr/sbin:/usr/bin:/sbin:/bin" +export PATH + +# +# warn_if_bad Put out warning message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Incoming $1 is returned unless it is 0 +# +function warn_if_bad() +{ + local -i rc="$1" + local script="${0##*/}" + + # Ignore if no problems + [ "${rc}" -eq "0" ] && return 0 + + # Broken + shift + echo "${script}: $@" >&2 + return "${rc}" +} + +# +# exit_if_bad Put out error message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Exits with 1 unless $1 is 0 +# +function exit_if_bad() +{ + warn_if_bad "$@" || exit 1 + return 0 +} + +# +# check_root_or_exit +# +# Breaks the script if not running as root. +# +# If this returns 1, the invoker MUST abort the script. +# +# Returns 0 if running as root +# Returns 1 if not (and breaks the script) +# +function check_root_or_exit() +{ + [ "${UID}" -eq "0" ] + exit_if_bad "$?" "Must be run by UID=0. Actual UID=${UID}." + return 0 +} + +# +# check_executes Check for executable(s) +# +# Returns 0 if true. +# Returns 1 if not. +# +function check_executes() +{ + local cmd + local all_ok="yes" + for cmd in "$@" + do + if ! type "${cmd}" &>/dev/null + then + echo "Command \"${cmd}\" not found." >&2 + all_ok="no" + fi + done + [ "${all_ok}" = "yes" ] +} + +# +# check_exec_or_exit Check for required executables. +# +# Exits (not returns) if commands listed on command line do not exist. +# +# Returns 0 if true. +# Exits with 1 if not. +# +function check_exec_or_exit() +{ + check_executes "$@" + exit_if_bad "$?" "Above listed required command(s) not found." + return 0 +} + +TMP_DIR="" + +# +# internal_setup Script setup +# +# Returns 0 on success. +# Exits (not returns) with 1 on failure. +# +function internal_setup() +{ + shopt -s extglob + + # Trap exit for internal_cleanup function. + trap "internal_cleanup" EXIT + + check_exec_or_exit awk mktemp printf + + umask 0077 + + TMP_DIR="$(mktemp -d "/tmp/${0##*/}.XXXXXXXX" 2>/dev/null)" + [ -d "${TMP_DIR}" ] + exit_if_bad "$?" "Make temporary directory failed." + + custom_setup +} + +# +# internal_cleanup Script cleanup (reached via trap 0) +# +# Destory any temporarily facility created by internal_setup. +# +function internal_cleanup() +{ + custom_cleanup + + [ -d "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" +} + +# +# custom_setup +# +function custom_setup() +{ + check_exec_or_exit awk sed tr date +} + +# +# custom_cleanup +# +function custom_cleanup() +{ + : +} + +# +# cleanup_n_exec Do the cleanup, then execute the command +# +# $1+ The command to execute +# +function cleanup_n_exec() +{ + internal_cleanup + + exec "$@" +} + +internal_setup + +# +# xcattestlog2sql +# +# $1 The name of the test run +# $2 Log file of xcattest +# +function xcattestlog2sql() +{ + local test_run_name="$1" + local logfile="$2" + + local test_case_name="" + local test_case_result="" + local duration="" + + [ -n "${test_run_name}" ] + warn_if_bad "$?" "test run has no name" || return 1 + + while read ; do echo "${REPLY}" ; done <<-EOF + -- + -- Test run has name '${test_run_name}' + -- + + EOF + + [ -f "${logfile}" ] + warn_if_bad "$?" "${logfile}: No such log file" || return 1 + + while read ; do echo "${REPLY}" ; done <<-EOF + -- + -- Analysis file '${logfile}' + -- + + EOF + + while read test_case_name test_case_result duration + do + while read ; do echo "${REPLY}" ; done <<-EOF + INSERT INTO TestCase (TestCaseId, TestCaseName) + SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp + WHERE NOT EXISTS ( + SELECT TestCaseId FROM TestCase WHERE TestCaseName = '${test_case_name}' + ) LIMIT 1; + + INSERT INTO ResultDict (ResultId, ResultName) + SELECT * FROM (SELECT NULL, '${test_case_result}') AS tmp + WHERE NOT EXISTS ( + SELECT ResultId FROM ResultDict WHERE ResultName = '${test_case_result}' + ) LIMIT 1; + + REPLACE INTO TestResult (TestRunId, TestCaseId, ResultId, DurationTime) + SELECT ( + SELECT TestRunId FROM TestRun WHERE TestRunName = '${test_run_name}' + ) AS TestRunId, ( + SELECT TestCaseId FROM TestCase WHERE TestCaseName = '${test_case_name}' + ) AS TestCaseId, ( + SELECT ResultId FROM ResultDict WHERE ResultName = '${test_case_result}' + ) AS ResultId, '${duration}'; + + EOF + done < <(tr -d '\r' <"${logfile}" | grep "^------END" | + sed -e 's/^.*END::\(.*\)::\([A-Za-z0-9]*\)::.*Duration::\(-*[0-9]*\) sec.*$/\1 \2 \3/') + + return 0 +} + +# +# xcattestbundle2sql +# +# $1 The name of the test run +# $2 Bundle file of xcattest +# +function xcattestbundle2sql() +{ + local test_run_name="$1" + local logfile="$2" + + local test_case_name="" + local test_case_result="No run" + + [ -n "${test_run_name}" ] + warn_if_bad "$?" "test run has no name" || return 1 + + while read ; do echo "${REPLY}" ; done <<-EOF + -- + -- Test run has name '${test_run_name}' + -- + + EOF + + [ -f "${logfile}" ] + warn_if_bad "$?" "${logfile}: No such log file" || return 1 + + while read ; do echo "${REPLY}" ; done <<-EOF + -- + -- Analysis file '${logfile}' + -- + + INSERT INTO ResultDict (ResultId, ResultName) + SELECT * FROM (SELECT NULL, '${test_case_result}') AS tmp + WHERE NOT EXISTS ( + SELECT ResultId FROM ResultDict WHERE ResultName = '${test_case_result}' + ) LIMIT 1; + + EOF + + while read test_case_name + do + # Need chomp ${test_case_name} + test_case_name=$(echo ${test_case_name}) + + while read ; do echo "${REPLY}" ; done <<-EOF + INSERT INTO TestCase (TestCaseId, TestCaseName) + SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp + WHERE NOT EXISTS ( + SELECT TestCaseId FROM TestCase WHERE TestCaseName = '${test_case_name}' + ) LIMIT 1; + + INSERT IGNORE INTO TestResult (TestRunId, TestCaseId, ResultId, DurationTime) + SELECT ( + SELECT TestRunId FROM TestRun WHERE TestRunName = '${test_run_name}' + ) AS TestRunId, ( + SELECT TestCaseId FROM TestCase WHERE TestCaseName = '${test_case_name}' + ) AS TestCaseId, ( + SELECT ResultId FROM ResultDict WHERE ResultName = '${test_case_result}' + ) AS ResultId, '0'; + + EOF + done < <(tr -d '\r' <"${logfile}") +} + +# +# jenkinsprojectlog2sql +# +# $1 Log file of jenkins project run +# +# When return 0, will set global shell variable TestRunName +# +function jenkinsprojectlog2sql() +{ + local logfile="$1" + local foo="" + + local test_run_name="" + local start_time="" + local end_time="" + local os="" + local arch="" + local xcat_git_commit="" + local memo="" + + [ -f "${logfile}" ] + warn_if_bad "$?" "${logfile}: No such log file" || return 1 + + while read ; do echo "${REPLY}" ; done <<-EOF + -- + -- Analysis file '${logfile}' + -- + + EOF + + test_run_name="$(tr -d '\r' <"${logfile}" | + awk '/project.*description/ { print $(NF - 1) }')" + [ -n "${test_run_name}" ] + warn_if_bad "$?" "${test_run_name}: fail to parse test run name" || return 1 + + foo="$(tr -d '\r' <"${logfile}" | head -n 1 | cut -d ' ' -f 1)" + [ "${#foo}" = 14 ] + warn_if_bad "$?" "${foo}: fail to parse test start time" || return 1 + start_time="${foo:0:4}-${foo:4:2}-${foo:6:2} ${foo:8:2}:${foo:10:2}:${foo:12:2}" + + foo="$(tr -d '\r' <"${logfile}" | tail -n 1 | cut -d ' ' -f 1)" + [ "${#foo}" = 14 ] + warn_if_bad "$?" "${foo}: fail to parse test end time" || return 1 + end_time="${foo:0:4}-${foo:4:2}-${foo:6:2} ${foo:8:2}:${foo:10:2}:${foo:12:2}" + + arch="$(tr -d '\r' <"${logfile}" | awk -F - '/project.*description/ { print $2 }')" + [ "${arch}" = "ppc64el" ] && arch="ppc64le" + [ -n "${arch}" ] + warn_if_bad "$?" "${arch}: fail to parse arch" || return 1 + + os="$(tr -d '\r' <"${logfile}" | awk '/os.*=>/ { print $NF }')" + [ -n "${os}" ] + warn_if_bad "$?" "${os}: fail to parse operating system" || return 1 + + memo="$(tr -d '\r' <"${logfile}" | grep -A 7 'project.*description' | cut -d ' ' -f 4-)" + + while read ; do echo "${REPLY}" ; done <<-EOF + INSERT INTO ArchDict (ArchId, ArchName) + SELECT * FROM (SELECT NULL, '${arch}') AS tmp + WHERE NOT EXISTS ( + SELECT ArchId FROM ArchDict WHERE ArchName = '${arch}' + ) LIMIT 1; + + INSERT INTO OSDict (OSId, OSName) + SELECT * FROM (SELECT NULL, '${os}') AS tmp + WHERE NOT EXISTS ( + SELECT OSId FROM OSDict WHERE OSName = '${os}' + ) LIMIT 1; + + INSERT IGNORE INTO TestRun + (TestRunId, TestRunName, StartTime, EndTime, ArchId, OSId, xCATgitCommit, Memo) + SELECT NULL, '${test_run_name}', '${start_time}', '${end_time}', ( + SELECT ArchId FROM ArchDict WHERE ArchName = '${arch}' + ) AS ArchId, ( + SELECT OSId FROM OSDict WHERE OSName = '${os}' + ) AS OSId, '${xcat_git_commit}', '${memo}'; + + EOF + + TestRunName="${test_run_name}" + + return 0 +} + +# Main + +declare VERSION="0.00.1" + +declare xCATjkLog_DIR="" +declare TestRunName="" + +declare JenkinsProjectLog="" +declare xCATTestLogs="" + +while [ "$#" -gt "0" ] +do + case "$1" in + "--help") + usage + exit 0 + ;; + *) + [ "$1" == "--" ] && shift + [ -z "${xCATjkLog_DIR}" ] + exit_if_bad "$?" "invalid predicate - $1" + xCATjkLog_DIR="$1" + ;; + esac + shift +done + +[ -z "${xCATjkLog_DIR}" ] && usage >&2 && exit 1 + +[ -d "${xCATjkLog_DIR}" ] +exit_if_bad "$?" "${xCATjkLog_DIR}: No such directory" + +# Check if the mail log is there. If it is not, exit directly +JenkinsMailLog="$(echo "${xCATjkLog_DIR}/mail."*)" +[ -f "${JenkinsMailLog}" ] +exit_if_bad "$?" "${JenkinsMailLog}: no such log file" + +while read ; do echo "${REPLY}" ; done </dev/null 2>&1 && + echo "Command \"readlink\" not found" >&2 && exit 1 +while [ -L "${SCRIPT}" ] +do + LINK="$(readlink "${SCRIPT}")" + if [ "/" = "${LINK:0:1}" ] + then + SCRIPT="${LINK}" + else + SCRIPT="${SCRIPT%/*}/${LINK}" + fi +done +BASE_DIR="${SCRIPT%/*}" + +xCATjkScanLogs="${BASE_DIR}/xcatjk-scanlogs.sh" +if [ ! -x "${xCATjkScanLogs}" ] +then + echo "Script ${xCATjkScanLogs} not found" >&2 + exit 1 +fi + +while read ; do echo "${REPLY}" ; done </dev/null 2>&1 && + echo "Command \"readlink\" not found" >&2 && exit 1 +while [ -L "${SCRIPT}" ] +do + LINK="$(readlink "${SCRIPT}")" + if [ "/" = "${LINK:0:1}" ] + then + SCRIPT="${LINK}" + else + SCRIPT="${SCRIPT%/*}/${LINK}" + fi +done +BASE_DIR="${SCRIPT%/*}" + +SQLofCreateTables="${BASE_DIR}/xCATjkLogAnalyzer.sql" +if [ ! -f "${SQLofCreateTables}" ] +then + echo "${SQLofCreateTables}: SQL file not found" >&2 + exit 1 +fi + + +xCATjkScanLogs="${BASE_DIR}/xcatjk-scanlogs.sh" +if [ ! -x "${xCATjkScanLogs}" ] +then + echo "Script ${xCATjkScanLogs} not found" >&2 + exit 1 +fi + +while read ; do echo "${REPLY}" ; done <&2 + return "${rc}" +} + +# +# exit_if_bad Put out error message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Exits with 1 unless $1 is 0 +# +function exit_if_bad() +{ + warn_if_bad "$@" || exit 1 + return 0 +} + +# +# check_root_or_exit +# +# Breaks the script if not running as root. +# +# If this returns 1, the invoker MUST abort the script. +# +# Returns 0 if running as root +# Returns 1 if not (and breaks the script) +# +function check_root_or_exit() +{ + [ "${UID}" -eq "0" ] + exit_if_bad "$?" "Must be run by UID=0. Actual UID=${UID}." + return 0 +} + +# +# check_executes Check for executable(s) +# +# Returns 0 if true. +# Returns 1 if not. +# +function check_executes() +{ + local cmd + local all_ok="yes" + for cmd in "$@" + do + if ! type "${cmd}" &>/dev/null + then + echo "Command \"${cmd}\" not found." >&2 + all_ok="no" + fi + done + [ "${all_ok}" = "yes" ] +} + +# +# check_exec_or_exit Check for required executables. +# +# Exits (not returns) if commands listed on command line do not exist. +# +# Returns 0 if true. +# Exits with 1 if not. +# +function check_exec_or_exit() +{ + check_executes "$@" + exit_if_bad "$?" "Above listed required command(s) not found." + return 0 +} + +TMP_DIR="" + +# +# internal_setup Script setup +# +# Returns 0 on success. +# Exits (not returns) with 1 on failure. +# +function internal_setup() +{ + shopt -s extglob + + # Trap exit for internal_cleanup function. + trap "internal_cleanup" EXIT + + check_exec_or_exit awk mktemp printf + + umask 0077 + + TMP_DIR="$(mktemp -d "/tmp/${0##*/}.XXXXXXXX" 2>/dev/null)" + [ -d "${TMP_DIR}" ] + exit_if_bad "$?" "Make temporary directory failed." + + custom_setup +} + +# +# internal_cleanup Script cleanup (reached via trap 0) +# +# Destory any temporarily facility created by internal_setup. +# +function internal_cleanup() +{ + custom_cleanup + + [ -d "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" +} + +# +# custom_setup +# +function custom_setup() +{ + check_exec_or_exit awk dirname +} + +# +# custom_cleanup +# +function custom_cleanup() +{ + : +} + +# +# cleanup_n_exec Do the cleanup, then execute the command +# +# $1+ The command to execute +# +function cleanup_n_exec() +{ + internal_cleanup + + exec "$@" +} + +internal_setup + +SCRIPT="$0" +! type readlink >/dev/null 2>&1 && + echo "Command \"readlink\" not found" >&2 && exit 1 +while [ -L "${SCRIPT}" ] +do + LINK="$(readlink "${SCRIPT}")" + if [ "/" = "${LINK:0:1}" ] + then + SCRIPT="${LINK}" + else + SCRIPT="${SCRIPT%/*}/${LINK}" + fi +done +BASE_DIR="${SCRIPT%/*}" + +xCATjkLog2SQL="${BASE_DIR}/xcatjk-log2sql.sh" +[ -x "${xCATjkLog2SQL}" ] +exit_if_bad "$?" "Script ${xCATjkLog2SQL} not found" + +declare VERSION="0.0.1" + +declare xCATjkLog_TOPDIR="" +declare -a FIND_ARGS=() + +while [ "$#" -gt "0" ] +do + case "$1" in + "--help") + usage + exit 0 + ;; + "--recent") + FIND_ARGS=(-mtime -3) + ;; + *) + [ "$1" == "--" ] && shift + [ -z "${xCATjkLog_TopDir}" ] + exit_if_bad "$?" "invalid predicate - $1" + xCATjkLog_TopDir="$1" + ;; + esac + shift +done + +[ -z "${xCATjkLog_TopDir}" ] && usage >&2 && exit 1 + +[ -d "${xCATjkLog_TopDir}" ] +exit_if_bad "$?" "${xCATjkLog_TopDir}: No such directory" + +while read ; do echo "${REPLY}" ; done < Date: Thu, 16 Jun 2016 11:15:45 +0800 Subject: [PATCH 012/391] [xCAT Jenkins Email Report] Change the subject line of the xCAT Jenkins mail test report --- .../share/xcat/tools/jenkins/testreport/send-report.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index 60e1ff1b72..4012385ce0 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -37,14 +37,14 @@ Email report $report_setTo "Alice" alice@example.org -$report_setFrom "xCATjk Mail Bot" root@localhost.localdomain +$report_setFrom "xCAT Jenkins Mail Bot" root@localhost.localdomain DateTime="$(date -R)" MYSQL_COMMAND=("mysql" "-h" "${MYSQL_HOST}" -u "${MYSQL_USER}" -p"${MYSQL_PASS}" "${MYSQL_DB}") Subject="$("${MYSQL_COMMAND[@]}" <<<"SELECT CONCAT('Passed: ', SUM(Passed), ' Failed: ', SUM(Failed), ' No run: ', SUM(\`No run\`)) AS Summary FROM LatestDailyReport;" | tail -n 1)" -$report_setSubject "[xCATjk] ${Subject}" +$report_setSubject "[xCAT Jenkins] ${Subject}" $report_setHTML <<-EOF From 7f45b7b551f2acdc55269e5fba25b73253925c9b Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 28 Jun 2016 05:50:34 -0400 Subject: [PATCH 013/391] [xCAT Jenkins Email Report] Change all the VARCHAR to VARCHAR BINARY for case sensitive string comparison --- .../jenkins/testreport/xCATjkLogAnalyzer.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql index d2f9a90d09..8759427f89 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -1,6 +1,6 @@ -- MySQL dump 10.14 Distrib 5.5.47-MariaDB, for Linux (ppc64) -- --- Host: localhost Database: xcatjkloganalyzer +-- Host: localhost Database: xCATjkLogAnalyzer -- ------------------------------------------------------ -- Server version 5.5.47-MariaDB @@ -24,7 +24,7 @@ DROP TABLE IF EXISTS `ArchDict`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ArchDict` ( `ArchId` int(11) NOT NULL AUTO_INCREMENT, - `ArchName` varchar(255) NOT NULL, + `ArchName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`ArchId`), UNIQUE KEY `ArchName` (`ArchName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -133,7 +133,7 @@ DROP TABLE IF EXISTS `OSDict`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `OSDict` ( `OSId` int(11) NOT NULL AUTO_INCREMENT, - `OSName` varchar(255) NOT NULL, + `OSName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`OSId`), UNIQUE KEY `OSName` (`OSName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -148,7 +148,7 @@ DROP TABLE IF EXISTS `ResultDict`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `ResultDict` ( `ResultId` int(11) NOT NULL AUTO_INCREMENT, - `ResultName` varchar(255) NOT NULL, + `ResultName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, PRIMARY KEY (`ResultId`), UNIQUE KEY `ResultName` (`ResultName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -217,7 +217,7 @@ DROP TABLE IF EXISTS `TestCase`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `TestCase` ( `TestCaseId` int(11) NOT NULL AUTO_INCREMENT, - `TestCaseName` varchar(255) NOT NULL, + `TestCaseName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Memo` text NOT NULL, PRIMARY KEY (`TestCaseId`), UNIQUE KEY `TestCaseName` (`TestCaseName`) @@ -254,12 +254,12 @@ DROP TABLE IF EXISTS `TestRun`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `TestRun` ( `TestRunId` int(11) NOT NULL AUTO_INCREMENT, - `TestRunName` varchar(255) NOT NULL, + `TestRunName` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `StartTime` datetime NOT NULL, `EndTime` datetime NOT NULL, `ArchId` int(11) NOT NULL, `OSId` int(11) NOT NULL, - `xCATgitCommit` varchar(255) NOT NULL, + `xCATgitCommit` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `Memo` text NOT NULL, PRIMARY KEY (`TestRunId`), UNIQUE KEY `TestRunName` (`TestRunName`), @@ -542,4 +542,4 @@ SET character_set_client = @saved_cs_client; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-06-07 1:14:01 +-- Dump completed on 2016-06-29 4:52:47 From 20f186efa6fccf28d7715ce2055659e8045df3be Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 30 Jun 2016 15:23:02 +0800 Subject: [PATCH 014/391] [xCAT Jenkins Email Report] Order test results by OSName, then ArchName --- .../tools/jenkins/testreport/xCATjkLogAnalyzer.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql index 8759427f89..215df71fa3 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -338,7 +338,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`NinetyDayFailed`.`OSId` desc,`NinetyDayFailed`.`ArchId` desc */; +/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`NinetyDayFailed`.`OSId` desc,`NinetyDayFailed`.`ArchId` desc, `TestCase`.`TestCaseName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -357,7 +357,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `LatestDailyReport` AS select `TestRun`.`TestRunName` AS `Title`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,timediff(`TestRun`.`EndTime`,`TestRun`.`StartTime`) AS `Duration`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal`,ifnull(concat(round((((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) / ((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) + (select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))))) * 100),2),'%'),'N/A') AS `Pass rate`,(select ifnull(group_concat(`TestCase`.`TestCaseName` separator ' '),'') from (`TestResult` left join `TestCase` on((`TestResult`.`TestCaseId` = `TestCase`.`TestCaseId`))) where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed test cases` from ((`TestRun` left join `ArchDict` on((`TestRun`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`TestRun`.`OSId` = `OSDict`.`OSId`))) where `TestRun`.`TestRunId` in (select max(`TestRun`.`TestRunId`) AS `TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 2 day)) group by `TestRun`.`ArchId`,`TestRun`.`OSId` order by max(`TestRun`.`TestRunId`)) */; +/*!50001 VIEW `LatestDailyReport` AS select `TestRun`.`TestRunName` AS `Title`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,timediff(`TestRun`.`EndTime`,`TestRun`.`StartTime`) AS `Duration`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) AS `Passed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed`,(select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'No run')))) AS `No run`,(select count(0) from `TestResult` where (`TestResult`.`TestRunId` = `TestRun`.`TestRunId`)) AS `Subtotal`,ifnull(concat(round((((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) / ((select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Passed')))) + (select count(0) from `TestResult` where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))))) * 100),2),'%'),'N/A') AS `Pass rate`,(select ifnull(group_concat(`TestCase`.`TestCaseName` separator ' '),'') from (`TestResult` left join `TestCase` on((`TestResult`.`TestCaseId` = `TestCase`.`TestCaseId`))) where ((`TestResult`.`TestRunId` = `TestRun`.`TestRunId`) and `TestResult`.`ResultId` in (select `ResultDict`.`ResultId` from `ResultDict` where (`ResultDict`.`ResultName` = 'Failed')))) AS `Failed test cases` from ((`TestRun` left join `ArchDict` on((`TestRun`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`TestRun`.`OSId` = `OSDict`.`OSId`))) where `TestRun`.`TestRunId` in (select max(`TestRun`.`TestRunId`) AS `TestRunId` from `TestRun` where (`TestRun`.`StartTime` > (now() - interval 2 day)) group by `TestRun`.`ArchId`,`TestRun`.`OSId`) order by `OSDict`.`OSName`,`ArchDict`.`ArchName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -395,7 +395,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `NinetyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`NinetyDayReport`.`Passed`) AS `Passed`,sum(`NinetyDayReport`.`Failed`) AS `Failed`,sum(`NinetyDayReport`.`No run`) AS `No run`,sum(`NinetyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`NinetyDayReport`.`Passed`) / (sum(`NinetyDayReport`.`Passed`) + sum(`NinetyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`NinetyDayReport` left join `ArchDict` on((`NinetyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `NinetyDayReport`.`ArchId`,`NinetyDayReport`.`OSId` */; +/*!50001 VIEW `NinetyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`NinetyDayReport`.`Passed`) AS `Passed`,sum(`NinetyDayReport`.`Failed`) AS `Failed`,sum(`NinetyDayReport`.`No run`) AS `No run`,sum(`NinetyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`NinetyDayReport`.`Passed`) / (sum(`NinetyDayReport`.`Passed`) + sum(`NinetyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`NinetyDayReport` left join `ArchDict` on((`NinetyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `NinetyDayReport`.`ArchId`,`NinetyDayReport`.`OSId` order by `OSDict`.`OSName`,`ArchDict`.`ArchName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -452,7 +452,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `SevenDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`SevenDayReport`.`Passed`) AS `Passed`,sum(`SevenDayReport`.`Failed`) AS `Failed`,sum(`SevenDayReport`.`No run`) AS `No run`,sum(`SevenDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`SevenDayReport`.`Passed`) / (sum(`SevenDayReport`.`Passed`) + sum(`SevenDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`SevenDayReport` left join `ArchDict` on((`SevenDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`SevenDayReport`.`OSId` = `OSDict`.`OSId`))) group by `SevenDayReport`.`ArchId`,`SevenDayReport`.`OSId` */; +/*!50001 VIEW `SevenDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`SevenDayReport`.`Passed`) AS `Passed`,sum(`SevenDayReport`.`Failed`) AS `Failed`,sum(`SevenDayReport`.`No run`) AS `No run`,sum(`SevenDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`SevenDayReport`.`Passed`) / (sum(`SevenDayReport`.`Passed`) + sum(`SevenDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`SevenDayReport` left join `ArchDict` on((`SevenDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`SevenDayReport`.`OSId` = `OSDict`.`OSId`))) group by `SevenDayReport`.`ArchId`,`SevenDayReport`.`OSId` order by `OSDict`.`OSName`,`ArchDict`.`ArchName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -509,7 +509,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ThirtyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`ThirtyDayReport`.`Passed`) AS `Passed`,sum(`ThirtyDayReport`.`Failed`) AS `Failed`,sum(`ThirtyDayReport`.`No run`) AS `No run`,sum(`ThirtyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`ThirtyDayReport`.`Passed`) / (sum(`ThirtyDayReport`.`Passed`) + sum(`ThirtyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`ThirtyDayReport` left join `ArchDict` on((`ThirtyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`ThirtyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `ThirtyDayReport`.`ArchId`,`ThirtyDayReport`.`OSId` */; +/*!50001 VIEW `ThirtyDayLookBack` AS select `ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,count(0) AS `Test runs`,sum(`ThirtyDayReport`.`Passed`) AS `Passed`,sum(`ThirtyDayReport`.`Failed`) AS `Failed`,sum(`ThirtyDayReport`.`No run`) AS `No run`,sum(`ThirtyDayReport`.`Subtotal`) AS `Subtotal`,ifnull(concat(round(((sum(`ThirtyDayReport`.`Passed`) / (sum(`ThirtyDayReport`.`Passed`) + sum(`ThirtyDayReport`.`Failed`))) * 100),2),'%'),'N/A') AS `Pass rate` from ((`ThirtyDayReport` left join `ArchDict` on((`ThirtyDayReport`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`ThirtyDayReport`.`OSId` = `OSDict`.`OSId`))) group by `ThirtyDayReport`.`ArchId`,`ThirtyDayReport`.`OSId` order by `OSDict`.`OSName`,`ArchDict`.`ArchName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; From 38d00ce8d724c8c63e5275f7d5db55a9ae4a57ef Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 30 Jun 2016 16:50:42 +0800 Subject: [PATCH 015/391] [xCAT Jenkins Email Report] Add rank field to the `Top 50 Failed Test Cases' --- .../share/xcat/tools/jenkins/testreport/send-report.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index 4012385ce0..ae2d236249 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -289,6 +289,7 @@ IFS="${oIFS}"

Top 50 Failed Test Cases

+ @@ -297,15 +298,16 @@ IFS="${oIFS}" $( -Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList LIMIT 50;")" +Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 AS Rank, \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList, (SELECT @rank := 0) AS RANK LIMIT 50;")" oIFS="${IFS}" IFS="|" color="" -while read n test_case arch os last_seven_days last_thirty_days last_ninety_days n +while read n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" echo "" + echo "" echo "" echo "" echo "" From 329e64700efb2b79e713564e9564194ef99c1f2e Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 30 Jun 2016 16:54:41 +0800 Subject: [PATCH 016/391] [xCAT Jenkins Email Report] Rename xCATjk -> xCAT Jenkins --- .../share/xcat/tools/jenkins/testreport/send-report.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index ae2d236249..61ea2ad61c 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -37,7 +37,7 @@ Email report $report_setTo "Alice" alice@example.org -$report_setFrom "xCAT Jenkins Mail Bot" root@localhost.localdomain +$report_setFrom "xCAT Jenkins Mail Bot" root@localhost.localdomain DateTime="$(date -R)" @@ -52,12 +52,12 @@ $report_setHTML <<-EOF -xCATjk Test Report +xCAT Jenkins Test Report
Rank Test case Arch OSLast 90 days
${rank}${test_case}${arch}${os}
- +

xCATjk Test Report

xCAT Jenkins Test Report

xCAT Logo
@@ -322,7 +322,7 @@ IFS="${oIFS}"
- From aae45825c079ce7be15b9587cb5715be51ea53c2 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Thu, 30 Jun 2016 17:40:04 +0800 Subject: [PATCH 017/391] [xCAT Jenkins Email Report] Change all the `read' to `read -r' in bash script --- .../xcat/tools/jenkins/testreport/email.sh | 4 +-- .../tools/jenkins/testreport/send-report.sh | 20 +++++++------- .../jenkins/testreport/xCATjkLogAnalyzer.sql | 2 +- .../jenkins/testreport/xcatjk-log2sql.sh | 26 +++++++++---------- .../testreport/xcatjk-scanlogs-last3days.sh | 2 +- .../xcatjk-scanlogs-redo-everything.sh | 4 +-- .../jenkins/testreport/xcatjk-scanlogs.sh | 6 ++--- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh index 9c4d9c9d1c..5a999f85a5 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh @@ -201,7 +201,7 @@ function Email_setSubject() while : do - read -n 1 + read -r -n 1 [[ -z "${REPLY}" || "${REPLY}" =~ [\x00-\x7f\xc0-\xff] ]] && (( ${#w} + ${#c} > limit )) && declare -g ${mailSubject}+="$(echo -n "${w}" | @@ -243,7 +243,7 @@ function Email_addAttachment() # 76 is a magic number, see RFC 2045 - while read -n 76 + while read -r -n 76 do inMessage+="${REPLY}" inMessage+=$'\n' diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index 61ea2ad61c..6e3b0b5af6 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -78,7 +78,7 @@ LatestDailyReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, Durati oIFS="${IFS}" IFS="|" color="" -while read n title arch os duration passed failed no_run subtotal pass_rate n +while read -r n title arch os duration passed failed no_run subtotal pass_rate n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" echo "" @@ -97,7 +97,7 @@ IFS="${oIFS}" LatestDailyReportSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))) AS Duration, SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM LatestDailyReport;")" oIFS="${IFS}" IFS="|" -read n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g') +read -r n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g') echo "" echo "" echo "" @@ -124,7 +124,7 @@ FailedTestCasesReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, \` oIFS="${IFS}" IFS="|" color="" -while read n title arch os failed_test_cases n +while read -r n title arch os failed_test_cases n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" @@ -153,7 +153,7 @@ SevenDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, oIFS="${IFS}" IFS="|" color="" -while read n arch os test_runs passed failed no_run subtotal pass_rate n +while read -r n arch os test_runs passed failed no_run subtotal pass_rate n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" echo "" @@ -172,7 +172,7 @@ IFS="${oIFS}" SevenDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM SevenDayLookBack;")" oIFS="${IFS}" IFS="|" -read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') echo "" echo "" echo "" @@ -203,7 +203,7 @@ ThirtyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\` oIFS="${IFS}" IFS="|" color="" -while read n arch os test_runs passed failed no_run subtotal pass_rate n +while read -r n arch os test_runs passed failed no_run subtotal pass_rate n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" echo "" @@ -222,7 +222,7 @@ IFS="${oIFS}" ThirtyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM ThirtyDayLookBack;")" oIFS="${IFS}" IFS="|" -read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') echo "" echo "" echo "" @@ -253,7 +253,7 @@ NinetyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\` oIFS="${IFS}" IFS="|" color="" -while read n arch os test_runs passed failed no_run subtotal pass_rate n +while read -r n arch os test_runs passed failed no_run subtotal pass_rate n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" echo "" @@ -272,7 +272,7 @@ IFS="${oIFS}" NinetyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM NinetyDayLookBack;")" oIFS="${IFS}" IFS="|" -read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') +read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') echo "" echo "" echo "" @@ -302,7 +302,7 @@ Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 A oIFS="${IFS}" IFS="|" color="" -while read n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n +while read -r n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n do [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql index 215df71fa3..0c4ed1243f 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -338,7 +338,7 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`NinetyDayFailed`.`OSId` desc,`NinetyDayFailed`.`ArchId` desc, `TestCase`.`TestCaseName` */; +/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`OSName`,`ArchName`,`TestCase`.`TestCaseName` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh index 1dc323efaf..d3cff55e31 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh @@ -4,7 +4,7 @@ function usage() { local script="${0##*/}" - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF Usage: ${script} [OPTIONS] DIRECTORY Options: @@ -194,7 +194,7 @@ function xcattestlog2sql() [ -n "${test_run_name}" ] warn_if_bad "$?" "test run has no name" || return 1 - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF -- -- Test run has name '${test_run_name}' -- @@ -204,16 +204,16 @@ function xcattestlog2sql() [ -f "${logfile}" ] warn_if_bad "$?" "${logfile}: No such log file" || return 1 - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF -- -- Analysis file '${logfile}' -- EOF - while read test_case_name test_case_result duration + while read -r test_case_name test_case_result duration do - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF INSERT INTO TestCase (TestCaseId, TestCaseName) SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp WHERE NOT EXISTS ( @@ -259,7 +259,7 @@ function xcattestbundle2sql() [ -n "${test_run_name}" ] warn_if_bad "$?" "test run has no name" || return 1 - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF -- -- Test run has name '${test_run_name}' -- @@ -269,7 +269,7 @@ function xcattestbundle2sql() [ -f "${logfile}" ] warn_if_bad "$?" "${logfile}: No such log file" || return 1 - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF -- -- Analysis file '${logfile}' -- @@ -282,12 +282,12 @@ function xcattestbundle2sql() EOF - while read test_case_name + while read -r test_case_name do # Need chomp ${test_case_name} test_case_name=$(echo ${test_case_name}) - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF INSERT INTO TestCase (TestCaseId, TestCaseName) SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp WHERE NOT EXISTS ( @@ -330,7 +330,7 @@ function jenkinsprojectlog2sql() [ -f "${logfile}" ] warn_if_bad "$?" "${logfile}: No such log file" || return 1 - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF -- -- Analysis file '${logfile}' -- @@ -363,7 +363,7 @@ function jenkinsprojectlog2sql() memo="$(tr -d '\r' <"${logfile}" | grep -A 7 'project.*description' | cut -d ' ' -f 4-)" - while read ; do echo "${REPLY}" ; done <<-EOF + while read -r ; do echo "${REPLY}" ; done <<-EOF INSERT INTO ArchDict (ArchId, ArchName) SELECT * FROM (SELECT NULL, '${arch}') AS tmp WHERE NOT EXISTS ( @@ -428,7 +428,7 @@ JenkinsMailLog="$(echo "${xCATjkLog_DIR}/mail."*)" [ -f "${JenkinsMailLog}" ] exit_if_bad "$?" "${JenkinsMailLog}: no such log file" -while read ; do echo "${REPLY}" ; done < Date: Wed, 6 Jul 2016 15:41:10 +0800 Subject: [PATCH 018/391] [xCAT Jenkins Email Report] Fix the rank field of the `Top 50 Failed Test Cases' --- xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index 6e3b0b5af6..36d8e36867 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -298,7 +298,7 @@ IFS="${oIFS}" $( -Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 AS Rank, \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList, (SELECT @rank := 0) AS RANK LIMIT 50;")" +Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 AS Rank, \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM (SELECT \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList LIMIT 50) AS TopFifty, (SELECT @rank := 0) AS Rank;")" oIFS="${IFS}" IFS="|" color="" From 39375683ae5b31d927cc26c9186c613885dd48b2 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 8 Jul 2016 00:04:18 +0800 Subject: [PATCH 019/391] [xCAT Jenkins Email Report] Create a MySQL database procedure for the mail report --- .../tools/jenkins/testreport/send-report.sh | 304 +------------ .../jenkins/testreport/xCATjkLogAnalyzer.sql | 417 +++++++++++++++++- 2 files changed, 421 insertions(+), 300 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh index 36d8e36867..0110776d9b 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh @@ -17,6 +17,8 @@ BASE_DIR="${SCRIPT%/*}" ! source "${BASE_DIR}/email.sh" >/dev/null 2>&1 && echo "File \"${BASE_DIR}/email.sh\" not found" >&2 && exit 1 +! type mysql >/dev/null 2>&1 && + echo "Command \"mysql\" not found" >&2 && exit 1 # The configuration part @@ -25,13 +27,9 @@ MYSQL_USER="root" MYSQL_PASS="password" MYSQL_DB="xCATjkLogAnalyzer" -# The main part +MYSQL_COMMAND=("mysql" -B -N -r -s "-h" "${MYSQL_HOST}" -u "${MYSQL_USER}" -p"${MYSQL_PASS}" "${MYSQL_DB}") -for c in mysql tail sed grep -do - ! type "${c}" >/dev/null 2>&1 && - echo "Command \"${c}\" not found" >&2 && exit 1 -done +# The main part Email report @@ -39,297 +37,7 @@ $report_setTo "Alice" alice@example.org $report_setFrom "xCAT Jenkins Mail Bot" root@localhost.localdomain -DateTime="$(date -R)" - -MYSQL_COMMAND=("mysql" "-h" "${MYSQL_HOST}" -u "${MYSQL_USER}" -p"${MYSQL_PASS}" "${MYSQL_DB}") -Subject="$("${MYSQL_COMMAND[@]}" <<<"SELECT CONCAT('Passed: ', SUM(Passed), ' Failed: ', SUM(Failed), ' No run: ', SUM(\`No run\`)) AS Summary FROM LatestDailyReport;" | tail -n 1)" - -$report_setSubject "[xCAT Jenkins] ${Subject}" - -$report_setHTML <<-EOF - - - - - -xCAT Jenkins Test Report - - -

✻This email has been sent to you by xCATjk Mail Bot.
+

✻This email has been sent to you by xCAT Jenkins Mail Bot.
†This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message. If you have received this email in error, please delete it.
‡All the times shown in this test report are the local times of the testing environment.

${DateTime}

Total-
Total-
Total-
Total-Last 90 days
- - - - -

xCAT Jenkins Test Report

xCAT Logo
-

- - - - - - - - - - - -$( -LatestDailyReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, Duration, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM LatestDailyReport;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n title arch os duration passed failed no_run subtotal pass_rate n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${LatestDailyReport}" | sed -e '1d' -e 's/ *| */|/g') -IFS="${oIFS}" - -LatestDailyReportSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))) AS Duration, SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM LatestDailyReport;")" -oIFS="${IFS}" -IFS="|" -read -r n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g') -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -IFS="${oIFS}" -) -
ArchOSDurationPassedFailedNo runSubtotalPass rate
${arch}${os}${duration}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${duration}${passed}${failed}${no_run}${total}${pass_rate}
-
-

Failed Test Cases

- - - - - - -$( -FailedTestCasesReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, \`Failed test cases\` FROM LatestDailyReport;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n title arch os failed_test_cases n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${FailedTestCasesReport}" | sed -e '1d' -e 's/ *| */|/g') -) -
ArchOSFailed test cases
${arch}${os}${failed_test_cases}
-

Seven-day Look Back

- - - - - - - - - - - -$( -SevenDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM SevenDayLookBack;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n arch os test_runs passed failed no_run subtotal pass_rate n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${SevenDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') -IFS="${oIFS}" - -SevenDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM SevenDayLookBack;")" -oIFS="${IFS}" -IFS="|" -read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -IFS="${oIFS}" -) -
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
-

Thirty-day Look Back

- - - - - - - - - - - -$( -ThirtyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM ThirtyDayLookBack;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n arch os test_runs passed failed no_run subtotal pass_rate n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${ThirtyDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') -IFS="${oIFS}" - -ThirtyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM ThirtyDayLookBack;")" -oIFS="${IFS}" -IFS="|" -read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -IFS="${oIFS}" -) -
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
-

Ninety-day Look Back

- - - - - - - - - - - -$( -NinetyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`, Passed, Failed, \`No run\`, Subtotal, \`Pass rate\` FROM NinetyDayLookBack;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n arch os test_runs passed failed no_run subtotal pass_rate n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${NinetyDayLookBack}" | sed -e '1d' -e 's/ *| */|/g') -IFS="${oIFS}" - -NinetyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM NinetyDayLookBack;")" -oIFS="${IFS}" -IFS="|" -read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g') -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -echo "" -IFS="${oIFS}" -) -
ArchOSTest runsPassedFailedNo runSubtotalPass rate
${arch}${os}${test_runs}${passed}${failed}${no_run}${subtotal}${pass_rate}
Total-${test_runs}${passed}${failed}${no_run}${total}${pass_rate}
-

Top 50 Failed Test Cases

- - - - - - - - - - -$( -Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 AS Rank, \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM (SELECT \`Test case\`, Arch, OS, \`Last seven days\`, \`Last thirty days\`, \`Last ninety days\` FROM FailedTestCasesTopList LIMIT 50) AS TopFifty, (SELECT @rank := 0) AS Rank;")" -oIFS="${IFS}" -IFS="|" -color="" -while read -r n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n -do - [ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0" - [ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" - echo "" -done < <(grep -v -- ---- <<<"${Top50FailedTestCases}" | sed -e '1d' -e 's/ *| */|/g') -IFS="${oIFS}" -) -
RankTest caseArchOSLast 7 daysLast 30 daysLast 90 days
${rank}${test_case}${arch}${os}${last_seven_days}${last_thirty_days}${last_ninety_days}
-
- - - - -

✻This email has been sent to you by xCAT Jenkins Mail Bot.
-†This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message. If you have received this email in error, please delete it.
-‡All the times shown in this test report are the local times of the testing environment.

-

${DateTime}

- - -EOF +$report_setSubject "$("${MYSQL_COMMAND[@]}" <<<"SELECT * FROM LatestDailyMailReportSubject;")" +$report_setHTML < <("${MYSQL_COMMAND[@]}" <<<"CALL CreateLatestDailyMailReport;") $report_send diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql index 0c4ed1243f..93dd428b0b 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -48,6 +48,19 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Temporary table structure for view `LatestDailyMailReportSubject` +-- + +DROP TABLE IF EXISTS `LatestDailyMailReportSubject`; +/*!50001 DROP VIEW IF EXISTS `LatestDailyMailReportSubject`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `LatestDailyMailReportSubject` ( + `Subject` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + -- -- Temporary table structure for view `LatestDailyReport` -- @@ -324,6 +337,387 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Dumping routines for database 'xCATjkLogAnalyzer' +-- +/*!50003 DROP PROCEDURE IF EXISTS `CreateLatestDailyMailReport` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `CreateLatestDailyMailReport`() +BEGIN +SET group_concat_max_len := @@max_allowed_packet; +SELECT CONCAT( +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'xCAT Jenkins Test Report', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'

xCAT Jenkins Test Report

xCAT Logo
', "\n", +'

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +LatestDailyReportContents.HTML, +LatestDailyReportSummary.HTML, +'
ArchOSDurationPassedFailedNo runSubtotalPass rate
', "\n", +'
', "\n", +'

Failed Test Cases

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +FailedTestCasesReport.HTML, +'
ArchOSFailed test cases
', "\n", +'

Seven-day Look Back

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +SevenDayLookBackContents.HTML, +SevenDayLookBackSummary.HTML, +'
ArchOSTest runsPassedFailedNo runSubtotalPass rate
', "\n", +'

Thirty-day Look Back

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +ThirtyDayLookBackContents.HTML, +ThirtyDayLookBackSummary.HTML, +'
ArchOSTest runsPassedFailedNo runSubtotalPass rate
', "\n", +'

Ninety-day Look Back

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +NinetyDayLookBackContents.HTML, +NinetyDayLookBackSummary.HTML, +'
ArchOSTest runsPassedFailedNo runSubtotalPass rate
', "\n", +'

Top 50 Failed Test Cases

', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +TopFiftyFailedTestCases.HTML, +'
RankTest caseArchOSLast 7 daysLast 30 daysLast 90 days
', "\n", +'
', "\n", +'', "\n", +'', "\n", +'', "\n", +'', "\n", +'

✻This email has been sent to you by xCAT Jenkins Mail Bot.
', "\n", +'†This email was sent from a notification-only address that cannot accept incoming email. Please do not reply to this message. If you have received this email in error, please delete it.
', "\n", +'‡All the times shown in this test report are the local times of the testing environment.

', "\n", +'

', +NOW(), ' ', REPLACE(CONCAT('+', TIME_FORMAT(TIMEDIFF(NOW(), UTC_TIMESTAMP), '%H%i')), '+-', '-'), +'

', "\n", +'', "\n", +'' +) AS HTML +FROM ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n" +'', +Duration, '', "\n", +'', +Passed, '', "\n", +'', +Failed, '', "\n", +'', +`No run`, '', "\n", +'', +Subtotal, '', "\n", +'', +`Pass rate`, '', "\n", +'', "\n" +) AS HTML +FROM LatestDailyReport, +( SELECT @color := '' ) AS tmp00 +) AS tmp10 +) AS LatestDailyReportContents, ( +SELECT CONCAT( +'', "\n", +'Total', "\n", +'-', "\n", +'', +SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))), '', "\n" +'', +SUM(Passed), '', "\n", +'', +SUM(Failed), '', "\n", +'', +SUM(`No run`), '', "\n", +'', +SUM(Subtotal), '', "\n", +'', +IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", +'', "\n" +) AS HTML +FROM LatestDailyReport +) AS LatestDailyReportSummary, ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n", +'', +`Failed test cases`, '', "\n", +'' , "\n" +) AS HTML +FROM LatestDailyReport, +( SELECT @color := '' ) AS tmp00 +) AS tmp10 +) AS FailedTestCasesReport, ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n", +'', +`Test runs`, '', "\n", +'', +Passed, '', "\n", +'', +Failed, '', "\n", +'', +`No run`, '', "\n", +'', +Subtotal, '', "\n", +'', +`Pass rate`, '', "\n", +'', "\n" +) AS HTML +FROM SevenDayLookBack, +( SELECT @color := '' ) AS tmp00 +) AS tmp10 +) AS SevenDayLookBackContents, ( +SELECT CONCAT( +'', "\n", +'Total', "\n", +'-', "\n", +'', +SUM(`Test runs`), '', "\n", +'', +SUM(Passed), '', "\n", +'', +SUM(Failed), '', "\n", +'', +SUM(`No run`), '', "\n", +'', +SUM(Subtotal), '', "\n", +'', +IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", +'', "\n" +) AS HTML +FROM SevenDayLookBack +) AS SevenDayLookBackSummary, ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n", +'', +`Test runs`, '', "\n", +'', +Passed, '', "\n", +'', +Failed, '', "\n", +'', +`No run`, '', "\n", +'', +Subtotal, '', "\n", +'', +`Pass rate`, '', "\n", +'', "\n" +) AS HTML +FROM ThirtyDayLookBack, +( SELECT @color := '' ) AS tmp00 +) AS tmp10 +) AS ThirtyDayLookBackContents, ( +SELECT CONCAT( +'', "\n", +'Total', "\n", +'-', "\n", +'', +SUM(`Test runs`), '', "\n", +'', +SUM(Passed), '', "\n", +'', +SUM(Failed), '', "\n", +'', +SUM(`No run`), '', "\n", +'', +SUM(Subtotal), '', "\n", +'', +IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", +'', "\n" +) AS HTML +FROM ThirtyDayLookBack +) AS ThirtyDayLookBackSummary, ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n", +'', +`Test runs`, '', "\n", +'', +Passed, '', "\n", +'', +Failed, '', "\n", +'', +`No run`, '', "\n", +'', +Subtotal, '', "\n", +'', +`Pass rate`, '', "\n", +'', "\n" +) AS HTML +FROM NinetyDayLookBack, +( SELECT @color := '' ) AS tmp00 +) AS tmp10 +) AS NinetyDayLookBackContents, ( +SELECT CONCAT( +'', "\n", +'Total', "\n", +'-', "\n", +'', +SUM(`Test runs`), '', "\n", +'', +SUM(Passed), '', "\n", +'', +SUM(Failed), '', "\n", +'', +SUM(`No run`), '', "\n", +'', +SUM(Subtotal), '', "\n", +'', +IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", +'', "\n" +) AS HTML +FROM NinetyDayLookBack +) AS NinetyDayLookBackSummary, ( +SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +FROM ( +SELECT CONCAT( +'', "\n", +'', +@rank := @rank + 1, '', "\n", +'', +`Test case`, '', "\n", +'', +Arch, '', "\n", +'', +OS, '', "\n", +'', +`Last seven days`, '', "\n", +'', +`Last thirty days`, '', "\n", +'', +`Last ninety days`, '', "\n", +'', "\n" +) AS HTML FROM ( +SELECT `Test case`, Arch, OS, `Last seven days`, `Last thirty days`, `Last ninety days` +FROM FailedTestCasesTopList LIMIT 50 +) AS TopFifty, +( SELECT @color := '' ) AS tmp00, +( SELECT @rank := 0 ) AS tmp09 +) AS tmp10 +) AS TopFiftyFailedTestCases; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + -- -- Final view structure for view `FailedTestCasesTopList` -- @@ -338,7 +732,26 @@ SET character_set_client = @saved_cs_client; /*!50001 SET collation_connection = utf8_general_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`OSName`,`ArchName`,`TestCase`.`TestCaseName` */; +/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`OSDict`.`OSName`,`ArchDict`.`ArchName`,`TestCase`.`TestCaseName` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `LatestDailyMailReportSubject` +-- + +/*!50001 DROP TABLE IF EXISTS `LatestDailyMailReportSubject`*/; +/*!50001 DROP VIEW IF EXISTS `LatestDailyMailReportSubject`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `LatestDailyMailReportSubject` AS select concat('[xCAT Jenkins] ','Passed: ',sum(`LatestDailyReport`.`Passed`),' Failed: ',sum(`LatestDailyReport`.`Failed`),' No run: ',sum(`LatestDailyReport`.`No run`)) AS `Subject` from `LatestDailyReport` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -542,4 +955,4 @@ SET character_set_client = @saved_cs_client; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-06-29 4:52:47 +-- Dump completed on 2016-07-07 11:48:15 From 3b92cfb5c4cace00a3d55053f31fcb0d703ac02a Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 18 Jul 2016 20:49:05 +0800 Subject: [PATCH 020/391] [xCAT Jenkins Email Report] Remove comment from test bundle file, and do chomp()ing --- .../share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh index d3cff55e31..bc83667e15 100755 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh @@ -284,8 +284,11 @@ function xcattestbundle2sql() while read -r test_case_name do - # Need chomp ${test_case_name} + # Remove any comment + test_case_name="${test_case_name%%#*}" + # Chomp test_case_name=$(echo ${test_case_name}) + [ -z "${test_case_name}" ] && continue while read -r ; do echo "${REPLY}" ; done <<-EOF INSERT INTO TestCase (TestCaseId, TestCaseName) From 9589d1be590dc130ad757fc0d0b285318334aa8a Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 20 Jul 2016 14:50:14 -0400 Subject: [PATCH 021/391] more modification --- .../lib/xcat/plugins/switchdiscover.pm | 88 +++++++++++-------- 1 file changed, 53 insertions(+), 35 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 2319bdc30d..a0b6c28a0c 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1373,6 +1373,9 @@ sub switchsetup { my $switchInfo; my $output; my $dshcmd; + my $static_ip; + my $discover_switch; + my @rmnodes; #print Dumper($outhash); my $macmap = xCAT::MacMap->new(); @@ -1395,7 +1398,8 @@ sub switchsetup { my $node = $macmap->find_mac($mac,0); if (!$node) { - send_message($request, 0, "NO predefined switch matched this switch $dswitch with mac address $mac"); + send_msg($request, 0, "NO predefined switch matched this switch $dswitch with mac address $mac"); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'otherinterfaces=no predefined switch'] }, $sub_req, 0, 1); next; } @@ -1412,47 +1416,50 @@ sub switchsetup { # BNT switches if ( $stype =~ /BNT/ ) { - config_BNT($dswitch, $node, $ip, $request, $sub_req); + $ret = config_BNT($dswitch, $node, $static_ip, $request, $sub_req); + if ($ret == 1) { + next; + } } # Mellanox switches elsif ( $stype =~ /Mellanox/ ) { #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now #NOTE: this expect routine will timeout after set up address - config_Mellanox($dswitch, $node, $ip, $request, $sub_req); + $ret = config_Mellanox($dswitch, $node, $static_ip, $request, $sub_req); + if ($ret == 1) { + next; + } } else { send_msg($request, 0, "the switch $dswitch type $stype is not support\n"); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'otherinterfaces=switch type is not supported'] }, $sub_req, 0, 1); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype",'otherinterfaces=switch type is not supported'] }, $sub_req, 0, 1); next; } - #after switch ip address is setup to static ip - #remove discover switch definition - if (exists($globalopt{verbose})) { - send_msg($request, 0, "remove discover switch $dswitch from xCAT"); - } - $output = xCAT::Utils->runxcmd({command => ["makehosts"], - node =>[$dswitch], - arg => ['-d'] }, $sub_req, 0, 1); - - my $ccmd = "rmdef $dswitch"; - $output = xCAT::Utils->runcmd($ccmd, 0); - #send_msg($request, 0, Dumper($output)); - - #add mac to predefine switch - if (exists($globalopt{verbose})) { - send_msg($request, 0, "Update Mac address for switch $node"); - } - - my $mactab = xCAT::Table->new('mac'); - my $upmac; - if ($mactab) { - $upmac->{$node}->{mac} = $mac; - $mactab->setNodesAttribs($upmac); - } - + # save for update mac address and remove node definition + $discovered_switch->{$node}->{mac}=$mac; + push (@rmnodes, $dswitch); } + #after switch ip address is setup to static ip + #remove discover switch definition + $output = xCAT::Utils->runxcmd({command => ["makehosts"], + node => \@rmnodes, + arg => ['-d'] }, $sub_req, 0, 1); + my $remove_nodes = join(",", @rmnodes); + my $ccmd = "rmdef $remove_nodes"; + $output = xCAT::Utils->runcmd($ccmd, 0); + #send_msg($request, 0, Dumper($output)); + + #update mac address + my $mactab = xCAT::Table->new('mac'); + if ($mactab) { + $mactab->setNodesAttribs($discovered_switch); + } + + return; } @@ -1474,10 +1481,11 @@ sub switchsetup { sub config_BNT { my $dswitch=shift; my $node = shift; - my $ip = shift; + my $static_ip = shift; my $request = shift; my $sub_req = shift; my $dshcmd; + my $ret; #xdsh switch-192-168-5-152 --devicetype EthSwitch::BNT # "enable;configure terminal;show interface ip;interface ip 1;ip address 192.168.5.22" @@ -1496,9 +1504,14 @@ sub config_BNT { $output = xCAT::Utils->runxcmd({command => ["xdsh"], node =>[$node], arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); - #send_msg($request, 0, "hostname changed\n"); + if ($::RUNCMD_RC != 0) + { + send_msg($request, 0, "Failed to change hostname on $node"); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=Failed to change hostname'] }, $sub_req, 0, 1); + return 1; + } - return; + return 0; } #-------------------------------------------------------------------------------- @@ -1519,7 +1532,7 @@ sub config_BNT { sub config_Mellanox { my $dswitch=shift; my $node = shift; - my $ip = shift; + my $static_ip = shift; my $request = shift; my $sub_req = shift; my $dshcmd; @@ -1536,7 +1549,6 @@ sub config_Mellanox { } } - send_msg($request, 0, "setup Mellanox switch $node, $static_ip, $mask\n"); #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now #NOTE: this expect routine will timeout after set up address @@ -1592,7 +1604,7 @@ sub config_Mellanox { #add default attribute for Mellanox switch $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox'] }, $sub_req, 0, 1); - send_msg($request, 0, Dumper($output)); + #send_msg($request, 0, Dumper($output)); #set up hostname @@ -1600,8 +1612,14 @@ sub config_Mellanox { $output = xCAT::Utils->runxcmd({command => ["xdsh"], node =>[$node], arg => ["-l", "admin", "--devicetype", "IBSwitch::Mellanox", "$dshcmd"] }, $sub_req, 0, 1); + if ($::RUNCMD_RC != 0) + { + send_msg($request, 0, "Failed to change hostname on $node"); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=Failed to change hostname'] }, $sub_req, 0, 1); + return 1; + } - return; + return 0; } From cd10a95ff5310a7fad082b76b4bc29d0ad719505 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 21 Jul 2016 13:29:44 -0400 Subject: [PATCH 022/391] add otherinterfaces for error cases. --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index a0b6c28a0c..bc36b777e3 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1418,7 +1418,7 @@ sub switchsetup { if ( $stype =~ /BNT/ ) { $ret = config_BNT($dswitch, $node, $static_ip, $request, $sub_req); if ($ret == 1) { - next; + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=config failed, dhcp ip=$ip'] }, $sub_req, 0, 1); } } # Mellanox switches @@ -1427,15 +1427,13 @@ sub switchsetup { #NOTE: this expect routine will timeout after set up address $ret = config_Mellanox($dswitch, $node, $static_ip, $request, $sub_req); if ($ret == 1) { - next; + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=config failed, dhcp ip=$ip'] }, $sub_req, 0, 1); } } else { send_msg($request, 0, "the switch $dswitch type $stype is not support\n"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'otherinterfaces=switch type is not supported'] }, $sub_req, 0, 1); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype",'otherinterfaces=switch type is not supported'] }, $sub_req, 0, 1); - next; + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype",'otherinterfaces=switch type is not supported yet, dhcp ip=$ip'] }, $sub_req, 0, 1); } # save for update mac address and remove node definition @@ -1458,8 +1456,6 @@ sub switchsetup { if ($mactab) { $mactab->setNodesAttribs($discovered_switch); } - - return; } @@ -1496,7 +1492,7 @@ sub config_BNT { #send_msg($request, 0, Dumper($output)); #add default attribute for BNT switch - my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT'] }, $sub_req, 0, 1); + my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT','otherinterfaces='] }, $sub_req, 0, 1); #send_msg($request, 0, Dumper($ret)); #set up hostname @@ -1507,7 +1503,6 @@ sub config_BNT { if ($::RUNCMD_RC != 0) { send_msg($request, 0, "Failed to change hostname on $node"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=Failed to change hostname'] }, $sub_req, 0, 1); return 1; } @@ -1603,7 +1598,7 @@ sub config_Mellanox { $myexp->soft_close(); #add default attribute for Mellanox switch - $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox'] }, $sub_req, 0, 1); + $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox','otherinterfaces='] }, $sub_req, 0, 1); #send_msg($request, 0, Dumper($output)); @@ -1615,7 +1610,6 @@ sub config_Mellanox { if ($::RUNCMD_RC != 0) { send_msg($request, 0, "Failed to change hostname on $node"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=Failed to change hostname'] }, $sub_req, 0, 1); return 1; } From 9b98b93603408b16d37e5f412b2a89425062e59a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 21 Jul 2016 15:49:14 -0400 Subject: [PATCH 023/391] Remove the chmod in the building of the xCAT-probe RPM, should instead make sure the permissions for the files are set correctly in the git repo. Using a wildcard in the spec file to create the filelist --- xCAT-probe/xCAT-probe.spec | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 146b08c7a8..74d9860438 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -37,14 +37,8 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin mkdir -p $RPM_BUILD_ROOT/%{prefix}/probe/ cp xcatprobe $RPM_BUILD_ROOT/%{prefix}/bin -chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/* - cp -r subcmds $RPM_BUILD_ROOT/%{prefix}/probe/ -chmod 755 $RPM_BUILD_ROOT/%{prefix}/probe/subcmds/* - cp -r lib $RPM_BUILD_ROOT/%{prefix}/probe/ -chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/probe/lib/perl/ -chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/probe/lib/perl/xCAT/ %clean # This step does not happen until *after* the %files packaging below From efec9f073cba3bc4bfe520bcdbd63bc2c42849d2 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 22 Jul 2016 09:54:30 -0400 Subject: [PATCH 024/391] modify otherinterfaces attribute and add status attribute --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index bc36b777e3..cc91d76f46 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1399,7 +1399,7 @@ sub switchsetup { my $node = $macmap->find_mac($mac,0); if (!$node) { send_msg($request, 0, "NO predefined switch matched this switch $dswitch with mac address $mac"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'otherinterfaces=no predefined switch'] }, $sub_req, 0, 1); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'status=no predefined switch'] }, $sub_req, 0, 1); next; } @@ -1418,7 +1418,7 @@ sub switchsetup { if ( $stype =~ /BNT/ ) { $ret = config_BNT($dswitch, $node, $static_ip, $request, $sub_req); if ($ret == 1) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=config failed, dhcp ip=$ip'] }, $sub_req, 0, 1); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=dhcp:$ip",'status=config failed'] }, $sub_req, 0, 1); } } # Mellanox switches @@ -1427,13 +1427,13 @@ sub switchsetup { #NOTE: this expect routine will timeout after set up address $ret = config_Mellanox($dswitch, $node, $static_ip, $request, $sub_req); if ($ret == 1) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'otherinterfaces=config failed, dhcp ip=$ip'] }, $sub_req, 0, 1); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=dhcp:$ip",'status=config failed'] }, $sub_req, 0, 1); } } else { send_msg($request, 0, "the switch $dswitch type $stype is not support\n"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype",'otherinterfaces=switch type is not supported yet, dhcp ip=$ip'] }, $sub_req, 0, 1); + $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype","otherinterfaces=dhcp:$ip",'status=switch type is not supported yet'] }, $sub_req, 0, 1); } # save for update mac address and remove node definition @@ -1492,7 +1492,7 @@ sub config_BNT { #send_msg($request, 0, Dumper($output)); #add default attribute for BNT switch - my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT','otherinterfaces='] }, $sub_req, 0, 1); + my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT','otherinterfaces=','status='] }, $sub_req, 0, 1); #send_msg($request, 0, Dumper($ret)); #set up hostname @@ -1598,7 +1598,7 @@ sub config_Mellanox { $myexp->soft_close(); #add default attribute for Mellanox switch - $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox','otherinterfaces='] }, $sub_req, 0, 1); + $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox','otherinterfaces=','status='] }, $sub_req, 0, 1); #send_msg($request, 0, Dumper($output)); From e9ad97b2d6bbc09ae3bdf45dd5bba42aa04a8fb2 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 22 Jul 2016 10:57:43 -0400 Subject: [PATCH 025/391] Add some error checking and also some additional dependencies to try to make it easier to build the genesis-base on newly installed build machines --- xCAT-genesis-builder/buildrpm | 11 +++++++++++ xCAT-genesis-builder/xCAT-genesis-builder.spec | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 7760bc46df..6bc49ed3d7 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -170,10 +170,21 @@ if [ $BUILDARCH = "ppc64" ]; then else dracut -m "xcat base" -f /tmp/xcatgenesis.$$.rfs $KERNELVERSION fi + +if [ $? -ne 0 ]; then + echo "ERROR - creating the initramfs, please correct the issues and try again" + exit 1 +fi + echo Expanding the initramfs into /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs ... cd /tmp/xcatgenesis.$$/opt/xcat/share/xcat/netboot/genesis/$BUILDARCH/fs zcat /tmp/xcatgenesis.$$.rfs|cpio -dumi +if [ $? -ne 0 ]; then + echo "ERROR - expanding the initramfs, please correct the issues and try again" + exit 1 +fi + # add the kernel if [ "$HOSTOS" = "mcp" ]; then echo Adding kernel /boot/vmlinuz-* ... diff --git a/xCAT-genesis-builder/xCAT-genesis-builder.spec b/xCAT-genesis-builder/xCAT-genesis-builder.spec index c77235957b..7e113a8b01 100644 --- a/xCAT-genesis-builder/xCAT-genesis-builder.spec +++ b/xCAT-genesis-builder/xCAT-genesis-builder.spec @@ -4,7 +4,7 @@ BuildArch: noarch Release: snap%(date +"%Y%m%d%H%M") Epoch: 1 AutoReq: false -Requires: ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33 +Requires: ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33 mstflint xfsprogs nc reiserfs-utils Prefix: /opt/xcat AutoProv: false From 926e3e06f4f947658cbf12823ffa29beddb228d4 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 25 Jul 2016 04:04:08 -0400 Subject: [PATCH 026/391] fix bug: can't pull xcat install log back in ubunut --- xCAT-server/share/xcat/tools/jenkins/xcatjktest | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index cb28293a80..0d2ed43ec9 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -825,11 +825,10 @@ sub install_xcat { &runcmd("xdsh $mn 'apt-get -y install xcat xcat-test > $installlog 2>&1' >/dev/null 2>&1"); if($?){ send_msg(0, "[install_xcat] apt-get -y install xcat xCAT-test in $mn failed"); - return 1; + }else{ + &runcmd("xdsh $mn 'mkdir -p /install/$os/%arch/install/netboot '"); + &runcmd("scp /install/$os/%arch/install/netboot/initrd.gz $mn:/install/%os/%arch/install/netboot "); } - - &runcmd("xdsh $mn 'mkdir -p /install/$os/%arch/install/netboot '"); - &runcmd("scp /install/$os/%arch/install/netboot/initrd.gz $mn:/install/%os/%arch/install/netboot "); } } From db9a71750e56314cb6627611aefc7f8b279d03d0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 25 Jul 2016 08:56:18 -0400 Subject: [PATCH 027/391] Fix sytax errors reported by perltidy --- perl-xCAT/xCAT/DBobjUtils.pm | 6 +- perl-xCAT/xCAT/FSPvm.pm | 8 +- perl-xCAT/xCAT/LparNetbootExp.pm | 86 ++++++++++---------- perl-xCAT/xCAT/NetworkUtils.pm | 4 +- perl-xCAT/xCAT/PPCdb.pm | 2 +- perl-xCAT/xCAT/ProfiledNodeUtils.pm | 2 +- xCAT-UI/xcat/plugins/web.pm | 4 +- xCAT-client/bin/genimage | 6 +- xCAT-probe/lib/perl/xCAT/NetworkUtils.pm | 4 +- xCAT-rmc/scripts/mkrmcresources | 2 +- xCAT-server/lib/perl/xCAT/ADUtils.pm | 9 +- xCAT-server/lib/perl/xCAT/Template.pm | 2 +- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 1 - xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 4 +- xCAT-server/lib/xcat/plugins/aixinstall.pm | 14 ++-- xCAT-server/lib/xcat/plugins/blade.pm | 18 ++-- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 2 +- xCAT-server/lib/xcat/plugins/dhcp.pm | 2 +- xCAT-server/lib/xcat/plugins/grub2.pm | 4 +- xCAT-server/lib/xcat/plugins/imgport.pm | 4 +- xCAT-server/lib/xcat/plugins/kit.pm | 10 +-- xCAT-server/lib/xcat/plugins/kvm.pm | 23 ------ xCAT-server/lib/xcat/plugins/lsslp.pm | 2 +- xCAT-server/lib/xcat/plugins/packimage.pm | 2 +- xCAT-server/lib/xcat/plugins/petitboot.pm | 4 +- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 2 +- xCAT-server/lib/xcat/plugins/setup.pm | 12 +-- xCAT-server/lib/xcat/plugins/snmove.pm | 2 +- xCAT-server/lib/xcat/plugins/statelite.pm | 4 +- xCAT-server/lib/xcat/plugins/tabutils.pm | 4 +- xCAT-server/lib/xcat/plugins/xen.pm | 23 ------ xCAT-server/lib/xcat/plugins/yaboot.pm | 4 +- xCAT-server/sbin/flashmic | 2 +- xCAT-server/sbin/proxydhcp-xcat | 6 +- xCAT-server/share/xcat/cons/ipmi | 2 +- xCAT-server/share/xcat/tools/mktoolscenter | 2 +- xCAT-server/share/xcat/tools/nodesw | 6 +- xCAT-server/share/xcat/tools/xcatstat | 2 +- xCAT-server/xCAT-wsapi/restapi.pl | 1 - xCAT-server/xCAT-wsapi/xcatws.cgi | 1 - xCAT-test/xcattest | 2 +- 41 files changed, 127 insertions(+), 173 deletions(-) diff --git a/perl-xCAT/xCAT/DBobjUtils.pm b/perl-xCAT/xCAT/DBobjUtils.pm index 6f9c9e3f54..5400fb7c8a 100755 --- a/perl-xCAT/xCAT/DBobjUtils.pm +++ b/perl-xCAT/xCAT/DBobjUtils.pm @@ -990,7 +990,7 @@ sub setobjdefs } xCAT::MsgUtils->message("I", $rsp, $::callback); $checkedattrs{$attr_name} = 1; - if ($invalidattr->{$attr_name}->{valid} ne 1) { + if ($invalidattr->{$attr_name}->{valid} != 1) { $invalidattr->{$attr_name}->{valid} = 0; $invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'"; } @@ -999,7 +999,7 @@ sub setobjdefs } if (!($objhash{$objname}{$check_attr} =~ /\b$check_value\b/) && !($DBattrvals{$objname}{$check_attr} =~ /\b$check_value\b/)) { - if ($invalidattr->{$attr_name}->{valid} ne 1) { + if ($invalidattr->{$attr_name}->{valid} != 1) { $invalidattr->{$attr_name}->{valid} = 0; $invalidattr->{$attr_name}->{condition} = "\'$check_attr=$check_value\'"; @@ -1126,7 +1126,7 @@ sub setobjdefs my $rsp; foreach my $att (keys %$invalidattr) { - if ($invalidattr->{$att}->{valid} ne 1) { + if ($invalidattr->{$att}->{valid} != 1) { my $tt = $invalidattr->{$att}->{valid}; push @{ $rsp->{data} }, "Cannot set the attr=\'$att\' attribute unless $invalidattr->{$att}->{condition}."; xCAT::MsgUtils->message("E", $rsp, $::callback); diff --git a/perl-xCAT/xCAT/FSPvm.pm b/perl-xCAT/xCAT/FSPvm.pm index c935b488b7..15badd5186 100644 --- a/perl-xCAT/xCAT/FSPvm.pm +++ b/perl-xCAT/xCAT/FSPvm.pm @@ -1874,11 +1874,11 @@ sub query_cec_info_actions { if (@$values[1] =~ /^$/) { next; } - if ($usage eq 1 or $usage eq 2) { + if ($usage == 1 or $usage == 2) { &parse_part_get_info(\%hash, @$values[1], $lparid); } - if ($usage eq 0 or $usage eq 2) { + if ($usage == 0 or $usage == 2) { if ($lparid) { if ($action eq "lpar_lhea_mac") { my @output = split /\n/, @$values[1]; @@ -1941,10 +1941,10 @@ sub query_cec_info_actions { push @array, [ $name, @$values[1], @$values[2] ]; } } - if ($usage eq 0 or $usage eq 2) { + if ($usage == 0 or $usage == 2) { #return $data; - if ($usage eq 2) { + if ($usage == 2) { %$lpar_hash = %hash; } return \@array; diff --git a/perl-xCAT/xCAT/LparNetbootExp.pm b/perl-xCAT/xCAT/LparNetbootExp.pm index 56a47ce34d..e5f1284ac5 100755 --- a/perl-xCAT/xCAT/LparNetbootExp.pm +++ b/perl-xCAT/xCAT/LparNetbootExp.pm @@ -99,12 +99,12 @@ sub nc_msg my $msg = shift; my $rsp; - if ($verbose eq 1) { + if ($verbose == 1) { $rsp->{data}->[0] = $msg; xCAT::MsgUtils->message("I", $rsp, $::CALLBACK); } - if ($verbose eq 2) { + if ($verbose == 2) { $rsp->{data}->[0] = $msg; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); } @@ -468,7 +468,7 @@ sub get_phandle { } ], ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); # Next, the 'ls' command is sent. The result is a display of the entire # device tree. The code then looks at the @@ -552,7 +552,7 @@ sub get_phandle { } ], ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); if ($result[2] =~ /(\w*)\:(\s*)\/(\S*)/) { my $x1 = $1; @@ -698,7 +698,7 @@ sub get_adap_prop { # state 7, done $done[7] = 1; - while ($done[$state] eq 0) { + while ($done[$state] == 0) { nc_msg($verbose, "Status: command is $cmd[$state]\n"); send_command($verbose, $rconsole, $cmd[$state]); @result = (); @@ -706,7 +706,7 @@ sub get_adap_prop { $timeout, [ qr/$pattern[$state]/i, sub { - if ($state eq 1) { + if ($state == 1) { if ($rconsole->before() =~ /-\d+/) { nc_msg($verbose, "Status: Error getting adapter property for phandle=$phandle.\n"); $state = 7; @@ -750,12 +750,12 @@ sub get_adap_prop { } ] ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); # After state 3, the network type is parsed and the connector # type extracted. If the type hasn't been found, add it to # the list of supported connector types. - if ($state eq 4) { + if ($state == 4) { # Build the adapter properties from the string #regexp .*,(.*),(.*),(.*) $nw_type dummy nw_speed nw_conn nw_duplex @@ -784,7 +784,7 @@ sub get_adap_prop { # state variable is left alone. if not, the state variable is # set to 2, causing a loop back to the step where the # decode-string command is sent. - if ($state eq 5) { + if ($state == 5) { if ($result[3] =~ /2 > \.s \w+ (\w*)/) { $state = 2 if ($1 != 0); } @@ -899,14 +899,14 @@ sub get_mac_addr { # state 4, all done $done[4] = 1; - while ($done[$state] eq 0) { + while ($done[$state] == 0) { @result = (); send_command($verbose, $rconsole, $cmd[$state]); @result = $rconsole->expect( $timeout, [ qr/$pattern[$state]/ => sub { - if ($state eq 1) { + if ($state == 1) { if ($rconsole->before() =~ /-\d+/) { nc_msg($verbose, "Status: Error getting MAC address for phandle=$phandle.\n"); $rconsole->clear_accum(); @@ -990,11 +990,11 @@ sub get_mac_addr { } ], ); - return undef if ($rc eq 1); + return undef if ($rc == 1); } # if the state is 0, 1, or 2, an error occurred and the join will fail - if ($state eq 4) { + if ($state == 4) { if ($result[2] =~ /dump-mac\s*(\w*)\s*ok/) { $mac_address = $1; } @@ -1097,7 +1097,7 @@ sub get_adaptr_loc { $timeout, [ qr/$pattern[$state]/ => sub { - if ($state eq 1) { + if ($state == 1) { if ($rconsole->before() =~ /-\d+/) { nc_msg($verbose, "Status: Error getting adapter location for phandle=$phandle."); $rconsole->clear_accum(); @@ -1178,7 +1178,7 @@ sub get_adaptr_loc { } ], ); - return undef if ($rc eq 1); + return undef if ($rc == 1); } # Did we find one or more adapters? @@ -1353,7 +1353,7 @@ sub ping_server { # Get the list of properties for this adapter # $adap_prop_list_array = get_adap_prop($phandle, $rconsole, $node, $verbose); - if ($adap_prop_list_array eq 1) { + if ($adap_prop_list_array == 1) { nc_msg($verbose, "ERROR return from get_adap_prop\n"); return 1; } @@ -1444,23 +1444,23 @@ sub ping_server { ], ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); - if ($state eq 1) { + if ($state == 1) { $adap_conn = $adap_conn_list[$j]; $cmd[1] = "\" ethernet,$adap_speed,$adap_conn,$adap_duplex\" encode-string \" chosen-network-type\" property\r"; nc_msg($verbose, "Status: Trying connector type $adap_conn\n"); $j++; } - if ((($tty_do_ping eq 1) && ($state eq 4)) || ($tty_do_ping != 1) && ($state eq 3)) { + if ((($tty_do_ping == 1) && ($state == 4)) || ($tty_do_ping != 1) && ($state == 3)) { $ping_debug = $result[2]; } - if ((($tty_do_ping eq 1) && ($state eq 5)) || ($tty_do_ping != 1) && ($state eq 4)) { - if (($tty_do_ping eq 1) && ($state eq 5)) { + if ((($tty_do_ping == 1) && ($state == 5)) || ($tty_do_ping != 1) && ($state == 4)) { + if (($tty_do_ping == 1) && ($state == 5)) { #$ping_rc = $result[2]; $stack_level = length($result[4]); - } elsif (($state eq 4) && ($tty_do_ping != 1) && ($result[2] =~ /PING SUCCESS/)) { + } elsif (($state == 4) && ($tty_do_ping != 1) && ($result[2] =~ /PING SUCCESS/)) { $ping_rc = 0; #} elsif ( $result[2] =~ /unknown word/ ) { @@ -1497,7 +1497,7 @@ sub ping_server { if ($ping_rc eq 0) { nc_msg($verbose, "# $full_path_name ping successful.\n"); - } elsif ($ping_rc eq 1) { + } elsif ($ping_rc == 1) { nc_msg($verbose, "# $full_path_name ping unsuccessful.\n"); nc_msg($verbose, "# $full_path_name ping unsuccessful.\n"); nc_msg($verbose, "$ping_debug\n"); @@ -1711,7 +1711,7 @@ sub set_disk_boot { [ qr/$pattern[$state]/ => sub { $rconsole->clear_accum(); - if ($state eq 4) { + if ($state == 4) { if ($expect_out[6] eq "None") { $state = 8; } @@ -1744,7 +1744,7 @@ sub set_disk_boot { } ], ); - if ($rc eq 1) { + if ($rc == 1) { return 1; } else { return 0; @@ -1898,25 +1898,25 @@ sub boot_network { sub { $rconsole->clear_accum(); my @expect_out = shift; - if ($state eq 2) { - if ($set_boot_order eq 1) { + if ($state == 2) { + if ($set_boot_order == 1) { ######################################## # Set network as boot device ######################################## $cmd[3] = "setenv boot-device $net_device[$newstate[3]]\r"; - } elsif ($set_boot_order eq 2) { + } elsif ($set_boot_order == 2) { ######################################## # Set network as 1st boot device,disk as 2nd boot device ######################################## $boot_device_bk = $expect_out[1]; $cmd[3] = "setenv boot-device $net_device[$newstate[3]] $boot_device_bk\r"; - } elsif ($set_boot_order eq 3) { + } elsif ($set_boot_order == 3) { ######################################## # Set disk as 1st boot device,network as 2nd boot device ######################################## $boot_device_bk = $expect_out[1]; $cmd[3] = "setenv boot-device $boot_device_bk $net_device[$newstate[3]]\r"; - } elsif ($set_boot_order eq 4) { + } elsif ($set_boot_order == 4) { ######################################## # set disk as boot device ######################################## @@ -1973,7 +1973,7 @@ sub boot_network { } ], ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); } return 0; } @@ -2363,7 +2363,7 @@ sub Firmware_Dump { } ], ); - return 1 if ($rc eq 1); + return 1 if ($rc == 1); } return 0; } @@ -2846,7 +2846,7 @@ sub lparnetbootexp return [1]; } unless ($output =~ /Success/) { - if ($retry_count eq 3) { + if ($retry_count == 3) { nc_msg($verbose, "Power off failed, msg is $output.\n"); return [1]; } @@ -2874,7 +2874,7 @@ sub lparnetbootexp return [1]; } unless ($output =~ /Success/) { - if ($retry_count eq 3) { + if ($retry_count == 3) { nc_msg($verbose, "Power off failed, msg is $output.\n"); return [1]; } @@ -2988,7 +2988,7 @@ sub lparnetbootexp sub { $rconsole->send("\r"); $retry_count++; - if ($retry_count eq 9) { + if ($retry_count == 9) { nc_msg($verbose, "Timeout waiting for ok prompt; exiting.\n"); $rconsole->soft_close(); $rc = 1; @@ -3003,7 +3003,7 @@ sub lparnetbootexp } ], ); - return [1] if ($rc eq 1); + return [1] if ($rc == 1); } @@ -3033,10 +3033,10 @@ sub lparnetbootexp nc_msg($verbose, "begin to run get_phandle"); while (!$done) { my $result = get_phandle($rconsole, $node, $verbose); - if ($result eq 1) { + if ($result == 1) { $retry_count++; $rconsole->send("\r"); - if ($retry_count eq 3) { + if ($retry_count == 3) { nc_msg($verbose, "Unable to obtain network adapter information. Quitting.\n"); return [1]; } @@ -3053,7 +3053,7 @@ sub lparnetbootexp ############################## nc_msg($verbose, "begin to run multiple_open_dev"); my $result = xCAT::LparNetbootExp->multiple_open_dev($rconsole, $node, $verbose); - if ($result eq 1) { + if ($result == 1) { nc_msg($verbose, "Unable to obtain network adapter information. Quitting.\n"); return [1]; } @@ -3230,7 +3230,7 @@ sub lparnetbootexp } $mac_address = get_mac_addr($phandle_array[$i], $rconsole, $node, $verbose); if ($macaddress =~ /$mac_address/) { - if (($discovery eq 1) && !$discoverynoping) { + if (($discovery == 1) && !$discoverynoping) { unless ($adap_type[$i] eq "hfi-ent") { $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); } @@ -3281,7 +3281,7 @@ sub lparnetbootexp for ($i = 0 ; $i < $adapter_found ; $i++) { nc_msg($verbose, " begint to boot from first adapter in the device tree \n"); if ($adap_type[$i] eq $list_type) { - if (($discovery eq 1) && !$discoverynoping) { + if (($discovery == 1) && !$discoverynoping) { $ping_rc = ping_server($phandle_array[$i], $full_path_name_array[$i], $rconsole, $node, $mac_address, $verbose, $adap_speed, $adap_duplex, $list_type, $server_ip, $client_ip, $gateway_ip); unless ($ping_rc eq 0) { return [1]; @@ -3318,7 +3318,7 @@ sub lparnetbootexp # Need to retry network boot because of intermittant network failure # after partition reboot. Force partition to stop at Open Firmware prompt. ########################################################################### - if ($result eq 5) { + if ($result == 5) { $timeout = 300; $rconsole->expect( @@ -3360,7 +3360,7 @@ sub lparnetbootexp } ], ); - return [1] if ($rc eq 1); + return [1] if ($rc == 1); nc_msg($verbose, "# bootp sent over network.\n"); $rc = Boot($rconsole, $node, $verbose); #, @expect_out); unless ($rc eq 0) { diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index d523dc8f38..ed4694a70d 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -770,7 +770,7 @@ sub classful_networks_for_net_and_mask my @results; my $bitstoeven = (8 - ($mask % 8)); - if ($bitstoeven eq 8) { $bitstoeven = 0; } + if ($bitstoeven == 8) { $bitstoeven = 0; } my $resultmask = $mask + $bitstoeven; if ($given_mask) { @@ -828,7 +828,7 @@ sub my_hexnets } (my $curnet, my $maskbits) = split /\//, $elems[2]; my $bitstoeven = (4 - ($maskbits % 4)); - if ($bitstoeven eq 4) { $bitstoeven = 0; } + if ($bitstoeven == 4) { $bitstoeven = 0; } my $padbits = (32 - ($bitstoeven + $maskbits)); my $numchars = int(($maskbits + $bitstoeven) / 4); my $curmask = 2**$maskbits - 1 << (32 - $maskbits); diff --git a/perl-xCAT/xCAT/PPCdb.pm b/perl-xCAT/xCAT/PPCdb.pm index 464ac4b34c..af6eebeadf 100644 --- a/perl-xCAT/xCAT/PPCdb.pm +++ b/perl-xCAT/xCAT/PPCdb.pm @@ -1209,7 +1209,7 @@ sub get_host { if ($tmpmtm eq $mtm and $tmpsn eq $sn and $tmptype eq $type) { if ($oldnode =~ /^Server\-/) { #judge if need to change node's name if ($oldnode =~ /(\-A)$/) { - $nodename = s/(\-A)$//; + $nodename =~ s/(\-A)$//; # should send a warning here $$flagref = 1; diff --git a/perl-xCAT/xCAT/ProfiledNodeUtils.pm b/perl-xCAT/xCAT/ProfiledNodeUtils.pm index d65ea1cdd0..dc351df6ac 100644 --- a/perl-xCAT/xCAT/ProfiledNodeUtils.pm +++ b/perl-xCAT/xCAT/ProfiledNodeUtils.pm @@ -1261,7 +1261,7 @@ sub check_nicips { $nic = $nic_and_ips[0]; $nic_ip = $nic_and_ips[1]; - if (exists $nics_hash{$nic} or $len ne 2) { + if (exists $nics_hash{$nic} or $len != 2) { $errmsg = "The specified nicips is incorrect. It must be formatted correctly, in the form: !,!,..."; return (1, "", $errmsg); } diff --git a/xCAT-UI/xcat/plugins/web.pm b/xCAT-UI/xcat/plugins/web.pm index c94b9c18dd..cd74bde6b2 100644 --- a/xCAT-UI/xcat/plugins/web.pm +++ b/xCAT-UI/xcat/plugins/web.pm @@ -1982,8 +1982,8 @@ sub web_summary { while (my ($key, $value) = each(%{$attrs})) { web_attrcount($value->[0]->{'os'}, \%oshash); web_attrcount($value->[0]->{'arch'}, \%archhash); - web_attrcount($value->[0]->{'provmethod'},, \%provhash); - web_attrcount($value->[0]->{'nodetype'},, \%typehash); + web_attrcount($value->[0]->{'provmethod'}, \%provhash); + web_attrcount($value->[0]->{'nodetype'}, \%typehash); } $attrs = $nodelistTab->getNodesAttribs(\@nodes, ['status']); diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index 4693a56e2f..d09119dc5d 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -182,7 +182,7 @@ if ((!$imagename) && (!$os)) { } } - if ($#oses eq -1) { + if ($#oses == -1) { print "There are no OS repositories in $installdir. Please run copycds for the OS first.\n"; exit 1; } @@ -260,7 +260,7 @@ if ((!$imagename) && (!$profile)) { $seen{$f}++; } @profiles = sort keys %seen; - if ($#profiles eq -1) { + if ($#profiles == -1) { print "There are no profiles in $::XCATROOT/share/xcat/netboot/$osfamily.\n"; exit 1; } @@ -287,7 +287,7 @@ if ((!$imagename) && (!$profile)) { $match = 1; } } - if ($match eq 1) { + if ($match == 1) { last; } } diff --git a/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm b/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm index d523dc8f38..ed4694a70d 100644 --- a/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm +++ b/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm @@ -770,7 +770,7 @@ sub classful_networks_for_net_and_mask my @results; my $bitstoeven = (8 - ($mask % 8)); - if ($bitstoeven eq 8) { $bitstoeven = 0; } + if ($bitstoeven == 8) { $bitstoeven = 0; } my $resultmask = $mask + $bitstoeven; if ($given_mask) { @@ -828,7 +828,7 @@ sub my_hexnets } (my $curnet, my $maskbits) = split /\//, $elems[2]; my $bitstoeven = (4 - ($maskbits % 4)); - if ($bitstoeven eq 4) { $bitstoeven = 0; } + if ($bitstoeven == 4) { $bitstoeven = 0; } my $padbits = (32 - ($bitstoeven + $maskbits)); my $numchars = int(($maskbits + $bitstoeven) / 4); my $curmask = 2**$maskbits - 1 << (32 - $maskbits); diff --git a/xCAT-rmc/scripts/mkrmcresources b/xCAT-rmc/scripts/mkrmcresources index 261b67cd6f..98466a551f 100755 --- a/xCAT-rmc/scripts/mkrmcresources +++ b/xCAT-rmc/scripts/mkrmcresources @@ -826,7 +826,7 @@ if ( } if ($::HELP) { &usage; exit; } -if (isHMC() && ($ENV{'DC_ENVIRONMENT'} ne 1)) +if (isHMC() && ($ENV{'DC_ENVIRONMENT'} != 1)) { print "mkresources is not supported on HMC.\n"; } diff --git a/xCAT-server/lib/perl/xCAT/ADUtils.pm b/xCAT-server/lib/perl/xCAT/ADUtils.pm index 50db9005f0..cdd095f6ff 100644 --- a/xCAT-server/lib/perl/xCAT/ADUtils.pm +++ b/xCAT-server/lib/perl/xCAT/ADUtils.pm @@ -364,8 +364,10 @@ sub delete_user_account { #provide enough data to construct an /etc/passwd looki } } -=cut +=head3 add_user_account + example: add_user_account(username=>'fred',fullname=>'fred the great'); + =cut sub add_user_account { @@ -479,10 +481,11 @@ sub add_user_account { return { password => $newpassword }; } -=cut -add_host_account +=head3 add_host_account + Arguments are in a hash: node=>name of machine to add + =cut sub add_host_account { diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index a80402fd11..41511ef3ea 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -670,7 +670,7 @@ sub windows_net_cfg { } $interface_cfg .= '' . $ip . "/$netmask" . ''; } - if ($num eq 1) { + if ($num == 1) { # no correct IP with correct network is found next; diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 8b24f282e0..1a7cf4d4de 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -417,7 +417,6 @@ sub deconfig { (return code, message) =cut -=cut #-------------------------------------------------------------------------------- sub deconfigSNMP { return (0, ""); diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index b9db2a539b..6e55d0944b 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -406,7 +406,7 @@ sub processArgs } } if (defined($::args) && @{$::args}) { - if (scalar(@{$::args}) eq 1 and $::args->[0] eq '-S') + if (scalar(@{$::args}) == 1 and $::args->[0] eq '-S') { if ($::command eq "lsdef") { push @ARGV, "-t"; @@ -3649,7 +3649,7 @@ sub defls my @def_nodes = keys %defhash; my $hidden_nodes = $listtab->getNodesAttribs(\@def_nodes, ['hidden']); foreach my $n (keys %{$hidden_nodes}) { - if (defined($hidden_nodes->{$n}->[0]->{'hidden'}) && $hidden_nodes->{$n}->[0]->{'hidden'} eq 1) { + if (defined($hidden_nodes->{$n}->[0]->{'hidden'}) && $hidden_nodes->{$n}->[0]->{'hidden'} == 1) { delete $defhash{$n}; } } diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index 969bae7a2f..4208109fe4 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -5175,7 +5175,7 @@ sub chk_resolv_conf last; } } - if (!$nfsvers || ($nfsvers eq 3)) + if (!$nfsvers || ($nfsvers == 3)) { my $ecmd = qq~/usr/sbin/rmnfsexp -d $install_dir/nim/resolv_conf/$resolv_conf_name/resolv.conf -B 2>/dev/null~; xCAT::InstUtils->xcmd($callback, $subreq, "xdsh", $nimprime, $ecmd, 0); @@ -7426,7 +7426,7 @@ sub updatespot chomp $sharedinstall; if ($sharedinstall eq "sns") { my $rc = xCAT::InstUtils->dolitesetup($image, \%imghash, \@nodelist, $callback, $subreq); - if ($rc eq 1) { # error + if ($rc == 1) { # error my $rsp; push @{ $rsp->{data} }, qq{Could not complete the statelite setup.}; xCAT::MsgUtils->message("E", $rsp, $callback); @@ -8796,7 +8796,7 @@ qq~mkdir -m 644 -p $install_dir/nim/scripts; cp $install_dir/postscripts/xcataix last; } } - if (!$nfsvers || ($nfsvers eq 3)) + if (!$nfsvers || ($nfsvers == 3)) { # make sure we clean up the /etc/exports file of NFSv3 exports my $ecmd = qq~/usr/sbin/rmnfsexp -d $install_dir/nim/scripts/xcataixscript -B 2>/dev/null~; @@ -11260,7 +11260,7 @@ sub mkdsklsnode } my $rc = xCAT::InstUtils->dolitesetup($image, \%imagehash, \@osinodes, $callback, $subreq); - if ($rc eq 1) { # error + if ($rc == 1) { # error my $rsp; push @{ $rsp->{data} }, qq{Could not complete the statelite setup.}; xCAT::MsgUtils->message("E", $rsp, $callback); @@ -12405,7 +12405,7 @@ sub mkdsklsnode my $xcatmaster = $objhash{$tnode}{'xcatmaster'}; $xcatmasterhash{$xcatmaster} = 1; } - if (scalar(keys %snhash) ne 2) + if (scalar(keys %snhash) != 2) { $setuphanfserr++; my $rsp; @@ -12414,7 +12414,7 @@ sub mkdsklsnode xCAT::MsgUtils->message("E", $rsp, $callback); } - if (scalar(keys %xcatmasterhash) ne 1) + if (scalar(keys %xcatmasterhash) != 1) { my %masteriphash = (); foreach my $master (keys %xcatmasterhash) @@ -12422,7 +12422,7 @@ sub mkdsklsnode my $xcatmasterip = xCAT::NetworkUtils->getipaddr($master); $masteriphash{$xcatmasterip} = 1; } - if (scalar(keys %masteriphash) ne 1) + if (scalar(keys %masteriphash) != 1) { $setuphanfserr++; my $rsp; diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 1a751bfa64..7ff063a48a 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -292,7 +292,7 @@ sub isallchassis { } foreach (1 .. 14) { my $tmp = $session->get([ $bladexistsoid . ".$_" ]); - if ($tmp eq 1) { $bladesinchassis++ } + if ($tmp == 1) { $bladesinchassis++ } } my $count = keys %{ $mpahash{$mpa}->{nodes} }; if ($count >= $bladesinchassis) { $allinchassis++; return 1 }; #commands that affect entire are okayed, i.e eventlog clear @@ -498,7 +498,7 @@ m/Severity:(\S+)\s+Source:(\S+)\s+Name:\S*\s+Date:(\S+)\s+Time:(\S+)\s+Text:(.+) $data = $session->set($varbind); if ($session->{ErrorStr}) { return (1, $session->{ErrorStr}); } $didchassis = 1; - if ($varbind->[2] eq 1) { + if ($varbind->[2] == 1) { return 0, "eventlog cleared"; } } @@ -1001,7 +1001,7 @@ sub vitals { if (grep /temp/, @vitems) { for my $idx (6 .. 20) { - if ($idx eq 11) { + if ($idx == 11) { next; } push @bindlist, [ ".1.3.6.1.4.1.2.3.51.2.22.1.5.3.1.$idx", $slot ]; @@ -1429,14 +1429,14 @@ sub populateblowervitals { my $idx = $_->[1]; my $tmp_type = $_->[0]; $tmp_type =~ s/^.*\.(\d*)$/$1/; - if ($tmp_type eq 3) { + if ($tmp_type == 3) { $blowerstats{$idx}->{percentage} = $_->[2]; $blowerstats{$idx}->{percentage} =~ s/^(\d*)%.*$/$1/; - } elsif ($tmp_type eq 4) { + } elsif ($tmp_type == 4) { $blowerstats{$idx}->{state} = $_->[2]; - } elsif ($tmp_type eq 5) { + } elsif ($tmp_type == 5) { $blowerstats{$idx}->{rpm} = $_->[2]; - } elsif ($tmp_type eq 6) { + } elsif ($tmp_type == 6) { $blowerstats{$idx}->{cstate} = $_->[2]; } } @@ -1525,7 +1525,7 @@ sub rscan { foreach (1 .. 14) { my $tmp = $session->get([ $bladexistsoid . ".$_" ]); - if ($tmp eq 1) { + if ($tmp == 1) { my $type = $session->get([ $blademtmoid, $_ ]); if ($session->{ErrorStr}) { return (1, $session->{ErrorStr}); @@ -3779,7 +3779,7 @@ sub bladecmd { if ($slot > 0 and not $slot =~ /:/) { my $tmp = $session->get([ $bladexistsoid . ".$slot" ]); if ($session->{ErrorStr}) { return (1, $session->{ErrorStr}); } - unless ($tmp eq 1) { return (1, "Target bay empty"); } + unless ($tmp == 1) { return (1, "Target bay empty"); } } if ($command eq "rbeacon") { return beacon(@args); diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 6fac9950a6..608bc9092f 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -82,7 +82,7 @@ sub process_request return 2; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { return 2; } diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 66a51a003c..ed84bfae60 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -537,7 +537,7 @@ sub addnode unless ($node_server) { my @nxtsrvd = xCAT::NetworkUtils->my_ip_facing($node); unless ($nxtsrvd[0]) { $nxtsrv = $nxtsrvd[1]; } - elsif ($nxtsrvd[0] eq 1) { $callback->({ error => [ $nxtsrvd[1] ] }); } + elsif ($nxtsrvd[0] == 1) { $callback->({ error => [ $nxtsrvd[1] ] }); } else { $callback->({ error => ["Unable to determine the tftpserver for $node"], errorcode => [1] }); return; diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 67a352df24..d315ad241a 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -107,7 +107,7 @@ sub setstate { my $ipfn; my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node); - if ($ipfnd[0] eq 1) { + if ($ipfnd[0] == 1) { $::callback->( { error => [ $ipfnd[1] ], @@ -115,7 +115,7 @@ sub setstate { }); return; } - elsif ($ipfnd[0] eq 2) { + elsif ($ipfnd[0] == 2) { my $servicenodes = $nrhash{$node}->[0]; if ($servicenodes and $servicenodes->{servicenode}) { my @sns = split /,/, $servicenodes->{servicenode}; diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index 7ba19c3e90..d594385afd 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -110,7 +110,7 @@ sub ximport { }; unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } @@ -157,7 +157,7 @@ sub xexport { }; unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index e3a4d362e8..bdc12da427 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1172,7 +1172,7 @@ sub addkit unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } @@ -1508,7 +1508,7 @@ sub rmkit unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } @@ -1929,7 +1929,7 @@ sub addkitcomp unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } @@ -2481,7 +2481,7 @@ sub rmkitcomp unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } @@ -3403,7 +3403,7 @@ sub chkkitcomp unless (defined($request->{arg})) { $xusage->(1); return; } @ARGV = @{ $request->{arg} }; - if ($#ARGV eq -1) { + if ($#ARGV == -1) { $xusage->(1); return; } diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index e97c0669fb..f4fe987e97 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -3425,29 +3425,6 @@ sub guestcmd { return rscan($node, @args); } -=cut - } elsif ($command eq "rvitals") { - return vitals(@args); - } elsif ($command =~ /r[ms]preset/) { - return resetmp(@args); - } elsif ($command eq "rspconfig") { - return mpaconfig($mpa,$user,$pass,$node,$slot,@args); - } elsif ($command eq "rbootseq") { - return bootseq(@args); - } elsif ($command eq "switchblade") { - return switchblade(@args); - } elsif ($command eq "getmacs") { - return getmacs(@args); - } elsif ($command eq "rinv") { - return inv(@args); - } elsif ($command eq "reventlog") { - return eventlog(@args); - } elsif ($command eq "rscan") { - return rscan(\@args); - } - -=cut - return (1, "$command not a supported command by kvm method"); } diff --git a/xCAT-server/lib/xcat/plugins/lsslp.pm b/xCAT-server/lib/xcat/plugins/lsslp.pm index 6f91116808..369b41867f 100755 --- a/xCAT-server/lib/xcat/plugins/lsslp.pm +++ b/xCAT-server/lib/xcat/plugins/lsslp.pm @@ -290,7 +290,7 @@ sub parse_args { ############################################# # Check for node range ############################################# - if (scalar(@ARGV) eq 1) { + if (scalar(@ARGV) == 1) { my @nodes = xCAT::NodeRange::noderange(@ARGV); foreach (@nodes) { push @filternodes, $_; diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 3032615f68..3ed8d5f350 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -701,7 +701,7 @@ sub parseLiteFiles { my @res = grep { $_ =~ m/\Q$parent\E$/ } @entries; my $found = scalar @res; - if ($found eq 1) { # $parent is found in @entries + if ($found == 1) { # $parent is found in @entries # handle $res[0]; my @tmpresentry = split /\s+/, $res[0]; shift @tmpresentry; diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 957c093888..3d3d7fa6d6 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -108,7 +108,7 @@ sub setstate { my $ipfn; my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node); - if ($ipfnd[0] eq 1) { + if ($ipfnd[0] == 1) { $::callback->( { error => [ $ipfnd[1] ], @@ -116,7 +116,7 @@ sub setstate { }); return; } - elsif ($ipfnd[0] eq 2) { + elsif ($ipfnd[0] == 2) { my $servicenodes = $nrhash{$node}->[0]; if ($servicenodes and $servicenodes->{servicenode}) { my @sns = split /,/, $servicenodes->{servicenode}; diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index abe8b834aa..fc668a0aff 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -919,7 +919,7 @@ Usage: } if (@discoverednodes) { unless ($long) { - push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE',, 'METHOD', 'MTM', 'SERIAL'); + push @{ $rsp->{data} }, sprintf(" %-40s%-20s%-15s%-10s%-13s", 'UUID', 'NODE', 'METHOD', 'MTM', 'SERIAL'); } foreach (@discoverednodes) { push @{ $rsp->{data} }, "$_"; diff --git a/xCAT-server/lib/xcat/plugins/setup.pm b/xCAT-server/lib/xcat/plugins/setup.pm index d249af6ee4..5ebe50cd97 100644 --- a/xCAT-server/lib/xcat/plugins/setup.pm +++ b/xCAT-server/lib/xcat/plugins/setup.pm @@ -490,8 +490,8 @@ sub writeframe { my $num1 = int((int($num) - $fnum) / $framesperhmc) + $umb; my $num2 = length($$hmchash{'primary-start'}) - length($num1); $FRAMESFP{$nn}{sfp} = $hmcbase . $num1 . $hmcattch if ($num2 <= 0); - $FRAMESFP{$nn}{sfp} = $hmcbase . '0' . $num1 . $hmcattch if ($num2 eq 1); - $FRAMESFP{$nn}{sfp} = $hmcbase . '00' . $num1 . $hmcattch if ($num2 eq 2); + $FRAMESFP{$nn}{sfp} = $hmcbase . '0' . $num1 . $hmcattch if ($num2 == 1); + $FRAMESFP{$nn}{sfp} = $hmcbase . '00' . $num1 . $hmcattch if ($num2 == 2); } $tables{'ppc'}->setNodesAttribs(\%FRAMESFP); } @@ -533,10 +533,10 @@ sub writechildren { } else { $trange = 1; } - $ranges{'A-0'} = $trange if ($tt eq 0); - $ranges{'A-1'} = $trange if ($tt eq 1); - $ranges{'B-0'} = $trange if ($tt eq 2); - $ranges{'B-1'} = $trange if ($tt eq 3); + $ranges{'A-0'} = $trange if ($tt == 0); + $ranges{'A-1'} = $trange if ($tt == 1); + $ranges{'B-0'} = $trange if ($tt == 2); + $ranges{'B-1'} = $trange if ($tt == 3); $tt++; } if ($DELETENODES) { diff --git a/xCAT-server/lib/xcat/plugins/snmove.pm b/xCAT-server/lib/xcat/plugins/snmove.pm index 2c8506c609..90665f4533 100644 --- a/xCAT-server/lib/xcat/plugins/snmove.pm +++ b/xCAT-server/lib/xcat/plugins/snmove.pm @@ -2227,7 +2227,7 @@ sub sfsSLconfig # dolitesetup to update the shared_root table files # - updates files in the sopot and shared_root resour my $rc = xCAT::InstUtils->dolitesetup($i, \%imghash, \@{ $osinodes{$i} }, $callback, $sub_req); - if ($rc eq 1) { # error + if ($rc == 1) { # error my $rsp; push @{ $rsp->{data} }, "Could not complete the statelite setup.\n"; xCAT::MsgUtils->message("E", $rsp, $callback); diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 8662628169..9435e390d5 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -719,11 +719,11 @@ sub parseLiteFiles { $parent .= "/" unless ($parent =~ m/\/$/); @res = grep { $_ =~ m/\Q$parent\E$/ } @entries; $found = scalar @res; - last if ($found eq 1); + last if ($found == 1); $parent = dirname $parent; } - if ($found eq 1) { # $parent is found in @entries + if ($found == 1) { # $parent is found in @entries # handle $res[0]; my @tmpresentry = split /\s+/, $res[0]; shift @tmpresentry; # remove the imgname in @tmpresentry diff --git a/xCAT-server/lib/xcat/plugins/tabutils.pm b/xCAT-server/lib/xcat/plugins/tabutils.pm index 28d0b261b1..0515eae931 100644 --- a/xCAT-server/lib/xcat/plugins/tabutils.pm +++ b/xCAT-server/lib/xcat/plugins/tabutils.pm @@ -1947,7 +1947,7 @@ sub nodels foreach my $rnode (@$nodes) { unless (defined($listHash->{$rnode}->[0]->{hidden})) { push(@newnodes, $rnode); - } elsif ($listHash->{$rnode}->[0]->{hidden} ne 1) { + } elsif ($listHash->{$rnode}->[0]->{hidden} != 1) { push(@newnodes, $rnode); } } @@ -2181,7 +2181,7 @@ sub nodels foreach my $rnode (@nodes) { unless (defined($listHash->{$rnode}->[0]->{hidden})) { push(@newnodes, $rnode); - } elsif ($listHash->{$rnode}->[0]->{hidden} ne 1) { + } elsif ($listHash->{$rnode}->[0]->{hidden} != 1) { push(@newnodes, $rnode); } } diff --git a/xCAT-server/lib/xcat/plugins/xen.pm b/xCAT-server/lib/xcat/plugins/xen.pm index 2721d61393..9d9289e185 100644 --- a/xCAT-server/lib/xcat/plugins/xen.pm +++ b/xCAT-server/lib/xcat/plugins/xen.pm @@ -586,29 +586,6 @@ sub guestcmd { return getvmcons($node, @args); } -=cut - } elsif ($command eq "rvitals") { - return vitals(@args); - } elsif ($command =~ /r[ms]preset/) { - return resetmp(@args); - } elsif ($command eq "rspconfig") { - return mpaconfig($mpa,$user,$pass,$node,$slot,@args); - } elsif ($command eq "rbootseq") { - return bootseq(@args); - } elsif ($command eq "switchblade") { - return switchblade(@args); - } elsif ($command eq "getmacs") { - return getmacs(@args); - } elsif ($command eq "rinv") { - return inv(@args); - } elsif ($command eq "reventlog") { - return eventlog(@args); - } elsif ($command eq "rscan") { - return rscan(\@args); - } - -=cut - return (1, "$command not a supported command by xen method"); } diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 60bf8b4082..a1bde29f04 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -100,7 +100,7 @@ sub setstate { my $ipfn; my @ipfnd = xCAT::NetworkUtils->my_ip_facing($node); - if ($ipfnd[0] eq 1) { + if ($ipfnd[0] == 1) { $::YABOOT_callback->( { error => [ $ipfnd[1] ], @@ -108,7 +108,7 @@ sub setstate { }); return; } - elsif ($ipfnd[0] eq 2) { + elsif ($ipfnd[0] == 2) { my $servicenodes = $nrhash{$node}->[0]; if ($servicenodes and $servicenodes->{servicenode}) { my @sns = split /,/, $servicenodes->{servicenode}; diff --git a/xCAT-server/sbin/flashmic b/xCAT-server/sbin/flashmic index 0a92fd94df..c782feb544 100755 --- a/xCAT-server/sbin/flashmic +++ b/xCAT-server/sbin/flashmic @@ -171,7 +171,7 @@ foreach (@$output) { if ($line =~ /^mic(\d+):/) { $line =~ s/^mic(\d+):/MICMSG:$miccfg{$1}{'name'}:/; } - print $line. "\n"; + print $line . "\n"; } } diff --git a/xCAT-server/sbin/proxydhcp-xcat b/xCAT-server/sbin/proxydhcp-xcat index 8fba00534b..f3c9ea2975 100755 --- a/xCAT-server/sbin/proxydhcp-xcat +++ b/xCAT-server/sbin/proxydhcp-xcat @@ -127,7 +127,7 @@ until ($quit) { my $strp = 0xf0; my $archp = 0; while ($strp < $#package) { - if ($package[$strp] eq 60) { + if ($package[$strp] == 60) { $archp = $strp + 0x11; last; } else { @@ -240,12 +240,12 @@ until ($quit) { } if (($num - 5) % 16 eq 0) { syslog("info", $msg); - print $msg. "\n"; + print "$msg \n"; $msg = ""; } $num++; } - print $msg. "\n"; + print "$msg \n"; } } diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index 875fa11bae..620a72e019 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -54,7 +54,7 @@ sub getans { $password = $rsp->{node}->[0]->{bmcpass}->[0]; if (exists $rsp->{node}->[0]->{error}) { my $error = $rsp->{node}->[0]->{error}->[0]; - print $error. "\n"; + print "$error\n"; } } } diff --git a/xCAT-server/share/xcat/tools/mktoolscenter b/xCAT-server/share/xcat/tools/mktoolscenter index 8766890c7d..8ec88ebc85 100755 --- a/xCAT-server/share/xcat/tools/mktoolscenter +++ b/xCAT-server/share/xcat/tools/mktoolscenter @@ -574,7 +574,7 @@ if (symlink($repo, "$path/repo") eq 0) { exit; } -if ($surrogate eq 1) { +if ($surrogate == 1) { output("Creating tar"); my $tarme = ""; if (-d "$instroot/netboot/toolscenter") { diff --git a/xCAT-server/share/xcat/tools/nodesw b/xCAT-server/share/xcat/tools/nodesw index 4a3db0f4a9..a3fc4c08a8 100755 --- a/xCAT-server/share/xcat/tools/nodesw +++ b/xCAT-server/share/xcat/tools/nodesw @@ -35,7 +35,7 @@ sub getVlanMask { #foreach (@xs){ # print $_ . "\n"; #} - unless (scalar(@xs) eq 7) { + unless (scalar(@xs) == 7) { print "Could not get vlan mask for $vlan\n"; } @@ -121,7 +121,7 @@ sub connectToSwitch { #ERROR: print "Failed to communicate with $switch\n"; - print $SNMP::Session::ErrorStr . "\n"; + print "$SNMP::Session::ErrorStr\n"; #xCAT::MsgUtils->message("S","Failed to communicate with $switch"); } @@ -259,7 +259,7 @@ sub addNodeToVlan { #print Dumper($v2); $session->set($v2); if ($session->{ErrorStr}) { - print "Error! " . $session->{ErrorStr} . "\n"; + print "Error! $session->{ErrorStr} \n"; } ####################################### diff --git a/xCAT-server/share/xcat/tools/xcatstat b/xCAT-server/share/xcat/tools/xcatstat index 32e84b7336..46a460766e 100755 --- a/xCAT-server/share/xcat/tools/xcatstat +++ b/xCAT-server/share/xcat/tools/xcatstat @@ -178,7 +178,7 @@ if ($DILIMITER) { print "# Hostname:Status:Network-Interfaces:\n"; foreach (sort @statusoutput) { - print $_. ":\n"; + print "$_ :\n"; } exit 0; diff --git a/xCAT-server/xCAT-wsapi/restapi.pl b/xCAT-server/xCAT-wsapi/restapi.pl index 716cff3100..a4427e8d04 100755 --- a/xCAT-server/xCAT-wsapi/restapi.pl +++ b/xCAT-server/xCAT-wsapi/restapi.pl @@ -1347,7 +1347,6 @@ else { sub isGET { return uc($requestType) eq "GET"; } sub isPost { return uc($requestType) eq "POST"; } sub isPut { return uc($requestType) eq "PUT"; } -sub isPost { return uc($requestType) eq "POST"; } sub isPatch { return uc($requestType) eq "PATCH"; } sub isDelete { return uc($requestType) eq "DELETE"; } diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 30a04cecc5..cc911b2bfc 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -1524,7 +1524,6 @@ else { sub isGET { return uc($requestType) eq "GET"; } sub isPost { return uc($requestType) eq "POST"; } sub isPut { return uc($requestType) eq "PUT"; } -sub isPost { return uc($requestType) eq "POST"; } sub isPatch { return uc($requestType) eq "PATCH"; } sub isDelete { return uc($requestType) eq "DELETE"; } diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 871da212fb..3523c04e69 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -444,7 +444,7 @@ sub Get_Files_Recursive } else { my $dirpath = $dir . '/' . $direntry . "\n"; - print $dir. '/' . $direntry . "\n"; + print $dirpath; #print $dir."\n"; push(@filespath, glob("$dirpath")); From 2da47d9f4abaa5e4390388015fb2fcf8137fe10e Mon Sep 17 00:00:00 2001 From: Xiaopeng Wang Date: Tue, 26 Jul 2016 10:02:47 +0800 Subject: [PATCH 028/391] correct typo and remove useless variable definition --- perl-xCAT/xCAT/Client.pm | 2 +- perl-xCAT/xCAT/FSPbootseq.pm | 3 +-- xCAT-server/sbin/xcatd | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index b460d5f38c..9aa8cfd0ed 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -838,7 +838,7 @@ sub submit_request { #----- end added to Client.pm -----# if (ref $_->{'_xcatdest'} and (ref $_->{'_xcatdest'}) eq 'ARRAY') { - _->{'_xcatdest'} = $_->{'_xcatdest'}->[0]; + $_->{'_xcatdest'} = $_->{'_xcatdest'}->[0]; } if ($onlyone and not($_->{'_xcatdest'} and xCAT::NetworkUtils->thishostisnot($_->{'_xcatdest'}))) { $SIG{CHLD} = 'DEFAULT'; diff --git a/perl-xCAT/xCAT/FSPbootseq.pm b/perl-xCAT/xCAT/FSPbootseq.pm index 8f6ba2e750..3d81f73b55 100644 --- a/perl-xCAT/xCAT/FSPbootseq.pm +++ b/perl-xCAT/xCAT/FSPbootseq.pm @@ -21,8 +21,7 @@ sub parse_args { my $cmd = $request->{command}; my $args = $request->{arg}; my $node = $request->{node}; - my $vers = - my @VERSION = qw( 2.6 ); + my @VERSION = qw( 2.6 ); my @dev = qw(hfi net); ############################################# diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 8e92715096..ded392492f 100644 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -2165,7 +2165,7 @@ sub dispatch_request { my $child; delete $_->{noderange}; if (ref $_->{'_xcatdest'} and (ref $_->{'_xcatdest'}) eq 'ARRAY') { - _->{'_xcatdest'} = $_->{'_xcatdest'}->[0]; + $_->{'_xcatdest'} = $_->{'_xcatdest'}->[0]; } if ($onlyone and not($_->{'_xcatdest'} and xCAT::NetworkUtils->thishostisnot($_->{'_xcatdest'}))) { $SIG{CHLD} = 'DEFAULT'; From fa16e12d48814211f16025ad3906e28c3e4a01e4 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 26 Jul 2016 10:51:34 +0800 Subject: [PATCH 029/391] Fix the overwrite error when dealing with the conflict (#1588) --- xCAT-server/sbin/xcatconfig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index b58f14797a..2686e9b98d 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -452,6 +452,12 @@ if ($::INITIALINSTALL || $::FORCE || $::UPDATEINSTALL || $::genCredentials) } else { + #since the xcatd service unit file is updated on xcat upgrade + #"systemctl daemon-reload" need to be run to update the service unit + if ($::UPDATEINSTALL) { + $xcmd="type systemctl >/dev/null 2>&1 && systemctl daemon-reload"; + xCAT::Utils->runcmd("$xcmd", 0); + } #$xcmd = "/etc/init.d/xcatd restart"; xCAT::Utils->restartservice("xcatd"); } From 5879544c6bf0c147f5adc3a2623fbe5f198ff752 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 26 Jul 2016 03:08:06 -0400 Subject: [PATCH 030/391] update version to a variable --- xCAT-test/autotest/testcase/go-xcat/case1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 index 3a3433307e..e1e89b6d19 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case1 +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -47,10 +47,10 @@ cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /e check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 -cmd:xdsh $$CN "cd /; ./go-xcat -x 2.11 -y install" +cmd:xdsh $$CN "cd /; ./go-xcat -x $$MIGRATION1_VERSION -y install" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" -check:output=~Version 2.11 +check:output=~Version $$MIGRATION1_VERSION cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running From 6d2e5aeaa11f48c22de9cd0736d224a4239dac70 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 26 Jul 2016 03:24:23 -0400 Subject: [PATCH 031/391] add go-xcat cases in daily build --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle | 8 ++++++++ 13 files changed, 104 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index d754680172..155395c28f 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -300,4 +300,12 @@ reg_linux_diskfull_installation_hierarchy reg_linux_diskless_installation_hierarchy reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 3e68215982..0d408f1cd7 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -206,4 +206,12 @@ reg_linux_diskfull_installation_hierarchy reg_linux_diskless_installation_hierarchy reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index ee6a786f9c..cb5b3250b3 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -302,4 +302,12 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs redhat_migration1 redhat_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 2b2bb560cf..7d17f9e653 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -196,4 +196,12 @@ nodeset_cmdline nodeset_runimg redhat_migration1 redhat_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index 0025be4bd3..9d3e9bb881 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -208,4 +208,12 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs redhat_migration1 redhat_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index 74d1534013..df0b9f843f 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -266,4 +266,12 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs sles_migration1 sles_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 4af6e55088..9f7f4e8942 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -218,4 +218,12 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs sles_migration1 sles_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 2caa4876bb..4fc369f3de 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -206,3 +206,11 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd sles_migration1 sles_migration2 +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index 757cbc2bff..a74f82d8e8 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -213,3 +213,11 @@ sles_migration1 sles_migration2 reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 36ec63e99f..4740028046 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -241,3 +241,11 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 7a307a29dd..bfbce153c9 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -258,3 +258,11 @@ rmdocker_command rmdocker_f_command lsdocker_h_command lsdocker_l_command +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index 32328d5947..e4253bc89f 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -241,3 +241,11 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle index 8413bfedcf..0fd26a629f 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle @@ -250,3 +250,11 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput From 9fc3d2b96768d4b148e93fece64a3db06dc5c5b3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 26 Jul 2016 08:06:47 -0400 Subject: [PATCH 032/391] Use correct vmstorageformat for chvm --- xCAT-server/lib/xcat/plugins/kvm.pm | 42 ++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index e97c0669fb..4f26c2cd80 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1226,6 +1226,25 @@ sub getpowstate { } } +# Return storageformat definition +sub getstorageformat { + my $cfginfo = shift; + + my @flags = split /,/, $cfginfo->{virtflags}; + my $format; + foreach (@flags) { + if (/^imageformat=(.*)\z/) { + $format = $1; + } elsif (/^clonemethod=(.*)\z/) { + $clonemethod = $1; + } + } + if ($cfginfo->{storageformat}) { + $format = $cfginfo->{storageformat}; + } + return $format; +} + sub xhrm_satisfy { my $node = shift; my $hyp = shift; @@ -1410,23 +1429,10 @@ sub createstorage { my $cfginfo = shift; my $force = shift; - #my $diskstruct = shift; my $node = $cfginfo->{node}; - my @flags = split /,/, $cfginfo->{virtflags}; - my $format; - foreach (@flags) { - if (/^imageformat=(.*)\z/) { - $format = $1; - } elsif (/^clonemethod=(.*)\z/) { - $clonemethod = $1; - } - } - if ($cfginfo->{storageformat}) { - $format = $cfginfo->{storageformat}; - } my $mountpath; my $pathappend; - + my $format = getstorageformat($cfginfo); #for nfs paths and qemu-img, we do the magic locally only for now my $basename; @@ -1891,6 +1897,11 @@ sub chvm { if (@addsizes) { #need to add disks, first identify used devnames my @diskstoadd; my $location = $confdata->{vm}->{$node}->[0]->{storage}; + unless ($location) { + # Calling add disk for a vm with no storage defined + xCAT::SvrUtils::sendmsg([ 1, "Can not add storage, vmstorage attribute not defined." ], $callback, $node); + return; + } $location =~ s/.*\|//; #use the rightmost location for making new devices $location =~ s/,.*//; #no comma specified parameters are valid $location =~ s/=(.*)//; #store model if specified here @@ -1920,6 +1931,7 @@ sub chvm { foreach (@addsizes) { push @newsizes, split /,/, $_; } + my $format = getstorageformat($confdata->{vm}->{$node}->[0]); foreach (@newsizes) { my $dev; do { @@ -1927,7 +1939,7 @@ sub chvm { } while ($useddisks{$dev}); #ok, now I need a volume created to attach - push @diskstoadd, get_filepath_by_url(url => $location, dev => $dev, create => $_); + push @diskstoadd, get_filepath_by_url(url => $location, dev => $dev, create => $_, format => $format); } #now that the volumes are made, must build xml for each and attempt attach if and only if the VM is live From 47f051e08c488b1dcdb316bf1561e9f4c27599f3 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 26 Jul 2016 23:41:54 -0400 Subject: [PATCH 033/391] complete --- .../installation/reg_linux_statelite_installation_flat | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 3605fd0213..019554cc2f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -124,6 +124,11 @@ cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN +cmd:rm -rf /tmp/image;mkdir /tmp/image +check:rc==0 +cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image +check:rc==0 + cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 cmd:rmdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute From dd783ff14b3d1616209f416615ab37fc04ff9ce5 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Jul 2016 03:50:30 -0400 Subject: [PATCH 034/391] 1596:Enhance the process of reinstall for PCM --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index c5458e3349..d44beca15e 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -996,8 +996,16 @@ Usage: # Add BMC/FSP as reserve NICs and not remove it form nics table foreach my $oldNic (keys %$oldNicsRef) { - if ($oldNicsRef->{$oldNic}->{'type'} ne 'BMC' and $oldNicsRef->{$oldNic}->{'type'} ne 'FSP') { - $updateNicsHash{$oldNic} = 1; + if ($oldNicsRef->{$oldNic}->{'type'} ne 'BMC' and $oldNicsRef->{$oldNic}->{'type'} ne 'FSP'){ + if ($oldNicsRef->{$oldNic}->{'network'} eq $newNicsRef->{$oldNic}->{'network'}){ + $reserveNicsHash{$oldNic} = 1; + if(exists $updateNicsHash{$oldNic}) + { + delete($updateNicsHash{$oldNic}); + } + } else { + $updateNicsHash{$oldNic} = 1; + } } else { $reserveNicsHash{$oldNic} = 1; } From aec59a08aa2587f2ff86977435e21e2e2c51e325 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 27 Jul 2016 15:56:25 +0800 Subject: [PATCH 035/391] Update reg_linux_statelite_installation_flat --- .../testcase/installation/reg_linux_statelite_installation_flat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 019554cc2f..7471c5e094 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -126,7 +126,7 @@ check:output=~64 bytes from $$CN cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 -cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image +cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi From d3eaa578d09462577ccd43039af8ac75be3a1606 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 27 Jul 2016 05:30:34 -0400 Subject: [PATCH 036/391] Remove the code sections that upload the resulting build to xcat.org (#1586) The upload is no longer handled in this build script, removing for clarity --- build-ubunturepo | 67 +++--------------------------------------------- 1 file changed, 3 insertions(+), 64 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 275a95347d..6c9e001cd0 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -102,16 +102,6 @@ if [ "$c_flag" -a "$d_flag" ];then fi - -uploader="litingt" -USER="xcat" -SERVER="xcat.org" -FILES_PATH="files" -FRS="/var/www/${SERVER}/${FILES_PATH}" -release="github.com/xcat2/xcat-core/releases" -APT_DIR="${FRS}/xcat" -APT_REPO_DIR="${APT_DIR}/repos/apt" - # Find where this script is located to set some build variables old_pwd=`pwd` cd `dirname $0` @@ -121,11 +111,6 @@ curdir=`pwd` local_core_repo_path="$curdir/../../xcat-core" local_dep_repo_path="$curdir/../../xcat-dep/xcat-dep" -#define the url used for creating the source list file -#define the upload dir used for uploading packages -sf_repo_url="https://xcat.org/files/ubuntu" -sf_dir="/var/www/xcat.org/files" - #use flock to only one person build at the same time # Get a lock, so can not do 2 builds at once exec 8>/var/lock/xcatbld.lock @@ -365,7 +350,6 @@ __EOF__ chmod 775 mklocalrepo.sh #create the xcat-core.list file - #echo "deb ${sf_repo_url}/${REL}/${upload_dir}/ precise main" > xcat-core.list cd ../ if ! grep xcat /etc/group ; then @@ -384,26 +368,8 @@ __EOF__ ln -s xcat-core core-snap fi - # Decide whether to upload or not (default NOT to upload) - if [ "$UP" != "1" ]; then - echo "Upload not specified, Done! (rerun with UP=1, to upload)" - cd $old_pwd - exit 0 - fi - - #upload the deb packages - i=0 - echo "Uploading RPMs from $upload_dir to ${APT_REPO_DIR}/${REL}/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $upload_dir $USER@${SERVER}:${APT_REPO_DIR}/${REL}/ - do : ; done - - #upload the tar ball - i=0 - echo "Uploading $tar_name to ${APT_DIR}/xcat-core/${REL}/Ubuntu/core-snap/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v --force $tar_name $USER@${SERVER}:${APT_DIR}/xcat-core/${REL}/Ubuntu/core-snap/ - do : ; done - - cd $old_pwd + cd $old_pwd + exit 0 fi if [ "$d_flag" ] @@ -493,8 +459,6 @@ __EOF__ chmod 775 mklocalrepo.sh - #echo ""deb ${sf_repo_url}/xcat-dep/ precise main"" > xcat-dep.list - cd .. if ! grep xcat /etc/group ; then groupadd xcat @@ -509,32 +473,7 @@ __EOF__ chgrp root $dep_tar_name chmod g+w $dep_tar_name - # Decide whether to upload or not (default NOT to upload) - if [ "$UP" != "1" ]; then - echo "Upload not specified, Done! (rerun with UP=1, to upload)" - cd $old_pwd - exit 0 - fi - - #upload the dep packages - i=0 - echo "Uploading debs from xcat-dep to ${APT_REPO_DIR}/xcat-dep/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete xcat-dep $USER@${SERVER}:${APT_REPO_DIR}/ - do : ; done - - #upload the tarball - i=0 - echo "Uploading $dep_tar_name to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v --force $dep_tar_name $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ - do : ; done - - #upload the README file - cd debs - i=0 - echo "Uploading README to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v --force README $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ - do : ; done - cd $old_pwd + exit 0 fi exit 0 From b8c553d3293cee240e2cd4f73e916c01e0571186 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 28 Jul 2016 10:56:01 +0800 Subject: [PATCH 037/391] Update customize_sleep_for_sn --- .../autotest/testcase/installation/customize_sleep_for_sn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn b/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn index 5c4c1ce7c1..7cc8b5790f 100755 --- a/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn +++ b/xCAT-test/autotest/testcase/installation/customize_sleep_for_sn @@ -11,7 +11,7 @@ chomp($snnodename); sleep 300; my $timecnt = 0; -while ($timecnt < 200) { +while ($timecnt < 120) { my $booted = system("lsdef -l $snnodename|grep status|grep booted > /dev/null 2>&1"); last if ($booted == 0); @@ -21,7 +21,7 @@ while ($timecnt < 200) { `echo "send signal to $snnodename for the $timecnt times" >> $log`; } - sleep 10; + sleep 30; $timecnt++; } From 45c1dc0f92ac34062572d93010901218f9cb4d8d Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 28 Jul 2016 01:37:28 -0400 Subject: [PATCH 038/391] fix [FVT]:mysqlsetup -i failed to setup database on sles12 #1413 ;refine the logic to determine hostname of the master --- xCAT-client/bin/mysqlsetup | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 5a4ccbf8c6..e61857a206 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -405,12 +405,8 @@ if (($::INIT) && ($::xcatrunningmysql == 0)) my $cmd = "grep master $sitefile"; my @output = xCAT::Utils->runcmd($cmd, -1); my $hname; - if ($::RUNCMD_RC != 0) # no entry in site table - { - $hname = `hostname`; - chomp $hname; - } - else # from site.master + # from site.master + if ($::RUNCMD_RC == 0 ) { (my $attr, my $master) = split(",", $output[0]); (my $q, $hname) = split("\"", $master); @@ -418,6 +414,11 @@ if (($::INIT) && ($::xcatrunningmysql == 0)) } + if( "$hname" eq ""){ + $hname = `hostname`; + chomp $hname; + } + #my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname); my $ipaddr = xCAT::NetworkUtils->getipaddr($hname); if ($ipaddr) From 7a3a0836e21171441aefd84cdefc8c80b356d524 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 26 Jul 2016 04:39:21 -0400 Subject: [PATCH 039/391] Add trust_host option in rest api for makeconservercf --- xCAT-server/xCAT-wsapi/xcatws.cgi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index cc911b2bfc..20306c00d5 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -223,8 +223,8 @@ my %URIdef = ( PUT => { desc => "Update conserver configuration for the node {noderange}.", usage => "|Json Formatted DataBody: {action:on/off}.|$usagemsg{non_getreturn}|", - example => "|Enable the console capability for node1|PUT|/nodes/node1/console {\"action\":\"on\"}||", - cmd => "makeconservercf", + example => "|Enable the console capability for node1|PUT|/nodes/node1/console {\"action\":\"on\", \"trust_host\": \"host\"}||", + cmd => "makeconservercf", fhandler => \&actionhdl, outhdler => \&noout, } @@ -2195,9 +2195,12 @@ sub actionhdl { } elsif ($params->{'resourcename'} eq "console") { if ($paramhash->{'action'}) { - my $option = $paramhash->{'action'}; - my %op_hash = ('on' => '', 'off' => '-d'); - push @args, $op_hash{ $paramhash->{'action'} }; + my %action = ('on' => '', 'off' => '-d'); + push @args, $action{$paramhash->{'action'}}; + if ($paramhash->{'trust_host'}) { + push @args, '-t'; + push @args, $paramhash->{'trust_host'}; + } } else { error("Missed Action.", $STATUS_NOT_FOUND); } From 89cec47de7bd0e7c6c1d1377c63f80924a511511 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 27 Jul 2016 23:52:26 -0400 Subject: [PATCH 040/391] fix a mistake --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 16 ++++++++-------- .../autotest/bundle/rhels7.2_ppc64le.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 16 ++++++++-------- .../autotest/bundle/sles12.1_ppc64le.bundle | 16 ++++++++-------- xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 16 ++++++++-------- .../autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 16 ++++++++-------- .../autotest/bundle/ubuntu14.04.4_x86_64.bundle | 16 ++++++++-------- .../autotest/bundle/ubuntu16.04_ppc64le.bundle | 16 ++++++++-------- 12 files changed, 96 insertions(+), 96 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 155395c28f..8c990aa865 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput updatenode_h updatenode_v updatenode_diskful_syncfiles @@ -300,12 +308,4 @@ reg_linux_diskfull_installation_hierarchy reg_linux_diskless_installation_hierarchy reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 0d408f1cd7..7b014eafba 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -206,12 +214,4 @@ reg_linux_diskfull_installation_hierarchy reg_linux_diskless_installation_hierarchy reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index cb5b3250b3..b348a21c56 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput updatenode_h updatenode_v updatenode_diskful_syncfiles @@ -302,12 +310,4 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs redhat_migration1 redhat_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 7d17f9e653..cc15f6b88e 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -1,5 +1,13 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -196,12 +204,4 @@ nodeset_cmdline nodeset_runimg redhat_migration1 redhat_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index 9d3e9bb881..d9d0ba4e87 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -208,12 +216,4 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs redhat_migration1 redhat_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index df0b9f843f..d9d8a1ad76 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput chdef_null chdef_t_node chdef_t_network @@ -266,12 +274,4 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs sles_migration1 sles_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 9f7f4e8942..0ba277a042 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -218,12 +226,4 @@ reg_linux_statelite_installation_hierarchy_by_ramdisk reg_linux_statelite_installation_hierarchy_by_nfs sles_migration1 sles_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput clean_up_env diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 4fc369f3de..61ae6ffdbc 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -1,5 +1,13 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -206,11 +214,3 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd sles_migration1 sles_migration2 -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index a74f82d8e8..be3eb8b858 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -1,4 +1,12 @@ reg_linux_diskfull_installation_flat +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n @@ -213,11 +221,3 @@ sles_migration1 sles_migration2 reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 4740028046..4e9c2fb3fd 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -1,5 +1,13 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n_noderange @@ -241,11 +249,3 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index bfbce153c9..b86bc7dfa8 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -1,5 +1,13 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n_noderange @@ -258,11 +266,3 @@ rmdocker_command rmdocker_f_command lsdocker_h_command lsdocker_l_command -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index e4253bc89f..ae76c787ff 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -1,5 +1,13 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput makehosts_h makehosts_help makehosts_n_noderange @@ -241,11 +249,3 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput From 13fa0118b647e8d84b645f3624f3b2b8b8e08c10 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 28 Jul 2016 04:31:31 -0400 Subject: [PATCH 041/391] Deal with the scenario that more than 1 nic connecting to the provisioning network --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 33 +++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 93d461fd01..8d2b57d0c7 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -246,6 +246,8 @@ sub process_request { my $mactab = xCAT::Table->new("mac", -create => 1); my @ifinfo; my %usednames; + my %usednames_for_net; + my @hostnames_to_update = (); my %bydriverindex; my $forcenic = 0; #-1 is force skip, 0 is use default behavior, 1 is force to be declared even if hosttag is skipped to do so foreach (@{ $request->{mac} }) { @@ -283,10 +285,20 @@ sub process_request { my $ipn = unpack("N", inet_aton($ip)); my $mask = 2**$netbits - 1 << (32 - $netbits); my $netn = inet_ntoa(pack("N", $ipn & $mask)); - my $hosttag = gethosttag($node, $netn, @ifinfo[1], \%usednames); + my $hosttag; + if ($usednames_for_net{$netn}) { + $hosttag = $usednames_for_net{$netn}; + if ($hosttag eq $node) { + $hosttag .= "-$ifinfo[1]"; + push @hostnames_to_update, $hosttag; + } + } else { + $hosttag = gethosttag($node, $netn, @ifinfo[1], \%usednames); + } print Dumper($hosttag) . "\n"; if ($hosttag) { $usednames{$hosttag} = 1; + $usednames_for_net{$netn} = $hosttag; if ($hosttag eq $node) { $macstring .= $currmac . "|"; } else { @@ -308,6 +320,25 @@ sub process_request { } $macstring =~ s/\|\z//; $mactab->setNodeAttribs($node, { mac => $macstring }); + if (scalar @hostnames_to_update) { + my $hosttab = xCAT::Table->new('hosts'); + if ($hosttab) { + my ($ent) = $hosttab->getNodeAttribs($node, ['hostnames']); + if ($ent and $ent->{hostnames}) { + my @hostnames_array = split /,/, $ent->{hostnames}; + push @hostnames_to_update,@hostnames_array; + } + my %allhostnames = map { $_=>1 } @hostnames_to_update; + my $hostnames = join(",", (keys %allhostnames)); + $hosttab->setNodeAttribs($node, { hostnames => $hostnames }); + $hosttab->commit(); + } + my %request = ( + command => ['makehosts'], + node => [$node] + ); + $doreq->(\%request); + } my %request = ( command => ['makedhcp'], node => [$node] From 4a7591a471ccfc0e50c43b2087d049384858a1c7 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 29 Jul 2016 03:54:02 -0400 Subject: [PATCH 042/391] refine cases to remove packages on ubunt completely --- xCAT-test/autotest/testcase/go-xcat/case0 | 28 +++++++++++------------ xCAT-test/autotest/testcase/go-xcat/case1 | 16 ++++++------- xCAT-test/autotest/testcase/go-xcat/case2 | 24 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case0 b/xCAT-test/autotest/testcase/go-xcat/case0 index b5ff284e5b..e1939271cc 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case0 +++ b/xCAT-test/autotest/testcase/go-xcat/case0 @@ -1,7 +1,7 @@ start:go_xcat_local_repo_case1 description:test go_xcat with the option --xcat-core=/path/to/xcat-core.repo install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -29,7 +29,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -39,7 +39,7 @@ end start:go_xcat_local_repo_case2 description:test go_xcat with the option --xcat-core=/path/to/xcat-core install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -65,7 +65,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -75,7 +75,7 @@ end start:go_xcat_local_repo_case3 description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -101,7 +101,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -111,7 +111,7 @@ end start:go_xcat_local_repo_case4 description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar.bz2 --xcat-dep=/path/to/xcat-dep.tar.bz2 install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -137,7 +137,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -147,7 +147,7 @@ end start:go_xcat_local_repo_case5 description:test go_xcat with the option --xcat-core=/path/to/xcat-core.repo --xcat-dep=/path/to/xcat-dep.repo install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -180,7 +180,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -190,7 +190,7 @@ end start:go_xcat_local_repo_case6 description:test go_xcat with the option --xcat-core=/path/to/xcat-core --xcat-dep=/path/to/xcat-dep install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -220,7 +220,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -230,7 +230,7 @@ end start:go_xcat_local_repo_case7 description:test go_xcat with the option --xcat-core=/path/to/xcat-core.tar.bz2 --xcat-dep=/path/to/xcat-dep.tar.bz2 install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -254,7 +254,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 index e1e89b6d19..7976c0d450 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case1 +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -1,7 +1,7 @@ start:go_xcat_noinput description:test go_xcat without any input parameters os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -23,7 +23,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -33,7 +33,7 @@ end start:go_xcat_with_x description:test go_xcat with the option -x version -y install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -55,7 +55,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -65,7 +65,7 @@ end start:go_xcat_with_xcat-version-1 description:test go_xcat with the option --xcat-version=devel install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -87,7 +87,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -97,7 +97,7 @@ end start:go_xcat_with_xcat-version-2 description:test go_xcat with the option --xcat-version=$MIGRATION2_VERSION install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -120,7 +120,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 diff --git a/xCAT-test/autotest/testcase/go-xcat/case2 b/xCAT-test/autotest/testcase/go-xcat/case2 index 6729f55f50..b0fab9bc14 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case2 +++ b/xCAT-test/autotest/testcase/go-xcat/case2 @@ -1,7 +1,7 @@ start:go_xcat_online_repo_case1 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.repo install. This case is only for rh and suse os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -19,7 +19,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -29,7 +29,7 @@ end start:go_xcat_online_repo_case2 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -52,7 +52,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -62,7 +62,7 @@ end start:go_xcat_online_repo_case3 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -85,7 +85,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -95,7 +95,7 @@ end start:go_xcat_online_repo_case4 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.repo --xcat-dep=http://xcat.org/path/to/xcat-dep.repo install. This is for rh and suse. os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -112,7 +112,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -123,7 +123,7 @@ end start:go_xcat_online_repo_case5 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core --xcat-dep=http://xcat.org/path/to/xcat-dep install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -144,7 +144,7 @@ check:rc==0 cmd:xdsh $$CN "service xcatd status" check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 @@ -154,7 +154,7 @@ end start:go_xcat_online_repo_case6 description:test go_xcat with the option --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 --xcat-dep=http://xcat.org/path/to/xcat-dep.tar.bz2 install os:Linux -cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat"; else echo "Sorry,this is not supported os"; fi +cmd:if xdsh $$CN "zypper -h"; then xdsh $$CN "zypper remove -y *xCAT*"; elif xdsh $$CN "yum -h";then xdsh $$CN "yum remove -y *xCAT*"; elif xdsh $$CN "apt-get -h";then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa |grep -i perl-xcat";fi check:rc!=0 cmd:if xdsh $$CN "grep \"Red Hat\" /etc/*release >/dev/null"; then xdsh $$CN "yum install -y yum-utils bzip2"; fi @@ -176,7 +176,7 @@ cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running cmd:xdsh $$CN "service xcatd stop" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get remove perl-xcat xcat-client xcat-server xcat" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "zypper remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/zypp/repos.d/xCAT-*.repo"; elif grep "Red Hat" /etc/*release;then xdsh $$CN "yum remove -y *xCAT*" && xdsh $$CN "rm -rf /etc/yum.repos.d/xCAT-*.repo"; elif grep Ubuntu /etc/*release;then xdsh $$CN "apt-get purge perl-xcat xcat-client xcat-server xcat -y" && xdsh $$CN "rm -rf /etc/apt/sources.list.d/xcat-*.list"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "dpkg -l |grep -i perl-xcat";else xdsh $$CN "rpm -qa|grep -i perl-xcat";fi check:rc!=0 From dd31896c94c7e7b8ec7ccf196d102bfb365f19d5 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 29 Jul 2016 04:19:28 -0400 Subject: [PATCH 043/391] To have runxcmd to keep $::callback in case some module use it --- perl-xCAT/xCAT/Utils.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index 427893ae87..499c838f2a 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -1179,6 +1179,7 @@ sub runxcmd { my $save_CALLBACK = $::CALLBACK; + my $save_callback = $::callback; my ($class, $cmd, $subreq, $exitcode, $refoutput) = @_; $::RUNCMD_RC = 0; @@ -1248,7 +1249,7 @@ sub runxcmd } $::CALLBACK = $save_CALLBACK; # in case the subreq call changed it - + $::callback = $save_callback; # To keep $::callback also since some module use this global variable if ($::RUNCMD_RC) { my $displayerror = 1; From cf927f8cdbd39337794079db2c2998b6b5e9d127 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 29 Jul 2016 05:35:00 -0400 Subject: [PATCH 044/391] modify kill sub proc part depending on gongjie's comment --- .../share/xcat/tools/jenkins/xcatjktest | 54 ++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index 0d2ed43ec9..1ab31417e5 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -1214,13 +1214,28 @@ if ( !defined($pid) ) { $SIG{TERM} = $SIG{INT} = sub { if($pid) { - my $try=1; - do{ - kill 'INT', $pid; - send_msg(2, "send INT to subprocess $pid...[$try]"); - $try++; + my $try=0; + kill 'INT', $pid; + while(waitpid($pid, WNOHANG)==0){ + ++$try; + #try INT up to 4 times if need + if($try < 5){ + kill 'INT', $pid; + send_msg(2, "send INT to subprocess $pid...[$try]"); + #try TERM up to 4 times if need + }elsif($try < 9){ + kill 'TERM', $pid; + send_msg(2, "send TERM to subprocess $pid...[$try]"); + #force to kill finally + }elsif($try < 100){ + kill 'KILL', $pid; + send_msg(2, "send KILL to subprocess $pid...[$try]"); + }else{ + send_msg(2, "Can't stop pid $pid"); + last; + } sleep 1; - }while(waitpid($pid, WNOHANG)==0) + } } &cleanup; @@ -1274,13 +1289,28 @@ if($sub_process_rt) { }else{ send_msg(0, "[[main]]: regression test return out of time"); if($pid) { - my $try=1; - do{ - kill 'INT', $pid; - send_msg(2, "[[main]]: send INT to subprocess $pid...[$try]"); - $try++; + my $try=0; + kill 'INT', $pid; + while(waitpid($pid, WNOHANG)==0){ + ++$try; + #try INT up to 4 times if need + if($try < 5){ + kill 'INT', $pid; + send_msg(2, "send INT to subprocess $pid...[$try]"); + #try TERM up to 4 times if need + }elsif($try < 9){ + kill 'TERM', $pid; + send_msg(2, "send TERM to subprocess $pid...[$try]"); + #force to kill finally + }elsif($try < 100){ + kill 'KILL', $pid; + send_msg(2, "send KILL to subprocess $pid...[$try]"); + }else{ + send_msg(2, "Can't stop pid $pid"); + last; + } sleep 1; - }while(waitpid($pid, WNOHANG)==0) + } } } From fff5c05c8ab0c1578222f766a121d6799171ee7f Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 29 Jul 2016 05:42:52 -0400 Subject: [PATCH 045/391] modify signal handler part depending on gongjie's comment --- xCAT-server/share/xcat/tools/jenkins/xcatjktest | 6 ------ 1 file changed, 6 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index 1ab31417e5..9c6d9da697 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -1221,25 +1221,19 @@ $SIG{TERM} = $SIG{INT} = sub { #try INT up to 4 times if need if($try < 5){ kill 'INT', $pid; - send_msg(2, "send INT to subprocess $pid...[$try]"); #try TERM up to 4 times if need }elsif($try < 9){ kill 'TERM', $pid; - send_msg(2, "send TERM to subprocess $pid...[$try]"); #force to kill finally }elsif($try < 100){ kill 'KILL', $pid; - send_msg(2, "send KILL to subprocess $pid...[$try]"); }else{ - send_msg(2, "Can't stop pid $pid"); last; } - sleep 1; } } &cleanup; - send_msg(2, "receive TERM or INT signal to exit"); exit 0; }; From 843525e73b790c02aee8c280409f1eb6d099448c Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 29 Jul 2016 17:25:45 -0400 Subject: [PATCH 046/391] Restructure code flow for switch-based switch discovery --- .../lib/xcat/plugins/switchdiscover.pm | 224 +--------- xCAT-server/share/xcat/tools/configBNT | 403 ++++++++++++------ xCAT-server/share/xcat/tools/configMellanox | 230 ++++++++-- 3 files changed, 483 insertions(+), 374 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index cc91d76f46..e926123457 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -163,7 +163,7 @@ sub parse_args { ############################################# # Check for node range ############################################# - if ( scalar(@ARGV) eq 1 ) { + if ( scalar(@ARGV) == 1 ) { my @nodes = xCAT::NodeRange::noderange( @ARGV ); if (nodesmissed) { return (usage( "The following nodes are not defined in xCAT DB:\n " . join(',', nodesmissed))); @@ -456,7 +456,7 @@ sub process_request { if (exists($result->{$key}->{vendor})) { $vendor = $result->{$key}->{vendor}; } - if ($key != /nomac/) { + if ($key !~ /nomac/) { $mac = $key; } my $msg = sprintf $format, $ip, $name, $vendor, $key; @@ -472,11 +472,6 @@ sub process_request { } if (exists($globalopt{setup})) { - #discovered switches need to write to xcatdb before we can set them up - # It will be removed once we found predefine switch. - if (!exists($globalopt{w})) { - xCATdB($result, \%request, $sub_req); - } switchsetup($result, \%request, $sub_req); } @@ -1376,6 +1371,8 @@ sub switchsetup { my $static_ip; my $discover_switch; my @rmnodes; + my @BNTswitches; + my @MLNXswitches; #print Dumper($outhash); my $macmap = xCAT::MacMap->new(); @@ -1392,14 +1389,9 @@ sub switchsetup { # issue makehosts so we can use xdsh my $dswitch = get_hostname($outhash->{$mac}->{name}, $ip); - #add discovered switch to /etc/hosts - $output = xCAT::Utils->runxcmd({command => ["makehosts"], - node =>[$dswitch]}, $sub_req, 0, 1); - my $node = $macmap->find_mac($mac,0); if (!$node) { - send_msg($request, 0, "NO predefined switch matched this switch $dswitch with mac address $mac"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$dswitch,"ip=$ip",'status=no predefined switch'] }, $sub_req, 0, 1); + send_msg($request, 0, "NO predefined switch matched this switch $dswitch with ip address $ip and mac address $mac"); next; } @@ -1416,209 +1408,35 @@ sub switchsetup { # BNT switches if ( $stype =~ /BNT/ ) { - $ret = config_BNT($dswitch, $node, $static_ip, $request, $sub_req); - if ($ret == 1) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=dhcp:$ip",'status=config failed'] }, $sub_req, 0, 1); - } + push (@BNTswitches, $node); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=$ip",'status=Matched',"mac=$mac",'switchtype=BNT','username=root','password=admin'] }, $sub_req, 0, 1); } # Mellanox switches elsif ( $stype =~ /Mellanox/ ) { - #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now - #NOTE: this expect routine will timeout after set up address - $ret = config_Mellanox($dswitch, $node, $static_ip, $request, $sub_req); - if ($ret == 1) { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=dhcp:$ip",'status=config failed'] }, $sub_req, 0, 1); - } + push (@MLNXswitches, $node); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=$ip",'status=Matched',"mac=$mac",'switchtype=Mellanox','username=admin'] }, $sub_req, 0, 1); } else { - send_msg($request, 0, "the switch $dswitch type $stype is not support\n"); - $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype","otherinterfaces=dhcp:$ip",'status=switch type is not supported yet'] }, $sub_req, 0, 1); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype","otherinterfaces=$ip",'status=not supported',"mac=$mac"] }, $sub_req, 0, 1); } - - # save for update mac address and remove node definition - $discovered_switch->{$node}->{mac}=$mac; - push (@rmnodes, $dswitch); } - - #after switch ip address is setup to static ip - #remove discover switch definition - $output = xCAT::Utils->runxcmd({command => ["makehosts"], - node => \@rmnodes, - arg => ['-d'] }, $sub_req, 0, 1); - my $remove_nodes = join(",", @rmnodes); - my $ccmd = "rmdef $remove_nodes"; - $output = xCAT::Utils->runcmd($ccmd, 0); - #send_msg($request, 0, Dumper($output)); - #update mac address - my $mactab = xCAT::Table->new('mac'); - if ($mactab) { - $mactab->setNodesAttribs($discovered_switch); + if (@BNTswitches) { + my $bntsw = join(",",@BNTswitches); + send_msg($request, 0, "call to config BNT switches $bntsw\n"); + my $out = `/opt/xcat/share/xcat/tools/configBNT --range $bntsw --all`; + send_msg($request, 0, "output = $out\n"); + } + if (@MLNXswitches) { + my $mlnxsw = join(",",@MLNXswitches); + send_msg($request, 0, "call to config Mellanox switches $mlnxsw\n"); + my $out = `/opt/xcat/share/xcat/tools/configMellanox --range $mlnxsw --all`; + send_msg($request, 0, "output = $out\n"); } return; } -#-------------------------------------------------------------------------------- -=head3 config_BNT - config BNT switches - ---setup static ip address - ---setup hostname - ---set default user/password - Arguments: - dswitch: discovered switch - node: predefine switch - ip: static ip address - Returns: - result: -=cut -#-------------------------------------------------------------------------------- - -sub config_BNT { - my $dswitch=shift; - my $node = shift; - my $static_ip = shift; - my $request = shift; - my $sub_req = shift; - my $dshcmd; - my $ret; - - #xdsh switch-192-168-5-152 --devicetype EthSwitch::BNT - # "enable;configure terminal;show interface ip;interface ip 1;ip address 192.168.5.22" - $dshcmd="enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$dswitch], - arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); - #send_msg($request, 0, Dumper($output)); - - #add default attribute for BNT switch - my $ret = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=root','password=admin','protocol=telnet','switchtype=BNT','otherinterfaces=','status='] }, $sub_req, 0, 1); - #send_msg($request, 0, Dumper($ret)); - - #set up hostname - $dshcmd="enable;configure terminal;hostname $node;write memory"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$node], - arg => ["--devicetype", "EthSwitch::BNT", "$dshcmd"] }, $sub_req, 0, 1); - if ($::RUNCMD_RC != 0) - { - send_msg($request, 0, "Failed to change hostname on $node"); - return 1; - } - - return 0; -} - -#-------------------------------------------------------------------------------- -=head3 config_Mellanox - config Mellanox switches - ---setup static ip address - ---setup hostname - ---set default user/password - Arguments: - dswitch: discovered switch - node: predefine switch - ip: static ip address - Returns: - result: -=cut -#-------------------------------------------------------------------------------- - -sub config_Mellanox { - my $dswitch=shift; - my $node = shift; - my $static_ip = shift; - my $request = shift; - my $sub_req = shift; - my $dshcmd; - my $mask; - - # get netmask from network table - my $nettab = xCAT::Table->new("networks"); - if ($nettab) { - my @nets = $nettab->getAllAttribs('net','mask'); - foreach my $net (@nets) { - if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) { - $mask=$net->{'mask'}; - } - } - } - - #set static ip address the mgmt0, we don't have EthSwitch yet, will use IBSwitch for now - #NOTE: this expect routine will timeout after set up address - - my $myexp = new Expect; - my $timeout = 10; - my $login_cmd = "ssh -ladmin $dswitch\r"; - my $first_prompt = "^.*>"; - my $config_prompt="^.*#"; - my $cfg_ip="no interface mgmt0 dhcp\r"; - my $cfg_ip1="interface mgmt0 ip address $static_ip $mask\r"; - - unless ($myexp->spawn($login_cmd)) - { - $myexp->soft_close(); - send_msg($request, 0, "Unable to run $login_cmd\n"); - next; - } - - my @result = $myexp->expect( - $timeout, - [ - "-re", $first_prompt, - sub { - $myexp->clear_accum(); - $myexp->send("enable\r"); - $myexp->clear_accum(); - $myexp->send("configure terminal\r"); - $myexp->clear_accum(); - $myexp->exp_continue(); - } - ], - [ - "-re", $config_prompt, - sub { - $myexp->clear_accum(); - $myexp->send($cfg_ip); - $myexp->send($cfg_ip1); - $myexp->clear_accum(); - $myexp->send("configuration write\r"); - $myexp->send("exit\r"); - $myexp->send("exit\r"); - } - ], - ); - if (defined($result[1])) - { - my $errmsg = $result[1]; - $myexp->soft_close(); - send_msg($request,0,"Failed expect command $errmsg\n"); - } - - $myexp->soft_close(); - - #add default attribute for Mellanox switch - $output = xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip",'username=admin','switchtype=Mellanox','otherinterfaces=','status='] }, $sub_req, 0, 1); - #send_msg($request, 0, Dumper($output)); - - - #set up hostname - $dshcmd="enable;configure terminal;hostname $node;configuration write"; - $output = xCAT::Utils->runxcmd({command => ["xdsh"], - node =>[$node], - arg => ["-l", "admin", "--devicetype", "IBSwitch::Mellanox", "$dshcmd"] }, $sub_req, 0, 1); - if ($::RUNCMD_RC != 0) - { - send_msg($request, 0, "Failed to change hostname on $node"); - return 1; - } - - return 0; -} - - - - 1; diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/tools/configBNT index 89e3801039..c17271c52b 100755 --- a/xCAT-server/share/xcat/tools/configBNT +++ b/xCAT-server/share/xcat/tools/configBNT @@ -4,9 +4,25 @@ # Configure Ethnet BNT switches #--------------------------------------------------------- +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + + use strict; +use Socket; use Getopt::Long; use Expect; +use xCAT::Usage; +use xCAT::NodeRange; +use xCAT::NetworkUtils; +use xCAT::Utils; +use xCAT::Table; +use xCAT::MsgUtils; + my $args = join ' ', @ARGV; $::command = "$0 $args"; @@ -14,6 +30,10 @@ $::command = "$0 $args"; Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; +#global variables +my @nodes; +my @filternodes; + #--------------------------------------------------------- #Main @@ -22,13 +42,16 @@ $Getopt::Long::ignorecase = 0; if ( !GetOptions( 'h|help' => \$::HELP, - 'r|range=s' => \$::SWITCH, - 'p|port=s' => \$::PORT, - 'v|vlan=s' => \$::VLAN, - 'u|user=s' => \$::USER, - 'w|password=s' => \$::PASSWORD, - 'g|group=s' => \$::GROUP, + 'range=s' => \$::SWITCH, + 'port=s' => \$::PORT, + 'vlan=s' => \$::VLAN, + 'user=s' => \$::USER, + 'password=s' => \$::PASSWORD, + 'group=s' => \$::GROUP, 'snmp' => \$::SNMP, + 'ip' => \$::IP, + 'name' => \$::NAME, + 'all' => \$::ALL, ) ) { @@ -43,54 +66,146 @@ if ($::HELP) exit(0); } -my $switch; -if ($::SWITCH) -{ - $switch = $::SWITCH; +if ($::SWITCH) { + my @filternodes = xCAT::NodeRange::noderange( $::SWITCH ); + if (nodesmissed) { + my $nodenotdefined = join(',', nodesmissed); + xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); + } + foreach (@filternodes) { + push @nodes, $_; + } + unless (@nodes) { + xCAT::MsgUtils->message("E","No Valid Switch to process"); + exit(1); + } } else { + xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --range"); &usage; exit(1); } +my $switches = join(",",@nodes); my $cmd; - my $vlan; my $port; -if ($::VLAN) -{ - if ($::PORT) { - $port = $::PORT; - } else { - print "Need port number to set up VLAN\n"; - &usage; - exit(1); - } - $vlan = $::VLAN; - print "Tagging VLAN=$vlan for $switch port $port\n"; - #create vlan - #tagged vlan - $cmd = `xdsh $switch --devicetype EthSwitch::BNT "enable;configure terminal;vlan $vlan;exit;interface port $port;switchport mode trunk;switchport trunk allowed vlan $vlan;write memory;exit;exit"`; +my $sub_req; +my $switch; +my $rc; + +if ($::ALL) { + config_ip(); + config_hostname(); + config_snmp(); } +if ($::IP) +{ + config_ip(); +} + +if ($::NAME) +{ + config_hostname(); +} +if ($::SNMP) +{ + config_snmp(); +} +if ($::VLAN) +{ + config_vlan(); +} + +sub config_ip { + + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['otherinterfaces']); + foreach my $switch (@nodes) { + print "change $switch to static ip address\n"; + my $dip= $nodehash->{$switch}->[0]->{otherinterfaces}; + + #get hostname + my $dswitch = xCAT::NetworkUtils->gethostname($dip); + + #if not defined, need to create one for xdsh to use + if (!$dswitch) { + my $ip_str = $dip; + $ip_str =~ s/\./\-/g; + $dswitch = "switch-$ip_str"; + #is there other way we can check if this node is defined in the xCATdb + $cmd = "lsdef $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + $cmd = "mkdef -t node -o $dswitch groups=switch ip=$dip switchtype=BNT username=root password=admin protocol=telnet nodetype=switch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + } + #check if it is in the /etc/hosts + my $output = `grep $dswitch /etc/hosts`; + if ( !$output ) { + $cmd = "makehosts $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + # verify if xdsh works + $cmd = "xdsh $dswitch --devicetype EthSwitch::BNT 'enable;configure terminal;exit' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Couldn't communicate with $dswitch, $dip"); + next; + } + #change to static ip address + my $static_ip = xCAT::NetworkUtils->getipaddr($switch); + if (!$static_ip){ + xCAT::MsgUtils->message("E","static ip is not defined for $switch"); + next; + } + $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT 'enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + print "finish setup static ip address for $switch\n"; + + #update switch status + $cmd = "chdef $switch status=ip_configed otherinterface="; + $rc= xCAT::Utils->runcmd($cmd, 0); + + #remove discover switch from xCATdb and /etc/hosts + $cmd = "makehosts -d $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "rmdef $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } +} + +sub config_hostname { + my $switchtab = xCAT::Table->new('switches'); + my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','sshpassword']); + foreach my $switch (@nodes) { + my $user= $switchhash->{$switch}->[0]->{sshusername}; + my $pwd= $switchhash->{$switch}->[0]->{sshpassword}; + if ((!$user)||(!$pwd)) { + print "switch ssh username or password is not define, add default one\n"; + $cmd = "chdef $switch username=root password=admin"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + $cmd="xdsh $switch --devicetype EthSwitch::BNT 'enable;configure terminal;hostname $switch;write memory' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to setup hostname for $switch"); + next; + } + #update switch status + $cmd = "chdef $switch status=hostname_configed" ; + $rc= xCAT::Utils->runcmd($cmd, 0); + } +} + + #setup secure SNMP v3 -if ($::SNMP){ - my $mysw; - my $enable_cmd="enable\r"; - my $config_cmd="configure terminal\r"; - my $exit_cmd="exit\r"; - - my $pwd_prompt = "password: "; - my $sw_prompt = "$switch>"; - my $enable_prompt="$switch#"; - my $config_prompt="^.*\\\(config\\\)\#"; - - $mysw = new Expect; - my $timeout = 20; - my $login_cmd = "telnet $switch\r"; - my $passwd = "admin\r"; +sub config_snmp { my $snmp_user; my $snmp_passwd; my $snmp_group; + if ($::USER) { $snmp_user = $::USER; } else { @@ -107,99 +222,132 @@ if ($::SNMP){ } else { $snmp_group = "xcatgroup\r"; } - print "Setup SNMP server for user=$snmp_user, password=$snmp_passwd, group=$snmp_group\n"; - #create a SNMP user - my $cfg_user1="snmp-server user 5 name $snmp_user\r"; - my $cfg_user2="snmp-server user 5 authentication-protocol sha authentication-password\r"; - #create a SNMP group - my $cfg_group1="snmp-server group 5 group-name $snmp_group\r"; - my $cfg_group2="snmp-server group 5 user-name $snmp_user\r"; - my $cfg_group3="snmp-server group 5 security usm\r"; - #Add access permission - my $cfg_access1="snmp-server access 5 name $snmp_group\r"; - my $cfg_access2="snmp-server access 5 level authNoPriv\r"; - my $cfg_access3="snmp-server access 5 security usm\r"; - my $cfg_access4="snmp-server access 5 read-view iso\r"; - $mysw->slave->stty(qw(sane -echo)); + foreach my $switch (@nodes) { + my $mysw; + my $enable_cmd="enable\r"; + my $config_cmd="configure terminal\r"; + my $exit_cmd="exit\r"; - unless ($mysw->spawn($login_cmd)) - { + my $pwd_prompt = "password: "; + my $sw_prompt = "$switch>"; + my $enable_prompt="$switch#"; + my $config_prompt="^.*\\\(config\\\)\#"; + + $mysw = new Expect; + my $timeout = 20; + my $login_cmd = "telnet $switch\r"; + my $passwd = "admin\r"; + + print "Setup SNMP server for $switch\n"; + #create a SNMP user + my $cfg_user1="snmp-server user 5 name $snmp_user\r"; + my $cfg_user2="snmp-server user 5 authentication-protocol sha authentication-password\r"; + #create a SNMP group + my $cfg_group1="snmp-server group 5 group-name $snmp_group\r"; + my $cfg_group2="snmp-server group 5 user-name $snmp_user\r"; + my $cfg_group3="snmp-server group 5 security usm\r"; + #Add access permission + my $cfg_access1="snmp-server access 5 name $snmp_group\r"; + my $cfg_access2="snmp-server access 5 level authNoPriv\r"; + my $cfg_access3="snmp-server access 5 security usm\r"; + my $cfg_access4="snmp-server access 5 read-view iso\r"; + + $mysw->slave->stty(qw(sane -echo)); + + unless ($mysw->spawn($login_cmd)) + { + $mysw->soft_close(); + print "Unable to run $login_cmd\n"; + next; + } + my @result = $mysw->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysw->clear_accum(); + $mysw->send("$passwd\r"); + $mysw->clear_accum(); + $mysw->exp_continue(); + } + ], + [ + "-re", $sw_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($enable_cmd); + $mysw->exp_continue(); + } + ], + [ + "-re", $enable_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($config_cmd); + $mysw->exp_continue(); + } + ], + [ + "-re", $config_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($cfg_user1); + $mysw->send($cfg_user2); + $mysw->send($passwd); + $mysw->send($snmp_passwd); + $mysw->send($snmp_passwd); + sleep 1; + $mysw->clear_accum(); + # create snmp group + $mysw->send($cfg_group1); + $mysw->send($cfg_group2); + $mysw->send($cfg_group3); + $mysw->clear_accum(); + $mysw->send($cfg_access1); + $mysw->send($cfg_access2); + $mysw->send($cfg_access3); + $mysw->send($cfg_access4); + $mysw->clear_accum(); + $mysw->send("write memory\r"); + $mysw->send($exit_cmd); + $mysw->send($exit_cmd); + } + ], + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysw->soft_close(); + print "Failed expect command $errmsg\n"; + exit(1); + } $mysw->soft_close(); - print "Unable to run $login_cmd\n"; - next; + + #update switch status + $cmd = "chdef $switch status=switch_configed" ; + $rc= xCAT::Utils->runcmd($cmd, 0); } - my @result = $mysw->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysw->clear_accum(); - $mysw->send("$passwd\r"); - $mysw->clear_accum(); - $mysw->exp_continue(); - } - ], - [ - "-re", $sw_prompt, - sub { - #print "$switch: sending enable command: $enable_cmd\n"; - $mysw->clear_accum(); - $mysw->send($enable_cmd); - $mysw->exp_continue(); - } - ], - [ - "-re", $enable_prompt, - sub { - #print "$switch: sending config command: $config_cmd\n"; - $mysw->clear_accum(); - $mysw->send($config_cmd); - $mysw->exp_continue(); - } - ], - [ - "-re", $config_prompt, - sub { - $mysw->clear_accum(); - $mysw->send($cfg_user1); - $mysw->send($cfg_user2); - $mysw->send($passwd); - $mysw->send($snmp_passwd); - $mysw->send($snmp_passwd); - sleep 1; - $mysw->clear_accum(); - # create snmp group - $mysw->send($cfg_group1); - $mysw->send($cfg_group2); - $mysw->send($cfg_group3); - $mysw->clear_accum(); - $mysw->send($cfg_access1); - $mysw->send($cfg_access2); - $mysw->send($cfg_access3); - $mysw->send($cfg_access4); - $mysw->clear_accum(); - $mysw->send("write memory\r"); - $mysw->send($exit_cmd); - $mysw->send($exit_cmd); - } - ], - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysw->soft_close(); - print "Failed expect command $errmsg\n"; +} + +sub config_vlan { + if ($::PORT) { + $port = $::PORT; + } else { + &usage; exit(1); } - $mysw->soft_close(); + $vlan = $::VLAN; + print "Tagging VLAN=$vlan for $switches port $port\n"; + #create vlan, tagged vlan + $cmd = `xdsh $switches --devicetype EthSwitch::BNT "enable;configure terminal;vlan $vlan;exit;interface port $port;switchport mode trunk;switchport trunk allowed vlan $vlan;write memory;exit;exit"`; - } + #--------------------------------------------------------- =head3 usage @@ -213,8 +361,11 @@ sub usage { print "Usage: configBNT [-?│-h│--help] - configBNT [--range switchnames] [-p|--port port] [-v|--vlan vlan] - configBNT [--range switchnames] [--snmp] [-u|--user snmp_user] [-w|--password snmp_password] [-g|--group snmp_group] + configBNT [--range switchnames] [--all] + configBNT [--range switchnames] [--ip] + configBNT [--range switchnames] [--name ] + configBNT [--range switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] + configBNT [--range switchnames] [--port port] [--vlan vlan] \n"; } diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/tools/configMellanox index 647a3c2d67..ebf8db8f58 100755 --- a/xCAT-server/share/xcat/tools/configMellanox +++ b/xCAT-server/share/xcat/tools/configMellanox @@ -4,9 +4,24 @@ # Configure Ethnet Mellonax switches #--------------------------------------------------------- +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + + use strict; use Getopt::Long; use Expect; +use xCAT::Usage; +use xCAT::NodeRange; +use xCAT::NetworkUtils; +use xCAT::Utils; +use xCAT::Table; +use xCAT::MsgUtils; + my $args = join ' ', @ARGV; $::command = "$0 $args"; @@ -14,6 +29,10 @@ $::command = "$0 $args"; Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; +#global variables +my @nodes; +my @filternodes; + #--------------------------------------------------------- #Main @@ -21,10 +40,12 @@ $Getopt::Long::ignorecase = 0; # parse the options if ( !GetOptions( - 'h|help' => \$::HELP, - 'r|range=s' => \$::SWITCH, - 'u|user=s' => \$::USER, - 'i|ip=s' => \$::IP, + 'h|help' => \$::HELP, + 'range=s' => \$::SWITCH, + 'config' => \$::CONFIG, + 'ip' => \$::IP, + 'name' => \$::NAME, + 'all' => \$::ALL, ) ) { @@ -39,61 +60,177 @@ if ($::HELP) exit(0); } -my $switch; if ($::SWITCH) { - $switch = $::SWITCH; + my @filternodes = xCAT::NodeRange::noderange( $::SWITCH ); + if (nodesmissed) { + my $nodenotdefined = join(',', nodesmissed); + xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); + } + foreach (@filternodes) { + push @nodes, $_; + } + unless (@nodes) { + xCAT::MsgUtils->message("E","No Valid Switch to process"); + exit(1); + } } else { + xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --range"); &usage; exit(1); } +my $switches = join(",",@nodes); my $user; - -if ($::USER) -{ - $user = $::USER; -} else { - &usage; - exit(1); -} - -my $ip; -if ($::IP) -{ - $ip = $::IP; -} else { - &usage; - exit(1); -} - - my $cmd; +my $switch; +my $rc; +my $master; -#default root/password and protcol for Mellonax switch -$cmd = `chtab switch=$switch switches.sshusername=$user`; -print $cmd; +if ($::ALL) { + config_ip(); + config_hostname(); + run_rspconfig(); +} +if ($::IP) { + config_ip(); +} -#call rspconfig command to setup switch -#enable ssh -$cmd=`rspconfig $switch sshcfg=enable`; -print $cmd; +if ($::NAME) { + config_hostname(); +} -#enable snmp function on the switch -$cmd=`rspconfig $switch snmpcfg=enable`; -print $cmd; -#enable the snmp trap -$cmd=`rspconfig $switch alert=enable`; -print $cmd; +if ($::CONFIG) +{ + run_rspconfig(); +} -#Logging destination: -$cmd=`rspconfig $switch logdest=$ip`; -print $cmd; -#config ntp -$cmd = `xdsh $switch -l $user --devicetype IBSwitch::Mellanox "enable;configure terminal;ntp enable;ntpdate $ip; ntp server $ip;configuration write;show ntp" `; -print $cmd; +sub config_ip { + # get host table for otherinterfaces + my $nodetab = xCAT::Table->new('hosts'); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['otherinterfaces']); + # get netmask from network table + my $nettab = xCAT::Table->new("networks"); + my @nets; + if ($nettab) { + @nets = $nettab->getAllAttribs('net','mask'); + } + foreach my $switch (@nodes) { + print "change $switch to static ip address\n"; + my $dip= $nodehash->{$switch}->[0]->{otherinterfaces}; + + #get hostname + my $dswitch = xCAT::NetworkUtils->gethostname($dip); + + #if not defined, need to create one for xdsh to use + if (!$dswitch) { + my $ip_str = $dip; + $ip_str =~ s/\./\-/g; + $dswitch = "switch-$ip_str"; + #is there other way we can check if this node is defined in the xCATdb + $cmd = "lsdef $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + $cmd = "mkdef -t node -o $dswitch groups=switch ip=$dip switchtype=Mellanox username=admin nodetype=switch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + } + #check if it is in the /etc/hosts + my $output = `grep $dswitch /etc/hosts`; + if ( !$output ) { + $cmd = "makehosts $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + # verify if xdsh works + $cmd = "xdsh $dswitch -l admin --devicetype IBSwitch::Mellanox 'enable;configure terminal;exit' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Couldn't communicate with $dswitch, $dip"); + next; + } + #change to static ip address + my $static_ip = xCAT::NetworkUtils->getipaddr($switch); + if (!$static_ip){ + xCAT::MsgUtils->message("E","static ip is not defined for $switch"); + next; + } + #get netmask + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $static_ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + } + } + + $cmd="xdsh $dswitch -t 10 -l admin --devicetype IBSwitch::Mellanox 'enable;configure terminal;no interface mgmt0 dhcp;interface mgmt0 ip address $static_ip $mask;configuration write;exit;exit' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + + #update switch status + $cmd = "chdef $switch status=ip_configed otherinterface="; + $rc= xCAT::Utils->runcmd($cmd, 0); + + #remove discover switch from xCATdb and /etc/hosts + $cmd = "makehosts -d $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "rmdef $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } +} + +sub config_hostname { + my $switchtab = xCAT::Table->new('switches'); + my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername']); + foreach my $switch (@nodes) { + my $user= $switchhash->{$switch}->[0]->{sshusername}; + if (!$user) { + print "switch ssh username is not defined, add default one\n"; + $cmd = "chdef $switch username=admin"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $user="admin"; + } + $cmd="xdsh $switch -l $user --devicetype IBSwitch::Mellanox 'enable;configure terminal;hostname $switch;configuration write' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to setup hostname for $switch"); + next; + } + #update switch status + $cmd = "chdef $switch status=hostname_configed" ; + $rc= xCAT::Utils->runcmd($cmd, 0); + } +} + +sub run_rspconfig { + my $switchtab = xCAT::Table->new('switches'); + my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername']); + $master = `hostname -i`; + print "master=$master\n"; + foreach my $switch (@nodes) { + my $user= $switchhash->{$switch}->[0]->{sshusername}; + #call rspconfig command to setup switch + #enable ssh + $cmd=`rspconfig $switch sshcfg=enable`; + + #enable snmp function on the switch + $cmd=`rspconfig $switch snmpcfg=enable`; + + #enable the snmp trap + $cmd=`rspconfig $switch alert=enable`; + + #Logging destination: + $cmd=`rspconfig $switch logdest=$master`; + + #config ntp + $cmd = `xdsh $switch -l $user --devicetype IBSwitch::Mellanox "enable;configure terminal;ntp enable;ntpdate $master; ntp server $master;configuration write;show ntp" `; + + #update switch status + $cmd = "chdef $switch status=switch_configed" ; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + +} #--------------------------------------------------------- @@ -108,7 +245,10 @@ sub usage { print "Usage: configMellonax [-?│-h│--help] - configMellonax [--range switchnames] [-u|--user sshusername] [-i|--ip xcatMN_ip_address] + configMellonax [--range switchnames] [--all] + configMellonax [--range switchnames] [--ip] + configMellonax [--range switchnames] [--name] + configMellonax [--range switchnames] [--config] \n"; } From bae1f51546d854deffa2edd5971be4c1ede0f73b Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 29 Jul 2016 11:39:30 -0400 Subject: [PATCH 047/391] add description of subroutine get_disks_by_userspecs --- xCAT-server/lib/xcat/plugins/kvm.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 22ed3f414c..d0d8eab119 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -2522,6 +2522,31 @@ sub chvm { } } +####################################################################### +# get_disks_by_userspecs +# Description: get the storage device info ( xml and source file ) of +# the user specified disk devices +# Arguments: +# $specs : ref to the user specified disk name list +# $xml : the xml string of the domain +# $returnmoddedxml : switch on whether to prepend +# the domain xml with the user specified disk removed +# to the beginning of the return array +# Return : +# An array with the structure +# [ +# (optional: with the user specified disk removed, +# exist only if $returnmoddedxml specified), +# [, ], +# [, ], +# ... +# ] +# Example : +# 1. my @disklist = get_disks_by_userspecs(\@diskname, $vmxml, 'returnmoddedxml'); +# my $moddedxml = shift @disklist; +# 2. my @disklist = get_disks_by_userspecs(\@diskname, $vmxml) +# +####################################################################### sub get_disks_by_userspecs { my $specs = shift; my $xml = shift; From caadc87bb5ead9c197030caf883c0597816ce4ae Mon Sep 17 00:00:00 2001 From: chenglch Date: Sun, 31 Jul 2016 22:47:47 -0400 Subject: [PATCH 048/391] Propagate signal via ssh even though pipe broken can not be detected Add `-tt` option to force tty allocation when running ssh command close-issue: #1609 --- perl-xCAT/xCAT/SSH.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/SSH.pm b/perl-xCAT/xCAT/SSH.pm index 182671abbc..c1de602afb 100644 --- a/perl-xCAT/xCAT/SSH.pm +++ b/perl-xCAT/xCAT/SSH.pm @@ -75,6 +75,7 @@ sub remote_shell_command { if ($ssh_version eq 'OpenSSH') { push @command, '-o'; push @command, 'BatchMode=yes'; + push @command, '-tt'; ($$config{'options'} !~ /-X/) && push @command, '-x'; } From 4efa05ddb5fe181f9a54113d1d1c7b0b6fb66c8d Mon Sep 17 00:00:00 2001 From: ertaozh Date: Sun, 31 Jul 2016 22:58:47 -0400 Subject: [PATCH 049/391] Deal with hostname which is alias of the predefined node --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index 8d2b57d0c7..e992f6d0e3 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -285,15 +285,15 @@ sub process_request { my $ipn = unpack("N", inet_aton($ip)); my $mask = 2**$netbits - 1 << (32 - $netbits); my $netn = inet_ntoa(pack("N", $ipn & $mask)); - my $hosttag; - if ($usednames_for_net{$netn}) { - $hosttag = $usednames_for_net{$netn}; - if ($hosttag eq $node) { - $hosttag .= "-$ifinfo[1]"; + my $hosttag = gethosttag($node, $netn, @ifinfo[1], \%usednames); + unless ($hosttag) { + my $nettagname = $usednames_for_net{$netn}; + # For nics not in the install network, don't deal with them if not an avaliable hostname get + # In case another nic in install network get a hosttag other than nodename, need to compare the IP address they can convert to + if ($nettagname and (inet_aton($nettagname) eq inet_aton($node))) { + $hosttag = "$node-$ifinfo[1]"; push @hostnames_to_update, $hosttag; } - } else { - $hosttag = gethosttag($node, $netn, @ifinfo[1], \%usednames); } print Dumper($hosttag) . "\n"; if ($hosttag) { From 42fbc5fe8e231b25c281b9cd778fb5caf35a8291 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Tue, 2 Aug 2016 13:55:24 +0800 Subject: [PATCH 050/391] enable the log can be forwarded to mn (#1532) --- xCAT/postscripts/xcatlib.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh index de54c3f90f..68de2f95ef 100755 --- a/xCAT/postscripts/xcatlib.sh +++ b/xCAT/postscripts/xcatlib.sh @@ -761,7 +761,22 @@ function msgutil_r { if [ -n "$logserver" ];then - logger -n $logserver -t xcat -p local4.$msgtype "$msgstr" >/dev/null 2>&1 + #In Ubuntu, there is a bug in some logger version that "-n" is ignored. The workaround is to specify the + #"-u " option together with "-n" option. + #So far as we know, this bug exists in logger 2.20 shipped in ubuntu 14.04.4 and + #has been fixed in logger 2.25 shipped in ubuntu 15.04. Since "-u" option won't break anything, + #use "-u xxxx" for the logger versions under 2.25 + if [ -f /etc/os-release ] && cat /etc/os-release |grep -i NAME|grep -i Ubuntu>/dev/null 2>&1 + then + eval $(logger -V 2>/dev/null | awk '{print $4}' | awk -F '.' '{printf("var1=%s; var2=%s",$1,$2)}') + if [ $var1 -eq 2 ] && [ $var2 -lt 25 ]; then + logger -u /tmp/ignored -n $logserver -t xcat -p local4.$msgtype "$msgstr" >/dev/null 2>&1 + else + logger -n $logserver -t xcat -p local4.$msgtype "$msgstr" >/dev/null 2>&1 + fi + else + logger -n $logserver -t xcat -p local4.$msgtype "$msgstr" >/dev/null 2>&1 + fi if [ "$?" != "0" ];then exec 3<>/dev/udp/$logserver/514 && logger -s -t xcat -p local4.$msgtype "$msgstr" 1>&3 2>&1 && exec 3>&- if [ "$?" != "0" ];then From 91954591edca09d60da1ff8182f32b0e638fe000 Mon Sep 17 00:00:00 2001 From: zet809 Date: Tue, 2 Aug 2016 14:44:18 +0800 Subject: [PATCH 051/391] To support more than 1 nics connect to the install network (#1613) --- xCAT-server/lib/xcat/plugins/nodediscover.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index e992f6d0e3..bf512cce7b 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -298,7 +298,9 @@ sub process_request { print Dumper($hosttag) . "\n"; if ($hosttag) { $usednames{$hosttag} = 1; - $usednames_for_net{$netn} = $hosttag; + unless ($usednames_for_net{$netn}) { + $usednames_for_net{$netn} = $hosttag; + } if ($hosttag eq $node) { $macstring .= $currmac . "|"; } else { From d47f5f6cdaacc358a7c08ea8a14b369d43105820 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 2 Aug 2016 04:11:31 -0400 Subject: [PATCH 052/391] delete useless files and add new ones --- .../bundle/ubuntu16.04.1_ppc64le.bundle | 251 +++++++++++++++++ .../bundle/ubuntu16.04.1_x86_64.bundle | 260 ++++++++++++++++++ 2 files changed, 511 insertions(+) create mode 100644 xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle create mode 100644 xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle new file mode 100644 index 0000000000..ae76c787ff --- /dev/null +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -0,0 +1,251 @@ +Diskless_installation_flat_p8_le +Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput +makehosts_h +makehosts_help +makehosts_n_noderange +makehosts_n +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +packimage_o_p_a_m +packimage_p_a_o +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a_ubuntu +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_specificvalue +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_tab +xcatstanzafile_normal +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_err_node +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_ubuntu_n +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err +addkit_v +addkit_h +addkit_kit +addkit_i +addkit_multikit +addkit_p +addkitcomp_v +addkitcomp_h +addkitcomp_i +addkitcomp_f +buildkit_v +buildkit_h +buildkit_create +buildkit_create_l +buildkit_cleanrepo_all +buildkit_buildtar +chkkitcomp_v +chkkitcomp_h +chkkitcomp_V +lskit_v +lskit_h +lskit_F +lskit_K +lskit_R +lskit_C +lskitcomp_v +lskitcomp_h +lskitcomp_C +lskitcomp_S +lskitdeployparam_v +lskitdeployparam_h +lskitdeployparam_no_param +lskitdeployparam_k_1 +lskitdeployparam_c_1 +rmkit_v +rmkit_h +rmkit_t_no +rmkit_t_yes +rmkit_f +rmkit_V +rmkitcomp_v +rmkitcomp_h +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +xcatd_start_systemd +xcatd_stop_systemd +xcatd_restart_systemd +run_command_with_XCATBYPASS_systemd +disable_root_permission_in_policy_table_systemd +assign_certain_command_permission_systemd diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle new file mode 100644 index 0000000000..0fd26a629f --- /dev/null +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -0,0 +1,260 @@ +Ubuntu_diskless_installation_flat_x86_vm +Ubuntu_full_installation_flat_x86_vm +makehosts_h +makehosts_help +makehosts_n_noderange +makehosts_n +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +packimage_o_p_a_m +packimage_p_a_o +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a_ubuntu +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_normal +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_noderange +nodestat_err_node +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_ubuntu_n +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err +addkit_v +addkit_h +addkit_kit +addkit_i +addkit_multikit +addkit_p +addkitcomp_v +addkitcomp_h +addkitcomp_i +addkitcomp_f +buildkit_v +buildkit_h +buildkit_create +buildkit_create_l +buildkit_buildrepo_all +buildkit_buildrepo_ubuntu +buildkit_cleanrepo_all +buildkit_cleanrepo_ubuntu +buildkit_listrepo +buildkit_buildtar +buildkit_cleantar +buildkit_partialkit_ubuntu +buildkit_partialkit_completekit +chkkitcomp_v +chkkitcomp_h +chkkitcomp_V +lskit_v +lskit_h +lskit_F +lskit_K +lskit_R +lskit_C +lskitcomp_v +lskitcomp_h +lskitcomp_C +lskitcomp_S +lskitdeployparam_v +lskitdeployparam_h +lskitdeployparam_no_param +lskitdeployparam_k_1 +lskitdeployparam_c_1 +rmkit_v +rmkit_h +rmkit_t_no +rmkit_t_yes +rmkit_f +rmkit_V +rmkitcomp_v +rmkitcomp_h +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +xcatd_start_systemd +xcatd_stop_systemd +xcatd_restart_systemd +run_command_with_XCATBYPASS_systemd +disable_root_permission_in_policy_table_systemd +assign_certain_command_permission_systemd +nodeset_check_warninginfo +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput From 4d91d4ee1c5a72912582c836fe2d4f02c5b0febd Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 2 Aug 2016 04:12:31 -0400 Subject: [PATCH 053/391] delete useless files --- xCAT-test/autotest/bundle/le_rhels_cmd.bundle | 193 ------------ xCAT-test/autotest/bundle/le_sles_cmd.bundle | 197 ------------ .../autotest/bundle/le_ubuntu_cmd.bundle | 240 -------------- xCAT-test/autotest/bundle/p_rhels_cmd.bundle | 296 ------------------ xCAT-test/autotest/bundle/p_sles_cmd.bundle | 260 --------------- xCAT-test/autotest/bundle/x_rhels_cmd.bundle | 199 ------------ xCAT-test/autotest/bundle/x_sles_cmd.bundle | 209 ------------- xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle | 257 --------------- 8 files changed, 1851 deletions(-) delete mode 100644 xCAT-test/autotest/bundle/le_rhels_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/le_sles_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/le_ubuntu_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/p_rhels_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/p_sles_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/x_rhels_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/x_sles_cmd.bundle delete mode 100644 xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle diff --git a/xCAT-test/autotest/bundle/le_rhels_cmd.bundle b/xCAT-test/autotest/bundle/le_rhels_cmd.bundle deleted file mode 100644 index dce4dad648..0000000000 --- a/xCAT-test/autotest/bundle/le_rhels_cmd.bundle +++ /dev/null @@ -1,193 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_err_node -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_n -makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_i_linux -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -redhat_migration1 -redhat_migration2 diff --git a/xCAT-test/autotest/bundle/le_sles_cmd.bundle b/xCAT-test/autotest/bundle/le_sles_cmd.bundle deleted file mode 100644 index f6173e756d..0000000000 --- a/xCAT-test/autotest/bundle/le_sles_cmd.bundle +++ /dev/null @@ -1,197 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_err_symble -chtab_err_table -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_err_node -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_n -makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_i_linux -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -sles_migration1 -sles_migration2 diff --git a/xCAT-test/autotest/bundle/le_ubuntu_cmd.bundle b/xCAT-test/autotest/bundle/le_ubuntu_cmd.bundle deleted file mode 100644 index 80fccf7345..0000000000 --- a/xCAT-test/autotest/bundle/le_ubuntu_cmd.bundle +++ /dev/null @@ -1,240 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n_noderange -makehosts_n -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a_ubuntu -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_specificvalue -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_tab -xcatstanzafile_normal -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_err_node -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_ubuntu_n -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -addkit_v -addkit_h -addkit_kit -addkit_i -addkit_multikit -addkit_p -addkitcomp_v -addkitcomp_h -addkitcomp_i -addkitcomp_f -buildkit_v -buildkit_h -buildkit_create -buildkit_create_l -buildkit_cleanrepo_all -buildkit_buildtar -chkkitcomp_v -chkkitcomp_h -chkkitcomp_V -lskit_v -lskit_h -lskit_F -lskit_K -lskit_R -lskit_C -lskitcomp_v -lskitcomp_h -lskitcomp_C -lskitcomp_S -lskitdeployparam_v -lskitdeployparam_h -lskitdeployparam_no_param -lskitdeployparam_k_1 -lskitdeployparam_c_1 -rmkit_v -rmkit_h -rmkit_t_no -rmkit_t_yes -rmkit_f -rmkit_V -rmkitcomp_v -rmkitcomp_h -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -xcatd_start -xcatd_stop -xcatd_restart -run_command_with_XCATBYPASS -disable_root_permission_in_policy_table -assign_certain_command_permission -ubuntu_migration1_p8le -ubuntu_migration2_p8le diff --git a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle b/xCAT-test/autotest/bundle/p_rhels_cmd.bundle deleted file mode 100644 index 886f512ba3..0000000000 --- a/xCAT-test/autotest/bundle/p_rhels_cmd.bundle +++ /dev/null @@ -1,296 +0,0 @@ -updatenode_h -updatenode_v -updatenode_diskful_syncfiles -updatenode_diskful_syncfiles_rename -updatenode_diskful_syncfiles_dir -updatenode_diskful_syncfiles_multi_files -updatenode_syncfile_EXECUTE -updatenode_syncfile_EXECUTEALWAYS -updatenode_syncfile_APPEND -updatenode_syncfile_MERGE -updatenode_P_script1 -updatenode_P_script2 -updatenode_f_incompatible_flags -updatenode_k_incompatible_flags -updatenode_diskful_syncfiles_P_script1 -updatenode_script3 -updatenode_P_script1_script2 -updatenode_without_flag -chdef_null -chdef_t_node -chdef_t_network -chdef_p -chdef_m -chdef_z -chdef_group -chdef_group_p -chdef_dynamic_group -chdef_multiple_keys -chdef_n -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -getmacs_noderange -getmacs_d -getmacs_f_D -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -lslite_i -lslite_noderange -lslite_h -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_normal -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_err_node -rinv_bus -rinv_config -rinv_serial -rinv_model -rinv_firm -rinv_all -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_off -rpower_stat -rpower_boot -rpower_on -rpower_reset -rpower_noderange -rpower_noderange_nodeps -rpower_err_noderange -rscan_noderange -rscan_x -rscan_z -rscan_w -rscan_x_w -rscan_z_w -rvitals_lcds -rvitals_all -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_p_auditlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makehosts_h -makehosts_help -makehosts_null -makehosts_l -makehosts_d -makehosts_n -makehosts_n_noderange -xdcp_src_dst -makedns_h -makedns_d_node -makedns_n -makedns -noderange_individual_node -noderange_individual_grp -noderange_node01-node10 -noderange_group1-group3 -noderange_10-20 -noderange_XCAT_NODE_PREFIX -noderange_XCAT_NODE_SUFFIX -noderange_exclusion -noderange_group_intersection -confignics_config_one_port_single_value -confignics_config_multiple_ports_single_value -confignics_config_multiple_ports_multiple_value -confignics_config_multiple_port_withnichostnamesuffixes_multiple_value -confignics_config_multiple_port_withnicaliases_multiple_value -confignics_disable_set_to_yes -confignics_disable_set_to_1 -confignics_s -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -makentp_v -makentp_h -makentp_V -makentp -makentp_a -nodeset_check_warninginfo -runcmdinstaller_h -runcmdinstaller_command -get_xcat_postscripts_loginfo -updatenode_postscripts_loginfo -bmcdiscover_h -bmcdiscover_nmap_range -bmcdiscover_v -bmcdiscover_check_paswd -bmcdiscover_check_passwd_wrong -bmcdiscover_get_ipsource -bmcdiscover_range_w -bmcdiscover_range_z -xcatd_start -xcatd_stop -xcatd_restart -run_command_with_XCATBYPASS -disable_root_permission_in_policy_table -assign_certain_command_permission -redhat_migration1 -redhat_migration2 diff --git a/xCAT-test/autotest/bundle/p_sles_cmd.bundle b/xCAT-test/autotest/bundle/p_sles_cmd.bundle deleted file mode 100644 index 3e9509dcb2..0000000000 --- a/xCAT-test/autotest/bundle/p_sles_cmd.bundle +++ /dev/null @@ -1,260 +0,0 @@ -chdef_null -chdef_t_node -chdef_t_network -chdef_p -chdef_m -chdef_z -chdef_group -chdef_group_p -chdef_dynamic_group -chdef_multiple_keys -chdef_n -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -getmacs_noderange -getmacs_d -getmacs_f_D -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -lslite_i -lslite_noderange -lslite_h -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_normal -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_err_node -rinv_bus -rinv_config -rinv_serial -rinv_model -rinv_firm -rinv_all -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_off -rpower_stat -rpower_boot -rpower_on -rpower_reset -rpower_noderange -rpower_noderange_nodeps -rpower_err_noderange -rscan_noderange -rscan_x -rscan_z -rscan_w -rscan_x_w -rscan_z_w -rvitals_lcds -rvitals_all -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_p_auditlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makehosts_h -makehosts_help -makehosts_null -makehosts_l -makehosts_d -makehosts_n -makehosts_n_noderange -xdcp_src_dst -makedns_h -makedns_d_node -makedns_n -makedns -noderange_individual_node -noderange_individual_grp -noderange_node01-node10 -noderange_group1-group3 -noderange_10-20 -noderange_XCAT_NODE_PREFIX -noderange_XCAT_NODE_SUFFIX -noderange_exclusion -noderange_group_intersection -confignics_config_one_port_single_value -confignics_config_multiple_ports_single_value -confignics_config_multiple_ports_multiple_value -confignics_config_multiple_port_withnichostnamesuffixes_multiple_value -confignics_config_multiple_port_withnicaliases_multiple_value -confignics_disable_set_to_yes -confignics_disable_set_to_1 -confignics_s -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -makentp_v -makentp_h -makentp_V -makentp -makentp_a -nodeset_check_warninginfo -sles_migration1 -sles_migration2 diff --git a/xCAT-test/autotest/bundle/x_rhels_cmd.bundle b/xCAT-test/autotest/bundle/x_rhels_cmd.bundle deleted file mode 100644 index ed6ca7d431..0000000000 --- a/xCAT-test/autotest/bundle/x_rhels_cmd.bundle +++ /dev/null @@ -1,199 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -lslite_i -lslite_noderange -lslite_h -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_normal -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_noderange -nodestat_err_node -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_n -makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_i_linux -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -nodeset_check_warninginfo -redhat_migration1 -redhat_migration2 diff --git a/xCAT-test/autotest/bundle/x_sles_cmd.bundle b/xCAT-test/autotest/bundle/x_sles_cmd.bundle deleted file mode 100644 index eb160f912e..0000000000 --- a/xCAT-test/autotest/bundle/x_sles_cmd.bundle +++ /dev/null @@ -1,209 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n -makehosts_n_noderange -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_err_symble -chtab_err_table -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -lslite_i -lslite_noderange -lslite_h -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a -makedhcp_a_d -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_normal -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_noderange -nodestat_err_node -rinv_noderange_err -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_n -makedns -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_i_linux -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -nodeset_check_warninginfo -xcatd_start -xcatd_stop -xcatd_restart -run_command_with_XCATBYPASS -disable_root_permission_in_policy_table -assign_certain_command_permission -sles_migration1 -sles_migration2 diff --git a/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle b/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle deleted file mode 100644 index 4b6fe505a8..0000000000 --- a/xCAT-test/autotest/bundle/x_ubuntu_cmd.bundle +++ /dev/null @@ -1,257 +0,0 @@ -makehosts_h -makehosts_help -makehosts_n_noderange -makehosts_n -chdef_null -chdef_z -chdef_t_o_error -chtab_null -chtab_d -chtab_modify_node -chtab_modify_key -chtab_h -chtab_v -packimage_o_p_a_m -packimage_p_a_o -packimage_imagename -packimage_h -packimage_v -pping_h -pping_v -pping_node -gettab_key_table -gettab_H -gettab_err -gettab_h -lsdef_null -lsdef_a -lsdef_t_o_l -lsdef_t_o_l_z -lsdef_t -lsdef_t_i_o -lsdef_t_w -lsdef_t_err -makeconservercf_null -makeconservercf_noderange -makeconservercf_d -makedhcp_n -makedhcp_a_ubuntu -makedhcp_d -mkdef_null -mkdef_z -mkdef_t_o_error -nodeadd_noderange -nodeadd_err_symbol -nodeadd_null -nodeadd_noderange_nodetype -nodeadd_v -nodeadd_h -nodegrpch_v -nodegrpch_h -nodegrpch_groups -nodegrpch_err -nodech_noderange_table -nodech_noderange_table_comma -nodech_noderange_table_arrow -nodech_noderanage_table_at -nodech_delete -nodech_error_node -nodech_error_table -nodech_h -nodech_v -nodech_noderange_table_include -nodech_noderange_table_uninclude -nodech_noderange_table_equal -nodech_noderange_table_unequal -nodech_noderange_shortname_groups -nodech_noderange_shortname_tags -nodech_noderange_shortname_mgt -nodels_null -nodels_H -nodels_noderange -nodels_err_symbol -nodels_err_noderange -nodels_noderange_shortname_groups -nodels_noderange_shortname_tags -nodels_noderange_shortname_mgt -nodels_table_include -nodels_noderange_table_uninclude -nodels_noderange_table_equal -nodels_noderange_table_unequal -nodels_b -nodels_S -nodels_noderange_table -nodels_tablevalue -nodels_tablevalue_tablecolumn -nodels_noderange_tablecolumn -nodels_h -nodels_v -xcatstanzafile_normal -xcatstanzafile_colon -xcatstanzafile_attribute -xcatstanzafile_objtype -xcatstanzafile_tab -xcatstanzafile_multattr -xcatstanzafile_defaultvalue -xcatstanzafile_specificvalue -noderm_noderange -noderm_h -noderm_null -noderm_err_node -nodeset_stat -nodeset_noderange -nodestat_noderange -nodestat_err_node -rmdef_null -rmdef_t_err -rpower_err_noderange -rvitals_noderange_err -tabdump_table -tabdump_d -tabdump_v -tabdump_h -tabdump_help -tabdump_w_match -tabdump_w_equal -tabdump_w_ne -tabdump_w_notmatch -tabdump_w_gt -tabdump_w_ge -tabdump_w_lt -tabdump_w_le -tabdump_f_d -tabdump_d_nodehm -tabprune_h -tabprune_v -tabprune_a_eventlog -tabprune_V_a_eventlog -tabprune_i_auditlog -tabprune_V_n_auditlog -tabgrep_node -tabgrep_null -tabgrep_h -tabgrep_err -tabrestore_table -tabrestore_null -tabrestore_h -tabrestore_err -dumpxCATdb_h -dumpxCATdb_v -dumpxCATdb_p_nullskiptables -dumpxCATdb_a_p_nullskiptables -dumpxCATdb_p_skiptables -dumpxCATdb_a_p_skiptables -dumpxCATdb_p_nullskiptables_V -dumpxCATdb_a_p_nullskiptables_V -dumpxCATdb_p_V -restorexCAT_h -restorexCATdb_v -restorexCATdb_p_V -restorexCATdb_a_p_V -restorexCATdb_wrongpath -regnotif_null -regnotif_o -regnotif_err -regnotif_h -regnotif_v -unregnotif_null -unregnotif_f -unregnotif_h -unregnotif_v -lsxcatd_null -lsxcatd_h -lsxcatd_d -lsxcatd_a -makedns_d_node -makedns_ubuntu_n -copycds_iso -copycds_n -copycds_a -copycds_n_a -copycds_a_err -copycds_n_err -addkit_v -addkit_h -addkit_kit -addkit_i -addkit_multikit -addkit_p -addkitcomp_v -addkitcomp_h -addkitcomp_i -addkitcomp_f -buildkit_v -buildkit_h -buildkit_create -buildkit_create_l -buildkit_buildrepo_all -buildkit_buildrepo_ubuntu -buildkit_cleanrepo_all -buildkit_cleanrepo_ubuntu -buildkit_listrepo -buildkit_buildtar -buildkit_cleantar -buildkit_partialkit_ubuntu -buildkit_partialkit_completekit -chkkitcomp_v -chkkitcomp_h -chkkitcomp_V -lskit_v -lskit_h -lskit_F -lskit_K -lskit_R -lskit_C -lskitcomp_v -lskitcomp_h -lskitcomp_C -lskitcomp_S -lskitdeployparam_v -lskitdeployparam_h -lskitdeployparam_no_param -lskitdeployparam_k_1 -lskitdeployparam_c_1 -rmkit_v -rmkit_h -rmkit_t_no -rmkit_t_yes -rmkit_f -rmkit_V -rmkitcomp_v -rmkitcomp_h -xdsh_h -xdsh_V -xdsh_regular_command -xdsh_Q_command -xdsh_c_cn -xdsh_e_filename -xdsh_E -xdsh_t -xdsh_q -xdsh_T -xdsh_o -switchdiscover_range_default -switchdiscover_h -switchdiscover_range_s -switchdiscover_range_default_w -switchdiscover_range_r -switchdiscover_range_x -switchdiscover_range_z -switchdiscover_range_z_V -nodeset_check_warninginfo -Full_installation_flat_docker -rpower_stop -rpower_start -rpower_state -rpower_restart -rpower_pause -rpower_unpause -mkdocker_h -mkdocker_command -rmdocker_h -rmdocker_command -rmdocker_f_command -lsdocker_h_command -lsdocker_l_command -ubuntux_migration1_vm -ubuntux_migration2_vm From 5cd203cdf563ac402d5718b5fdbfbec788870eaf Mon Sep 17 00:00:00 2001 From: penguhyang Date: Tue, 2 Aug 2016 16:45:31 +0800 Subject: [PATCH 054/391] enhance packimage -m txc (#1602) --- .../references/man1/packimage.1.rst | 2 +- xCAT-client/pods/man1/packimage.1.pod | 2 +- xCAT-server/lib/xcat/plugins/anaconda.pm | 4 +-- xCAT-server/lib/xcat/plugins/debian.pm | 4 +-- xCAT-server/lib/xcat/plugins/packimage.pm | 32 ++++++++++++------- xCAT-server/lib/xcat/plugins/sles.pm | 4 +-- .../share/xcat/netboot/rh/compute.pkglist | 2 ++ .../xcat/netboot/rh/compute.rhels6.pkglist | 2 ++ .../netboot/rh/compute.rhels6.ppc64.pkglist | 3 +- .../netboot/rh/compute.rhels6.x86_64.pkglist | 3 +- .../netboot/rh/compute.rhels7.ppc64.pkglist | 3 +- .../netboot/rh/compute.rhels7.x86_64.pkglist | 3 +- .../xcat/netboot/rh/dracut/install.netboot | 2 +- .../share/xcat/netboot/rh/dracut/xcatroot | 4 +-- .../netboot/rh/dracut_033/install.netboot | 2 +- .../share/xcat/netboot/rh/dracut_033/xcatroot | 6 ++-- xCAT-server/share/xcat/netboot/rh/genimage | 6 ++-- .../share/xcat/netboot/sles/compute.pkglist | 2 ++ .../xcat/netboot/sles/compute.sles11.pkglist | 2 ++ .../netboot/sles/compute.sles11.ppc64.pkglist | 2 ++ .../sles/compute.sles12.ppc64le.pkglist | 1 - .../sles/compute.sles12.x86_64.pkglist | 1 - .../netboot/sles/dracut_033/install.netboot | 2 +- .../xcat/netboot/sles/dracut_033/xcatroot | 6 ++-- xCAT-server/share/xcat/netboot/sles/genimage | 9 +++--- .../share/xcat/netboot/ubuntu/compute.pkglist | 2 ++ .../compute.ubuntu14.04.4.ppc64el.pkglist | 3 +- .../compute.ubuntu14.04.4.x86_64.pkglist | 3 +- .../ubuntu/compute.ubuntu14.04.pkglist | 2 ++ .../ubuntu/compute.ubuntu16.04.pkglist | 2 ++ .../compute.ubuntu16.04.ppc64el.pkglist | 3 +- .../ubuntu/compute.ubuntu16.04.x86_64.pkglist | 3 +- .../netboot/ubuntu/dracut/install.netboot | 2 +- .../share/xcat/netboot/ubuntu/dracut/xcatroot | 4 +-- .../share/xcat/netboot/ubuntu/genimage | 8 ++--- 35 files changed, 86 insertions(+), 55 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index 13510d4b11..d0520af547 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -62,7 +62,7 @@ OPTIONS \ **-a**\ Architecture (ppc64,x86_64,etc) -\ **-m**\ Method (cpio,txc,squashfs, default is cpio) +\ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio) ************ diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index c2f8bdc5c5..0fa78542c4 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -36,7 +36,7 @@ B<-p> Profile (compute,service) B<-a> Architecture (ppc64,x86_64,etc) -B<-m> Method (cpio,txc,squashfs, default is cpio) +B<-m> Archive Method (cpio,tar,squashfs, default is cpio) =head1 RETURN VALUE diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a9d00021eb..bf8c45f7f7 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -464,7 +464,7 @@ sub mknetboot $platform = xCAT_plugin::anaconda::getplatform($osver); my $suffix = 'gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'txz' if (-r "$rootimgdir/rootimg.txz"); + $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); # statelite images are not packed. if ($statelite) { @@ -513,7 +513,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 0908de774c..5d57bea304 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1172,7 +1172,7 @@ sub mknetboot $platform = xCAT_plugin::debian::getplatform($osver); my $suffix = 'gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'txz' if (-r "$rootimgdir/rootimg.txz"); + $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); # statelite images are not packed. if ($statelite) { @@ -1222,7 +1222,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 3ed8d5f350..296ede256d 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -429,7 +429,7 @@ sub process_request { $compress = "pigz"; } if (!$exlistloc) { - $excludestr = "find . -xdev |cpio -H newc -o | $compress -c - > ../rootimg.gz"; + $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.gz"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); @@ -439,22 +439,29 @@ sub process_request { $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.gz"; } $oldmask = umask 0077; - } elsif ($method =~ /txc/) { - my $isxz = system("bash -c 'type -p xz' >/dev/null 2>&1"); - unless ($isxz == 0) { - $callback->({ error => ["Command xz does not exist, please make sure it works."] }); - return 1; + } elsif ($method =~ /tar/) { + my $compress = "gzip"; + + #use "pigz" as the compress tool instead of gzip if "pigz" exist + my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); + if ($ispigz == 0) { + $compress = "pigz"; + } else { + my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); + unless ($isgzip == 0) { + $callback->({ error => ["Command gzip does not exist, please make sure it works."] }); + return 1; + } } - $callback->({ info => ["It will take several minutes to complete. So please wait for several minutes, then the other operations could be done. Otherwise, the other operation will fail."] }); if (!$exlistloc) { - $excludestr = "find . -xdev | tar --selinux --xattrs-include='*' -T - -Jcvf ../rootimg.txz"; + $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.tgz"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -Jcvf ../rootimg.txz"; + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.tgz"; } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { @@ -470,7 +477,8 @@ sub process_request { $callback->({ error => ["Invalid method '$method' requested"], errorcode => [1] }); } chdir("$rootimg_dir"); - `$excludestr`; + my $outputmsg = `$excludestr`; + $callback->({ info => ["$outputmsg"] }); if ($method =~ /cpio/) { chmod 0644, "$destdir/rootimg.gz"; if ($dotorrent) { @@ -482,8 +490,8 @@ sub process_request { chdir($currdir); } umask $oldmask; - } elsif ($method =~ /txc/) { - chmod 0644, "$destdir/rootimg.txz"; + } elsif ($method =~ /tar/) { + chmod 0644, "$destdir/rootimg.tgz"; umask $oldmask; } elsif ($method =~ /squashfs/) { my $flags; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 3b26ccdb99..a833353ea9 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -329,7 +329,7 @@ sub mknetboot my $suffix = 'gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'txz' if (-r "$rootimgdir/rootimg.txz"); + $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); if ($statelite) { unless (-r "$rootimgdir/kernel") { @@ -381,7 +381,7 @@ sub mknetboot } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.txz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] diff --git a/xCAT-server/share/xcat/netboot/rh/compute.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.pkglist index 30d4e4feb4..2824c79fc6 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.pkglist @@ -12,3 +12,5 @@ ntp sysklogd rpm rsync +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist index 555ec63ccd..e2389d3de6 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist @@ -13,3 +13,5 @@ rpm rsync rsyslog e2fsprogs +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist index 6ad7101c8e..fbaf36a2a7 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist @@ -24,4 +24,5 @@ lsvpd irqbalance procps parted -xz +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist index cf05388935..ae873e99fe 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist @@ -20,4 +20,5 @@ rsync rsyslog e2fsprogs parted -xz +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index 7f576221b3..bb9af2ce96 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -24,4 +24,5 @@ irqbalance procps-ng parted net-tools -xz +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 409531cdfb..3c54123a84 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -19,4 +19,5 @@ rsyslog e2fsprogs parted net-tools -xz +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index 706a14d12f..f14ffa1c04 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar xz cpio gzip dash modprobe touch echo cut wc xz +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc dracut_install -o ctorrent dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 71e63af698..688d7f7720 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -87,7 +87,7 @@ elif [ -r /rootimg.gz ]; then $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.txz ]; then +elif [ -r /rootimg.tgz ]; then echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -97,7 +97,7 @@ elif [ -r /rootimg.txz ]; then cd $NEWROOT echo -n "Extracting root filesystem:" - tar -Jxvf /rootimg.txz + tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz $NEWROOT/etc/init.d/localdisk echo Done elif [ -r /rootimg-statelite.gz ]; then diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot index 9bae9d704b..e1227868bf 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget cpio gzip modprobe touch echo cut wc xz +dracut_install wget tar cpio gzip modprobe touch echo cut wc dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 2344938dce..328068a324 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -89,8 +89,8 @@ elif [ -r /rootimg.gz ]; then $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.txz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.txz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tgz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -101,7 +101,7 @@ elif [ -r /rootimg.txz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar -Jxvf /rootimg.txz + tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 0c42cb1f58..9174f59a40 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1612,7 +1612,7 @@ EOMS print $inifile " zcat /rootimg.gz |cpio -idum\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.txz ]; then\n"; + print $inifile "elif [ -r /rootimg.tgz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1622,7 +1622,7 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar -Jxvf /rootimg.txz\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1699,7 +1699,7 @@ EOMS } # add rsync for statelite - foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/xz") { + foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } diff --git a/xCAT-server/share/xcat/netboot/sles/compute.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.pkglist index 05bfaa5b3c..cc5a5fd872 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.pkglist @@ -11,3 +11,5 @@ wget rsync timezone ntp +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist index a09fe48d14..e284622f1d 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist @@ -17,3 +17,5 @@ rsync timezone bc ntp +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist index a1fbff9575..26e735587d 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist @@ -19,3 +19,5 @@ lsvpd irqbalance procps ntp +gzip +tar diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist index d0b4c3a0e3..1eebf14144 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist @@ -41,4 +41,3 @@ udev kernel-default kernel-firmware adaptec-firmware -xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist index d0b4c3a0e3..1eebf14144 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist @@ -41,4 +41,3 @@ udev kernel-default kernel-firmware adaptec-firmware -xz diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot index 9bae9d704b..e1227868bf 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget cpio gzip modprobe touch echo cut wc xz +dracut_install wget tar cpio gzip modprobe touch echo cut wc dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index c9775a412b..91b6a3aa4a 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -87,8 +87,8 @@ elif [ -r /rootimg.gz ]; then $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.txz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.txz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tgz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -99,7 +99,7 @@ elif [ -r /rootimg.txz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar -Jxvf /rootimg.txz + tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index ebc09e3ded..5b894e37a7 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1639,7 +1639,7 @@ EOMS print $inifile " zcat /rootimg.gz |cpio -idum\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.txz ]; then\n"; + print $inifile "elif [ -r /rootimg.tgz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1649,7 +1649,7 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar -Jxvf /rootimg.txz\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1758,7 +1758,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } @@ -1770,7 +1770,7 @@ EOMS } } else { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } @@ -2422,3 +2422,4 @@ sub usage { print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --permission 777\n"; return 0; } + diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist index 6170973814..c3839a534b 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist @@ -12,3 +12,5 @@ rsyslog rsync busybox-static gawk +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist index 971deec455..730382c867 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist @@ -13,4 +13,5 @@ rsync busybox-static gawk dnsutils -xz-utils +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist index 971deec455..730382c867 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist @@ -13,4 +13,5 @@ rsync busybox-static gawk dnsutils -xz-utils +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist index c23ba181a1..b1357ac5f9 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist @@ -12,3 +12,5 @@ rsyslog rsync busybox-static gawk +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist index ebad2c2601..d3e1da0217 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist @@ -12,3 +12,5 @@ rsyslog rsync busybox-static gawk +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist index 07e8c4b1ba..8276befc20 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist @@ -14,4 +14,5 @@ rsync busybox-static gawk dnsutils -xz-utils +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist index 07e8c4b1ba..8276befc20 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist @@ -14,4 +14,5 @@ rsync busybox-static gawk dnsutils -xz-utils +tar +gzip diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot index a16bd719e7..10f1c73208 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget cpio gzip dash modprobe touch echo cut wc xz +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs inst "$moddir/xcatroot" "/sbin/xcatroot" diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index 6d9a3cbd06..073ec1e4b4 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -50,12 +50,12 @@ elif [ -r /rootimg.gz ]; then gzip -cd /rootimg.gz |cpio -idum fi echo Done -elif [ -r /rootimg.txz ]; then +elif [ -r /rootimg.tgz ]; then echo Setting up RAM-root tmpfs. mount -t tmpfs -o mode=755 rootfs $NEWROOT cd $NEWROOT echo -n "Extracting root filesystem:" - tar -Jxvf /rootimg.txz + tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz echo Done elif [ -r /rootimg-statelite.gz ]; then echo Setting up RAM-root tmpfs for statelite mode. diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 2921543ba2..870c13b73a 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1459,8 +1459,8 @@ EOMS print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.txz ]; then\n"; - print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.txz downloaded,setting up RAM-root tmpfs...\"\n"; + print $inifile "elif [ -r /rootimg.tgz ]; then\n"; + print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.tgz downloaded,setting up RAM-root tmpfs...\"\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1471,7 +1471,7 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar -Jxvf /rootimg.txz\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; print $inifile "else\n"; @@ -1612,7 +1612,7 @@ EOMS } # add rsync for statelite - foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz") { + foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } From a21edcdcb592ad8db73dce81c8a04b1ef7ea6b40 Mon Sep 17 00:00:00 2001 From: Chuck Brazie Date: Tue, 2 Aug 2016 22:03:15 -0400 Subject: [PATCH 055/391] Merged the zVM changes into some xcat_client files (#1608) Change-Id: I3405cede348c63ea6b43ceda4bdfdad0f3a5422a --- xCAT-client/bin/genimage | 6 ++++++ xCAT-client/bin/xdsh | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index d09119dc5d..1030b7ae07 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -57,6 +57,7 @@ sub print_usage print "Usage:\n"; print " genimage\n\n"; print " genimage --dryrun\n\n"; + print ' genimage -o [-a ] -p -i -n [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun]'."\n\n"; print ' genimage [-o ] [-a ] [-p ] [-i ] [-n ] [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun] [--noupdate] ' . "\n\n"; print " --permission is used for statelite only\n"; print " -g is used for SLES only\n\n"; @@ -64,6 +65,11 @@ sub print_usage print "Examples:\n"; print " genimage\n"; print " genimage --interactive\n"; + print " genimage -i eth0 -n tg3 -o sles11 -p compute\n"; + print " genimage -i eth0 -n tg3 -o sles11 -p compute --onlyinitrd\n"; + print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute --interactive\n"; + print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --dryrun\n"; + print " genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777\n"; print " genimage -i eth0 -n tg3 --interactive myimagename\n"; print " genimage myimagename\n"; } diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 1d06e74a95..46e1e94d74 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -38,7 +38,7 @@ This program is the client interface for xdsh/xdcp. Bypass mode is useful, when executing the command on the Management Server and in particular if you want to run as a non-root id. Call parse_args to verify mode (client/server or bypass) - and whether to use Env Variables + and whether to use Env Variables Build hash and submit request See man page for options @@ -232,6 +232,8 @@ sub parse_args_xdsh 'q|show-config' => \$options{'show-config'}, 'r|node-rsh=s' => \$options{'node-rsh'}, 'i|rootimg=s' => \$options{'rootimg'}, + 'ip=s' => \$options{'ip'}, + 'show=s' => \$options{'show'}, 's|stream' => \$options{'streaming'}, 't|timeout=i' => \$options{'timeout'}, 'v|verify' => \$options{'verify'}, @@ -407,12 +409,12 @@ sub parse_args_xdsh if ($options{'ssh-setup'}) # if going to setup ssh keys { my $msg; - if (!($ENV{'DSH_REMOTE_PASSWORD'})) - { # if not already set - # prompt for the password for the userid on the node that will be setup + if (!($ENV{'DSH_REMOTE_PASSWORD'}) && !$options{'show'} ) + { # if not already set and not requested to just show the information, + # prompt for the password for the userid on the node that will be setup my $userpw; $msg = -"The ssh keys will be updated for '$to_userid' on the node(s).\nPassword:"; + "Enter the password for the userid: $to_userid on the node where the ssh keys \nwill be updated:\n"; xCAT::MsgUtils->message("I", $msg); system("stty -echo"); # turn off keyboard chop($userpw = ); @@ -573,9 +575,11 @@ sub parse_args_xdcp 'F|File=s' => \$options{'File'}, 'h|help' => \$options{'help'}, 'i|rootimg=s' => \$options{'rootimg'}, - 'l|user=s' => \$options{'user'}, + 'ip=s' => \$options{'ip'}, + 'l|user=s' => \$options{'user'}, 'm|monitor' => \$options{'monitor'}, 'o|node-options=s' => \$options{'node-options'}, + 'show=s' => \$options{'show'}, 'q|show-config' => \$options{'show-config'}, 'p|preserve' => \$options{'preserve'}, 'r|c|node-rcp=s' => \$options{'node-rcp'}, From 5d4d0d169e1bf1dc17b402e2d73444cfbbf7ddab Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 2 Aug 2016 22:10:45 -0400 Subject: [PATCH 056/391] Modify code from code review --- .../lib/xcat/plugins/switchdiscover.pm | 50 +++----- xCAT-server/share/xcat/tools/configBNT | 115 +++++++++--------- xCAT-server/share/xcat/tools/configMellanox | 91 +++++++------- 3 files changed, 122 insertions(+), 134 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index e926123457..8d90f8024b 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1133,14 +1133,14 @@ sub get_hostname { #-------------------------------------------------------------------------------- sub get_switchtype { my $vendor = shift; - my $key; + my $key = "Not support"; my $search_string = join '|', keys(%global_switch_type); if ($vendor =~ /($search_string)/) { $key = $1; return $global_switch_type{$key}; } else { - return $vendor; + return $key; } } @@ -1370,9 +1370,7 @@ sub switchsetup { my $dshcmd; my $static_ip; my $discover_switch; - my @rmnodes; - my @BNTswitches; - my @MLNXswitches; + my $nodes_to_config; #print Dumper($outhash); my $macmap = xCAT::MacMap->new(); @@ -1402,39 +1400,25 @@ sub switchsetup { if (exists($globalopt{verbose})) { send_msg($request, 0, "Found Discovery switch $dswitch, $ip, $mac with predefine switch $node, $static_ip $stype switch\n" ); } + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); - #run xdsh command to set discover ip address to static ip address - #each switch type has different CLI for setup ip address + push (@{$nodes_to_config->{$stype}}, $node); + } - # BNT switches - if ( $stype =~ /BNT/ ) { - push (@BNTswitches, $node); - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=$ip",'status=Matched',"mac=$mac",'switchtype=BNT','username=root','password=admin'] }, $sub_req, 0, 1); - } - # Mellanox switches - elsif ( $stype =~ /Mellanox/ ) { - push (@MLNXswitches, $node); - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","otherinterfaces=$ip",'status=Matched',"mac=$mac",'switchtype=Mellanox','username=admin'] }, $sub_req, 0, 1); - - } - else { - xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"ip=$static_ip","switchtype=$stype","otherinterfaces=$ip",'status=not supported',"mac=$mac"] }, $sub_req, 0, 1); + foreach my $mytype (keys %$nodes_to_config) { + my $config_script = "$::XCATROOT/shart/xcat/tools/config".$mytype; + if (-r -x $config_script) { + my $switches = join(",",@{${nodes_to_config}->{$mytype}}); + send_msg($request, 0, "call to config $mytype switches $switches\n"); + my $out = `$config_script --switches $switches --all`; + send_msg($request, 0, "output = $out\n"); + } else { + send_msg($request, 0, "the switch type $mytype is not support yet\n"); } } - - if (@BNTswitches) { - my $bntsw = join(",",@BNTswitches); - send_msg($request, 0, "call to config BNT switches $bntsw\n"); - my $out = `/opt/xcat/share/xcat/tools/configBNT --range $bntsw --all`; - send_msg($request, 0, "output = $out\n"); - } - if (@MLNXswitches) { - my $mlnxsw = join(",",@MLNXswitches); - send_msg($request, 0, "call to config Mellanox switches $mlnxsw\n"); - my $out = `/opt/xcat/share/xcat/tools/configMellanox --range $mlnxsw --all`; - send_msg($request, 0, "output = $out\n"); - } + return; + } diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/tools/configBNT index c17271c52b..e3b3d62cc8 100755 --- a/xCAT-server/share/xcat/tools/configBNT +++ b/xCAT-server/share/xcat/tools/configBNT @@ -23,10 +23,6 @@ use xCAT::Utils; use xCAT::Table; use xCAT::MsgUtils; - -my $args = join ' ', @ARGV; -$::command = "$0 $args"; - Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; @@ -41,17 +37,17 @@ my @filternodes; # parse the options if ( !GetOptions( - 'h|help' => \$::HELP, - 'range=s' => \$::SWITCH, + 'h|help' => \$::HELP, + 'switches=s' => \$::SWITCH, 'port=s' => \$::PORT, 'vlan=s' => \$::VLAN, 'user=s' => \$::USER, 'password=s' => \$::PASSWORD, 'group=s' => \$::GROUP, - 'snmp' => \$::SNMP, - 'ip' => \$::IP, - 'name' => \$::NAME, - 'all' => \$::ALL, + 'snmp' => \$::SNMP, + 'ip' => \$::IP, + 'name' => \$::NAME, + 'all' => \$::ALL, ) ) { @@ -72,15 +68,22 @@ if ($::SWITCH) { my $nodenotdefined = join(',', nodesmissed); xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); } - foreach (@filternodes) { - push @nodes, $_; + # check switch type + my $switchestab = xCAT::Table->new('switches'); + my $switches_hash = $switchestab->getNodesAttribs(\@filternodes,['switchtype']); + foreach my $fsw (@filternodes) { + if (($switches_hash->{$fsw}->[0]->{switchtype}) =~ /BNT/) { + push @nodes, $fsw; + } else { + xCAT::MsgUtils->message("E","The $fsw is not BNT switch, will not config"); + } } unless (@nodes) { xCAT::MsgUtils->message("E","No Valid Switch to process"); exit(1); } } else { - xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --range"); + xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --switches"); &usage; exit(1); } @@ -90,25 +93,18 @@ my $cmd; my $vlan; my $port; my $sub_req; -my $switch; my $rc; -if ($::ALL) { - config_ip(); - config_hostname(); - config_snmp(); -} - -if ($::IP) +if (($::IP) || ($::ALL)) { config_ip(); } -if ($::NAME) +if (($::NAME) || ($::ALL)) { config_hostname(); } -if ($::SNMP) +if (($::SNMP) || ($::ALL)) { config_snmp(); } @@ -118,12 +114,14 @@ if ($::VLAN) } sub config_ip { - + my @config_switches; + my @discover_switches; my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@nodes,['otherinterfaces']); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); foreach my $switch (@nodes) { print "change $switch to static ip address\n"; my $dip= $nodehash->{$switch}->[0]->{otherinterfaces}; + my $static_ip= $nodehash->{$switch}->[0]->{ip}; #get hostname my $dswitch = xCAT::NetworkUtils->gethostname($dip); @@ -133,20 +131,12 @@ sub config_ip { my $ip_str = $dip; $ip_str =~ s/\./\-/g; $dswitch = "switch-$ip_str"; - #is there other way we can check if this node is defined in the xCATdb - $cmd = "lsdef $dswitch"; - $rc= xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) { - $cmd = "mkdef -t node -o $dswitch groups=switch ip=$dip switchtype=BNT username=root password=admin protocol=telnet nodetype=switch"; - $rc= xCAT::Utils->runcmd($cmd, 0); - } - } - #check if it is in the /etc/hosts - my $output = `grep $dswitch /etc/hosts`; - if ( !$output ) { - $cmd = "makehosts $dswitch"; - $rc= xCAT::Utils->runcmd($cmd, 0); } + $cmd = "chdef -t node -o $dswitch groups=switch ip=$dip switchtype=BNT username=root password=admin protocol=telnet nodetype=switch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "makehosts $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + # verify if xdsh works $cmd = "xdsh $dswitch --devicetype EthSwitch::BNT 'enable;configure terminal;exit' "; $rc= xCAT::Utils->runcmd($cmd, 0); @@ -154,29 +144,30 @@ sub config_ip { xCAT::MsgUtils->message("E","Couldn't communicate with $dswitch, $dip"); next; } - #change to static ip address - my $static_ip = xCAT::NetworkUtils->getipaddr($switch); - if (!$static_ip){ - xCAT::MsgUtils->message("E","static ip is not defined for $switch"); - next; - } $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT 'enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit' "; $rc= xCAT::Utils->runcmd($cmd, 0); print "finish setup static ip address for $switch\n"; - + push (@discover_switches, $dswitch); + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=ip_configed otherinterface="; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=ip_configed otherinterfaces="; $rc= xCAT::Utils->runcmd($cmd, 0); - + } + if (@discover_switches) { + my $dsw = join(",",@discover_switches); #remove discover switch from xCATdb and /etc/hosts - $cmd = "makehosts -d $dswitch"; + $cmd = "makehosts -d $dsw"; $rc= xCAT::Utils->runcmd($cmd, 0); - $cmd = "rmdef $dswitch"; + $cmd = "rmdef $dsw"; $rc= xCAT::Utils->runcmd($cmd, 0); } } sub config_hostname { + my @config_switches; my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','sshpassword']); foreach my $switch (@nodes) { @@ -193,8 +184,12 @@ sub config_hostname { xCAT::MsgUtils->message("E","Failed to setup hostname for $switch"); next; } + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=hostname_configed" ; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=hostname_configed" ; $rc= xCAT::Utils->runcmd($cmd, 0); } } @@ -205,6 +200,7 @@ sub config_snmp { my $snmp_user; my $snmp_passwd; my $snmp_group; + my @config_switches; if ($::USER) { $snmp_user = $::USER; @@ -326,9 +322,14 @@ sub config_snmp { exit(1); } $mysw->soft_close(); - + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=switch_configed" ; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=switch_configed" ; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "chtab switch=$csw switches.snmpversion=3 switches.auth=sha switches.username=$snmp_user switches.password=$snmp_passwd" ; $rc= xCAT::Utils->runcmd($cmd, 0); } } @@ -361,11 +362,11 @@ sub usage { print "Usage: configBNT [-?│-h│--help] - configBNT [--range switchnames] [--all] - configBNT [--range switchnames] [--ip] - configBNT [--range switchnames] [--name ] - configBNT [--range switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] - configBNT [--range switchnames] [--port port] [--vlan vlan] + configBNT [--switches switchnames] [--all] + configBNT [--switches switchnames] [--ip] + configBNT [--switches switchnames] [--name ] + configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] + configBNT [--switches switchnames] [--port port] [--vlan vlan] \n"; } diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/tools/configMellanox index ebf8db8f58..bc3bfc7c29 100755 --- a/xCAT-server/share/xcat/tools/configMellanox +++ b/xCAT-server/share/xcat/tools/configMellanox @@ -22,10 +22,6 @@ use xCAT::Utils; use xCAT::Table; use xCAT::MsgUtils; - -my $args = join ' ', @ARGV; -$::command = "$0 $args"; - Getopt::Long::Configure("bundling"); $Getopt::Long::ignorecase = 0; @@ -41,7 +37,7 @@ my @filternodes; if ( !GetOptions( 'h|help' => \$::HELP, - 'range=s' => \$::SWITCH, + 'switches=s' => \$::SWITCH, 'config' => \$::CONFIG, 'ip' => \$::IP, 'name' => \$::NAME, @@ -67,8 +63,15 @@ if ($::SWITCH) my $nodenotdefined = join(',', nodesmissed); xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); } - foreach (@filternodes) { - push @nodes, $_; + # check switch type + my $switchestab = xCAT::Table->new('switches'); + my $switches_hash = $switchestab->getNodesAttribs(\@filternodes,['switchtype']); + foreach my $fsw (@filternodes) { + if (($switches_hash->{$fsw}->[0]->{switchtype}) =~ /Mellanox/) { + push @nodes, $fsw; + } else { + xCAT::MsgUtils->message("E","The $fsw is not BNT switch, will not config"); + } } unless (@nodes) { xCAT::MsgUtils->message("E","No Valid Switch to process"); @@ -83,34 +86,29 @@ if ($::SWITCH) my $switches = join(",",@nodes); my $user; my $cmd; -my $switch; my $rc; my $master; -if ($::ALL) { - config_ip(); - config_hostname(); - run_rspconfig(); -} -if ($::IP) { +if (($::IP) || ($::ALL)) { config_ip(); } -if ($::NAME) { +if (($::NAME) || ($::ALL)) { config_hostname(); } -if ($::CONFIG) -{ +if (($::CONFIG) || ($::ALL)) { run_rspconfig(); } sub config_ip { + my @config_switches; + my @discover_switches; # get host table for otherinterfaces my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@nodes,['otherinterfaces']); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); # get netmask from network table my $nettab = xCAT::Table->new("networks"); my @nets; @@ -120,29 +118,23 @@ sub config_ip { foreach my $switch (@nodes) { print "change $switch to static ip address\n"; my $dip= $nodehash->{$switch}->[0]->{otherinterfaces}; + my $static_ip= $nodehash->{$switch}->[0]->{ip}; #get hostname my $dswitch = xCAT::NetworkUtils->gethostname($dip); + print "dip=$dip, static=$static_ip, dsw=$dswitch\n"; #if not defined, need to create one for xdsh to use if (!$dswitch) { my $ip_str = $dip; $ip_str =~ s/\./\-/g; $dswitch = "switch-$ip_str"; - #is there other way we can check if this node is defined in the xCATdb - $cmd = "lsdef $dswitch"; - $rc= xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) { - $cmd = "mkdef -t node -o $dswitch groups=switch ip=$dip switchtype=Mellanox username=admin nodetype=switch"; - $rc= xCAT::Utils->runcmd($cmd, 0); - } - } - #check if it is in the /etc/hosts - my $output = `grep $dswitch /etc/hosts`; - if ( !$output ) { - $cmd = "makehosts $dswitch"; - $rc= xCAT::Utils->runcmd($cmd, 0); } + $cmd = "chdef -t node -o $dswitch groups=switch ip=$dip switchtype=Mellanox username=admin nodetype=switch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "makehosts $dswitch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + # verify if xdsh works $cmd = "xdsh $dswitch -l admin --devicetype IBSwitch::Mellanox 'enable;configure terminal;exit' "; $rc= xCAT::Utils->runcmd($cmd, 0); @@ -150,12 +142,6 @@ sub config_ip { xCAT::MsgUtils->message("E","Couldn't communicate with $dswitch, $dip"); next; } - #change to static ip address - my $static_ip = xCAT::NetworkUtils->getipaddr($switch); - if (!$static_ip){ - xCAT::MsgUtils->message("E","static ip is not defined for $switch"); - next; - } #get netmask my $mask; foreach my $net (@nets) { @@ -166,20 +152,29 @@ sub config_ip { $cmd="xdsh $dswitch -t 10 -l admin --devicetype IBSwitch::Mellanox 'enable;configure terminal;no interface mgmt0 dhcp;interface mgmt0 ip address $static_ip $mask;configuration write;exit;exit' "; $rc= xCAT::Utils->runcmd($cmd, 0); + push (@discover_switches, $dswitch); + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=ip_configed otherinterface="; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=ip_configed otherinterfaces="; $rc= xCAT::Utils->runcmd($cmd, 0); - + } + + if (@discover_switches) { + my $dsw = join(",",@discover_switches); #remove discover switch from xCATdb and /etc/hosts - $cmd = "makehosts -d $dswitch"; + $cmd = "makehosts -d $dsw"; $rc= xCAT::Utils->runcmd($cmd, 0); - $cmd = "rmdef $dswitch"; + $cmd = "rmdef $dsw"; $rc= xCAT::Utils->runcmd($cmd, 0); } } sub config_hostname { + my @config_switches; my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername']); foreach my $switch (@nodes) { @@ -196,13 +191,18 @@ sub config_hostname { xCAT::MsgUtils->message("E","Failed to setup hostname for $switch"); next; } + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=hostname_configed" ; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=hostname_configed" ; $rc= xCAT::Utils->runcmd($cmd, 0); } } sub run_rspconfig { + my @config_switches; my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername']); $master = `hostname -i`; @@ -224,9 +224,12 @@ sub run_rspconfig { #config ntp $cmd = `xdsh $switch -l $user --devicetype IBSwitch::Mellanox "enable;configure terminal;ntp enable;ntpdate $master; ntp server $master;configuration write;show ntp" `; - + push (@config_switches, $switch); + } + if (@config_switches) { #update switch status - $cmd = "chdef $switch status=switch_configed" ; + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=switch_configed" ; $rc= xCAT::Utils->runcmd($cmd, 0); } From 860b61a7edb05f66aa452b20f2c2a7e53032178a Mon Sep 17 00:00:00 2001 From: yangsong Date: Wed, 3 Aug 2016 10:34:25 +0800 Subject: [PATCH 057/391] Revert "Master client merges for two files from zVM" (#1619) --- xCAT-client/bin/genimage | 6 ------ xCAT-client/bin/xdsh | 16 ++++++---------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index 1030b7ae07..d09119dc5d 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -57,7 +57,6 @@ sub print_usage print "Usage:\n"; print " genimage\n\n"; print " genimage --dryrun\n\n"; - print ' genimage -o [-a ] -p -i -n [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun]'."\n\n"; print ' genimage [-o ] [-a ] [-p ] [-i ] [-n ] [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun] [--noupdate] ' . "\n\n"; print " --permission is used for statelite only\n"; print " -g is used for SLES only\n\n"; @@ -65,11 +64,6 @@ sub print_usage print "Examples:\n"; print " genimage\n"; print " genimage --interactive\n"; - print " genimage -i eth0 -n tg3 -o sles11 -p compute\n"; - print " genimage -i eth0 -n tg3 -o sles11 -p compute --onlyinitrd\n"; - print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute --interactive\n"; - print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --dryrun\n"; - print " genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777\n"; print " genimage -i eth0 -n tg3 --interactive myimagename\n"; print " genimage myimagename\n"; } diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 46e1e94d74..1d06e74a95 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -38,7 +38,7 @@ This program is the client interface for xdsh/xdcp. Bypass mode is useful, when executing the command on the Management Server and in particular if you want to run as a non-root id. Call parse_args to verify mode (client/server or bypass) - and whether to use Env Variables + and whether to use Env Variables Build hash and submit request See man page for options @@ -232,8 +232,6 @@ sub parse_args_xdsh 'q|show-config' => \$options{'show-config'}, 'r|node-rsh=s' => \$options{'node-rsh'}, 'i|rootimg=s' => \$options{'rootimg'}, - 'ip=s' => \$options{'ip'}, - 'show=s' => \$options{'show'}, 's|stream' => \$options{'streaming'}, 't|timeout=i' => \$options{'timeout'}, 'v|verify' => \$options{'verify'}, @@ -409,12 +407,12 @@ sub parse_args_xdsh if ($options{'ssh-setup'}) # if going to setup ssh keys { my $msg; - if (!($ENV{'DSH_REMOTE_PASSWORD'}) && !$options{'show'} ) - { # if not already set and not requested to just show the information, - # prompt for the password for the userid on the node that will be setup + if (!($ENV{'DSH_REMOTE_PASSWORD'})) + { # if not already set + # prompt for the password for the userid on the node that will be setup my $userpw; $msg = - "Enter the password for the userid: $to_userid on the node where the ssh keys \nwill be updated:\n"; +"The ssh keys will be updated for '$to_userid' on the node(s).\nPassword:"; xCAT::MsgUtils->message("I", $msg); system("stty -echo"); # turn off keyboard chop($userpw = ); @@ -575,11 +573,9 @@ sub parse_args_xdcp 'F|File=s' => \$options{'File'}, 'h|help' => \$options{'help'}, 'i|rootimg=s' => \$options{'rootimg'}, - 'ip=s' => \$options{'ip'}, - 'l|user=s' => \$options{'user'}, + 'l|user=s' => \$options{'user'}, 'm|monitor' => \$options{'monitor'}, 'o|node-options=s' => \$options{'node-options'}, - 'show=s' => \$options{'show'}, 'q|show-config' => \$options{'show-config'}, 'p|preserve' => \$options{'preserve'}, 'r|c|node-rcp=s' => \$options{'node-rcp'}, From 193a9680d4a7a7b3981e2e2debb0650cdf9562c3 Mon Sep 17 00:00:00 2001 From: Chuck Brazie Date: Tue, 2 Aug 2016 22:38:24 -0400 Subject: [PATCH 058/391] Fix indentation in xdsh (#1617) * Merged the zVM changes into some xcat_client files Change-Id: I3405cede348c63ea6b43ceda4bdfdad0f3a5422a * Fix indentation in xdsh --- xCAT-client/bin/genimage | 6 ++++++ xCAT-client/bin/xdsh | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/xCAT-client/bin/genimage b/xCAT-client/bin/genimage index d09119dc5d..1030b7ae07 100755 --- a/xCAT-client/bin/genimage +++ b/xCAT-client/bin/genimage @@ -57,6 +57,7 @@ sub print_usage print "Usage:\n"; print " genimage\n\n"; print " genimage --dryrun\n\n"; + print ' genimage -o [-a ] -p -i -n [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun]'."\n\n"; print ' genimage [-o ] [-a ] [-p ] [-i ] [-n ] [--onlyinitrd] [-r ] [-k ] [-g ] [-m statelite] [-l rootlimitsize] [-t tmplimitsize] [--permission ] [--interactive] [--dryrun] [--noupdate] ' . "\n\n"; print " --permission is used for statelite only\n"; print " -g is used for SLES only\n\n"; @@ -64,6 +65,11 @@ sub print_usage print "Examples:\n"; print " genimage\n"; print " genimage --interactive\n"; + print " genimage -i eth0 -n tg3 -o sles11 -p compute\n"; + print " genimage -i eth0 -n tg3 -o sles11 -p compute --onlyinitrd\n"; + print " genimage -i eth0 -r eth1,eth2 -n tg3,bnx2 -o centos5.1 -p compute --interactive\n"; + print " genimage -i eth0 -n tg3,bnx2 -o sles11 -p compute --dryrun\n"; + print " genimage -i eth0 -n igb,e1000e,e1000,bnx2,tg3 -o centos5.4 -p nfsroot --permission 777\n"; print " genimage -i eth0 -n tg3 --interactive myimagename\n"; print " genimage myimagename\n"; } diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index 1d06e74a95..0797f4d937 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -38,7 +38,7 @@ This program is the client interface for xdsh/xdcp. Bypass mode is useful, when executing the command on the Management Server and in particular if you want to run as a non-root id. Call parse_args to verify mode (client/server or bypass) - and whether to use Env Variables + and whether to use Env Variables Build hash and submit request See man page for options @@ -232,6 +232,8 @@ sub parse_args_xdsh 'q|show-config' => \$options{'show-config'}, 'r|node-rsh=s' => \$options{'node-rsh'}, 'i|rootimg=s' => \$options{'rootimg'}, + 'ip=s' => \$options{'ip'}, + 'show=s' => \$options{'show'}, 's|stream' => \$options{'streaming'}, 't|timeout=i' => \$options{'timeout'}, 'v|verify' => \$options{'verify'}, @@ -407,12 +409,12 @@ sub parse_args_xdsh if ($options{'ssh-setup'}) # if going to setup ssh keys { my $msg; - if (!($ENV{'DSH_REMOTE_PASSWORD'})) - { # if not already set - # prompt for the password for the userid on the node that will be setup + if (!($ENV{'DSH_REMOTE_PASSWORD'}) && !$options{'show'} ) + { # if not already set and not requested to just show the information, + # prompt for the password for the userid on the node that will be setup my $userpw; $msg = -"The ssh keys will be updated for '$to_userid' on the node(s).\nPassword:"; + "Enter the password for the userid: $to_userid on the node where the ssh keys \nwill be updated:\n"; xCAT::MsgUtils->message("I", $msg); system("stty -echo"); # turn off keyboard chop($userpw = ); @@ -573,9 +575,11 @@ sub parse_args_xdcp 'F|File=s' => \$options{'File'}, 'h|help' => \$options{'help'}, 'i|rootimg=s' => \$options{'rootimg'}, + 'ip=s' => \$options{'ip'}, 'l|user=s' => \$options{'user'}, 'm|monitor' => \$options{'monitor'}, 'o|node-options=s' => \$options{'node-options'}, + 'show=s' => \$options{'show'}, 'q|show-config' => \$options{'show-config'}, 'p|preserve' => \$options{'preserve'}, 'r|c|node-rcp=s' => \$options{'node-rcp'}, From b9a6c4204997719b2281312964ef3a1bde79e6c6 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 3 Aug 2016 00:31:14 -0400 Subject: [PATCH 059/391] add one section to collect data to do xCAT product analyse, have nothing to do with auto test main job --- xCAT-server/share/xcat/tools/jenkins/xcatjktest | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index 9c6d9da697..ffec553af4 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -927,6 +927,8 @@ sub do_test { }else{ #to do part } + + return 2 if($casestop); return 0; @@ -1206,6 +1208,12 @@ if ( !defined($pid) ) { } send_msg(2, "[$$] Run do_test...............[OK]"); + #below code has nothing to do with xCAT autotest main job + #just in order to collect logs and data to do xCAT product further analyse + #----------start---------------- + &runcmd("scp -r $mn:/var/log/messages $mn:/var/log/xcat/computes.log $mn:/var/log/xcat/cluster.log $mn:/var/log/xcat/commands.log $logfiledir >/dev/null 2>&1"); + #-----------end----------------- + send_msg(2, "[$$]:whole regression test on $cluster_name finished"); syswrite MNWRITE,"[$$][$deployenvtime]:whole regression test are successful\n"; close MNWRITE; From 180c3fc0c7fbbc7dac5c30b9d4b4ed08e3a9e631 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Wed, 3 Aug 2016 13:59:07 +0800 Subject: [PATCH 060/391] add more output msg for packimage (#1622) --- xCAT-server/lib/xcat/plugins/packimage.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 296ede256d..6d6518df7c 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -419,7 +419,7 @@ sub process_request { unlink("$destdir/rootimg.gz"); unlink("$destdir/rootimg.sfs"); - $callback->({ info => ["compress method:$method"] }); + $callback->({ info => ["archive method:$method"] }); if ($method =~ /cpio/) { my $compress = "gzip"; @@ -428,6 +428,7 @@ sub process_request { if ($ispigz == 0) { $compress = "pigz"; } + $callback->({ info => ["compress method:$compress"] }); if (!$exlistloc) { $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.gz"; } else { @@ -453,6 +454,7 @@ sub process_request { return 1; } } + $callback->({ info => ["compress method:$compress"] }); if (!$exlistloc) { $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.tgz"; } else { From 62397604a4e6e03cae11e45758f0ae476425e3f6 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 3 Aug 2016 02:24:03 -0400 Subject: [PATCH 061/391] fix issue [FVT] updatenode CN without return value for more than hours #1621 --- xCAT/postscripts/remoteshell | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT/postscripts/remoteshell b/xCAT/postscripts/remoteshell index 0fb111bf7c..bf0be9dd05 100755 --- a/xCAT/postscripts/remoteshell +++ b/xCAT/postscripts/remoteshell @@ -225,6 +225,9 @@ fi rm /tmp/ssh_rsa_hostkey # if node supports ecdsa host key then download the replacement from the MN/SN +# remove the /tmp/ecdsa_key first, otherwise the "ssh-keygen" below might hang +# at waiting for user confirmation to overwritten the existing file +rm -rf /tmp/ecdsa_key >/dev/null 2>&1 if ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null ; then # download the host ecdsa key if [ $useflowcontrol = "1" ]; then From c72abd740991008e427712797e7a15c9d9acebaf Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 3 Aug 2016 04:57:30 -0400 Subject: [PATCH 062/391] completed --- .../guides/admin-guides/references/man1/xcattest.1.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst index e09fd2e9e4..eaa39e7e31 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -58,7 +58,7 @@ OPTIONS \ **-b**\ \ *case bundle list*\ - Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. + Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name.The bundle files should be listed in: /opt/xcat/share/xcat/tools/autotest/bundle. @@ -136,7 +136,7 @@ EXAMPLES .. code-block:: perl - xcattest -c /tmp/config -c rpower + xcattest -f /tmp/config -c rpower @@ -148,7 +148,7 @@ EXAMPLES .. code-block:: perl - xcattest -l > /tmp/custom.bundle + xcattest -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle xcattest -b custom.bundle From 4b859aea8a04a355f7a797d2d56aa9db8be2d3f3 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 3 Aug 2016 09:25:28 -0400 Subject: [PATCH 063/391] more modification... --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 6 +----- xCAT-server/share/xcat/tools/configBNT | 4 +--- xCAT-server/share/xcat/tools/configMellanox | 10 +++++----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 8d90f8024b..12e5525566 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -459,7 +459,7 @@ sub process_request { if ($key !~ /nomac/) { $mac = $key; } - my $msg = sprintf $format, $ip, $name, $vendor, $key; + my $msg = sprintf $format, $ip, $name, $vendor, $mac; send_msg(\%request, 0, $msg); } } @@ -1363,11 +1363,7 @@ sub switchsetup { my $outhash = shift; my $request = shift; my $sub_req = shift; - my $ret; my @switchnode = (); - my $switchInfo; - my $output; - my $dshcmd; my $static_ip; my $discover_switch; my $nodes_to_config; diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/tools/configBNT index e3b3d62cc8..13b8f67f53 100755 --- a/xCAT-server/share/xcat/tools/configBNT +++ b/xCAT-server/share/xcat/tools/configBNT @@ -327,9 +327,7 @@ sub config_snmp { if (@config_switches) { #update switch status my $csw = join(",",@config_switches); - $cmd = "chdef $csw status=switch_configed" ; - $rc= xCAT::Utils->runcmd($cmd, 0); - $cmd = "chtab switch=$csw switches.snmpversion=3 switches.auth=sha switches.username=$snmp_user switches.password=$snmp_passwd" ; + $cmd = "chdef $csw status=switch_configed snmpversion=3 snmpauth=sha snmpusername=$snmp_user snmppassword=$snmp_passwd"; $rc= xCAT::Utils->runcmd($cmd, 0); } } diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/tools/configMellanox index bc3bfc7c29..2af72ec183 100755 --- a/xCAT-server/share/xcat/tools/configMellanox +++ b/xCAT-server/share/xcat/tools/configMellanox @@ -78,7 +78,7 @@ if ($::SWITCH) exit(1); } } else { - xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --range"); + xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --switches"); &usage; exit(1); } @@ -248,10 +248,10 @@ sub usage { print "Usage: configMellonax [-?│-h│--help] - configMellonax [--range switchnames] [--all] - configMellonax [--range switchnames] [--ip] - configMellonax [--range switchnames] [--name] - configMellonax [--range switchnames] [--config] + configMellonax [--switches switchnames] [--all] + configMellonax [--switches switchnames] [--ip] + configMellonax [--switches switchnames] [--name] + configMellonax [--switches switchnames] [--config] \n"; } From c5121bce0f7299e3a54f3115e878c27b8177d3c6 Mon Sep 17 00:00:00 2001 From: Jesse Hanley Date: Wed, 3 Aug 2016 23:08:04 -0400 Subject: [PATCH 064/391] Added support for remote repos in pkgdir (#1614) This allows for remote repositories to be used for image creation. --- xCAT-server/share/xcat/netboot/rh/genimage | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 9174f59a40..0879cabb9e 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -265,12 +265,17 @@ unless ($onlyinitrd) { @yumdirs = (); my @pkgdirs = split(",", $srcdir); + my @pkgdir_internet; #Put all of the http mirrors in this array my $dir; foreach $dir (@pkgdirs) { + if ($dir =~ /^http.*/) { + push @pkgdir_internet, $dir; + } else { find(\&isyumdir, <$dir/>); if (!grep /$dir/, @yumdirs) { print "The repository for $dir should be created before running the genimge. Try to run [createrepo $dir].\n"; } + } } # Add the dir for kernel rpm to be installed @@ -280,8 +285,8 @@ unless ($onlyinitrd) { print "The repository for $kerneldir should be created before running the genimge. Try to run [createrepo $kerneldir].\n"; } } - unless (scalar(@yumdirs)) { - print "Need $installroot/$osver/$arch/ available from a system that has ran copycds on $osver $arch\n"; + unless (scalar(@yumdirs) || scalar(@pkgdir_internet)) { + print "Need $installroot/$osver/$arch/ available from a system that has ran copycds on $osver $arch or correct web repo\n"; exit 1; } @@ -300,6 +305,10 @@ unless ($onlyinitrd) { print $yumconfig "[$osver-$arch-$repnum]\nname=$osver-$arch-$repnum\nbaseurl=file://$srcdir\ngpgpcheck=0\n\n"; $repnum += 1; } + foreach $srcdir (@pkgdir_internet) { + print $yumconfig "[$osver-$arch-$repnum]\nname=$osver-$arch-$repnum\nbaseurl=$srcdir\ngpgpcheck=0\n\n"; + $repnum += 1; + } $repnum -= 1; close($yumconfig); mkpath "$rootimg_dir/etc"; From 9ff2f2b50a2c357faaee81f40118f78ded7370a7 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 4 Aug 2016 02:20:14 -0400 Subject: [PATCH 065/391] Revert "Propagate signal via ssh even though pipe broken can not be detected" --- perl-xCAT/xCAT/SSH.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/perl-xCAT/xCAT/SSH.pm b/perl-xCAT/xCAT/SSH.pm index c1de602afb..182671abbc 100644 --- a/perl-xCAT/xCAT/SSH.pm +++ b/perl-xCAT/xCAT/SSH.pm @@ -75,7 +75,6 @@ sub remote_shell_command { if ($ssh_version eq 'OpenSSH') { push @command, '-o'; push @command, 'BatchMode=yes'; - push @command, '-tt'; ($$config{'options'} !~ /-X/) && push @command, '-x'; } From c672699571a1d8b2af2cf28eb46fcfbcf4c2fe54 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Thu, 4 Aug 2016 14:35:45 +0800 Subject: [PATCH 066/391] fix genimage failed on rh6.8 (#1631) --- xCAT-server/share/xcat/netboot/rh/dracut/install.statelite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite index 61b3797f4c..b8bf69a461 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar xz cpio gzip dash modprobe wc touch echo cut +dracut_install wget tar cpio gzip dash modprobe wc touch echo cut dracut_install -o ctorrent dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install parted mke2fs bc mkswap swapon chmod From 39233a9a84cc4d331fcb2ac4683aed01f0519d51 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 4 Aug 2016 04:45:18 -0400 Subject: [PATCH 067/391] offer a template for probe sub command development which need to handle hierarchical scenario --- xCAT-probe/subcmds/code_template | 343 +++++++++++++++++++++++++++++++ 1 file changed, 343 insertions(+) create mode 100755 xCAT-probe/subcmds/code_template diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template new file mode 100755 index 0000000000..f1488b970f --- /dev/null +++ b/xCAT-probe/subcmds/code_template @@ -0,0 +1,343 @@ +#!/usr/bin/perl +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html + +BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } + +use lib "$::XCATROOT/probe/lib/perl"; +use probe_utils; +use xCAT::ServiceNodeUtils; +use File::Basename; +use Getopt::Long qw(:config no_ignore_case); +use IO::Select; +use Data::Dumper; + +my $program_name = basename("$0"); #current sub_command name +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' +my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT +my $is_sn = 0; #flag current server is SN +my $rst = 0; #the exit code of current command +my $terminal = 0; #means get INT signal from STDIN +my %summaryoutput; #save all output from commands running on SNs and MN + +#a map of SNs and command which will be dispatched to current SN +# $dispatchcmd{snname} = "command" +my %dispatchcmd; + +#save command line attributes from STDIN +my @tmpargv; + +#-------------------------------- +# below are some options rules used by default +# -h : Get usage information of current sub command +# -V : Output more information for debug +# -T : To verify if $program_name can work, reserve option for probe framework, dosen't use by customer +# -n : In xCAT probe, -n is uesd to specify node range uniformly +#-------------------------------- +$::USAGE = "Usage: + $program_name -h + $program_name [-V] + +Description: + This isn't a probe tool, this is just a template for sub command coding. + Using it to develop sub command which need to cover hierarchical cluster + <# ADD DESCRIPTION FOR YOUR COMMAND #> + +Options: + -h : Get usage information of $program_name + -V : Output more information for debug +"; + +#------------------------------------- +# TWO FUNCTIONS MUST BE IMPLEMENTED BY EACH SUB COMMAND +# They are do_main_job and summary_all_jobs_output +#------------------------------------- + +#------------------------------------ +# Please implement the main checking job of current command in do_main_job function +# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. +# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT +# Recommand to use probe_utils->send_msg() to handle message you plan to print out +#------------------------------------ +sub do_main_job { + my $outputtarget = shift; + $outputtarget = "stdout" if (!$outputtarget); + my $rst = 0; + + #<#DO YOUR OWN CHECKING JOB1i#> + probe_utils->send_msg($outputtarget, "o", "first checking point"); + + #<#DO YOUR OWN CHECKING JOB2#> + probe_utils->send_msg($outputtarget, "f", "second checking point"); + + return $rst; +} + +#------------------------------------- +# When this command return from all SNs and MN, you need to generate a summary +# All history outpout from SNs and MN are saved in globle hash %summaryoutput. +# $ummaryoutput{mn} = @mnhistory +# $ummaryoutput{snname1} = @snname1history; +# The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. +#------------------------------------- +sub summary_all_jobs_output { + + #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED + print "\n======================do summary=====================\n"; + foreach my $node (keys %summaryoutput) { + print "[$node]\n"; + foreach my $log (@{ $summaryoutput{$node} }) { + print "\t$log\n"; + } + } +} + +#------------------------------------- +# Each probe sub command is supposed to support hierarchical. +# This funtion is used to caclulate which SN should be dispatched which command +#------------------------------------- +sub caclulate_dispatch_cmd { + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + if ($noderange) { + my @nodes = `nodels $noderange 2>&1`; + if ($?) { + my $error = join(" ", @nodes); + if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { + probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); + } else { + probe_utils->send_msg("$output", "f", "There is error in command line attribute node range, please using nodels to check"); + } + return 1; + } else { + chomp foreach (@nodes); + my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); + my %newsnnodemap; + foreach my $sn (keys %$snnodemap) { + if (grep(/^$sn$/, @snlist)) { + push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); + } else { + push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); + } + } + + foreach my $sn (keys %newsnnodemap) { + my $nodes = join(",", @{ $newsnnodemap{$sn} }); + if ($sn eq "mn") { + $noderange = $nodes; + } else { + for (my $i = 0 ; $i <= $#tmpargv ; $i++) { + if ($tmpargv[$i] eq "-n") { + $tmpargv[ $i + 1 ] = $nodes; + last; + } + } + my $args = join(" ", @tmpargv); + $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; + } + } + } + } else { + if (@snlist) { + my $args = join(" ", @tmpargv); + my $sns = join(",", @snlist); + $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); + } + } + return 0; +} + + + +#------------------------------------- +# main process start +#------------------------------------- +@tmpargv = @ARGV; +if ( + !GetOptions("--help|h" => \$help, + "T" => \$test, + "n=s" => \$noderange, + "V" => \$verbose)) +{ + probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name"); + probe_utils->send_msg("$output", "d", "$::USAGE"); + exit 1; +} + +if ($help) { + if ($output ne "stdout") { + probe_utils->send_msg("$output", "d", "$::USAGE"); + } else { + print "$::USAGE"; + } + exit 0; +} + +if ($test) { + probe_utils->send_msg("$output", "o", "This isn't a probe tool, this is just a template for sub command coding. Using it to develop sub command which need to cover hierarchical cluster"); + exit 0; +} + +$SIG{TERM} = $SIG{INT} = sub { + $terminal = 1; +}; + +#-------------------------------------------- +# To confirm what current node is, MN or SN +#-------------------------------------------- +$is_sn = 1 if (-e "/etc/xCATSN"); + +if ($is_sn) { + $rst = do_main_job(); + exit $rst; +} + +#-------------------------------------------- +# Each probe tool is supposed to support hierarchical. +#-------------------------------------------- +$rst = caclulate_dispatch_cmd(); + +#print Dumper \%dispatchcmd; +#print "node left to mn : $noderange\n"; +exit $rst if ($rst); + +#-------------------------------------------- +# dispatch job to MN and SN +#-------------------------------------------- +my $mnjobpid = 0; +my @snsjobpids = (); +my @snsjobfds = (); +my $pipe_parent_read; +my $pipe_child_write; +pipe $pipe_parent_read, $pipe_child_write; +{ + #handle job in MN + $mnjobpid = fork(); + if (!defined($mnjobpid)) { + probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); + $rst = 1; + last; + } elsif ($mnjobpid == 0) { + $SIG{TERM} = $SIG{INT} = sub { + exit 1; + }; + + close $pipe_parent_read; + $rst = do_main_job($pipe_child_write); + exit $rst; + } + $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; + close $pipe_child_write; + + #handle job dispatch to SN + foreach my $sn (keys %dispatchcmd) { + my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\""; + + #print "$sn = $snjobcmd\n"; + my $snjobfd; + my $snjobpid; + if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { + probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); + next; + } + push(@snsjobpids, $snjobpid); + push(@snsjobfds, $snjobfd); + } + + my $select = new IO::Select; + $select->add(\*$pipe_parent_read) if ($pipe_parent_read); + $select->add(\*$_) foreach (@snsjobfds); + $| = 1; + + my $line; + my %pipeisnonull; + $pipeisnonull{mn} = 1; + $pipeisnonull{$_} = 1 foreach (@snsjobfds); + my $onepipeisnonull = 1; + while ($onepipeisnonull) { + if (@hdls = $select->can_read(0)) { + foreach $hdl (@hdls) { + if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { + if (eof($pipe_parent_read)) { + $pipeisnonull{mn} = 0; + } else { + chomp($line = <$pipe_parent_read>); + print "$line\n"; + push @{ $summaryoutput{mn} }, $line; + } + } else { + foreach my $fd (@snsjobfds) { + if ($pipeisnonull{$fd} && $hdl == \*$fd) { + if (eof($fd)) { + $pipeisnonull{$fd} = 0; + } else { + chomp($line = <$fd>); + if ($line =~ /^(\w+)\s*:\s(.*)/) { + print "$line\n"; + push @{ $summaryoutput{$1} }, $2; + } + } + } + } + } + } + $onepipeisnonull = 0; + $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); + } + last if ($terminal); + sleep 1; + } +} +close($pipe_child_write) if ($pipe_child_write); +close($pipe_parent_read) if ($pipe_parent_read); +close($_) foreach (@snsjobfds); + +my %runningpid; +$runningpid{$mnjobpid} = 1 if ($mnjobpid); +$runningpid{$_} = 1 foreach (@snsjobpids); +my $existrunningpid = 0; +$existrunningpid = 1 if (%runningpid); + +my $trytime = 0; +while ($existrunningpid) { + + #try INT 5 up to 5 times + if ($try < 5) { + foreach my $pid (keys %runningpid) { + kill 'INT', $pid if ($runningpid{$pid}); + } + + #try TERM 5 up to 5 times + } elsif ($try < 10) { + foreach my $pid (keys %runningpid) { + kill 'TERM', $pid if ($runningpid{$pid}); + } + + #try KILL 1 time + } else { + foreach my $pid (keys %runningpid) { + kill 'KILL', $pid if ($runningpid{$pid}); + } + } + ++$try; + + sleep 1; + foreach my $pid (keys %runningpid) { + $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); + } + $existrunningpid = 0; + $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); + last if ($try > 10); +} + +#------------------------------------- +# summary all jobs output to display +#------------------------------------- +$rst = summary_all_jobs_output(); + +exit $rst; + + + + From 560d01ab84fe34e35be73573a7570456c5d50110 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 2 Aug 2016 14:46:04 -0400 Subject: [PATCH 068/391] Cleanup boot configuration files when processing rmdef --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 6e55d0944b..23a96e8538 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -55,6 +55,8 @@ $Getopt::Long::ignorecase = 0; #@::objfilelist; # list of object names from the "-f" option #@::allobjnames; # combined list +my $doreq; + #@::noderange; # list of nodes derived from command line #------------------------------------------------------------------------------ @@ -137,6 +139,7 @@ sub process_request $::request = shift; $::callback = shift; + $doreq = shift; my $ret; my $msg; @@ -4239,6 +4242,26 @@ sub defrm } } + # Call nodeset offline on each node to cleanup its boot configuration files from /tftpboot directory + if ($doreq) { + # Go through each object and make sure it is a node type + my @allnodes; + foreach my $single_object (keys %objhash) { + if ($objhash{$single_object} eq "node") { + # build a list of nodes to offline + push @allnodes, $single_object; + } + } + # Run nodeset offline and capture output. + # But the output can be ignored since we do not want to prevent user from doing rmdef if + # nodeset returns some error. + my @output = xCAT::Utils->runxcmd({ + command => ['nodeset'], + node => [@allnodes], + arg => ['offline'], + }, $doreq, 0 ,1); + } + # remove the objects if (xCAT::DBobjUtils->rmobjdefs(\%objhash) != 0) { From 25cfd2b89ad73c40c64b2476cabdb39b58fc34aa Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 5 Aug 2016 02:38:24 -0400 Subject: [PATCH 069/391] modify depending on comments --- xCAT-probe/subcmds/code_template | 108 +++++++++++++++++++++++-------- 1 file changed, 82 insertions(+), 26 deletions(-) diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index f1488b970f..d6911dcaee 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -1,6 +1,26 @@ #!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#-------------------------------------------------------- +#This is a template for developing a probe sub_command. +#This template mainly implement the sub_comamd dispatch in hierarchical structure +#Developer only need to focus on main probe job (by implement do_main_job function) and friendly output (by implement summary_all_jobs_output function) for user +#This template can also be used in flat structure. but if developer think it's too heavy in flat, it's fine to develop sub command directly. +#But in hierarchical structure, we strongly recommand using this template. +#The main dispatch policy are: +#1. if there isn't noderange input from commmand line. if there are service nodes defined in current MN, +# we dispatch exact same command input from STDIN to all SNs and current MN. if there isn't service nodes defined, +# just hanld command input from STDIN in current MN +#2. If there is noderange input from command line by opion "-n", we will dispatch the command input from STDIN to SN which can hanle these ndoes +# For example, if we got command from STDIN like "probecommand -n test[1-15] -V" and test[1-5] 's SN is SN1, test[6-10]'s SN is SN2 +# The dispatch result will be: +# For MN run: probecommand -n test[11-15] -V +# For SN1 run: probecommand -n test[1-5] -V +# For SN2 run: probecommand -n test[6-10] -V +#3. All the return message from SNs and MN will be saved in hash %summaryoutput, develper can use it while implement summary_all_jobs_output function +#-------------------------------------------------------- + + BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; @@ -20,10 +40,17 @@ my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxx my $is_sn = 0; #flag current server is SN my $rst = 0; #the exit code of current command my $terminal = 0; #means get INT signal from STDIN -my %summaryoutput; #save all output from commands running on SNs and MN + +#save all output from commands running on SNs and MN +# one example: +# $summaryoutput{mn} = @mn_output_history +# $summaryoutput{SN1} = @SN1_output_history +my %summaryoutput; #a map of SNs and command which will be dispatched to current SN -# $dispatchcmd{snname} = "command" +# one example: +# $dispatchcmd{SN1} = "probecommand -n test[1-5] -V" +# $dispatchcmd{SN2} = "probecommand -n test[6-10] -V" my %dispatchcmd; #save command line attributes from STDIN @@ -41,8 +68,7 @@ $::USAGE = "Usage: $program_name [-V] Description: - This isn't a probe tool, this is just a template for sub command coding. - Using it to develop sub command which need to cover hierarchical cluster + This is a template for developing a probe sub_command. <# ADD DESCRIPTION FOR YOUR COMMAND #> Options: @@ -50,23 +76,21 @@ Options: -V : Output more information for debug "; -#------------------------------------- -# TWO FUNCTIONS MUST BE IMPLEMENTED BY EACH SUB COMMAND -# They are do_main_job and summary_all_jobs_output -#------------------------------------- - #------------------------------------ # Please implement the main checking job of current command in do_main_job function # If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. # If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT # Recommand to use probe_utils->send_msg() to handle message you plan to print out +# A simple example has been written in funciton. #------------------------------------ sub do_main_job { my $outputtarget = shift; $outputtarget = "stdout" if (!$outputtarget); my $rst = 0; - #<#DO YOUR OWN CHECKING JOB1i#> + probe_utils->send_msg($outputtarget, "o", "I reveive node range is $noderange"); + + #<#DO YOUR OWN CHECKING JOB1#> probe_utils->send_msg($outputtarget, "o", "first checking point"); #<#DO YOUR OWN CHECKING JOB2#> @@ -78,17 +102,18 @@ sub do_main_job { #------------------------------------- # When this command return from all SNs and MN, you need to generate a summary # All history outpout from SNs and MN are saved in globle hash %summaryoutput. -# $ummaryoutput{mn} = @mnhistory -# $ummaryoutput{snname1} = @snname1history; +# $summaryoutput{mn} = @mnhistory +# $summaryoutput{snname1} = @snname1history; # The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. +# A simple example of how to dump %summaryoutput has been written in function #------------------------------------- sub summary_all_jobs_output { #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED print "\n======================do summary=====================\n"; - foreach my $node (keys %summaryoutput) { - print "[$node]\n"; - foreach my $log (@{ $summaryoutput{$node} }) { + foreach my $sn (keys %summaryoutput) { + print "[$sn]\n"; + foreach my $log (@{ $summaryoutput{$sn} }) { print "\t$log\n"; } } @@ -98,10 +123,12 @@ sub summary_all_jobs_output { # Each probe sub command is supposed to support hierarchical. # This funtion is used to caclulate which SN should be dispatched which command #------------------------------------- -sub caclulate_dispatch_cmd { +sub calculate_dispatch_cmd { my @snlist = xCAT::ServiceNodeUtils->getAllSN(); if ($noderange) { my @nodes = `nodels $noderange 2>&1`; + + #if there is error in noderange if ($?) { my $error = join(" ", @nodes); if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { @@ -111,17 +138,25 @@ sub caclulate_dispatch_cmd { } return 1; } else { + + #calculate the mapping between SN and the nodes which belong to it. chomp foreach (@nodes); my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); + + #print Dumper $snnodemap; my %newsnnodemap; foreach my $sn (keys %$snnodemap) { - if (grep(/^$sn$/, @snlist)) { + if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); - } else { + } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN + push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); + } else { # the nodes don't belong to any SN will be handled by MN push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); } } + #print Dumper \%newsnnodemap; + #generate new command for each SN, replace noderange foreach my $sn (keys %newsnnodemap) { my $nodes = join(",", @{ $newsnnodemap{$sn} }); if ($sn eq "mn") { @@ -139,6 +174,8 @@ sub caclulate_dispatch_cmd { } } } else { + + #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN if (@snlist) { my $args = join(" ", @tmpargv); my $sns = join(",", @snlist); @@ -179,6 +216,7 @@ if ($test) { exit 0; } +#Handle the interrupt signal from STDIN $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; }; @@ -188,18 +226,20 @@ $SIG{TERM} = $SIG{INT} = sub { #-------------------------------------------- $is_sn = 1 if (-e "/etc/xCATSN"); +#if this node is SN, just run job, not to do dispatch if ($is_sn) { $rst = do_main_job(); exit $rst; } #-------------------------------------------- -# Each probe tool is supposed to support hierarchical. +# calculate which command should be dispatched to which SN #-------------------------------------------- -$rst = caclulate_dispatch_cmd(); +$rst = calculate_dispatch_cmd(); #print Dumper \%dispatchcmd; -#print "node left to mn : $noderange\n"; +#print "nodes left to mn : $noderange\n"; +#print "========================\n"; exit $rst if ($rst); #-------------------------------------------- @@ -215,7 +255,7 @@ pipe $pipe_parent_read, $pipe_child_write; #handle job in MN $mnjobpid = fork(); if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); + probe_utils->send_msg("$output", "f", "fock process to handle MN job failed: $!"); $rst = 1; last; } elsif ($mnjobpid == 0) { @@ -232,13 +272,13 @@ pipe $pipe_parent_read, $pipe_child_write; #handle job dispatch to SN foreach my $sn (keys %dispatchcmd) { - my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\""; + my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; #print "$sn = $snjobcmd\n"; my $snjobfd; my $snjobpid; if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); + probe_utils->send_msg("$output", "f", "fock process to dispatch cmd $snjobcmd to $sn failed: $!"); next; } push(@snsjobpids, $snjobpid); @@ -274,8 +314,9 @@ pipe $pipe_parent_read, $pipe_child_write; } else { chomp($line = <$fd>); if ($line =~ /^(\w+)\s*:\s(.*)/) { - print "$line\n"; push @{ $summaryoutput{$1} }, $2; + $line = "$2 :$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\])\s*:\s*(.*)/); + print "$line\n"; } } } @@ -293,6 +334,7 @@ close($pipe_child_write) if ($pipe_child_write); close($pipe_parent_read) if ($pipe_parent_read); close($_) foreach (@snsjobfds); +#start to clear up all sub processes my %runningpid; $runningpid{$mnjobpid} = 1 if ($mnjobpid); $runningpid{$_} = 1 foreach (@snsjobpids); @@ -302,6 +344,7 @@ $existrunningpid = 1 if (%runningpid); my $trytime = 0; while ($existrunningpid) { + #send terminal signal to all running process at same time #try INT 5 up to 5 times if ($try < 5) { foreach my $pid (keys %runningpid) { @@ -323,12 +366,25 @@ while ($existrunningpid) { ++$try; sleep 1; + + #To check how many process exit, set the flag of exited process to 0 foreach my $pid (keys %runningpid) { $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); } + + #To check if there are processes still running, if there are, try kill again in next loop $existrunningpid = 0; $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); - last if ($try > 10); + + #just try 10 times, if still can't kill some process, give up + if ($try > 10) { + my $leftpid; + foreach my $pid (keys %runningpid) { + $leftpid .= "$pid " if ($runningpid{$pid}); + } + print "Can't stop process $leftpid, please handle manually.\n"; + last; + } } #------------------------------------- From f9d532b0094b4cb2349f107425386fdc806e5e8b Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 5 Aug 2016 03:02:21 -0400 Subject: [PATCH 070/391] Fix issue 1638: Genesis not wait long enough time to have NICs get IP address --- xCAT-genesis-scripts/bin/doxcat | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index f8fc3ac224..73f16b0819 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -217,15 +217,16 @@ else fi fi done - sleep 2 + sleep 3 tries=$(($tries+1)) - if [ $tries -ge 10 ]; then + # Wait for 60 seconds to make sure the STP is done for at least one port + if [ $tries -ge 20 ]; then break fi done if [ -z "$bootnic" ]; then + logger -s -t $log_label -p local4.info "still can not get bootnic, go into /bin/bash" /bin/bash - logger -s -t $log_label -p local4.info "still can not get $bootnic, go into /bin/bash" fi else dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic & From 8417b07f63ffd578658acd2823949bb601e14a1d Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 29 Jul 2016 16:18:54 +0800 Subject: [PATCH 071/391] [xcat-wizard] Initial commit --- xCAT-server/share/xcat/tools/wizard/README | 0 .../share/xcat/tools/wizard/xcat-wizard | 421 ++++++++++++++++++ 2 files changed, 421 insertions(+) create mode 100644 xCAT-server/share/xcat/tools/wizard/README create mode 100755 xCAT-server/share/xcat/tools/wizard/xcat-wizard diff --git a/xCAT-server/share/xcat/tools/wizard/README b/xCAT-server/share/xcat/tools/wizard/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/xCAT-server/share/xcat/tools/wizard/xcat-wizard b/xCAT-server/share/xcat/tools/wizard/xcat-wizard new file mode 100755 index 0000000000..6d2f7e04a4 --- /dev/null +++ b/xCAT-server/share/xcat/tools/wizard/xcat-wizard @@ -0,0 +1,421 @@ +#!/bin/bash + +function step_0100_welcome() +{ + local -i ret=0 + dialog --backtitle 'xCAT Wizard' \ + --yes-label 'Next' --no-label 'Cancel' \ + --title 'Welcome' \ + --cr-wrap \ + --yesno \ + "Welcome to use xCAT Wizard.\n\nDuring this wizard session, a bunch of questions are going to be asked. Based on the answers of these questions, xCAT will be configured afterward." \ + 18 72 + ret="$?" + case "${ret}" in + 0) XCAT_WIZARD_STAGE="0200" ;; + *) + clear + exit 255 ;; + esac +} + +function step_0200_how_many_nodes() +{ + local -i ret=0 + exec 3>&1 + XCAT_WIZARD_0200_NODES="$(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --title 'How many nodes' \ + --inputbox \ + "In the cluster of which this xCAT management node will manage, how many nodes are plan to have? Based on the number of this answer, xCAT Wizard will do some optimization and performance tunning.\n\nA precise number is not needed, but please enter a rough number below." \ + 18 72 "${XCAT_WIZARD_0200_NODES:-100}" \ + 2>&1 1>&3)" + ret="$?" + exec 3>&- + # Treat the hostname properly + case "${ret}" in + 0) XCAT_WIZARD_STAGE="0300" ;; + 1) XCAT_WIZARD_STAGE="0100" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0300" + ;; + *) exit 255 ;; + esac +} + +function step_0300_network_adapter() +{ + local -i ret=0 + local oIFS="${IFS}" + IFS=$'\n' + local -a items=(` + IFS="${oIFS}" + while read -r nic blah + do + [[ ${nic} =~ : ]] || continue + nic="${nic%:}" + [[ "${nic}" = "lo" ]] && continue + mac="" + inet="" + inet6="" + while read -r key addr blah + do + case "${key}" in + "link/"*) + mac="${addr}" + ;; + "inet") + inet="${addr}" + ;; + "inet6") + inet6="${addr}" + ;; + esac + done < <(ip addr show "${nic}") + echo "${nic}" + echo "${mac} ${inet}" + done &1 + XCAT_WIZARD_0300_NIC="$(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --default-item "${XCAT_WIZARD_0300_NIC}" \ + --title 'Network adapter' \ + --menu \ + "Please choose the network adapter which connected to the cluster management network.\n\nThe xCAT management network is the network used by the management node to do the operating system deployment.\n\nIf you have a large cluster in which service nodes are involved, please choose the network adapter which connected to the management network in which multiple service nodes are connected." \ + 18 72 12 "${items[@]}" \ + 2>&1 1>&3)" + ret="$?" + exec 3>&- + case "${ret}" in + 0) + XCAT_WIZARD_MASTER="` + while read -r key addr blah + do + case "${key}" in + "link/"*) + mac="${addr}" + ;; + "inet") + inet="${addr}" + ;; + "inet6") + inet6="${addr}" + ;; + esac + done < <(ip addr show "${XCAT_WIZARD_0300_NIC}") + echo "${inet}" + `" + chdef -t site "master=${XCAT_WIZARD_MASTER%%/*}" >/dev/null 2>&1 + XCAT_WIZARD_STAGE="0400" + ;; + 1) XCAT_WIZARD_STAGE="0200" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0400" + ;; + *) exit 255 ;; + esac +} + +function step_0400_act_as_dns_server() +{ + local -i ret=0 + local use_external_dns="" + exec 3>&1 + XCAT_WIZARD_0400_DNS_SERVER="$(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --default-item "${XCAT_WIZARD_0400_DNS_SERVER}" \ + --title 'Be primary master name server?' \ + --menu \ + "Will this cluster have a separate DNS subdomain?\n\nIf you only have a small amount of nodes in this cluster, use external DNS server to do all the name resolution may be preferred. In this case, either all nodes in this cluster can be resolved with external DNS server, or a simple /etc/hosts file will be used to do all the name resolving in this cluster.\n\nOn the other hand, If you have a really large cluster with a great number of nodes, use a separate DNS subdomain for the whole cluster may be a good idea. In this case, this management node will act as the primary master name server of this subdomain." \ + 20 74 14 \ + "No" "use external DNS server" \ + "Yes" "use separate subdomain, and act as primary master name server" \ + 2>&1 1>&3)" + ret="$?" + exec 3>&- + case "${ret}" in + 0) + if [[ "${XCAT_WIZARD_0400_DNS_SERVER}" = "Yes" ]] + then + chdef -t site "nameservers=${XCAT_WIZARD_MASTER%%/*}" >/dev/null 2>&1 + fi + XCAT_WIZARD_STAGE="0500" + ;; + 1) XCAT_WIZARD_STAGE="0300" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0500" + ;; + *) exit 255 ;; + esac +} + +function step_0500_hostname() +{ + local -i ret=0 + local hostname="$(hostname -s 2>/dev/null)" + XCAT_WIZARD_0500_HOSTNAME="${hostname%%.*}" + exec 3>&1 + XCAT_WIZARD_0500_HOSTNAME="$(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --title 'Hostname' \ + --inputbox \ + "In order to make the xCAT management node running properly, the hostname of this machine must be configured correctly.\n\nPlease enter the hostname for this system.\n\nThe hostname is a single word that identifies your system to the network. If you do not know what your hostname should be, please consult your network administrator." \ + 18 72 "${XCAT_WIZARD_0500_HOSTNAME}" \ + 2>&1 1>&3)" + ret="$?" + exec 3>&- + # Treat the hostname properly + case "${ret}" in + 0) XCAT_WIZARD_STAGE="0600" ;; + 1) XCAT_WIZARD_STAGE="0400" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0600" + ;; + *) exit 255 ;; + esac +} + +function step_0600_dns_domain_name() +{ + local -i ret=0 + local dns_domain_name="$(hostname -d 2>/dev/null)" + XCAT_WIZARD_0600_DNS_DOMAIN_NAME="${dns_domain_name}" + exec 3>&1 + XCAT_WIZARD_0600_DNS_DOMAIN_NAME="$(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --title 'DNS domain name' \ + --inputbox \ + "Please enter the FQDN (Fully Qualified Domain Name) of this system.\n\nThe FQDN (Fully Qualified Domain Name) of the system is the name that the resolver returns for the host name, such as, ursula.example.com. It is usually the hostname followed by the DNS domain name (the part after the first dot).\n\nIf you do not know what your domain name should be, please consult your network administrator." \ + 18 72 "${XCAT_WIZARD_0600_DNS_DOMAIN_NAME}" \ + 2>&1 1>&3)" + ret="$?" + exec 3>&- + # Treat the DNS domain name properly + case "${ret}" in + 0) + chdef -t site "domain=${XCAT_WIZARD_0600_DNS_DOMAIN_NAME}" >/dev/null 2>&1 + XCAT_WIZARD_STAGE="0700" + ;; + 1) XCAT_WIZARD_STAGE="0500" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0700" + ;; + *) exit 255 ;; + esac +} + +function step_0700_name_servers() +{ + local -i ret=0 + local -a nameservers=() + while read -r + do + REPLY="${REPLY%%#*}" + set -- ${REPLY} + [[ "$1" = "nameserver" ]] && nameservers+=("$2") + done &1 + local oIFS="${IFS}" + IFS=$'\n' + XCAT_WIZARD_0700_NAME_SERVERS=($(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --title 'DNS Servers' \ + --form \ + "Please input the IP address of your DNS servers below.\n\nThese are Internet address of a name servers that the resolver should query, either an IPv4 address (in dot notation), or an IPv6 address in colon (and possibly dot) notation as per RFC 2373. Up to 3 DNS servers can be listed here.\n\nYou may consult your network administrator if needed." \ + 18 72 3 \ + "Primary DNS Server" 1 1 "${nameservers[0]}" 1 25 40 255 \ + "Secondary DNS Server" 2 1 "${nameservers[1]}" 2 25 40 255 \ + "Tertiary DNS Server" 3 1 "${nameservers[2]}" 3 25 40 255 \ + 2>&1 1>&3 + )) + ret="$?" + IFS="${oIFS}" + exec 3>&- + case "${ret}" in + 0) + # Save the configuration to /etc/resolv.conf + while read -r ; do echo "${REPLY}" ; done \ + >/etc/resolv.conf <<-EOF + # Generated by xCAT Wizard + $( + for n in "${XCAT_WIZARD_0700_NAME_SERVERS[@]}" + do + echo "nameserver ${n}" + done + ) + domain ${XCAT_WIZARD_0600_DNS_DOMAIN_NAME} + search ${XCAT_WIZARD_0600_DNS_DOMAIN_NAME} + EOF + chdef -t site "forwarders=${XCAT_WIZARD_0700_NAME_SERVERS[0]}" >/dev/null 2>&1 + if [[ "${XCAT_WIZARD_0400_DNS_SERVER}" = "No" ]] + then + chdef -t site "nameservers=${XCAT_WIZARD_0700_NAME_SERVERS[0]}" >/dev/null 2>&1 + fi + XCAT_WIZARD_STAGE="0800" + ;; + 1) XCAT_WIZARD_STAGE="0600" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="0800" + ;; + *) exit 255 ;; + esac +} + +function step_0800_ntp_servers() +{ + local -i ret=0 + local -a ntp_servers=() + while read -r + do + REPLY="${REPLY%%#*}" + set -- ${REPLY} + if [[ "$1" = "server" ]] + then + [[ $2 =~ ^127\. ]] && continue + ntp_servers+=("$2") + fi + done &1 + local oIFS="${IFS}" + IFS=$'\n' + XCAT_WIZARD_0800_NTP_SERVERS=($(dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --cancel-label 'Prev' \ + --extra-button --extra-label 'Skip' \ + --title 'NTP Servers' \ + --form \ + "Please input the IP address of your NTP servers below.\n\nNetwork Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. Up to 4 NTP servers can be listed here.\n\nYou may consult your network administrator if needed." \ + 18 72 4 \ + "Primary NTP Server" 1 1 "${ntp_servers[0]}" 1 25 40 255 \ + "Secondary NTP Server" 2 1 "${ntp_servers[1]}" 2 25 40 255 \ + "Tertiary NTP Server" 3 1 "${ntp_servers[2]}" 3 25 40 255 \ + "Quaternary NTP Server" 4 1 "${ntp_servers[3]}" 4 25 40 255 \ + 2>&1 1>&3 + )) + ret="$?" + IFS="${oIFS}" + exec 3>&- + case "${ret}" in + 0) + chdef -t site "extntpservers=${XCAT_WIZARD_0800_NTP_SERVERS[0]}${XCAT_WIZARD_0800_NTP_SERVERS[1]:+,}${XCAT_WIZARD_0800_NTP_SERVERS[1]}${XCAT_WIZARD_0800_NTP_SERVERS[2]:+,}${XCAT_WIZARD_0800_NTP_SERVERS[2]}${XCAT_WIZARD_0800_NTP_SERVERS[3]:+,}${XCAT_WIZARD_0800_NTP_SERVERS[3]}" >/dev/null 2>&1 + makentp >/dev/null 2>&1 + XCAT_WIZARD_STAGE="9900" + ;; + 1) XCAT_WIZARD_STAGE="0700" ;; + 3) + answer_later + XCAT_WIZARD_STAGE="9900" + ;; + *) exit 255 ;; + esac +} + +function step_9900_accomplished() +{ + local -i ret=0 + dialog --backtitle 'xCAT Wizard' \ + --yes-label 'Okay' --no-label 'Prev' \ + --title 'Accomplished' \ + --cr-wrap \ + --yesno \ + "The basic configuration of xCAT is accomplished. You may continue setup the cluster by refer the document below.\n\nhttps://xcat-docs.readthedocs.io/en/stable/guides/admin-guides/" \ + 18 72 + ret="$?" + case "${ret}" in + 0) XCAT_WIZARD_STAGE="" ;; + 1) XCAT_WIZARD_STAGE="0800" ;; + *) + clear + exit 255 ;; + esac +} + +function answer_later() +{ + dialog --backtitle 'xCAT Wizard' \ + --ok-label 'Next' --title 'Answer later' \ + --msgbox 'Cool, you can answer later if you want.' \ + 6 48 +} + +function var_export() +{ + local var="$1" + local -i i + local v="" + if [[ "$(declare -p "${var}")" =~ "declare -a" ]] + then + # Is array + echo -n "${var}=(" + for i in $(eval echo "\${!${var}[@]}") + do + [[ -n "${v}" ]] && echo -n " " + v="${var}[${i}]" + echo -n "[${i}]=\"${!v}\"" + done + echo ")" + else + echo "${var}=\"${!var}\"" + fi +} + +XCAT_WIZARD_CONFIG_FILE="${HOME}/.xcat-wizard" + +function save_config_file() +{ + local var="" + for var in "${!XCAT_WIZARD_0@}" + do + var_export "${var}" + done >"${XCAT_WIZARD_CONFIG_FILE}" +} + +function load_config_file() +{ + source "${XCAT_WIZARD_CONFIG_FILE}" 2>/dev/null +} + +XCAT_WIZARD_STAGE="" + +function xcat_wizard_engine() +{ + local stage="" + XCAT_WIZARD_STAGE="0100" + while [[ -n "${XCAT_WIZARD_STAGE}" ]] + do + stage="$(compgen -A function "step_${XCAT_WIZARD_STAGE}_")" + if [[ -z "${stage}" ]] + then + clear + echo "${0##*/}: unknown xCAT Wizard stage ${XCAT_WIZARD_STAGE}" >&2 + exit 1 + fi + "${stage}" + done +} + +export PATH="/opt/xcat/bin:/opt/xcat/sbin:/usr/sbin:/usr/bin:/sbin:/bin" + +load_config_file +xcat_wizard_engine +save_config_file +clear From ab3448ca9f2ce2af0cb7a76d7cadad15b8d3b3c1 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 2 Aug 2016 14:34:43 -0400 Subject: [PATCH 072/391] Change the summary message for go-xcat --- xCAT-server/share/xcat/tools/go-xcat | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 0f17c7aa5f..f3af5d556c 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1502,18 +1502,11 @@ case "${GO_XCAT_ACTION}" in while read -r ; do echo "${REPLY}" ; done <<-EOF + xCAT has been installed! + ======================== - Congratulations - =============== - - The fact that you got this far is a strong indication that xCAT bas been - installed correctly. - - Please notice if this is the first time you install xCAT. You need to do one - of the following. - - 1. Log out and then log in again, or - 2. run the following command to set the environment variables. + If this is the very first time xCAT has been installed, run the following + commands to set environment variables into your PATH: for sh, \`source /etc/profile.d/xcat.sh\` From 9b96ee24e6d8c0768c8dc40ff0f4265bd15c2822 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 5 Aug 2016 12:40:41 -0400 Subject: [PATCH 073/391] Display a different summary message on install vs update --- xCAT-server/share/xcat/tools/go-xcat | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index f3af5d556c..f13e6e3212 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1500,19 +1500,29 @@ case "${GO_XCAT_ACTION}" in exit "${RET}" fi - while read -r ; do echo "${REPLY}" ; done <<-EOF + if [ ${GO_XCAT_ACTION} == 'install' ]; then + # only print out this message on install + while read -r ; do echo "${REPLY}" ; done <<-EOF - xCAT has been installed! - ======================== + xCAT has been installed! + ======================== - If this is the very first time xCAT has been installed, run the following - commands to set environment variables into your PATH: + If this is the very first time xCAT has been installed, run the following + commands to set environment variables into your PATH: - for sh, - \`source /etc/profile.d/xcat.sh\` - or csh, - \`source /etc/profile.d/xcat.csh\` - EOF + for sh, + \`source /etc/profile.d/xcat.sh\` + or csh, + \`source /etc/profile.d/xcat.csh\` + EOF + else + while read -r ; do echo "${REPLY}" ; done <<-EOF + + xCAT has been updated! + ====================== + + EOF + fi ;; *) list_xcat_packages From 9d0f0fb67753f96eda5c1b24f893ada48a45144b Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 8 Aug 2016 11:34:51 +0800 Subject: [PATCH 074/391] Delete invalid statelite test case Delete invalid statelite test case --- xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index be3eb8b858..cedd4f8989 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -220,4 +220,3 @@ assign_certain_command_permission_systemd sles_migration1 sles_migration2 reg_linux_diskless_installation_flat -reg_linux_statelite_installation_flat From 878d43addc1a32a904a3112de6b5f4677e5fdd43 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 8 Aug 2016 00:21:06 -0400 Subject: [PATCH 075/391] Add a section to attempt to autodetect the RHEL OS to bypass (#1644) the need to update the discinfo database --- xCAT-server/lib/xcat/plugins/anaconda.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index bf8c45f7f7..a0e9f768db 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2239,17 +2239,27 @@ sub copycd } } - unless ($distname) { + print "INFO - Could not find ID=$did in the discinfo database for OS=$desc ARCH=$darch NUM=$dno, attempt to auto-detect...\n"; if ($desc =~ /IBM_PowerKVM/) { # check for PowerKVM support my @pkvm_version = split / /, $desc; $distname = "pkvm" . $pkvm_version[1]; } + elsif ($desc =~ /Red Hat Enterprise Linux/) + { + # + # Attempt to auto-detect for RHEL OS. + # RHEL 7.3 description is: Red Hat Enterprise Linux 7.3 + # + my @rhel_version = split / /, $desc; + $distname = "rhels" . $rhel_version[4]; + } else { + print "INFO - Could not auto-detect operating system.\n"; return; #Do nothing, not ours.. } } From 85d05682d47a6a15421a18c6835461b3c44baf35 Mon Sep 17 00:00:00 2001 From: bybai Date: Mon, 8 Aug 2016 04:47:54 -0400 Subject: [PATCH 076/391] add list_netip rest api --- xCAT-server/lib/xcat/plugins/localrest.pm | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/localrest.pm b/xCAT-server/lib/xcat/plugins/localrest.pm index 8474acad34..6c3b2ccdbe 100644 --- a/xCAT-server/lib/xcat/plugins/localrest.pm +++ b/xCAT-server/lib/xcat/plugins/localrest.pm @@ -161,6 +161,36 @@ sub list_adapter { return $result; } +#------------------------------------------------------- + +=head3 handler to list network adapter first ip + + Subroutine to handle rest request + GET /localres/netip/ + + Usage example: + This function is called from handle_rest_request, + do not call it directly. +=cut + +#------------------------------------------------------- +sub list_netip { + my @params = @_; + my ($rsp, $result, $iface, $cmd); + if (!@params) { + $rsp->{data}->[0] = "Argmument error."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return 1; + } + $iface = shift @params; + $cmd = "ip addr show dev $iface |grep inet|head -1|awk '{print \$2}'|awk -F/ '{print \$1}'"; + + $result->[ 0 ] = xCAT::Utils->runcmd("$cmd", -1); + + return $result; +} + + #------------------------------------------------------- =head3 handler to download credential files From 1646d8bed2cc39d783db6f2aa2946c8eedce2586 Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 8 Aug 2016 01:37:27 -0400 Subject: [PATCH 077/391] Modify usage, some probe commands do not support hierarchy --- xCAT-probe/subcmds/detect_dhcpd | 1 - xCAT-probe/subcmds/discovery | 5 ++--- xCAT-probe/subcmds/image | 2 -- xCAT-probe/subcmds/switch-macmap | 5 ++--- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/xCAT-probe/subcmds/detect_dhcpd b/xCAT-probe/subcmds/detect_dhcpd index 8c87591326..f1a2947b83 100755 --- a/xCAT-probe/subcmds/detect_dhcpd +++ b/xCAT-probe/subcmds/detect_dhcpd @@ -30,7 +30,6 @@ Options: -m macaddress: The mac that will be used to detect dhcp server. Recommend to use the real mac of the node that will be netboot. If no specified, the mac of interface which specified by -i will be used. -d duration: The time to wait to detect the dhcp messages. The default value is 10s. -V verbose: To print additional debug information. - -T : To verify if $program_name can work, reserve option for probe framework. "; #--------------------------- diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index a89626981d..bfcec74f43 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -32,17 +32,16 @@ my %monitor_nodes; $::USAGE = "Usage: $program_name -h - $program_name -T $program_name [-V] [-m -n ] [--noprecheck] Description: Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process. If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name exit for error. In order to do realtime monitor, $program_name probe program must be run along with the node discovery procedure. Plese trigger this command before trigger node discovery procedure. + Currently, this command does not support hierarchy. Options: -h : Get usage information of $program_name. - -T : To verify if $program_name can work, reserve option for probe framework. -V : Output more information for debug. -m : The method of discovery, the valid values are $valid_discovery_type_str. -n : The range of predefined node, must used with option -m. @@ -1137,7 +1136,7 @@ if ($help) { } if ($test) { - probe_utils->send_msg("$output", "o", "Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process.Before using this command, please install nslookup command ahead."); + probe_utils->send_msg("$output", "o", "Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process.Before using this command, please install nslookup command ahead. Currently, this command does not support hierarchy."); exit 0; } diff --git a/xCAT-probe/subcmds/image b/xCAT-probe/subcmds/image index 2dc104ab98..a79f16ab6e 100755 --- a/xCAT-probe/subcmds/image +++ b/xCAT-probe/subcmds/image @@ -22,7 +22,6 @@ my $rst = 0; $::USAGE = "Usage: $program_name -h - $program_name -T $program_name {-c|-d} [-n noderange] [-V] Description: @@ -31,7 +30,6 @@ Description: Options: -h : Get usage information of $program_name - -T : To verify if $program_name can work, reserve option for probe framework -n : Range of nodes to check -d : To verify diskless, pingable compute nodes have the same images installed as defines in xCAT DB. -c : To verify all diskless, pingable compute nodes have the identical images installed. diff --git a/xCAT-probe/subcmds/switch-macmap b/xCAT-probe/subcmds/switch-macmap index a92b0e8862..ca567a26ea 100755 --- a/xCAT-probe/subcmds/switch-macmap +++ b/xCAT-probe/subcmds/switch-macmap @@ -16,14 +16,13 @@ my $output = "stdout"; $::USAGE = "Usage: $proname -h - $proname -T $proname [-c] [-V] Description: To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. + Currently, this command does not support hierarchy. Options: - -T: Check whether this script is OK to run. -c: To check whether the switch is OK to retrieve MAC address mapping. -V: Output verbose information when accessing switch "; @@ -67,7 +66,7 @@ if ($test) { probe_utils->send_msg("$output", "f", "No switchprobe tool is available at $currdir/bin/"); exit 1; } else { - probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db."); + probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. Currently, this command does not support hierarchy."); exit 0; } } From 2ab944ea652f29bb786cca7d44b020550205d15b Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 4 Aug 2016 05:40:01 -0400 Subject: [PATCH 078/391] add ubuntu16.04.1 netboot pkglist;modify the precedence of SvrUtils::get_file_name --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 18 +++++++++--------- .../ubuntu/compute.ubuntu16.04.1.pkglist | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 4319eae821..3c813ca452 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -460,21 +460,21 @@ sub get_file_name { if (-r "$searchpath/$profile.$os.$arch.$extension") { return "$searchpath/$profile.$os.$arch.$extension"; } - elsif (-r "$searchpath/$profile.$osbase.$arch.$extension") { - return "$searchpath/$profile.$osbase.$arch.$extension"; - } - elsif (-r "$searchpath/$profile.$genos.$arch.$extension") { - return "$searchpath/$profile.$genos.$arch.$extension"; - } elsif (-r "$searchpath/$profile.$os.$extension") { return "$searchpath/$profile.$os.$extension"; } + elsif (($genos) && (-r "$searchpath/$profile.$genos.$arch.$extension")) { + return "$searchpath/$profile.$genos.$arch.$extension"; + } + elsif (($genos) && (-r "$searchpath/$profile.$genos.$extension")) { + return "$searchpath/$profile.$genos.$extension"; + } + elsif (-r "$searchpath/$profile.$osbase.$arch.$extension") { + return "$searchpath/$profile.$osbase.$arch.$extension"; + } elsif (-r "$searchpath/$profile.$osbase.$extension") { return "$searchpath/$profile.$osbase.$extension"; } - elsif (-r "$searchpath/$profile.$genos.$extension") { - return "$searchpath/$profile.$genos.$extension"; - } elsif (-r "$searchpath/$profile.$arch.$extension") { return "$searchpath/$profile.$arch.$extension"; } diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist new file mode 100644 index 0000000000..a5861a9e0b --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist @@ -0,0 +1,17 @@ +bash +nfs-common +openssl +isc-dhcp-client +libc-bin +linux-image-generic +openssh-server +openssh-client +wget +ntp +ntpdate +rsync +busybox-static +gawk +dnsutils +tar +gzip From 463f69e3a4cbbc3db9e5c50642e39b135da77b25 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Tue, 9 Aug 2016 02:30:05 -0400 Subject: [PATCH 079/391] Implement replay and state control function for os provision probe --- xCAT-probe/subcmds/osdeploy | 713 ++++++++++++++++++++++++++++-------- 1 file changed, 559 insertions(+), 154 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index dabbd16fea..c051e6e567 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -9,35 +9,158 @@ use probe_utils; use xCAT::NetworkUtils; use File::Basename; use IO::Select; +use Time::Local; +use Data::Dumper; use Getopt::Long qw(:config no_ignore_case); my $program_name = basename("$0"); my $help; my $test; -my $output = "stdout"; -my $verbose = 0; -my $rst = 0; +my $maxwaittime = 60; #unit is minute +my $output = "stdout"; +my $verbose = 0; +my $rst = 0; my $noderange; -my %rawdata; -my %ipnodemap; -my %macmap; my $terminal = 0; +my $installnic; +my $monitor = 0; +my $replaylog; ##used by feature replay deploymen log + +my %rawdata; + +#-%rawdata structure------- +# $rawdata{nodename}{"history"} #array, the log history of current node +# $rawdata{nodename}{"state"} #the latest status of current node, used for State Machine +# $rawdata{nodename}{"statehistory"} #array, the history status of current node, used for State Machine +#-------------------------- + +my %macmap; + +#-%macmap structure------- +# $macmap{mac_addr}{"ip"}="x.x.x.x" +# $macmap{mac_addr}{"node"}="nodename" +#------------------------- + +my %ipnodemap; + +#-%ipnodemap structure------- +# $ipnodemap{ip_addr}="nodename" +#--------------------------- + my %monitor_nodes; +#- %monitor_nodes structure------- +# $monitor_nodes{nodename}{"status"} #useless now +# $monitor_nodes{nodename}{"rst"} +#--------------------------------- + +# provision state machine +my %state_set = ( + "unknown" => 0, + "sever_reboot" => 1, + "loaded_kernel_and_initrd" => 2, + "kernel_and_initrd_got_ip" => 3, + "install_os_packages" => 4, + "run_postscript" => 5, + "run_postbootscript" => 6, + "done" => 7, +); + +my %state_set_reverse = ( + "0" => "unknown", + "1" => "sever_reboot", + "2" => "loaded_kernel_and_initrd", + "3" => "kernel_and_initrd_got_ip", + "4" => "install_os_packages", + "5" => "run_postscript", + "6" => "run_postbootscript", + "7" => "done", +); + +my %valid_process; +$valid_process{1}{process} = [ $state_set{unknown}, $state_set{done} ]; +$valid_process{1}{type} = "reboot"; + +$valid_process{2}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{done} ]; +$valid_process{2}{type} = "reboot"; + +$valid_process{3}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{3}{type} = "reboot"; + +$valid_process{4}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{4}{type} = "deploy"; + +$valid_process{5}{process} = [ $state_set{unknown}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{5}{type} = "deploy"; + +sub reset_state { + my $state_ref = shift; + my $condition = shift; + my $reset_flag = 1; + + if ($$state_ref == $state_set{unknown} && $condition eq "dhcp") { + $$state_ref = $state_set{sever_reboot}; + } elsif ($$state_ref == $state_set{unknown} && $condition eq "booted") { + $$state_ref = $state_set{done}; + } elsif (($$state_ref == $state_set{unknown} && $condition eq "tftp") || ($$state_ref == $state_set{unknown} && $condition eq "http")) { + $$state_ref = $state_set{loaded_kernel_and_initrd}; + } elsif ($$state_ref == $state_set{sever_reboot} && $condition eq "booted") { + $$state_ref = $state_set{done}; + } elsif ($$state_ref == $state_set{sever_reboot} && $condition eq "postscript") { + $$state_ref = $state_set{run_postbootscript}; + } elsif (($$state_ref == $state_set{sever_reboot} && $condition eq "tftp") || ($$state_ref == $state_set{sever_reboot} && $condition eq "http")) { + $$state_ref = $state_set{loaded_kernel_and_initrd}; + } elsif ($$state_ref == $state_set{loaded_kernel_and_initrd} && $condition eq "dhcp") { + $$state_ref = $state_set{kernel_and_initrd_got_ip}; + } elsif ($$state_ref == $state_set{kernel_and_initrd_got_ip} && $condition eq "http") { + $$state_ref = $state_set{install_os_packages}; + } elsif ($$state_ref == $state_set{install_os_packages} && $condition eq "postscript") { + $$state_ref = $state_set{run_postscript}; + } elsif ($$state_ref == $state_set{run_postscript} && $condition eq "dhcp") { + $$state_ref = $state_set{sever_reboot}; + } elsif ($$state_ref == $state_set{run_postbootscript} && $condition eq "booted") { + $$state_ref = $state_set{done}; + } elsif ($$state_ref == $state_set{done} && $condition eq "dhcp") { + $$state_ref = $state_set{sever_reboot}; + } elsif ($$state_ref == $state_set{done} && $condition eq "poweron") { + $$state_ref = $state_set{sever_reboot}; + } else { + $reset_flag = 0; + } + + return $reset_flag; +} + + +my @candidate_svr_hostname_inlog; +my $svr_hostname_short = `hostname -s`; +chomp($svr_hostname_short); +my $svr_hostname_domain = `hostname -d`; +chomp($svr_hostname_domain); +push(@candidate_svr_hostname_inlog, $svr_hostname_short); +push(@candidate_svr_hostname_inlog, "$svr_hostname_short.$svr_hostname_domain"); + + $::USAGE = "Usage: $program_name -h $program_name -T $program_name -n [-V] + $program_name -n -r [-V] Description: - Do probe for os provision process, realtime monitor of os provision process. - Please run this before rpower node. + Do probe for os provision process. Realtime monitor or replay history of os provision process. + If do realtime monitor, please run this before rpower node. + Unsupport hierarchial structure now. Options: -h : Get usage information of $program_name -T : To verify if $program_name can work, reserve option for probe framework -V : Output more information for debug - -n : The range of monitored node. + -n : The range of node to be monitor or replay log. + -t : The maximum time to wait when doing monitor, the unit is minute, default is 60 minutes. + -r : Replay history log to probe provision. need input a start time when probe should begin from. + Support time format are xxhxxm, xxh, or xxm. h means hour, m means minute. + If there isn't unit input, using hour by default. "; #------------------------------------------ @@ -54,58 +177,58 @@ Options: #------------------------------------------ sub check_noderange { - my $node_range = shift; - my @cmdoutput = `lsdef $node_range -i ip,mac 2>&1`; - my $rst = 0; - my $currentnode = ""; - my $ip = "NOIP"; + my $node_range = shift; + my @cmdoutput = `lsdef $node_range -i ip,mac -c 2>&1`; + my $rst = 0; my %nodecheckrst; - my $mac_line; - my @macs; foreach (@cmdoutput) { chomp($_); $_ =~ s/^\s+|\s+$//g; if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) { - $currentnode = $1; - $nodecheckrst{$currentnode}{"error"} = "Could not find node definition"; - $rst = 1; - } elsif ($_ =~ /^\s*Object name: (\w+)/i) { - - # 'rst' is used to check whether the node process finished, 1 is finished. - $monitor_nodes{$1}{"rst"} = 0; - $currentnode = $1; - $ip = "NOIP"; - } elsif ($_ =~ /^ip=(.+)/i) { - if ($1) { - $ip = $1; + $nodecheckrst{$1}{"error"} = "Could not find node definition"; + } elsif ($_ =~ /(\S+):\s+mac=(.*)/i) { + my $node = $1; + my $mac = $2; + if ($mac) { + $nodecheckrst{$node}{"mac"} = $mac; + } else { + $nodecheckrst{$node}{"error"} = "Node $1 doesn't have MAC address"; } - } elsif ($_ =~ /^mac=(.+)/i) { - next unless ($1); - $mac_line = $1; - @macs = split(/\|/, $mac_line); - foreach my $mac (@macs) { - if ($mac =~ /\!\*NOIP\*/) { - $mac =~ s/\!\*NOIP\*//g; - $macmap{$mac}{"ip"} = "NOIP"; - $macmap{$mac}{"node"} = $currentnode; - } - else { - $macmap{$mac}{"ip"} = $ip; - $macmap{$mac}{"node"} = $currentnode; - } + } elsif ($_ =~ /(\S+):\s+ip=(.*)/i) { + my $node = $1; + my $ip = $2; + if ($ip) { + $nodecheckrst{$node}{"ip"} = $ip; } } } foreach my $node (keys %nodecheckrst) { - probe_utils->send_msg("$output", "d", "$node : $nodecheckrst{$node}{error}") if (exists($nodecheckrst{$node}{error})); + if (exists($nodecheckrst{$node}{error})) { + probe_utils->send_msg("$output", "d", "$node : $nodecheckrst{$node}{error}"); + $rst = 1; + next; + } + $monitor_nodes{$node}{"rst"} = 0; + my @macs = split(/\|/, $nodecheckrst{$node}{"mac"}); + foreach my $mac (@macs) { + if ($mac =~ /\!\*NOIP\*/) { + $mac =~ s/\!\*NOIP\*//g; + $macmap{$mac}{"ip"} = "NOIP"; + $macmap{$mac}{"node"} = $node; + } else { + $macmap{$mac}{"ip"} = $nodecheckrst{$node}{"ip"}; + $macmap{$mac}{"node"} = $node; + } + } } unless (%monitor_nodes) { - probe_utils->send_msg("$output", "d", "There is no node to be monitored"); + probe_utils->send_msg("$output", "d", "There is no valid node to handle"); $rst = 1; } + return $rst; } @@ -116,7 +239,7 @@ sub check_noderange { Handle one line log come from dhcp log file Arguments: msg: one line http log - nics: target network interfaces + installnic: target network interfaces Returns: 0 : pass 1 : failed @@ -132,8 +255,8 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; - my $record = "Receive DHCPDISCOVER from [$node] $mac via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $record = "Receive DHCPDISCOVER via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); } } elsif ($msg =~ /.+DHCPOFFER\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/i) { @@ -143,8 +266,8 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; - my $record = "Send DHCPOFFER on $ip back to [$node] $mac via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $record = "Send DHCPOFFER on $ip back to $mac via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); } @@ -155,16 +278,10 @@ sub handle_dhcp_msg { my $nic = $4; if (exists $macmap{$mac}) { - my $node = $macmap{$mac}{"node"}; - my $record = "Receive DHCPREQUEST from [$node] $mac for $ip via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $node = $macmap{$mac}{"node"}; + my $record = "Receive DHCPREQUEST from $mac for $ip via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); - - if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { - my $warn_msg = "The ip of [$node] $mac from DHCP $ip is different with definition $macmap{$mac}{'ip'}."; - probe_utils->send_msg("$output", "w", "$warn_msg"); - push(@{ $rawdata{$node}{"history"} }, $warn_msg); - } } } elsif ($msg =~ /.+DHCPACK\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/) { my $ip = $1; @@ -173,19 +290,25 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; - my $record = "Send DHCPACK on $ip back to [$node] $mac via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $record = "Send DHCPACK on $ip back to $mac via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); $ipnodemap{$ip} = $node; + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp")); + + if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { + my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different with the ip($macmap{$mac}{'ip'}) in node definition."; + probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor); + push(@{ $rawdata{$node}{"history"} }, $warn_msg); + } } } elsif ($msg =~ /.+BOOTREQUEST\s+from\s+(.+)\s+via\s+([^:]+)(.*)/) { my $mac = $1; my $nic = $2; - if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; - my $record = "Receive BOOTREQUEST from [$node] $mac via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $record = "Receive BOOTREQUEST from $mac via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); } } elsif ($msg =~ /.+BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { @@ -195,14 +318,15 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; - my $record = "Send BOOTREPLY on $ip back to [$node] $mac via $nic"; - probe_utils->send_msg("$output", "d", "$record"); + my $record = "Send BOOTREPLY on $ip back to $mac via $nic"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $record); $ipnodemap{$ip} = $node; + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp")); if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { - my $warn_msg = "The ip of [$node] $mac from DHCP $ip is different with definition $macmap{$mac}{'ip'}."; - probe_utils->send_msg("$output", "w", "$warn_msg"); + my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different with the ip($macmap{$mac}{'ip'}) in node definition."; + probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $warn_msg); } } @@ -230,11 +354,11 @@ sub handle_tftp_msg { if ($msg =~ /RRQ\s+from\s+(.+)\s+filename\s+(.+)/i) { my $ip = $1; my $file = $2; - my $record = "[$ipnodemap{$ip}] Via TFTP $ip download $file"; - + my $record = "Via TFTP download $file"; if (exists($rawdata{"$ipnodemap{$ip}"})) { - probe_utils->send_msg("$output", "d", "$record"); + probe_utils->send_msg("$output", "d", "[$ipnodemap{$ip}] $record") if ($monitor); push(@{ $rawdata{ $ipnodemap{$ip} }{"history"} }, $record); + push(@{ $rawdata{ $ipnodemap{$ip} }{statehistory} }, $rawdata{ $ipnodemap{$ip} }{state}) if (reset_state(\$rawdata{ $ipnodemap{$ip} }{state}, "tftp")); } } } @@ -257,11 +381,12 @@ sub handle_http_msg { if ($msg =~ /(\d+\.\d+.\d+.\d+)\s.+GET\s+(.+)\s+HTTP.+/) { my $ip = $1; my $file = $2; - my $record = "[$ipnodemap{$ip}] Via HTTP $ip GET $file"; + my $record = "Via HTTP get $file"; if (exists($rawdata{"$ipnodemap{$ip}"})) { - probe_utils->send_msg("$output", "d", "$record"); + probe_utils->send_msg("$output", "d", "[$ipnodemap{$ip}] $record") if ($monitor); push(@{ $rawdata{ $ipnodemap{$ip} }{"history"} }, $record); + push(@{ $rawdata{ $ipnodemap{$ip} }{statehistory} }, $rawdata{ $ipnodemap{$ip} }{state}) if (reset_state(\$rawdata{ $ipnodemap{$ip} }{state}, "http")); } } return 0; @@ -286,37 +411,29 @@ sub handle_cluster_msg { my $msg; my $status; - if ($line =~ /.+\s+xcat:\s+(.+)\s+status:\s+(.+)\s+statustime:\s(.+)/) { - $node = $1; - $status = $2; + my @splitline = split(/\s+/, $line); + if (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i)) { - if (exists($rawdata{$node})) { - my $record = "Receive from $node : status is $status"; - probe_utils->send_msg("$output", "d", "$record"); - push(@{ $rawdata{$node}{"history"} }, $record); - } + #log like: Aug 7 22:30:31 c910f02c01p09 xcat: c910f02c04p04 status: booted statustime: 08-07-2016 22:30:31 + if (($splitline[6] =~ /^status:$/i) && ($splitline[8] =~ /^statustime:$/)) { + $node = $splitline[5]; + $status = $splitline[7]; + if (exists($rawdata{$node})) { + my $record = "Node status is changed to $status"; + probe_utils->send_msg("$output", "d", "[$node] $record") if ($monitor); + push(@{ $rawdata{$node}{"history"} }, $record); - # When receive 'status is booted', check whether the $monitor_nodes{$node}{"status"} is installing. - # If so, the node has finished its os provision. - if (exists($rawdata{$node}) and ($status eq "booted")) { - if ($monitor_nodes{$node}{"status"} eq "installing") { - $record = "Node $node has finished it's os provision process"; - probe_utils->send_msg("$output", "o", "$record"); - push(@{ $rawdata{$node}{"history"} }, $record); - } else { - $record = "NO installing process detected for node $node"; - probe_utils->send_msg("$output", "f", "$record"); - push(@{ $rawdata{$node}{"history"} }, $record); + #one node finish deployment + if ($status eq "booted") { + $monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node})); + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "booted")); + } + + if ($status eq "powering-on") { + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "poweron")); + } } - $monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node})); - } elsif (exists($rawdata{$node}) and ($status eq "failed")) { - $monitor_nodes{$node}{"rst"} = 1 if (defined($monitor_nodes{$node})); - probe_utils->send_msg("$output", "f", "Node $node has finished it's os provision process"); - push(@{ $rawdata{$node}{"history"} }, "Node $node os provision failed"); - } elsif (exists($rawdata{$node}) and ($status eq "installing")) { - # record 'installing' status, to check when receive 'booted' status - $monitor_nodes{$node}{"status"} = "installing"; } } return 0; @@ -350,10 +467,15 @@ sub handle_compute_msg { } else { $node = $ipnodemap{$sender}; } + if ($node ne "" && exists($rawdata{$node})) { - my $record = "Receive from $node : $msg"; - probe_utils->send_msg("$output", "d", "$record"); - push(@{ $rawdata{$node}{"history"} }, $record); + probe_utils->send_msg("$output", "d", "[$node] $msg") if ($monitor); + push(@{ $rawdata{$node}{"history"} }, $msg); + + #node start to run postscript or postbootscript + if ($msg =~ /Running postscript/) { + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "postscript")); + } } } @@ -407,30 +529,113 @@ sub dump_history { print "$title\n"; foreach $node (keys %rawdata) { - my $line_num = 0; - my $http_num = 0; - my $length_http; - for (my $i = @{ $rawdata{$node}{"history"} } ; $i >= 0 ; $i--) { - if (${ $rawdata{$node}{"history"} }[$i] =~ /Via HTTP/) { - $length_http = $i; - last; + + if ($verbose) { + print "[$node]\n"; + + my $httphit = 0; + my @httptmp; + foreach my $line (@{ $rawdata{$node}{"history"} }) { + if ($line =~ /Via HTTP/) { + if ($httphit) { + shift @httptmp if ($#httptmp > 0); + push @httptmp, $line; + } else { + print "\t$line\n"; + $httphit = 1; + } + } else { + if ($#httptmp > -1) { + print "\tVia HTTP ..........\n"; + print "\t$_\n" foreach (@httptmp); + } + @httptmp = (); + $httphit = 0; + print "\t$line\n"; + } } } - foreach my $line (@{ $rawdata{$node}{"history"} }) { - # Print http message less than 10 lines - if ($line =~ /Via HTTP/) - { - if (($http_num <= 4) or ($length_http - $line_num <= 4)) { - probe_utils->send_msg("$output", "d", "\t$line"); + my @tmpnodestatehistory = @{ $rawdata{$node}{statehistory} }; + + #print "state history = @tmpnodestatehistory\n"; + + my %match_result; + my $procidx = 0; + my $newloop = 0; + my $notfirstloop = 0; + while (@tmpnodestatehistory) { + undef %match_result if ($notfirstloop); + $newloop = 0; + foreach my $type (keys %valid_process) { + if ($notfirstloop) { + $procidx = 1; } else { - probe_utils->send_msg("$output", "d", "\t......") if ($http_num == 5); + $procidx = 0; } - $http_num++; - } else { - probe_utils->send_msg("$output", "d", "\t$line"); + my $proclen = scalar(@{ $valid_process{$type}{process} }); + my $i; + for ($i = 0 ; $i < scalar(@tmpnodestatehistory) ; $i++) { + if ($procidx < $proclen) { + if ($tmpnodestatehistory[$i] == $valid_process{$type}{process}[$procidx]) { + ++$procidx; + } else { + --$procidx if (notfirstloop); + push @{ $match_result{$procidx} }, $type; + last; + } + } else { + splice(@tmpnodestatehistory, 0, $i); + $newloop = 1; + $notfirstloop = 1; + last; + } + } + if ($i == scalar(@tmpnodestatehistory)) { + push @{ $match_result{$procidx} }, $type; + next; + } + last if ($newloop); + } + last if (!$newloop); + } + + # print "------------result---------------\n"; + # print Dumper %match_result; + + my $max_match = 0; + foreach my $key (keys %match_result) { + $max_match = $key if ($key > $max_match); + } + + my $formatprefix; + if ($max_match == 0) { + my $statelist = ""; + for (my $i = 0 ; $i < scalar(@{ $rawdata{$node}{statehistory} }) ; $i++) { + $statelist .= "$state_set_reverse{$rawdata{$node}{statehistory}[$i]} "; + } + probe_utils->send_msg("$output", "f", "[$node] deployment failed"); + probe_utils->send_msg("$output", "d", "\t$node did unknown process, state change history is $statelist"); + } elsif (scalar(@{ $match_result{$max_match} }) > 1) { + probe_utils->send_msg("$output", "f", "[$node] deployment failed"); + probe_utils->send_msg("$output", "d", "\tThere are more than one possible process satisfy $node situation"); + foreach my $proc (@{ $match_result{$max_match} }) { + if ($valid_process{$proc}{type} eq "deploy") { + probe_utils->send_msg("$output", "d", "\tpossible process \"deploy\", pass $state_set_reverse{$valid_process{$proc}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$proc}{process}[$max_match]} stage"); + } elsif ($valid_process{$proc}{type} eq "reboot") { + probe_utils->send_msg("$output", "d", "\tpossible process \"reboot\", pass $state_set_reverse{$valid_process{$proc}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$proc}{process}[$max_match]} stage"); + } + } + } else { + if (($valid_process{ $match_result{$max_match}[0] }{type} eq "deploy") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] == $state_set{done})) { + probe_utils->send_msg("$output", "o", "[$node] deployment completed"); + } elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "deploy") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] != $state_set{done})) { + probe_utils->send_msg("$output", "f", "[$node] deployment failed, pass $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage") + } elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] == $state_set{done})) { + probe_utils->send_msg("$output", "f", "[$node] reboot completed, without deployment process"); + } elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] != $state_set{done})) { + probe_utils->send_msg("$output", "f", "[$node] reboot failed,without deployment process, stop at $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage"); } - $line_num++; } } } @@ -451,29 +656,6 @@ sub do_monitor { $terminal = 1; }; - my $msg = "All pre_defined nodes are valid"; - my $rc = check_noderange($noderange); - if ($rc) { - probe_utils->send_msg("$output", "f", $msg); - $rst = 1; - unless (%monitor_nodes) { - return $rst; - } - } else { - probe_utils->send_msg("$output", "o", $msg); - } - - if (!$nics) { - my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; - chomp($masteripinsite); - $nics = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`; - chomp($nics); - if (!$nics) { - probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface"); - return 1; - } - } - my $rst = 0; my $startline = "------------------------------------------------------------- @@ -514,6 +696,7 @@ Start to capture every message during os provision process...... if (!-e "$clusterlog") { probe_utils->send_msg("$output", "w", "$clusterlog doesn't exist"); + probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x is using, please ignore above warning"); } else { if (!($clusterpid = open(CLUSTERLOGFILE, "tail -f -n 0 $clusterlog 2>&1 |"))) { probe_utils->send_msg("$output", "f", "Can't open $clusterlog to get logs"); @@ -532,6 +715,7 @@ Start to capture every message during os provision process...... } if (!-e "$computelog") { probe_utils->send_msg("$output", "w", "$computelog doesn't exist"); + probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x is using, please ignore above warning"); } else { if (!($computerpid = open(COMPUTERFILE, "tail -f -n 0 $computelog 2>&1 |"))) { probe_utils->send_msg("$output", "f", "Can't open $computelog to get logs"); @@ -551,21 +735,15 @@ Start to capture every message during os provision process...... my @hdls; my $hdl; - my @candidate_svr_hostname_inlog; - my $svr_hostname_short = `hostname -s`; - chomp($svr_hostname_short); - my $svr_hostname_domain = `hostname -d`; - chomp($svr_hostname_domain); - push(@candidate_svr_hostname_inlog, $svr_hostname_short); - push(@candidate_svr_hostname_inlog, "$svr_hostname_short.$svr_hostname_domain"); - + my $starttime = time(); + $monitor = 1; for (; ;) { if (@hdls = $select->can_read(0)) { foreach $hdl (@hdls) { if ($hdl == \*VARLOGMSGFILE) { chomp($line = ); my @tmp = split(/\s+/, $line); - if ($tmp[4] =~ /dhcpd:/i && $line =~ /$nics/) { + if ($tmp[4] =~ /dhcpd:/i && $line =~ /$installnic/) { handle_dhcp_msg("$line"); } elsif ($tmp[4] =~ /in.tftpd/i) { handle_tftp_msg("$line"); @@ -596,7 +774,13 @@ Start to capture every message during os provision process...... probe_utils->send_msg("$output", "o", "All nodes need to monitor have finished os provision process"); } last; - } sleep 0.01; + } + + if (time() - $starttime > ($maxwaittime * 60)) { + probe_utils->send_msg("$output", "i", "$maxwaittime minutes are expired, stop monitor"); + last; + } + sleep 0.01; } &dump_history; } @@ -612,6 +796,176 @@ Start to capture every message during os provision process...... return $rst; } +sub get_valid_logs { + my $ref_timestamp = shift; + my $year = shift; + my $epoch_seconds_of_now = shift; + my $bthistory_ref = shift; + my $nics = "eth0"; + my @orglogfilelist = ("/var/log/xcat/cluster.log", + "/var/log/messages", + "/var/log/xcat/computes.log"); + my $httplog; + if (-e "/var/log/httpd/access_log") { + $httplog = "/var/log/httpd/access_log"; + } elsif (-e "/var/log/apache2/access_log") { + $httplog = "/var/log/apache2/access_log"; + } elsif (-e "/var/log/apache2/access.log") { + $httplog = "/var/log/apache2/access.log"; + } + push @orglogfilelist, $httplog; + + foreach my $f (@orglogfilelist) { + my $filename = basename("$f"); + $filename =~ s/(.+)\.(.+)/$1/g; + my $path_only = dirname("$f"); + my @rotatefiles; + my @alltargetfiles = `ls -lt $path_only |awk -F" " '/ $filename/ {print \$9}'`; + foreach my $samenamefile (@alltargetfiles) { + chomp($samenamefile); + push @rotatefiles, "$path_only/$samenamefile"; + } + + my $ishttplog = 0; + $ishttplog = 1 if ($filename =~ /access[\._]log/); + + foreach my $file (@rotatefiles) { + my $fd; + my $filetype = `file $file 2>&1`; + chomp($filetype); + if ($filetype =~ /ASCII text/) { + if (!open($fd, "$file")) { + print "open $files failed\n"; + next; + } + } else { + + #TODO handle compression files + } + + #print "--->load $file\n"; + my $line; + my $historynum = 0; + last unless ($line = <$fd>); + chomp($line); + my $needrotate = 0; + my $istorynum = 0; + my $logindex = 0; + my @splitline = split(/\s+/, $line); + my $timestamp; + my $timestampepoch; + + if ($ishttplog) { + $splitline[3] =~ s/^\[(.+)/$1/g; + $timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]); + } else { + $timestamp = join(" ", @splitline[ 0 .. 2 ]); + $timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now); + } + if ($ref_timestamp <= $timestampepoch) { + $needrotate = 1; + } else { + seek($fd, 0, 2); + my $tail = tell; + my $head = 0; + my $lasttail = $tail; + my $i = 0; + while ($head <= $tail) { + my $middle = int(($tail - $head) / 2) + $head; + seek($fd, $middle, 0); + $line = <$fd>; + $middle += length($line); + last unless ($line = <$fd>); + @splitline = split(/\s+/, $line); + if ($ishttplog) { + $splitline[3] =~ s/^\[(.+)/$1/g; + $timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]); + } else { + $timestamp = join(" ", @splitline[ 0 .. 2 ]); + $timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now); + } if ($ref_timestamp == $timestampepoch) { + $historynum = $middle; + last; + } elsif ($ref_timestamp < $timestampepoch) { + $tail = $middle; + last if ($tail == $lasttail); + $lasttail = $tail; + } else { + $head = $middle; + } + } + $historynum = $head unless ($historynum); + } + + seek($fd, $historynum, 0); + while (<$fd>) { + chomp; + @splitline = split(/\s+/, $_); + if ($ishttplog) { + $splitline[3] =~ s/^\[(.+)/$1/g; + $timestampepoch = probe_utils->convert_to_epoch_seconds($splitline[3]); + } else { + $timestamp = join(" ", @splitline[ 0 .. 2 ]); + $timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now); + } + + if (($splitline[4] =~ /dhcpd:/i && $_ =~ /$nics/) + || ($splitline[4] =~ /in.tftpd/i) + || (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i)) + || ($splitline[5] =~ /GET/ && $splitline[7] =~ /HTTP/)) { + my $log = "$timestampepoch $filename$logindex $_"; + $logindex++; + push @$bthistory_ref, $log; + } + } + close($fd); + last unless ($needrotate); + } + } + + #sort logs depending on time + my @sort_ht = sort(@$bthistory_ref); + for ($i = 0 ; $i <= $#sort_ht ; $i++) { + $sort_ht[$i] =~ s/^(\d+) (\S+) (.+)/$1 $3/g; + } + + #delete duplicate logs + my %count; + @$bthistory_ref = grep { ++$count{$_} < 2; } @sort_ht; +} + +sub do_replay { + my $ref_timestamp = shift; + + my $timestr = scalar(localtime($ref_timestamp)); + print "Start to search logs after '$timestr', please waiting for a while.............\n"; + + my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst) = localtime(time()); + my $epoch_seconds_of_now = time(); + my @bthistory; + get_valid_logs($ref_timestamp, $year, $epoch_seconds_of_now, \@bthistory); + + foreach my $line (@bthistory) { + $line =~ s/(\d+) (.+)/$2/g; + my @tmp = split(/\s+/, $line); + if ($tmp[4] =~ /dhcpd:/i && $line =~ /$nics/) { + handle_dhcp_msg("$line"); + } elsif ($tmp[4] =~ /in.tftpd/i) { + handle_tftp_msg("$line"); + } elsif (($tmp[4] =~ /^xcat/i) || ($tmp[5] =~ /^xcat/i)) { + if (grep(/^$tmp[3]$/, @candidate_svr_hostname_inlog)) { + handle_cluster_msg("$line"); + } else { + handle_compute_msg("$line"); + } + } elsif ($tmp[5] =~ /GET/ && $tmp[7] =~ /HTTP/) { + handle_http_msg("$line"); + } + } + &dump_history; + return 0; +} + #------------------------------------- # main process #------------------------------------- @@ -619,6 +973,8 @@ if ( !GetOptions("--help|h|?" => \$help, "T" => \$test, "V" => \$verbose, + "t" => \$maxwaittime, + "r=s" => \$replaylog, "n=s" => \$noderange)) { probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name"); @@ -641,11 +997,60 @@ if ($test) { } unless ($noderange) { - probe_utils->send_msg("$output", "f", "Option -n is required"); + probe_utils->send_msg("$output", "f", "A noderange is needed"); probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } +my $epoch_starttime = time(); +if ($replaylog) { + if ($replaylog =~ /(\d+)h(\d+)m/i) { + $epoch_starttime -= ($1 * 3600 + $2 * 60) + } elsif ($replaylog =~ /^(\d+)h*$/i) { + $epoch_starttime -= $1 * 3600; + } elsif ($replaylog =~ /^(\d+)m$/) { + $epoch_starttime -= $1 * 60; + } else { + probe_utils->send_msg("$output", "f", "Unsupport time format for replay history log"); + print "$::USAGE"; + exit 1; + } +} + +my $msg = "All pre_defined nodes are valid"; +my $rc = check_noderange($noderange); +if ($rc) { + probe_utils->send_msg("$output", "f", $msg); + $rst = 1; +} else { + probe_utils->send_msg("$output", "o", $msg); +} + +unless ($installnic) { + my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; + chomp($masteripinsite); + $installnic = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`; + chomp($installnic); + if (!$installnic) { + probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface"); + $rst = 1; + } else { + probe_utils->send_msg("$output", "i", "The installation network interface is $installnic"); + } +} + +exit $rst if ($rst); + +foreach my $node (keys %monitor_nodes) { + $rawdata{$node}{state} = $state_set{unknown}; + push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}); +} + +if ($replaylog) { + $rst = do_replay($epoch_starttime); + exit $rst; +} + $rst = do_monitor(); exit $rst; From 43dc07c56fd768d324bad07626a01e19aec881db Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 9 Aug 2016 03:31:17 -0400 Subject: [PATCH 080/391] fix [FVT]:ubuntu build script build-ubunturepo does not support minor release #1604 --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index 6c9e001cd0..3cf553ccb8 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -203,7 +203,7 @@ then pkg_type="snap" build_string="Snap_Build" cur_date=`date +%Y%m%d%H%M` - pkg_version="${short_ver}-${pkg_type}${cur_date}" + pkg_version="${ver}-${pkg_type}${cur_date}" if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" From 769ba844c835fe77235307625c45522262d903f4 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 9 Aug 2016 15:11:00 +0800 Subject: [PATCH 081/391] [go-xcat] Remove all the complicated examples --- xCAT-server/share/xcat/tools/go-xcat | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index f13e6e3212..775c87ae37 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -49,26 +49,8 @@ function usage() ${script} --yes install ${script} -x 2.12 -y install ${script} --xcat-version=devel install - ${script} --xcat-core=/path/to/xcat-core.repo install - ${script} --xcat-core=/path/to/xcat-core install - ${script} --xcat-core=/path/to/xcat-core.tar install - ${script} --xcat-core=/path/to/xcat-core.tar.Z install - ${script} --xcat-core=/path/to/xcat-core.tar.gz install - ${script} --xcat-core=/path/to/xcat-core.tar.bz2 install - ${script} --xcat-core=/path/to/xcat-core.tar.xz install - ${script} --xcat-core=http://xcat.org/path/to/xcat-core.repo install - ${script} --xcat-core=http://xcat.org/path/to/xcat-core install - ${script} --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 install - ${script} --xcat-core=/path/to/xcat-core.repo \\ - --xcat-dep=/path/to/xcat-dep.repo install - ${script} --xcat-core=/path/to/xcat-core \\ - --xcat-dep=/path/to/xcat-dep install ${script} --xcat-core=/path/to/xcat-core.tar.bz2 \\ --xcat-dep=/path/to/xcat-dep.tar.bz2 install - ${script} --xcat-core=http://xcat.org/path/to/xcat-core.repo \\ - --xcat-dep=http://xcat.org/path/to/xcat-dep.repo install - ${script} --xcat-core=http://xcat.org/path/to/xcat-core \\ - --xcat-dep=http://xcat.org/path/to/xcat-dep install ${script} --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 \\ --xcat-dep=http://xcat.org/path/to/xcat-dep.tar.bz2 install From c67da2b4d636b79568fa3ed1944d5a4f7826082b Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 9 Aug 2016 04:42:00 -0400 Subject: [PATCH 082/391] update bundle files according to go-xcat change --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 9 +++------ xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 9 +++------ xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 9 +++------ xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 9 +++------ xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 9 +++------ xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 9 +++------ xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 9 +++------ xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 9 +++------ xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 9 +++------ .../autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 9 +++------ .../autotest/bundle/ubuntu14.04.4_x86_64.bundle | 9 +++------ .../autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 9 +++------ .../autotest/bundle/ubuntu16.04.1_x86_64.bundle | 13 +++++-------- .../autotest/bundle/ubuntu16.04_ppc64le.bundle | 9 +++------ xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle | 13 +++++-------- 15 files changed, 49 insertions(+), 94 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 8c990aa865..50cf777875 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 updatenode_h updatenode_v updatenode_diskful_syncfiles diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 7b014eafba..1ea9aa5443 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index b348a21c56..f2b8df3fc4 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 updatenode_h updatenode_v updatenode_diskful_syncfiles diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index cc15f6b88e..016cc6e184 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index d9d0ba4e87..b49f7d3d5e 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index d9d8a1ad76..e87ae4427c 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 chdef_null chdef_t_node chdef_t_network diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 0ba277a042..7a7e5fd188 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 61ae6ffdbc..908c9e3365 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index cedd4f8989..de0b6e2943 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -1,12 +1,9 @@ reg_linux_diskfull_installation_flat -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 4e9c2fb3fd..5e2b828c7d 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index b86bc7dfa8..94301d77bc 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -1,13 +1,10 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index ae76c787ff..28cd9b4c03 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 0fd26a629f..fe60349549 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -1,5 +1,10 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange @@ -250,11 +255,3 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index ae76c787ff..28cd9b4c03 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle index 0fd26a629f..fe60349549 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle @@ -1,5 +1,10 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n_noderange @@ -250,11 +255,3 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 -go_xcat_local_repo_case7 -go_xcat_noinput From cb7b48070f3ad690e0ce6ba8b458b170338f8fb1 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 9 Aug 2016 04:51:27 -0400 Subject: [PATCH 083/391] update option check,-f/-b files check and delete -l output files --- xCAT-test/xcattest | 52 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 3523c04e69..e4ab5eb684 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -14,7 +14,7 @@ BEGIN use lib "$::XCATROOT/lib/perl"; my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $needhelp = 0; -my $configfile = "$rootdir/default.conf"; +my $config_info = "$rootdir/default.conf"; my $bundle_list = undef; my $case_list = undef; my $cmd_list = undef; @@ -24,7 +24,7 @@ my $ret = 0; my $string1 = undef; if ( !GetOptions("h|?" => \$needhelp, - "f=s" => \$configfile, + "f=s" => \$config_info, "b=s" => \$bundle_list, "t=s" => \$case_list, "c=s" => \$cmd_list, @@ -36,12 +36,48 @@ if ( exit 1; } +unless(defined($bundle_list) || defined($case_list) || defined($cmd_list) || defined($needshow)){ + &usage; + exit 1; +} if ($needhelp) { &usage; exit 0; } +#check config file and system label +my $configfile = undef; +my $inital_info = undef; +if ($config_info){ + if ($config_info =~ /:/){ + my @config_info = split /:/, $config_info; + $configfile = $config_info[0]; + $inital_info = $config_info[1]; + if ($inital_info ne "system"){ + print "Failed: $inital_info in $config_info is not supported!\n"; + exit 1; + } + }else{ + $configfile = $config_info; + } +} +if (!open(FILE, "$configfile")) { + print "can't open config file: $configfile\n"; + exit 1; +} + +#check bundle files +if ($bundle_list){ + my @bundles = split /,/, $bundle_list; + foreach my $bundle (@bundles){ + if (!open(FILE, "<$rootdir/bundle/$bundle")) { + print "can't open bundle file: $rootdir/bundle/$bundle\n"; + exit 1; + } + } +} + #load case to $cases # key type #$cases[x](x>0): hash @@ -51,7 +87,6 @@ if ($needhelp) # hcp:hmc/mm/bmc/fsp string # cmd: array # check: array - my @cases = (); if ($needshow) { &loadcase; @@ -150,10 +185,6 @@ sub getConfig log_this("******************************"); log_this("Reading Configure"); log_this("******************************"); - if (!(-e $configfile)) { - log_this("Warning: The xCAT test Configure file doesn't exist!"); - return 0; - } my $type = undef; #Script_Prev,Script_Post,Table,Object,System,Custom my $sub_type = undef; # The string after $type_ @@ -175,7 +206,6 @@ sub getConfig my $mgt_name = undef; - open(FILE, "$configfile") or die "can't to open $configfile"; while (my $line = ) { $line = &trim($line); next if (length($line) == 0); @@ -444,7 +474,7 @@ sub Get_Files_Recursive } else { my $dirpath = $dir . '/' . $direntry . "\n"; - print $dirpath; + # print $dirpath; #print $dir."\n"; push(@filespath, glob("$dirpath")); @@ -501,10 +531,6 @@ sub loadcase if ($bundle_list) { my @bundles = split /,/, $bundle_list; foreach my $bundle (@bundles) { - if (!open(FILE, "<$rootdir/bundle/$bundle")) { - log_this("can't open $rootdir/bundle/$bundle"); - return 1; - } while ($line = ) { $line = trim($line); next if (length($line) == 0); From c458718ebf1a616ae9a11be70907fa6f15a6a387 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 9 Aug 2016 16:54:08 -0400 Subject: [PATCH 084/391] move config switch files to scripts dir --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 2 +- xCAT-server/share/xcat/{tools => scripts}/configBNT | 0 xCAT-server/share/xcat/{tools => scripts}/configMellanox | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename xCAT-server/share/xcat/{tools => scripts}/configBNT (100%) rename xCAT-server/share/xcat/{tools => scripts}/configMellanox (100%) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 12e5525566..2d4682ecf1 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -1402,7 +1402,7 @@ sub switchsetup { } foreach my $mytype (keys %$nodes_to_config) { - my $config_script = "$::XCATROOT/shart/xcat/tools/config".$mytype; + my $config_script = "$::XCATROOT/share/xcat/scripts/config".$mytype; if (-r -x $config_script) { my $switches = join(",",@{${nodes_to_config}->{$mytype}}); send_msg($request, 0, "call to config $mytype switches $switches\n"); diff --git a/xCAT-server/share/xcat/tools/configBNT b/xCAT-server/share/xcat/scripts/configBNT similarity index 100% rename from xCAT-server/share/xcat/tools/configBNT rename to xCAT-server/share/xcat/scripts/configBNT diff --git a/xCAT-server/share/xcat/tools/configMellanox b/xCAT-server/share/xcat/scripts/configMellanox similarity index 100% rename from xCAT-server/share/xcat/tools/configMellanox rename to xCAT-server/share/xcat/scripts/configMellanox From 08cb5f16600467e2f9fd7b56980c3cbd7bd04c54 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Tue, 9 Aug 2016 22:01:43 -0400 Subject: [PATCH 085/391] Probe package, add ServiceNodeUtils.pm to probe lib --- build-ubunturepo | 1 + makerpm | 1 + 2 files changed, 2 insertions(+) diff --git a/build-ubunturepo b/build-ubunturepo index 6c9e001cd0..ef7bab0835 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -236,6 +236,7 @@ then mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/ cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ + cp -f ${CURDIR}/perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ fi dpkg-buildpackage -uc -us else diff --git a/makerpm b/makerpm index c3cd442dfd..983b3ecc56 100755 --- a/makerpm +++ b/makerpm @@ -50,6 +50,7 @@ function makenoarch { mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/ cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ + cp -f ${CURDIR}/perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ fi tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME From 8b5f44c44a0020fad44c7abd324da4cb19185918 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 10 Aug 2016 01:01:46 -0400 Subject: [PATCH 086/391] Modify xcat-genesis-script pkg name for ubuntu --- xCAT-genesis-scripts/debian/control-amd64 | 8 ++++---- xCAT-genesis-scripts/xCAT-genesis-scripts.spec | 14 +------------- xCAT/debian/control | 2 +- xCAT/xCAT.spec | 5 ++--- xCATsn/debian/control | 2 +- xCATsn/xCATsn.spec | 5 ++--- 6 files changed, 11 insertions(+), 25 deletions(-) diff --git a/xCAT-genesis-scripts/debian/control-amd64 b/xCAT-genesis-scripts/debian/control-amd64 index 7e883f3283..20b99c52e2 100644 --- a/xCAT-genesis-scripts/debian/control-amd64 +++ b/xCAT-genesis-scripts/debian/control-amd64 @@ -5,11 +5,11 @@ Maintainer: xCAT Build-Depends: debhelper (>= 8.0.0) Standards-Version: 3.9.2 -Package: xcat-genesis-scripts-x86-64 +Package: xcat-genesis-scripts-amd64 Architecture: all -Depends: xcat-genesis-base-x86-64 -Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-amd64 -Replaces: xcat-genesis-scripts,xcat-genesis-scripts-amd64 +Depends: xcat-genesis-base-amd64 +Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 +Replaces: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 Description: xCAT genesis (Genesis Enhanced Netboot Environment for System Information and Servicing) is a small, embedded-like environment for xCAT's use in discovery and management actions when interaction with an OS is infeasible. This package reperesents the EPL content that is more tightly bound to specific xcat-core versions diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index 02d8292df2..0f7bddcf76 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -99,21 +99,9 @@ touch /etc/xcat/genesis-scripts-updated %{rpminstallroot}/bin/update_flash %{rpminstallroot}/bin/update_flash_nv %{rpminstallroot}/bin/restart -%{rpminstallroot}/debian/changelog -%{rpminstallroot}/debian/compat -%{rpminstallroot}/debian/control-amd64 -%{rpminstallroot}/debian/control-ppc64el -%{rpminstallroot}/debian/copyright -#%{rpminstallroot}/debian/dirs -%{rpminstallroot}/debian/docs -#%{rpminstallroot}/debian/install -%{rpminstallroot}/debian/postinst -%{rpminstallroot}/debian/postrm -%{rpminstallroot}/debian/preinst -%{rpminstallroot}/debian/prerm -%{rpminstallroot}/debian/rules %{rpminstallroot}/etc/init.d/functions %{rpminstallroot}/etc/udev/rules.d/99-imm.rules %{rpminstallroot}/etc/udev/rules.d/98-mlx.rules %{rpminstallroot}/sbin/setupimmnic %{rpminstallroot}/sbin/loadmlxeth +%exclude %{rpminstallroot}/debian/* diff --git a/xCAT/debian/control b/xCAT/debian/control index 69dd56b0e5..997910a96c 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: xcat Architecture: amd64 ppc64el -Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.15-2), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-x86-64, elilo-xcat, xcat-buildkit, xcat-probe (>=2.12) +Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.15-2), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat, xcat-buildkit, xcat-probe (>=2.12) Description: Server and configuration utilities of the xCAT management project xcat-server provides the core server and configuration management components of xCAT. This package should be installed on your management server diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index c800f288d8..8557d2c8c7 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -25,7 +25,7 @@ Source7: xcat.conf.apach24 Provides: xCAT = %{version} Conflicts: xCATsn -Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-probe >= 2.12.1 +Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-probe >= 2.12.1 xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 %define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi) %define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi) @@ -60,13 +60,12 @@ Requires: conserver-xcat %endif %ifarch i386 i586 i686 x86 x86_64 -Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat +Requires: syslinux elilo-xcat Requires: ipmitool-xcat >= 1.8.15-2 Requires: xnba-undi %endif %ifos linux %ifarch ppc ppc64 ppc64le -Requires: xCAT-genesis-scripts-ppc64 Requires: ipmitool-xcat >= 1.8.15-2 %endif %endif diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 8283481f1e..865c489252 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: xcatsn Architecture: all -Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.15-2), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-x86-64, elilo-xcat,libsys-virt-perl +Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.15-2), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl Recommends: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale management, including hardware management and software management. diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index ffcf1e5eb8..fd0fca2d8a 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -17,7 +17,7 @@ Source3: xCATSN Source5: templates.tar.gz Source6: xcat.conf.apach24 Provides: xCATsn = %{version} -Requires: xCAT-server xCAT-client perl-DBD-SQLite +Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 Conflicts: xCAT @@ -55,13 +55,12 @@ Requires: conserver-xcat %endif %ifarch i386 i586 i686 x86 x86_64 -Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat +Requires: syslinux elilo-xcat Requires: ipmitool-xcat >= 1.8.15-2 Requires: xnba-undi %endif %ifos linux %ifarch ppc ppc64 ppc64le -Requires: xCAT-genesis-scripts-ppc64 Requires: ipmitool-xcat >= 1.8.15-2 %endif %endif From 8c2381d9764be3a8d244353e53bb42575b140a52 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 10 Aug 2016 08:01:07 -0400 Subject: [PATCH 087/391] add bundle for rhels7.3 ppc64le --- .../autotest/bundle/rhels7.3_ppc64le.bundle | 207 ++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle new file mode 100644 index 0000000000..cc15f6b88e --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -0,0 +1,207 @@ +Diskless_installation_flat_p8_le +Full_installation_flat_p8_le +go_xcat_local_repo_case1 +go_xcat_local_repo_case2 +go_xcat_local_repo_case3 +go_xcat_local_repo_case4 +go_xcat_local_repo_case5 +go_xcat_local_repo_case6 +go_xcat_local_repo_case7 +go_xcat_noinput +makehosts_h +makehosts_help +makehosts_n +makehosts_n_noderange +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +packimage_o_p_a_m +packimage_p_a_o +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_err_node +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_n +makedns +copycds_iso +copycds_n +copycds_a +copycds_n_a +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_i_linux +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +redhat_migration1 +redhat_migration2 +clean_up_env From c309f372e0b668577978bb8551332df697cd6132 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 10 Aug 2016 04:04:53 -0400 Subject: [PATCH 088/391] add get the first net ip mask --- xCAT-server/lib/xcat/plugins/localrest.pm | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/localrest.pm b/xCAT-server/lib/xcat/plugins/localrest.pm index 6c3b2ccdbe..c0e3887101 100644 --- a/xCAT-server/lib/xcat/plugins/localrest.pm +++ b/xCAT-server/lib/xcat/plugins/localrest.pm @@ -190,6 +190,35 @@ sub list_netip { return $result; } +#------------------------------------------------------- + +=head3 handler to list network adapter first ip mask + + Subroutine to handle rest request + GET /localres/netmask/ + + Usage example: + This function is called from handle_rest_request, + do not call it directly. +=cut + +#------------------------------------------------------- +sub list_netmask { + my @params = @_; + my ($rsp, $iface, $netmask, $cmd, $prefix, $result); + if (!@params) { + $rsp->{data}->[0] = "Argmument error."; + xCAT::MsgUtils->message("E", $rsp, $::callback); + return 1; + } + $iface = shift @params; + $prefix = `ip addr show dev $iface |grep inet|head -1|awk '{print \$2}'`; + $cmd = "ipcalc -m $prefix"; + $netmask->[0] = xCAT::Utils->runcmd("$cmd", -1); + return $netmask; +} + + #------------------------------------------------------- From 989548aef15eae01106f6d149cb413f29e5b33ee Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 26 Jul 2016 03:26:40 -0400 Subject: [PATCH 089/391] xCATprobe check xcat service node --- xCAT-probe/lib/perl/probe_utils.pm | 15 +- xCAT-probe/subcmds/xcatmn | 1372 ++++++++++++++++++---------- 2 files changed, 914 insertions(+), 473 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index ace99bf602..8f2198fcaa 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -50,6 +50,8 @@ sub send_msg { if ($output eq "stdout") { print "$flag$msg\n"; + } elsif($output) { + syswrite $output, "$flag$msg\n"; } else { if (!open(LOGFILE, ">> $output")) { return 1; @@ -324,20 +326,21 @@ sub is_tftp_ready { sub is_dns_ready { my $mnip = shift; $mnip = shift if (($mnip) && ($mnip =~ /probe_utils/)); + my $serverip = shift; my $hostname = shift; my $domain = shift; - my $output = `nslookup $mnip $mnip 2>&1`; + my $output = `nslookup $mnip $serverip 2>&1`; if ($?) { return 0; } else { chomp($output); - my $tmp = `echo "$output" |grep "Server:[\t\s]*$mnip" >/dev/null 2>&1`; - print "$tmp"; - return 0 if ($?); - $tmp = `echo "$output"|grep "name ="|grep "$hostname\.$domain" >/dev/null 2>&1`; - return 0 if ($?); + my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split(/\n/, $output); + return 0 if ($tmp == 0); + + $tmp = grep {$_ =~ "name = $hostname\.$domain"} split(/\n/, $output); + return 0 if ($tmp == 0); return 1; } } diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index ed88011f83..e564197f44 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -1,56 +1,801 @@ -#! /usr/bin/perl +#!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; use probe_utils; +use xCAT::ServiceNodeUtils; +use xCAT::NetworkUtils; use File::Basename; use Getopt::Long qw(:config no_ignore_case); +use IO::Select; +use Data::Dumper; -my $proname = basename("$0"); -my $help; +my $program_name = basename("$0"); #current sub_command name +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' my $installnic; -my $test; -my $output = "stdout"; -my $verbose = 0; -my $rst = 0; +my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT +my $is_sn = 0; #flag current server is SN +my $rst = 0; #the exit code of current command +my $terminal = 0; #means get INT signal from STDIN +my %summaryoutput; #save all output from commands running on SNs and MN +#a map of SNs and command which will be dispatched to current SN +# $dispatchcmd{snname} = "command" +my %dispatchcmd; + +#save command line attributes from STDIN +my @tmpargv; + +#-------------------------------- +# below are some options rules used by default +# -h : Get usage information of current sub command +# -V : Output more information for debug +# -T : To verify if $program_name can work, reserve option for probe framework, dosen't use by customer +# -n : In xCAT probe, -n is uesd to specify node range uniformly +#-------------------------------- $::USAGE = "Usage: - $proname -h - $proname -T - $proname [-n ] [-V] + $program_name -h + $program_name [-i ] [-V] Description: - After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. + After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. + For hierarchical cluster, just support that the provision network is in the same network with management node. If in the different nework, please ignore the results. Options: - -h : Get usage information of $proname - -T : To verify if $proname can work, reserve option for probe framework - -n : Required. Specify the network interface name of provision network + -h : Get usage information of $program_name -V : Output more information for debug + -i : Required. Specify the network interface name of provision network "; + sub returncmdoutput { my $rst = shift; chomp($rst); + my $outputtarget = shift; my @lines = split("[\n\r]", $rst); foreach my $line (@lines) { - probe_utils->send_msg("$output", "d", "$line"); + probe_utils->send_msg("$outputtarget", "d", "$line"); } } +#------------------------------------- +# TWO FUNCTIONS MUST BE IMPLEMENTED BY EACH SUB COMMAND +# They are do_main_job and summary_all_jobs_output +#------------------------------------- + +#------------------------------------ +# Please implement the main checking job of current command in do_main_job function +# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. +# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT +# Recommand to use probe_utils->send_msg() to handle message you plan to print out +#------------------------------------ +sub do_main_job { + my $outputtarget = shift; + $outputtarget = "stdout" if (!$outputtarget); + my $rst = 0; + + my $msg; + my $serverip; + + $msg = "Sub process 'xcatd: SSL listener' is running"; + my $xcatdproc = `ps aux|grep -v grep|grep xcatd`; + chomp($xcatdproc); + if ($xcatdproc =~ /xcatd: SSL listener/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "Sub process 'xcatd: DB Access' is running"; + if ($xcatdproc =~ /xcatd: DB Access/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "Sub process 'xcatd: UDP listener' is running"; + if ($xcatdproc =~ /xcatd: UDP listener/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "Sub process 'xcatd: install monitor' is running"; + if ($xcatdproc =~ /xcatd: install monitor/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "Sub process 'xcatd: Discovery worker' is running"; + if ($xcatdproc =~ /xcatd: Discovery worker/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "Sub process 'xcatd: Command log writer' is running"; + if ($xcatdproc =~ /xcatd: Command log writer/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "w", "Sub process 'xcatd: Command log writer' isn't running"); + } + return 1 if ($rst); + + my $xcatdport = `lsdef -t site -i xcatdport -c | awk -F'=' '{print \$2}'`; + chomp($xcatdport); + probe_utils->send_msg($outputtarget, "d", "The port used by the xcatd daemon for client/server communication is $xcatdport") if ($verbose); + $msg = "xcatd is listening on port $xcatdport"; + my $cmdoutput = `netstat -ant|grep LISTEN|grep $xcatdport`; + if ($?) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + my $xcatiport = `lsdef -t site -i xcatiport -c | awk -F'=' '{print \$2}'`; + chomp($xcatiport); + probe_utils->send_msg($outputtarget, "d", "The port used by xcatd to receive install status updates from nodes is $xcatiport") if ($verbose); + $msg = "xcatd is listening on port $xcatiport"; + $cmdoutput = `netstat -antp | grep -i xcatd|grep LISTEN|grep $xcatiport`; + if ($?) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + return 1 if ($rst); + + $msg = "'lsxcatd -a' works"; + $cmdoutput = `lsxcatd -a 2>&1`; + $rst = $?; + returncmdoutput($cmdoutput, $outputtarget) if ($verbose); + if ($rst) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + return $rst; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + my $masteripinsite = `lsdef -t site -i master -c | awk -F'=' '{print \$2}'`; + chomp($masteripinsite); + probe_utils->send_msg($outputtarget, "d", "The value of 'master' in 'site' table is $masteripinsite") if ($verbose); + probe_utils->send_msg($outputtarget, "f", "There isn't 'master' definition in 'site' talbe") if ($masteripinsite eq ""); + + $msg = "The value of 'master' in 'site' table is a IP address"; + if (probe_utils->is_ip_addr("$masteripinsite")) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + return 1; + } + + if (!$is_sn) { + + # on MN, check the validity of installnic and get ip address of the NIC + $msg = "NIC $installnic exists on current server"; + my $nics = `ip addr show $installnic >/dev/null 2>&1`; + if ($?) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + probe_utils->send_msg($outputtarget, "d", "Please use 'ip addr show' to check if there is NIC named $installnic on current server"); + return 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + $msg = "Get ip address of NIC $installnic"; + $serverip = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; + chomp($serverip); + if (!defined($serverip) || ($serverip eq "")) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + probe_utils->send_msg($outputtarget, "d", "Please use 'ip addr show' to check if there is ip assigned to $installnic"); + return 1; + } else { + probe_utils->send_msg($outputtarget, "d", "The IP of NIC $installnic is $serverip") if ($verbose); + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + if ($serverip) { + $msg = "The IP $serverip of $installnic equals the value of 'master' in 'site' table"; + if ($serverip eq $masteripinsite) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + } + + $msg = "IP $serverip of NIC $installnic is a static IP on current server"; + if (probe_utils->is_static_ip("$serverip", "$installnic")) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "w", "IP $serverip of $installnic is not a static ip on current server"); + } + } else { + + # on SN, get ip address by compare 'master' attribute in 'site' table + # choose the one in the same network with 'master' + my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; + + foreach (@ipoutput) { + if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { + if (xCAT::NetworkUtils::isInSameSubnet($masteripinsite, $1, $2, 1)) { + $serverip = $1; + } + } + } + + $msg = "Get ip address that in the same network with master $masteripinsite"; + if (!defined($serverip) || ($serverip eq "")) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + return 1; + } else { + probe_utils->send_msg($outputtarget, "d", "The IP is $serverip") if ($verbose); + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + $msg = "$serverip belongs to one of networks defined in 'networks' table"; + my $networks = `tabdump networks|grep -v "^#"`; + $networks =~ s/\"//g; + my $netcnt = `echo "$networks"|wc -l`; + my $hit = 0; + for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { + my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; + chomp($line); + if ($line =~ /(.+) (.+) (.+)/) { + if (!$is_sn) { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip) && ("$3" eq "$installnic")); + } else { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip)); + } + } + } + if ($hit) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "There is domain definition in 'site' table"; + my $domain = `lsdef -t site -i domain -c | awk -F'=' '{print \$2}'`; + chomp($domain); + if ($domain) { + probe_utils->send_msg($outputtarget, "d", "The value of 'domain' in 'site' table is $domain") if ($verbose); + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + $msg = "There is configuration in 'passwd' table for 'system' for node provision"; + my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; + chomp($passwd); + my ($username, $pw) = split(" ", $passwd); + if ($username eq "" || $pw eq "") { + probe_utils->send_msg($outputtarget, "f", "$msg"); + probe_utils->send_msg($outputtarget, "d", "Please define username and password for 'system' in 'passwd' table"); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + my $installdir = `lsdef -t site -i installdir -c | awk -F'=' '{print \$2}'`; + chomp($installdir); + probe_utils->send_msg($outputtarget, "d", "The 'install' directory is set to $installdir in 'site' table on current server") if ($verbose); + my $tftpdir = `lsdef -t site -i tftpdir -c | awk -F'=' '{print \$2}'`; + chomp($tftpdir); + probe_utils->send_msg($outputtarget, "d", "The 'tftp' directory is set to $tftpdir in 'site' talbe on current server") if ($verbose); + + $msg = "There is $installdir directory on current server"; + if (-e "$installdir/postscripts/") { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + if ($is_sn) { + my $mountoutput = `mount | grep '$masteripinsite' | grep '$installdir'`; + chomp($mountoutput); + + $msg = "installdir $installdir is mounted on from the Management Node"; + if ($mountoutput =~ /$masteripinsite:$installdir on $installdir/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + } + + $msg = "There is $tftpdir directory on current server"; + if (-e "$tftpdir") { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + + if ($is_sn) { + my $mountoutput = `mount | grep '$masteripinsite' | grep '$tftpdir'`; + chomp($mountoutput); + + $msg = "tftpdir $tftpdir is mounted on from the Management Node"; + if ($mountoutput =~ /$masteripinsite:$tftpdir on $tftpdir/) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + } + + my $expected = 10; + $msg = "The free space of / directory is more than $expected G"; + my $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/\$"`; + if ($?) { + probe_utils->send_msg($outputtarget, "d", "There isn't any filesystem mount on / directory"); + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + chomp($diskspace); + my ($size, $dir) = split(" ", $diskspace); + $size =~ s/G//g; + probe_utils->send_msg($outputtarget, "d", "The free space of / is $size G") if ($verbose); + if ($size < $expected) { + probe_utils->send_msg($outputtarget, "w", "The free space of / is less than $expected G"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + $expected = 1; + $msg = "The free space of /var directory is more than $expected G"; + $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/var\$"`; + if (!$?) { + chomp($diskspace); + my ($size, $dir) = split(" ", $diskspace); + $size =~ s/G//g; + probe_utils->send_msg($outputtarget, "d", "The free space of /var is $size G") if ($verbose); + if ($size < $expected) { + probe_utils->send_msg($outputtarget, "w", "The free space of /var is less than $expected G"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + $expected = 1; + $msg = "The free space of /tmp directory is more than $expected G"; + $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/tmp\$"`; + if (!$?) { + chomp($diskspace); + my ($size, $dir) = split(" ", $diskspace); + $size =~ s/G//g; + probe_utils->send_msg($outputtarget, "d", "The free space of /tmp is $size G") if ($verbose); + if ($size < $expected) { + probe_utils->send_msg($outputtarget, "w", "The free space of /tmp is less than $expected G"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + $expected = 10; + $msg = "The free space of $installdir directory is more than $expected G"; + $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "$installdir\$"`; + if (!$?) { + chomp($diskspace); + my ($size, $dir) = split(" ", $diskspace); + $size =~ s/G//g; + probe_utils->send_msg($outputtarget, "d", "The free space of /install is $size G") if ($verbose); + if ($size < $expected) { + probe_utils->send_msg($outputtarget, "w", "The free space of /install is less than $expected G"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + $msg = "SELinux is disabled on current server"; + if (probe_utils->is_selinux_enable()) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + $msg = "Firewall is closed on current server"; + if (probe_utils->is_firewall_open()) { + probe_utils->send_msg($outputtarget, "w", "Firewall is configured on current server"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + + `which wget > /dev/null 2>&1`; + if ($?) { + probe_utils->send_msg($outputtarget, "w", "wget tool isn't installed on current server, skip checking HTTP service."); + probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing wget"); + } else { + $msg = "HTTP service is ready on $serverip"; + if (probe_utils->is_http_ready("$serverip")) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + } + + my $nodename = `hostname -s`; + chomp($nodename); + + # For sn, 'setuptftp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie TFTP service, will not check it + my $checktftp = 1; + if ($is_sn) { + $checktftp = `lsdef $nodename -i setuptftp -c | awk -F'=' '{print \$2}'`; + chomp($checktftp); + unless ($checktftp) { + probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide TFTP service"); + } + } + if ($checktftp) { + `which tftp > /dev/null 2>&1`; + if ($?) { + probe_utils->send_msg($outputtarget, "w", "tftp tool isn't installed on current server, skip checking tftp service."); + probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing tftp"); + } else { + $msg = "TFTP service is ready on $serverip"; + if (probe_utils->is_tftp_ready("$serverip")) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } + } + } + + # For sn, 'setupdns' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DNS service, will not check it + my $checkdns = 1; + if ($is_sn) { + $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; + chomp($checkdns); + unless ($checkdns) { + probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DNS service"); + } + } + + if ($checkdns) { + `which nslookup > /dev/null 2>&1`; + if ($?) { + probe_utils->send_msg($outputtarget, "w", "nslookup tool isn't installed in current server, skip checking DNS service."); + probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing nslookup"); + } else { + $msg = "DNS server is ready on $serverip"; + probe_utils->send_msg($outputtarget, "d", "Domain used to check DNS is $domain") if ($verbose); + + my $rc = 0; + + if (!$is_sn) { + + # if this is a hierarchical cluster, nslookup one of sn to check DNS service + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $sninfo = `cat /etc/hosts | grep $sntmp`; + if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { + my $snip = "$1.$2.$3.$4"; + if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$domain")) { + probe_utils->send_msg("$outputtarget", "d", "nslookup $sntmp $snip failed"); + $rc = 1; + } + } + } else { + + # if there is no sn, simulate a host to check DNS service + `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + + { #very important brace to create a block + open HOSTFILE, ">> /etc/hosts"; + print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; + close HOSTFILE; + + probe_utils->send_msg($outputtarget, "d", "To do 'makedns -n xcatmntest'") if ($verbose); + $tmp = `makedns -V -n 2>&1`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedns -n xcatmntest failed") if ($verbose); + $rc = 1; + last; + } + + if (!probe_utils->is_dns_ready("$serverip", "$serverip", "xcatmntest", "$domain")) { + probe_utils->send_msg($outputtarget, "d", "nslookup xcatmntest $serverip failed"); + $rc = 1; + last; + } + } + `rm /etc/hosts > /dev/null 2>&1`; + `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; + `makedns -n 2>&1`; + } + if ($rc) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } else { + + # on sn, nslookup it's ip to check DNS service + if (!probe_utils->is_dns_ready("$serverip", "$masteripinsite", "$nodename", "$domain")) { + probe_utils->send_msg($outputtarget, "d", "nslookup $serverip failed"); + probe_utils->send_msg($outputtarget, "f", "$msg"); + } + else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + } + } + + # For sn, 'setupdhcp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DHCP service, will not check it + my $checkdhcp = 1; + my $rc = 0; + if ($is_sn) { + $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; + chomp($checkdhcp); + if ($checkdhcp) { + + # on sn, just check dhcpd service whether running + $msg = "DHCP service is ready on $serverip"; + my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; + if ($dhcpoutput) { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } else { + probe_utils->send_msg($outputtarget, "f", "$msg"); + } + } else { + probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DHCP service"); + } + } else { + my $leasefile = ""; + if (-e "/var/lib/dhcpd/dhcpd.leases") { + $leasefile = "/var/lib/dhcpd/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/db/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/db/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/dhcpd.leases"; + } + + $msg = "The size of $leasefile is less than 100M"; + my $filesizetmp = `du -sb $leasefile`; + if ($?) { + returncmdoutput($filesizetmp) if ($verbose); + probe_utils->send_msg($outputtarget, "f", "$msg"); + $rst = 1; + } else { + chomp($filesizetmp); + my ($size, $file) = split(" ", $filesizetmp); + probe_utils->send_msg($outputtarget, "d", "The size of $leasefile is $size byte") if ($verbose); + if ($size > 104857600) { + probe_utils->send_msg($outputtarget, "w", "The size of $leasefile is more than 100M"); + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + my $rc = 0; + my $msg = "DHCP service is ready on $serverip"; + { #very important brace to create a block + my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "Simulate a node by chdef failed") if ($verbose); + $rc = 1; + last; + } else { + probe_utils->send_msg($outputtarget, "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); + } + + `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + + open HOSTFILE, ">> /etc/hosts"; + print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; + close HOSTFILE; + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); + $tmp = `makedhcp xcatmntest 2>&1`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); + $rc = 1; + `rmdef xcatmntest`; + last; + } + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); + $tmp = `makedhcp -q xcatmntest`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + chomp($tmp); + if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + + probe_utils->send_msg($outputtarget, "d", "Start to clear simulate information for dhcp test") if ($verbose); + $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; + returncmdoutput($tmp, $outputtarget) if ($verbose); + } + + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; + + if ($rc) { + probe_utils->send_msg($outputtarget, "f", "$msg"); + probe_utils->send_msg($outputtarget, "d", "please run 'makedhcp -n' if never run it before."); + $rst = 1; + } else { + probe_utils->send_msg($outputtarget, "o", "$msg"); + } + } + + + return $rst; +} #------------------------------------- -# main process +# When this command return from all SNs and MN, you need to generate a summary +# All history outpout from SNs and MN are saved in globle hash %summaryoutput. +# $ummaryoutput{mn} = @mnhistory +# $ummaryoutput{snname1} = @snname1history; +# The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. #------------------------------------- +sub summary_all_jobs_output { + + print "\n======================do ERROR summary=====================\n"; + my $isprint = 1; + + foreach my $line (@{ $summaryoutput{mn} }) { + if ($line =~ /\[failed\]/) { + if ($isprint) { + print "[mn]:\n"; + $isprint = 0; + } + print "\t$line\n"; + } + } + + $isprint = 1; + foreach my $node (keys %summaryoutput) { + next if ($node eq "mn"); + foreach my $log (@{ $summaryoutput{$node} }) { + if ($log =~ /\[failed\]/) { + if ($isprint) { + print "[$node]:\n"; + $isprint = 0; + } + print "\t$log\n"; + } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { + if ($isprint) { + print "[$node]:\n"; + $isprint = 0; + } + print "\t$log\n"; + } + } + } +} + +#------------------------------------- +# Each probe sub command is supposed to support hierarchical. +# This funtion is used to caclulate which SN should be dispatched which command +#------------------------------------- +sub caclulate_dispatch_cmd { + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + if ($noderange) { + my @nodes = `nodels $noderange 2>&1`; + if ($?) { + my $error = join(" ", @nodes); + if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { + probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); + } else { + probe_utils->send_msg("$output", "f", "There is error in command line attribute node range, please using nodels to check"); + } + return 1; + } else { + chomp foreach (@nodes); + my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); + my %newsnnodemap; + foreach my $sn (keys %$snnodemap) { + if (grep(/^$sn$/, @snlist)) { + push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); + } else { + push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); + } + } + + foreach my $sn (keys %newsnnodemap) { + my $nodes = join(",", @{ $newsnnodemap{$sn} }); + if ($sn eq "mn") { + $noderange = $nodes; + } else { + for (my $i = 0 ; $i <= $#tmpargv ; $i++) { + if ($tmpargv[$i] eq "-n") { + $tmpargv[ $i + 1 ] = $nodes; + last; + } + } + my $args = join(" ", @tmpargv); + $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; + } + } + } + } else { + if (@snlist) { + my $args = join(" ", @tmpargv); + if ($args =~ /\-V/) { + $args = "-V"; + } else { + $args = " "; + } + my $sns = join(",", @snlist); + $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); + } + } + return 0; +} + +#------------------------------------ +# print sn's msg after all msg received +#------------------------------------ +sub send_sn_msg { + foreach $node (keys %summaryoutput) { + next if ($node eq "mn"); + foreach my $line (@{ $summaryoutput{$node} }) { + if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { + $line = "$1:$node: $2"; + print "$line\n"; + } else { + print "[failed] :$node: $line\n"; + } + } + } +} + +#------------------------------------- +# main process start +#------------------------------------- +@tmpargv = @ARGV; if ( !GetOptions("--help|h" => \$help, "T" => \$test, + "n=s" => \$noderange, "V" => \$verbose, - "n=s" => \$installnic)) + "i=s" => \$installnic)) { - probe_utils->send_msg("$output", "f", "Invalid parameter for $proname"); + probe_utils->send_msg("$output", "f", "Invalid parameter for $program_name"); probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } @@ -69,481 +814,174 @@ if ($test) { exit 0; } +$SIG{TERM} = $SIG{INT} = sub { + $terminal = 1; +}; + +#-------------------------------------------- +# To confirm what current node is, MN or SN +#-------------------------------------------- +$is_sn = 1 if (-e "/etc/xCATSN"); + +if ($is_sn) { + $rst = do_main_job(); + exit $rst; +} + if (!defined($installnic)) { - probe_utils->send_msg("$output", "f", "Option -n is required"); + probe_utils->send_msg("$output", "f", "Option -i is required"); probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } -my $msg = "NIC $installnic exists on current server"; -my $nics = `ip addr show $installnic >/dev/null 2>&1`; -if ($?) { - probe_utils->send_msg("$output", "f", "$msg"); - probe_utils->send_msg("$output", "d", "Please use 'ip addr show' to check if there is NIC named $installnic on current server"); - exit 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} +#-------------------------------------------- +# Each probe tool is supposed to support hierarchical. +#-------------------------------------------- +$rst = caclulate_dispatch_cmd(); -$msg = "Get ip address of NIC $installnic"; -my $mnip = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; -chomp($mnip); -if (!defined($mnip) || ($mnip eq "")) { - probe_utils->send_msg("$output", "f", "$msg"); - probe_utils->send_msg("$output", "d", "Please use 'ip addr show' to check if there is ip assigned to $installnic"); - exit 1; -} else { - probe_utils->send_msg("$output", "d", "The IP of NIC $installnic is $mnip") if ($verbose); - probe_utils->send_msg("$output", "o", "$msg"); -} +#print Dumper \%dispatchcmd; +#print "node left to mn : $noderange\n"; +exit $rst if ($rst); -$msg = "Sub process 'xcatd: SSL listener' is running"; -my $xcatdproc = `ps aux|grep -v grep|grep xcatd`; -chomp($xcatdproc); -if ($xcatdproc =~ /xcatd: SSL listener/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "Sub process 'xcatd: DB Access' is running"; -if ($xcatdproc =~ /xcatd: DB Access/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "Sub process 'xcatd: UDP listener' is running"; -if ($xcatdproc =~ /xcatd: UDP listener/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "Sub process 'xcatd: install monitor' is running"; -if ($xcatdproc =~ /xcatd: install monitor/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "Sub process 'xcatd: Discovery worker' is running"; -if ($xcatdproc =~ /xcatd: Discovery worker/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "Sub process 'xcatd: Command log writer' is running"; -if ($xcatdproc =~ /xcatd: Command log writer/) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "w", "Sub process 'xcatd: Command log writer' isn't running"); -} -exit 1 if ($rst); - - -my $xcatdport = `tabdump site 2>&1 | awk -F',' '/^"xcatdport",/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($xcatdport); -probe_utils->send_msg("$output", "d", "The port used by the xcatd daemon for client/server communication is $xcatdport") if ($verbose); -$msg = "xcatd is listening on port $xcatdport"; -my $cmdoutput = `netstat -ant|grep LISTEN|grep $xcatdport`; -if ($?) { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} - -my $xcatiport = `tabdump site 2>&1| awk -F',' '/^"xcatiport",/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($xcatiport); -probe_utils->send_msg("$output", "d", "The port used by xcatd to receive install status updates from nodes is $xcatiport") if ($verbose); -$msg = "xcatd is listening on port $xcatiport"; -$cmdoutput = `netstat -antp | grep -i xcatd|grep LISTEN|grep $xcatiport`; -if ($?) { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} -exit 1 if ($rst); - -$msg = "'lsxcatd -a' works"; -$cmdoutput = `lsxcatd -a 2>&1`; -$rst = $?; -returncmdoutput($cmdoutput) if ($verbose); -if ($rst) { - probe_utils->send_msg("$output", "f", "$msg"); - exit $rst; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} - -my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($masteripinsite); -probe_utils->send_msg("$output", "d", "The value of 'master' in 'site' table is $masteripinsite") if ($verbose); -probe_utils->send_msg("$output", "f", "There isn't 'master' definition in 'site' talbe") if ($masteripinsite eq ""); - -$msg = "The value of 'master' in 'site' table is a IP address"; -if (probe_utils->is_ip_addr("$masteripinsite")) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - exit 1; -} - -if ($mnip) { - $msg = "The IP $mnip of $installnic equals the value of 'master' in 'site' table"; - if ($mnip eq $masteripinsite) { - probe_utils->send_msg("$output", "o", "$msg"); - } else { - probe_utils->send_msg("$output", "f", "$msg"); +#-------------------------------------------- +# dispatch job to MN and SN +#-------------------------------------------- +my $mnjobpid = 0; +my @snsjobpids = (); +my @snsjobfds = (); +my $pipe_parent_read; +my $pipe_child_write; +pipe $pipe_parent_read, $pipe_child_write; +{ + #handle job in MN + $mnjobpid = fork(); + if (!defined($mnjobpid)) { + probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); $rst = 1; + last; + } elsif ($mnjobpid == 0) { + $SIG{TERM} = $SIG{INT} = sub { + exit 1; + }; + + close $pipe_parent_read; + $rst = do_main_job($pipe_child_write); + exit $rst; } -} + $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; + close $pipe_child_write; -$msg = "IP $mnip of NIC $installnic is a static IP on current server"; -if (probe_utils->is_static_ip("$mnip", "$installnic")) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "w", "IP $mnip of $installnic is not a static ip on current server"); -} + #handle job dispatch to SN + foreach my $sn (keys %dispatchcmd) { + my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; + probe_utils->send_msg("$output", "i", "Dispatch cmd $program_name to $sn $1"); -$msg = "$mnip belongs to one of networks defined in 'networks' table"; -my $networks = `tabdump networks|grep -v "^#"`; -$networks =~ s/\"//g; -my $netcnt = `echo "$networks"|wc -l`; -my $hit = 0; -for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { - my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; - chomp($line); - if ($line =~ /(.+) (.+) (.+)/) { - $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $mnip) && ("$3" eq "$installnic")); + my $snjobfd; + my $snjobpid; + if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { + probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); + next; + } + push(@snsjobpids, $snjobpid); + push(@snsjobfds, $snjobfd); } -} -if ($hit) { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} -$msg = "There is domain definition in 'site' table"; -my $domain = `tabdump site | awk -F',' '/^"domain",/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($domain); -if ($domain) { - probe_utils->send_msg("$output", "d", "The value of 'domain' in 'site' table is $domain") if ($verbose); - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} + my $select = new IO::Select; + $select->add(\*$pipe_parent_read) if ($pipe_parent_read); + $select->add(\*$_) foreach (@snsjobfds); + $| = 1; -$msg = "There is configuration in 'passwd' table for 'system' for node provision"; -my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; -chomp($passwd); -my ($username, $pw) = split(" ", $passwd); -if ($username eq "" || $pw eq "") { - probe_utils->send_msg("$output", "f", "$msg"); - probe_utils->send_msg("$output", "d", "Please define username and password for 'system' in 'passwd' table"); - $rst = 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} - -my $installdir = `tabdump site 2>&1 | awk -F',' '/^"installdir"/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($installdir); -probe_utils->send_msg("$output", "d", "The 'install' directory is set to $installdir in 'site' table on current server") if ($verbose); -my $tftpdir = `tabdump site 2>&1 | awk -F',' '/^"tftpdir",/ { gsub(/"/, "", \$2) ; print \$2 }'`; -chomp($tftpdir); -probe_utils->send_msg("$output", "d", "The 'tftp' directory is set to $tftpdir in 'site' talbe on current server") if ($verbose); - -$msg = "There is $installdir directory on current server"; -if (-e "$installdir/postscripts/") { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -$msg = "There is $tftpdir directory on current server"; -if (-e "$tftpdir") { - probe_utils->send_msg("$output", "o", "$msg"); -} else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} - -my $expected = 10; -$msg = "The free space of / directory is more than $expected G"; -my $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/\$"`; -if ($?) { - probe_utils->send_msg("$output", "d", "There isn't any filesystem mount on / directory"); - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} else { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg("$output", "d", "The free space of / is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg("$output", "w", "The free space of / is less than $expected G"); - } else { - probe_utils->send_msg("$output", "o", "$msg"); + my $line; + my %pipeisnonull; + $pipeisnonull{mn} = 1; + $pipeisnonull{$_} = 1 foreach (@snsjobfds); + my $onepipeisnonull = 1; + while ($onepipeisnonull) { + if (@hdls = $select->can_read(0)) { + foreach $hdl (@hdls) { + if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { + if (eof($pipe_parent_read)) { + $pipeisnonull{mn} = 0; + } else { + chomp($line = <$pipe_parent_read>); + print "$line\n"; + push @{ $summaryoutput{mn} }, $line; + } + } else { + foreach my $fd (@snsjobfds) { + if ($pipeisnonull{$fd} && $hdl == \*$fd) { + if (eof($fd)) { + $pipeisnonull{$fd} = 0; + } else { + chomp($line = <$fd>); + if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { + push @{ $summaryoutput{$2} }, $line; + } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { + push @{ $summaryoutput{$1} }, $2; + $line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); + } + } + } + } + } + } + $onepipeisnonull = 0; + $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); + } + last if ($terminal); + sleep 1; } + send_sn_msg(); } +close($pipe_child_write) if ($pipe_child_write); +close($pipe_parent_read) if ($pipe_parent_read); +close($_) foreach (@snsjobfds); -$expected = 1; -$msg = "The free space of /var directory is more than $expected G"; -$diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/var\$"`; -if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg("$output", "d", "The free space of /var is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg("$output", "w", "The free space of /var is less than $expected G"); - } else { - probe_utils->send_msg("$output", "o", "$msg"); - } -} +my %runningpid; +$runningpid{$mnjobpid} = 1 if ($mnjobpid); +$runningpid{$_} = 1 foreach (@snsjobpids); +my $existrunningpid = 0; +$existrunningpid = 1 if (%runningpid); -$expected = 1; -$msg = "The free space of /tmp directory is more than $expected G"; -$diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/tmp\$"`; -if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg("$output", "d", "The free space of /tmp is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg("$output", "w", "The free space of /tmp is less than $expected G"); - } else { - probe_utils->send_msg("$output", "o", "$msg"); - } -} +my $trytime = 0; +while ($existrunningpid) { - -$expected = 10; -$msg = "The free space of $installdir directory is more than $expected G"; -$diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "$installdir\$"`; -if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg("$output", "d", "The free space of /install is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg("$output", "w", "The free space of /install is less than $expected G"); - } else { - probe_utils->send_msg("$output", "o", "$msg"); - } -} - -$msg = "SELinux is disabled on current server"; -if (probe_utils->is_selinux_enable()) { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} - -$msg = "Firewall is closed on current server"; -if (probe_utils->is_firewall_open()) { - probe_utils->send_msg("$output", "w", "Firewall is configured on current server"); -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} - -`which wget > /dev/null 2>&1`; -if ($?) { - probe_utils->send_msg("$output", "w", "wget tool isn't installed on current server, skip checking HTTP service."); - probe_utils->send_msg("$output", "d", "Please do probe again after installing wget"); -} else { - $msg = "HTTP service is ready on $mnip"; - if (probe_utils->is_http_ready("$mnip")) { - probe_utils->send_msg("$output", "o", "$msg"); - } else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; - } -} - -`which tftp > /dev/null 2>&1`; -if ($?) { - probe_utils->send_msg("$output", "w", "tftp tool isn't installed on current server, skip checking tftp service."); - probe_utils->send_msg("$output", "d", "Please do probe again after installing tftp"); -} else { - $msg = "TFTP service is ready on $mnip"; - if (probe_utils->is_tftp_ready("$mnip")) { - probe_utils->send_msg("$output", "o", "$msg"); - } else { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; - } -} - -`which nslookup > /dev/null 2>&1`; -if ($?) { - probe_utils->send_msg("$output", "w", "nslookup tool isn't installed in current server, skip checking DNS service."); - probe_utils->send_msg("$output", "d", "Please do probe again after installing nslookup"); -} else { - $msg = "DNS server is ready on $mnip"; - probe_utils->send_msg("$output", "d", "Domain used to check DNS is $domain") if ($verbose); - - my $rc = 0; - { #very important brace to create a block - my $tmp = `chdef xcatmntest groups=all ip=$mnip`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "Simulate a node by chdef failed") if ($verbose); - $rc = 1; - last; - } else { - probe_utils->send_msg("$output", "d", "Simulate a node xcatmntest to do DNS test") if ($verbose); + #try INT 5 up to 5 times + if ($try < 5) { + foreach my $pid (keys %runningpid) { + kill 'INT', $pid if ($runningpid{$pid}); } - probe_utils->send_msg("$output", "d", "To do 'makehosts xcatmntest'") if ($verbose); - $tmp = `makehosts xcatmntest`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "makehosts xcatmntest failed") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; + #try TERM 5 up to 5 times + } elsif ($try < 10) { + foreach my $pid (keys %runningpid) { + kill 'TERM', $pid if ($runningpid{$pid}); } - $tmp = `cat /etc/hosts |grep xcatmntest |grep $mnip`; - if ($?) { - probe_utils->send_msg("$output", "d", "makehosts failed to add test node xcatmntest to /etc/hosts") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - - probe_utils->send_msg("$output", "d", "To do 'makedns -n xcatmntest'") if ($verbose); - $tmp = `makedns -V -n xcatmntest 2>&1`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "makedns -n xcatmntest failed") if ($verbose); - $rc = 1; - `makehosts -d xcatmntest && rmdef xcatmntest`; - last; - } - - if (!probe_utils->is_dns_ready("$mnip", "xcatmntest", "$domain")) { - probe_utils->send_msg("$output", "d", "nslookup xcatmntest $mnip failed"); - $rc = 1; - `makehosts -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg("$output", "d", "Start to clear simulate information for DNS test") if ($verbose); - $tmp = `makedns -d xcatmntest && makehosts -d xcatmntest && rmdef xcatmntest`; - returncmdoutput($tmp) if ($verbose); - } - - if ($rc) { - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; + #try KILL 1 time } else { - probe_utils->send_msg("$output", "o", "$msg"); + foreach my $pid (keys %runningpid) { + kill 'KILL', $pid if ($runningpid{$pid}); + } } + ++$try; + + sleep 1; + foreach my $pid (keys %runningpid) { + $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); + } + $existrunningpid = 0; + $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); + last if ($try > 10); } -my $os = probe_utils->get_os(); -my $leasefile = ""; -$leasefile = "/var/lib/dhcpd/dhcpd.leases" if ($os =~ /redhat/i); -$leasefile = "/var/lib/dhcp/db/dhcpd.leases" if ($os =~ /sles/i); -$leasefile = "/var/lib/dhcp/dhcpd.leases" if ($os =~ /ubuntu/i); -$msg = "The size of $leasefile is less than 100M"; -my $filesizetmp = `du -sb $leasefile`; -if ($?) { - returncmdoutput($filesizetmp) if ($verbose); - probe_utils->send_msg("$output", "f", "$msg"); - $rst = 1; -} else { - chomp($filesizetmp); - my ($size, $file) = split(" ", $filesizetmp); - probe_utils->send_msg("$output", "d", "The size of $leasefile is $size bytes") if ($verbose); - if ($size > 104857600) { - probe_utils->send_msg("$output", "w", "The size of $leasefile is more than 100M"); - } else { - probe_utils->send_msg("$output", "o", "$msg"); - } -} +#------------------------------------- +# summary all jobs output to display +#------------------------------------- +$rst = summary_all_jobs_output(); -my $msg = "DHCP service is ready on $mnip"; -my $rc = 0; -{ #very important brace to create a block - my $tmp = `chdef xcatmntest groups=all ip=$mnip mac=aa:aa:aa:aa:aa:aa`; if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "Simulate a node by chdef failed") if ($verbose); - $rc = 1; - last; - } else { - probe_utils->send_msg("$output", "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); - } - - probe_utils->send_msg("$output", "d", "To do 'makehosts xcatmntest'") if ($verbose); - $tmp = `makehosts xcatmntest`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "makehosts xcatmntest failed") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - - $tmp = `cat /etc/hosts |grep xcatmntest |grep $mnip`; - if ($?) { - probe_utils->send_msg("$output", "d", "makehosts failed to add test node xcatmntest to /etc/hosts") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - - probe_utils->send_msg("$output", "d", "To do 'makedhcp xcatmntest'") if ($verbose); - $tmp = `makedhcp xcatmntest 2>&1`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "makedhcp xcatmntest failed") if ($verbose); - $rc = 1; - `makehosts -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg("$output", "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); - $tmp = `makedhcp -q xcatmntest`; - if ($?) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "makedhcp -q xcatmntest failed") if ($verbose); - $rc = 1; -`makedhcp -d xcatmntest && makehosts -d xcatmntest && rmdef xcatmntest`; - last; - } - chomp($tmp); - if ($tmp !~ /xcatmntest: ip-address = $mnip, hardware-address = aa:aa:aa:aa:aa:aa/) { - returncmdoutput($tmp) if ($verbose); - probe_utils->send_msg("$output", "d", "DHCP server's reply is wrong") if ($verbose); - $rc = 1; -`makedhcp -d xcatmntest && makehosts -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg("$output", "d", "Start to clear simulate information for dhcp test") if ($verbose); - $tmp = `makedhcp -d xcatmntest && makehosts -d xcatmntest && rmdef xcatmntest`; - returncmdoutput($tmp) if ($verbose); -} -if ($rc) { - probe_utils->send_msg("$output", "f", "$msg"); - probe_utils->send_msg("$output", "d", "please run 'makedhcp -n' if never run it before."); - $rst = 1; -} else { - probe_utils->send_msg("$output", "o", "$msg"); -} exit $rst; + + + + From d4c410491d710673a8426c5ee172730ca2c6d93c Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 10 Aug 2016 09:45:41 -0400 Subject: [PATCH 090/391] modify bundle file --- xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index cc15f6b88e..a9a3aa760a 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -1,13 +1,10 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le -go_xcat_local_repo_case1 -go_xcat_local_repo_case2 -go_xcat_local_repo_case3 -go_xcat_local_repo_case4 -go_xcat_local_repo_case5 -go_xcat_local_repo_case6 go_xcat_local_repo_case7 go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 makehosts_h makehosts_help makehosts_n @@ -202,6 +199,4 @@ switchdiscover_range_z_V nodeset_shell nodeset_cmdline nodeset_runimg -redhat_migration1 -redhat_migration2 clean_up_env From e78dfb7f3858b842a7c2bb38e05afbd3a7b342f1 Mon Sep 17 00:00:00 2001 From: Andreas Hilboll Date: Wed, 10 Aug 2016 22:08:20 +0200 Subject: [PATCH 091/391] Update features.rst --- docs/source/overview/features.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/overview/features.rst b/docs/source/overview/features.rst index c15ac84712..176d6b82a0 100644 --- a/docs/source/overview/features.rst +++ b/docs/source/overview/features.rst @@ -51,6 +51,7 @@ Features * Parallel ping #. Integrate xCAT in Cloud + * Openstack * SoftLayer From 9842b155e88e07b5e0cf1c4e653e94e6a638b652 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 10 Aug 2016 21:27:31 -0400 Subject: [PATCH 092/391] modify summary output of xcatmn --- xCAT-probe/subcmds/xcatmn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index e564197f44..0b72e8886a 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -668,9 +668,10 @@ sub do_main_job { #------------------------------------- # When this command return from all SNs and MN, you need to generate a summary # All history outpout from SNs and MN are saved in globle hash %summaryoutput. -# $ummaryoutput{mn} = @mnhistory -# $ummaryoutput{snname1} = @snname1history; +# $summaryoutput{mn} = @mnhistory +# $summaryoutput{snname1} = @snname1history; # The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. +# A simple example of how to dump %summaryoutput has been written in function #------------------------------------- sub summary_all_jobs_output { @@ -775,8 +776,7 @@ sub send_sn_msg { next if ($node eq "mn"); foreach my $line (@{ $summaryoutput{$node} }) { if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { - $line = "$1:$node: $2"; - print "$line\n"; + print "$1:$node: $2\n"; } else { print "[failed] :$node: $line\n"; } From 6a1976071906f0868edef0f02a70e7edda6131ec Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 11 Aug 2016 01:26:13 -0400 Subject: [PATCH 093/391] modify depending on comments --- xCAT-probe/subcmds/code_template | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index d6911dcaee..e087ba8af4 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -121,7 +121,7 @@ sub summary_all_jobs_output { #------------------------------------- # Each probe sub command is supposed to support hierarchical. -# This funtion is used to caclulate which SN should be dispatched which command +# This funtion is used to calclulate which SN should be dispatched which command #------------------------------------- sub calculate_dispatch_cmd { my @snlist = xCAT::ServiceNodeUtils->getAllSN(); @@ -149,7 +149,11 @@ sub calculate_dispatch_cmd { if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN - push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); + if(grep(/^$1$/, @snlist)){ + push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); + }else{ + probe_utils->send_msg("$output", "f", "The value $1 of 'servicenode' isn't a service node"); + } } else { # the nodes don't belong to any SN will be handled by MN push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); } @@ -255,7 +259,7 @@ pipe $pipe_parent_read, $pipe_child_write; #handle job in MN $mnjobpid = fork(); if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fock process to handle MN job failed: $!"); + probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); $rst = 1; last; } elsif ($mnjobpid == 0) { @@ -278,7 +282,7 @@ pipe $pipe_parent_read, $pipe_child_write; my $snjobfd; my $snjobpid; if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fock process to dispatch cmd $snjobcmd to $sn failed: $!"); + probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); next; } push(@snsjobpids, $snjobpid); @@ -313,10 +317,15 @@ pipe $pipe_parent_read, $pipe_child_write; $pipeisnonull{$fd} = 0; } else { chomp($line = <$fd>); - if ($line =~ /^(\w+)\s*:\s(.*)/) { + if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { + push @{ $summaryoutput{$2} }, $line; + #if need to print to STDIN in real time, can make below line available + #print "[failed] :$2: $line\n"; + } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { push @{ $summaryoutput{$1} }, $2; - $line = "$2 :$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\])\s*:\s*(.*)/); - print "$line\n"; + #if need to print to STDIN in real time, can make below lines available + #$line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); + #print "$line\n"; } } } From 7831ea277d698c6c7ce43296bc6e9f3bf00464a0 Mon Sep 17 00:00:00 2001 From: neo954 Date: Thu, 11 Aug 2016 01:21:07 -0500 Subject: [PATCH 094/391] [go-xcat] Version 1.0.2 Fix a couple of bugs. (#1663) * [go-xcat] Let the end user see the original interactive prompt of yum, zypper and apt-get. * [go-xcat] Change the package list for Ubuntu based on commit number 8b5f44c * [go-xcat] Change the default behavior of this script to show the help message * [go-xcat] Add a secret verbose help message * [go-xcat] A secret verbose help output * [go-xcat] Print out help message instantly while wrong command line argument were passed * [go-xcat] Add error handling for unknown command line argument --- xCAT-server/share/xcat/tools/go-xcat | 146 ++++++++++++++++++++++----- 1 file changed, 122 insertions(+), 24 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 775c87ae37..610bf3ebcf 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.1 +# Version 1.0.2 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -59,6 +59,65 @@ function usage() EOF } +# +# verbose_usage This function be will be called when user run +# `go-xcat --long-help'. +# Including a bunch of secert usage. +# +function verbose_usage() +( + local script="${0##*/}" + + exec 42< <(usage) + + function println() + { + local -i i + for (( i = 0 ; i < "$1" ; ++i )) + do + read -r -u 42 + [[ "$?" -ne "0" ]] && break + echo "${REPLY}" + done + } + + println 7 + println 1 >/dev/null # Drop a line + while read -r ; do echo "${REPLY}" ; done <<-EOF + -h, --help display a simply version of help and exit + --long-help display this help and exit + EOF + println 9 + while read -r ; do echo "${REPLY}" ; done <<-EOF + check check the version of the installed packages + of xCAT and packages in the repository + EOF + println 2 + while read -r ; do echo "${REPLY}" ; done <<-EOF + smoke-test preform basic tests of the xCAT installation + EOF + println 11 + while read -r ; do echo "${REPLY}" ; done <<-EOF + ${script} --xcat-core=/path/to/xcat-core.repo install + ${script} --xcat-core=/path/to/xcat-core install + ${script} --xcat-core=/path/to/xcat-core.tar install + ${script} --xcat-core=/path/to/xcat-core.tar.Z install + ${script} --xcat-core=/path/to/xcat-core.tar.gz install + ${script} --xcat-core=/path/to/xcat-core.tar.bz2 install + ${script} --xcat-core=/path/to/xcat-core.tar.xz install + ${script} --xcat-core=http://xcat.org/path/to/xcat-core.repo install + ${script} --xcat-core=http://xcat.org/path/to/xcat-core install + ${script} --xcat-core=http://xcat.org/path/to/xcat-core.tar.bz2 install + ${script} --xcat-core=/path/to/xcat-core.repo \\ + --xcat-dep=/path/to/xcat-dep.repo install + ${script} --xcat-core=/path/to/xcat-core \\ + --xcat-dep=/path/to/xcat-dep install + EOF + println 999999 # Print out all the rest of lines + + exec 42<&- +) + # # version Print out the version number. # @@ -83,8 +142,8 @@ GO_XCAT_CORE_PACKAGE_LIST=(perl-xCAT xCAT xCAT-SoftLayer xCAT-buildkit # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_CORE_PACKAGE_LIST=(perl-xcat xcat xcat-buildkit xcat-client - xcat-confluent xcat-genesis-scripts xcat-server xcat-test xcat-vlan - xcatsn) + xcat-confluent xcat-genesis-scripts-amd64 xcat-genesis-script-ppc64 + xcat-server xcat-test xcat-vlan xcatsn) GO_XCAT_DEP_PACKAGE_LIST=() # The package list of all the packages should be installed @@ -95,7 +154,7 @@ GO_XCAT_INSTALL_LIST=(perl-xCAT xCAT xCAT-buildkit xCAT-client # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-buildkit xcat-client - xcat-genesis-scripts xcat-server + xcat-genesis-scripts-amd64 xcat-genesis-script-ppc64 xcat-server conserver-xcat elilo-xcat grub2-xcat ipmitool-xcat syslinux-xcat xcat-genesis-base-amd64 xcat-genesis-base-ppc64 xnba-undi) @@ -715,6 +774,8 @@ function extract_archive() # $2 repo id function add_repo_by_url_yum_or_zypper() { + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" local repo_id="$2" local tmp="" @@ -786,6 +847,8 @@ function add_repo_by_url_yum_or_zypper() function add_repo_by_url_apt() { [[ -d /etc/apt/sources.list.d/ ]] || return 255 + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" local repo_id="$2" local tmp="" @@ -882,6 +945,8 @@ function remove_repo() function add_xcat_core_repo_yum_or_zypper() { type yum >/dev/null 2>&1 || type zypper >/dev/null 2>&1 || return 255 + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" local ver="$2" local tmp="" @@ -906,6 +971,8 @@ function add_xcat_core_repo_yum_or_zypper() function add_xcat_core_repo_apt() { [[ -d "/etc/apt/sources.list.d" ]] || return 255 + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" local ver="$2" local tmp="" @@ -939,6 +1006,8 @@ function add_xcat_core_repo() function add_xcat_dep_repo_yum_or_zypper() { type yum >/dev/null 2>&1 || type zypper >/dev/null 2>&1 || return 255 + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" local tmp="" local install_path="${GO_XCAT_DEFAULT_INSTALL_PATH}" @@ -1003,6 +1072,8 @@ function add_xcat_dep_repo_yum_or_zypper() function add_xcat_dep_repo_apt() { [[ -d "/etc/apt/sources.list.d" ]] || return 255 + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift local url="$1" [[ -z "${url}" ]] && url="${GO_XCAT_DEFAULT_BASE_URL}/apt/xcat-dep" @@ -1046,33 +1117,33 @@ function update_repo() function install_packages_dnf() { type dnf >/dev/null 2>&1 || return 255 - local -a args=() - [[ "$1" = "-y" ]] && args=("-y") && shift - dnf --nogpgcheck "${args[@]}" install "$@" + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift + dnf --nogpgcheck "${yes[@]}" install "$@" } function install_packages_yum() { type yum >/dev/null 2>&1 || return 255 - local -a args=() - [[ "$1" = "-y" ]] && args=("-y") && shift - yum --nogpgcheck "${args[@]}" install "$@" + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift + yum --nogpgcheck "${yes[@]}" install "$@" } function install_packages_zypper() { type zypper >/dev/null 2>&1 || return 255 - local -a args=() - [[ "$1" = "-y" ]] && args=("-n") && shift - zypper --no-gpg-checks "${args[@]}" install "$@" + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-n") && shift + zypper --no-gpg-checks "${yes[@]}" install "$@" } function install_packages_apt() { type apt-get >/dev/null 2>&1 || return 255 - local -a args=() - [[ "$1" = "-y" ]] && args=("-y") && shift - apt-get --allow-unauthenticated install "${args[@]}" "$@" + local -a yes=() + [[ "$1" = "-y" ]] && yes=("-y") && shift + apt-get --allow-unauthenticated install "${yes[@]}" "$@" } function install_packages() @@ -1309,6 +1380,10 @@ do usage exit 0 ;; + "--long-help") + verbose_usage + exit 0 + ;; "--xcat-core="*) GO_XCAT_CORE_URL="${1##--xcat-core=}" ;; @@ -1325,8 +1400,15 @@ do "-y"|"--yes") GO_XCAT_YES=("-y") ;; + "-"*) + warn_if_bad 1 "invalid option -- '$1'" + exit_if_bad 1 "Try \`$0 --help' for more information" + ;; *) [ "$1" == "--" ] && shift + [ -z "${GO_XCAT_ACTION}" ] + warn_if_bad "$?" "redundancy action -- '$1'" + exit_if_bad "$?" "Try \`$0 --help' for more information" GO_XCAT_ACTION="$1" ;; esac @@ -1334,10 +1416,20 @@ do done case "${GO_XCAT_ACTION}" in +"check"|"install"|"update") + ;; "smoke-test") perform_smoke_test exit "$?" ;; +"") + usage + exit 1 + ;; +*) + warn_if_bad 1 "invalid action -- '${GO_XCAT_ACTION}'" + exit_if_bad 1 "Try \`$0 --help' for more information" + ;; esac GO_XCAT_OS="$(check_os)" @@ -1386,9 +1478,9 @@ echo echo -n "Reading repositories " show_progress_meters ERR_MSG="$({ - if add_xcat_core_repo "${GO_XCAT_CORE_URL}" "${GO_XCAT_VERSION}" + if add_xcat_core_repo "${GO_XCAT_YES[@]}" "${GO_XCAT_CORE_URL}" "${GO_XCAT_VERSION}" then - if add_xcat_dep_repo "${GO_XCAT_DEP_URL}" + if add_xcat_dep_repo "${GO_XCAT_YES[@]}" "${GO_XCAT_DEP_URL}" then update_repo && exit 0 remove_repo "xcat-dep" @@ -1408,6 +1500,9 @@ fi echo "done" case "${GO_XCAT_ACTION}" in +"check") + list_xcat_packages + ;; "install"|"update") GO_XCAT_INSTALLER="${GO_XCAT_ACTION}_xcat" if [[ "${#GO_XCAT_YES[@]}" -eq "0" ]] @@ -1424,7 +1519,7 @@ case "${GO_XCAT_ACTION}" in esac fi ( - "${GO_XCAT_INSTALLER}" -y 2>&1 1>&42 | + "${GO_XCAT_INSTALLER}" "${GO_XCAT_YES[@]}" 2>&1 1>&42 | tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stderr" >&2 exit "${PIPESTATUS[0]}" ) 42>&1 | tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stdout" @@ -1482,8 +1577,9 @@ case "${GO_XCAT_ACTION}" in exit "${RET}" fi - if [ ${GO_XCAT_ACTION} == 'install' ]; then - # only print out this message on install + case "${GO_XCAT_ACTION}" in + "install") + # Only print out this message on install while read -r ; do echo "${REPLY}" ; done <<-EOF xCAT has been installed! @@ -1497,17 +1593,19 @@ case "${GO_XCAT_ACTION}" in or csh, \`source /etc/profile.d/xcat.csh\` EOF - else + ;; + "update") while read -r ; do echo "${REPLY}" ; done <<-EOF xCAT has been updated! ====================== EOF - fi + ;; + esac ;; *) - list_xcat_packages + exit 1 ;; esac # case "${GO_XCAT_ACTION}" in From 79426ad21e602b8a1bf5c02084ffb8c8ca9bf01e Mon Sep 17 00:00:00 2001 From: penguhyang Date: Thu, 11 Aug 2016 16:09:43 +0800 Subject: [PATCH 095/391] add new option to indicate compress method (#1669) --- .../references/man1/packimage.1.rst | 2 + xCAT-client/pods/man1/packimage.1.pod | 2 + xCAT-server/lib/xcat/plugins/anaconda.pm | 8 +- xCAT-server/lib/xcat/plugins/debian.pm | 9 +- xCAT-server/lib/xcat/plugins/packimage.pm | 95 ++++++++++++------- xCAT-server/lib/xcat/plugins/sles.pm | 8 +- .../share/xcat/netboot/rh/compute.pkglist | 1 + .../xcat/netboot/rh/compute.rhels6.pkglist | 1 + .../netboot/rh/compute.rhels6.ppc64.pkglist | 1 + .../netboot/rh/compute.rhels6.x86_64.pkglist | 1 + .../netboot/rh/compute.rhels7.ppc64.pkglist | 1 + .../netboot/rh/compute.rhels7.x86_64.pkglist | 1 + .../xcat/netboot/rh/dracut/install.netboot | 2 +- .../share/xcat/netboot/rh/dracut/xcatroot | 28 ++++-- .../netboot/rh/dracut_033/install.netboot | 2 +- .../share/xcat/netboot/rh/dracut_033/xcatroot | 30 ++++-- xCAT-server/share/xcat/netboot/rh/genimage | 28 ++++-- .../share/xcat/netboot/sles/compute.pkglist | 1 + .../xcat/netboot/sles/compute.sles11.pkglist | 1 + .../netboot/sles/compute.sles11.ppc64.pkglist | 1 + .../sles/compute.sles12.ppc64le.pkglist | 1 + .../sles/compute.sles12.x86_64.pkglist | 1 + .../netboot/sles/dracut_033/install.netboot | 2 +- .../xcat/netboot/sles/dracut_033/xcatroot | 30 ++++-- xCAT-server/share/xcat/netboot/sles/genimage | 30 ++++-- .../share/xcat/netboot/ubuntu/compute.pkglist | 1 + .../compute.ubuntu14.04.4.ppc64el.pkglist | 1 + .../compute.ubuntu14.04.4.x86_64.pkglist | 1 + .../ubuntu/compute.ubuntu14.04.pkglist | 1 + .../ubuntu/compute.ubuntu16.04.pkglist | 1 + .../compute.ubuntu16.04.ppc64el.pkglist | 1 + .../ubuntu/compute.ubuntu16.04.x86_64.pkglist | 1 + .../netboot/ubuntu/dracut/install.netboot | 2 +- .../share/xcat/netboot/ubuntu/dracut/xcatroot | 26 +++-- .../share/xcat/netboot/ubuntu/genimage | 32 +++++-- 35 files changed, 247 insertions(+), 107 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index d0520af547..20651fbda8 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -64,6 +64,8 @@ OPTIONS \ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio) +\ **-c**\ Compress Method (pigz,gzip,xz, default is pigz) + ************ RETURN VALUE diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 0fa78542c4..60b34fe6f9 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -38,6 +38,8 @@ B<-a> Architecture (ppc64,x86_64,etc) B<-m> Archive Method (cpio,tar,squashfs, default is cpio) +B<-c> Compress Method (pigz,gzip,xz, default is pigz) + =head1 RETURN VALUE diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a0e9f768db..bb6d1738b8 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -462,9 +462,11 @@ sub mknetboot } $platform = xCAT_plugin::anaconda::getplatform($osver); - my $suffix = 'gz'; + my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); # statelite images are not packed. if ($statelite) { @@ -513,7 +515,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 5d57bea304..9278868641 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1170,9 +1170,10 @@ sub mknetboot } $platform = xCAT_plugin::debian::getplatform($osver); - my $suffix = 'gz'; - $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + my $suffix = 'cpio.gz'; + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); # statelite images are not packed. if ($statelite) { @@ -1222,7 +1223,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 6d6518df7c..ca92c8f370 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -87,6 +87,7 @@ sub process_request { my $arch; my $profile; my $method = 'cpio'; + my $compress; my $exlistloc; my $syncfile; my $rootimg_dir; @@ -102,6 +103,7 @@ sub process_request { "arch|a=s" => \$arch, "osver|o=s" => \$osver, "method|m=s" => \$method, + "compress|c=s" => \$compress, "tracker=s" => \$dotorrent, "help|h" => \$help, "version|v" => \$version @@ -419,51 +421,77 @@ sub process_request { unlink("$destdir/rootimg.gz"); unlink("$destdir/rootimg.sfs"); - $callback->({ info => ["archive method:$method"] }); - if ($method =~ /cpio/) { - my $compress = "gzip"; - - #use "pigz" as the compress tool instead of gzip if "pigz" exist - my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); - if ($ispigz == 0) { - $compress = "pigz"; - } - $callback->({ info => ["compress method:$compress"] }); - if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.gz"; - } else { - chdir("$rootimg_dir"); - system("$excludestr >> $xcat_packimg_tmpfile"); - if ($includestr) { - system("$includestr >> $xcat_packimg_tmpfile"); + my $suffix; + if ($compress) { + if ($compress eq 'gzip') { + my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); + unless ($isgzip == 0) { + $callback->({ error => ["Command gzip does not exist, please make sure it is installed."] }); + return 1; } - $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.gz"; + $suffix = "gz"; + } elsif ($compress eq 'pigz') { + my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); + unless ($ispigz == 0) { + $callback->({ error => ["Command pigz does not exist, please make sure it is installed."] }); + return 1; + } + $suffix = "gz"; + } elsif ($compress eq 'xz') { + my $isxz = system("bash -c 'type -p xz' >/dev/null 2>&1"); + unless ($isxz == 0) { + $callback->({ error => ["Command xz does not exist, please make sure it is installed."] }); + return 1; + } + $suffix = "xz"; + } else { + $callback->({ error => ["Invalid compress method '$compress' requested"], errorcode => [1] }); + return 1; } - $oldmask = umask 0077; - } elsif ($method =~ /tar/) { - my $compress = "gzip"; - - #use "pigz" as the compress tool instead of gzip if "pigz" exist + } else { my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); if ($ispigz == 0) { $compress = "pigz"; } else { my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); - unless ($isgzip == 0) { - $callback->({ error => ["Command gzip does not exist, please make sure it works."] }); + if ($isgzip == 0) { + $compress = "gzip"; + } else { + $callback->({ error => ["The default compress tool 'gzip' and 'pigz' does not exist, please specify an available compress method with '-c'."] }); return 1; } } + $suffix = "gz"; + } + + $callback->({ info => ["archive method:$method"] }); + unless ($method =~ /squashfs/) { $callback->({ info => ["compress method:$compress"] }); + } + + $suffix = $method.".".$suffix; + if ($method =~ /cpio/) { if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.tgz"; + $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.tgz"; + $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.$suffix"; + } + $oldmask = umask 0077; + } elsif ($method =~ /tar/) { + if (!$exlistloc) { + $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.$suffix"; + } else { + chdir("$rootimg_dir"); + system("$excludestr >> $xcat_packimg_tmpfile"); + if ($includestr) { + system("$includestr >> $xcat_packimg_tmpfile"); + } + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.$suffix"; } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { @@ -476,24 +504,25 @@ sub process_request { } $excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath"; } else { - $callback->({ error => ["Invalid method '$method' requested"], errorcode => [1] }); + $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); + return 1; } chdir("$rootimg_dir"); my $outputmsg = `$excludestr`; $callback->({ info => ["$outputmsg"] }); if ($method =~ /cpio/) { - chmod 0644, "$destdir/rootimg.gz"; + chmod 0644, "$destdir/rootimg.$suffix"; if ($dotorrent) { my $currdir = getcwd; chdir($destdir); - unlink("rootimg.gz.metainfo"); - system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.gz.metainfo rootimg.gz"); - chmod 0644, "rootimg.gz.metainfo"; + unlink("rootimg.$suffix.metainfo"); + system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.$suffix.metainfo rootimg.$suffix"); + chmod 0644, "rootimg.$suffix.metainfo"; chdir($currdir); } umask $oldmask; } elsif ($method =~ /tar/) { - chmod 0644, "$destdir/rootimg.tgz"; + chmod 0644, "$destdir/rootimg.$suffix"; umask $oldmask; } elsif ($method =~ /squashfs/) { my $flags; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index a833353ea9..7429da3cf2 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -327,9 +327,11 @@ sub mknetboot $platform = "sles"; } - my $suffix = 'gz'; + my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); if ($statelite) { unless (-r "$rootimgdir/kernel") { @@ -381,7 +383,7 @@ sub mknetboot } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] diff --git a/xCAT-server/share/xcat/netboot/rh/compute.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.pkglist index 2824c79fc6..42f78c8a22 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.pkglist @@ -14,3 +14,4 @@ rpm rsync tar gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist index e2389d3de6..c5eaece651 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist @@ -15,3 +15,4 @@ rsyslog e2fsprogs gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist index fbaf36a2a7..1439425efd 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist @@ -26,3 +26,4 @@ procps parted gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist index ae873e99fe..24c092e95c 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist @@ -22,3 +22,4 @@ e2fsprogs parted gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index bb9af2ce96..2a7c348d3a 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -26,3 +26,4 @@ parted net-tools gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 3c54123a84..e0dede6122 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -21,3 +21,4 @@ parted net-tools gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index f14ffa1c04..0b19df672a 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip dash modprobe touch echo cut wc +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc xz dracut_install -o ctorrent dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 688d7f7720..4d20531fa6 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -67,8 +67,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -79,15 +79,23 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -97,7 +105,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk echo Done elif [ -r /rootimg-statelite.gz ]; then diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot index e1227868bf..cca462a0b3 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip modprobe touch echo cut wc +dracut_install wget tar cpio gzip modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 328068a324..0bc2ebcd95 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -69,8 +69,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -81,16 +81,24 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -101,7 +109,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 0879cabb9e..aa13d2855d 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1606,7 +1606,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro \$NEWROOT/ro mount --move /rw \$NEWROOT/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; print $inifile "echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o size=$rootlimit,mode=755 -t tmpfs rootfs \$NEWROOT\n"; @@ -1615,13 +1615,21 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1631,7 +1639,11 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1708,7 +1720,7 @@ EOMS } # add rsync for statelite - foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } diff --git a/xCAT-server/share/xcat/netboot/sles/compute.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.pkglist index cc5a5fd872..a3165f8349 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.pkglist @@ -13,3 +13,4 @@ timezone ntp tar gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist index e284622f1d..8787c0177c 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist @@ -19,3 +19,4 @@ bc ntp gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist index 26e735587d..3f9ffbed30 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist @@ -21,3 +21,4 @@ procps ntp gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist index 1eebf14144..d0b4c3a0e3 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist @@ -41,3 +41,4 @@ udev kernel-default kernel-firmware adaptec-firmware +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist index 1eebf14144..d0b4c3a0e3 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist @@ -41,3 +41,4 @@ udev kernel-default kernel-firmware adaptec-firmware +xz diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot index e1227868bf..cca462a0b3 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip modprobe touch echo cut wc +dracut_install wget tar cpio gzip modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index 91b6a3aa4a..acd7b3ebf6 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -67,8 +67,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -79,16 +79,24 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -99,7 +107,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 5b894e37a7..3fbe3c6c23 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1624,7 +1624,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro /sysroot/ro mount --move /rw /sysroot/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; print $inifile "echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o size=$rootlimit,mode=755 -t tmpfs rootfs \$NEWROOT\n"; @@ -1633,13 +1633,21 @@ EOMS } print $inifile " cd /sysroot\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1649,7 +1657,11 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1758,7 +1770,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } @@ -1770,7 +1782,7 @@ EOMS } } else { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist index c3839a534b..cac5d706a5 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist index 730382c867..1dea61ecbe 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist @@ -15,3 +15,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist index 730382c867..1dea61ecbe 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist @@ -15,3 +15,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist index b1357ac5f9..6e3b04dc24 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist index d3e1da0217..77dffd96f2 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist index 8276befc20..df556b887a 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist @@ -16,3 +16,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist index 8276befc20..df556b887a 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist @@ -16,3 +16,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot index 10f1c73208..372fa4df8d 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip dash modprobe touch echo cut wc +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs inst "$moddir/xcatroot" "/sbin/xcatroot" diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index 073ec1e4b4..67f40c8edc 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -39,23 +39,35 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then echo Setting up RAM-root tmpfs. mount -t tmpfs -o mode=755 rootfs $NEWROOT cd $NEWROOT echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi echo Done -elif [ -r /rootimg.tgz ]; then +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo Setting up RAM-root tmpfs. mount -t tmpfs -o mode=755 rootfs $NEWROOT cd $NEWROOT echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi echo Done elif [ -r /rootimg-statelite.gz ]; then echo Setting up RAM-root tmpfs for statelite mode. diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 870c13b73a..8934e44b10 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1441,8 +1441,8 @@ if [ -r /rootimg.sfs ]; then mount --move /ro \$NEWROOT/ro mount --move /rw \$NEWROOT/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; - print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.gz downloaded,setting up RAM-root tmpfs...\"\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n"; @@ -1452,15 +1452,23 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; - print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.tgz downloaded,setting up RAM-root tmpfs...\"\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1471,7 +1479,11 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; print $inifile "else\n"; @@ -1612,7 +1624,7 @@ EOMS } # add rsync for statelite - foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/gzip", "usr/bin/tar") { + foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } From c70913262d51b297eb04e59873f1bb75101ef1b4 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 11 Aug 2016 05:11:03 -0400 Subject: [PATCH 096/391] fix issue [DEV] Diskless boot failed for rhel7.3 because selinux disabled. #1666 ; disable selinux in the rootimg --- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 4 ++++ .../share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall | 6 ++++++ xCAT-server/share/xcat/netboot/rh/service.postinstall | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index dc423d20d3..0819752bba 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -32,6 +32,10 @@ END #cons:12345:respawn:/sbin/smart_agetty -L 38400 console echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab +#-- Disable SELinux in the rootimg +#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default +#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall index 01bc23cb45..b8eee319e9 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall @@ -32,6 +32,12 @@ END #echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab +#-- Disable SELinux in the rootimg +#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default +#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + + #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. #-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. diff --git a/xCAT-server/share/xcat/netboot/rh/service.postinstall b/xCAT-server/share/xcat/netboot/rh/service.postinstall index 5fbd8e26a7..86e295e455 100755 --- a/xCAT-server/share/xcat/netboot/rh/service.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/service.postinstall @@ -35,6 +35,12 @@ workdir=$5 echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab + +#-- Disable SELinux in the rootimg +#-- Redhat 7.3 will install selinux-policy and selinux is enabled by default +#-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. #-- Hence, we keep image definition files and postscripts in CVS. During image generation we create file /etc/IMGVERSION and fill it with CVS "$Id$" of files with image definition (.pkglist, .exlist, .repolist, .postinstall). Then, during boot, each "CVS enabled" postscript (see /install/postscripts/cvs_template.sh and /install/postscripts/cvs_template.pl) adds one line to /etc/IMGVERSION. Then you can determine in any time what image you are running and what postscipts in which versions were run. From 672b7113d7db057943254447a6d0295087cc634a Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 11 Aug 2016 11:35:42 -0400 Subject: [PATCH 097/391] CUDA8 support on rhel7.2 and rhel7.3 --- .../xcat/install/rh/cudafull.rhels7.ppc64le.pkglist | 2 +- .../xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist | 6 +++++- .../share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist | 3 +++ .../netboot/rh/cudafull.rhels7.ppc64le.otherpkgs.pkglist | 2 +- .../rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist | 6 +++++- xCAT/postscripts/config_cuda | 9 ++++----- 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/xCAT-server/share/xcat/install/rh/cudafull.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/cudafull.rhels7.ppc64le.pkglist index b08d9ac4db..c7f35565a8 100644 --- a/xCAT-server/share/xcat/install/rh/cudafull.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/cudafull.rhels7.ppc64le.pkglist @@ -1,6 +1,6 @@ #INCLUDE:compute.rhels7.pkglist# -#For Cuda 7.5 +#For Cuda kernel-devel gcc pciutils diff --git a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist index 1efe75819d..a481755371 100644 --- a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist @@ -1,9 +1,13 @@ #INCLUDE:compute.rhels7.pkglist# -#For Cuda 7.5 +#For Cuda kernel-devel gcc pciutils dkms +#To install cuda-runtime, need to specify the version +#if want to install cuda-runtime-8-0, uncomment it, +#then comment out cuda-runtime-7-5 +#cuda-runtime-8-0 cuda-runtime-7-5 diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index 2a7c348d3a..6c101ad233 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -27,3 +27,6 @@ net-tools gzip tar xz +grub2 +grub2-tools +bzip2 diff --git a/xCAT-server/share/xcat/netboot/rh/cudafull.rhels7.ppc64le.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/cudafull.rhels7.ppc64le.otherpkgs.pkglist index bbb7cc4187..01f740b46e 100644 --- a/xCAT-server/share/xcat/netboot/rh/cudafull.rhels7.ppc64le.otherpkgs.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/cudafull.rhels7.ppc64le.otherpkgs.pkglist @@ -1,5 +1,5 @@ -#For Cuda 7.5 +#For Cuda kernel-devel gcc pciutils diff --git a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist index 8a5acb8577..12c60f80a0 100644 --- a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist @@ -1,8 +1,12 @@ -#For Cuda 7.5 +#For Cuda kernel-devel gcc pciutils dkms +#To install cuda-runtime, need to specify the version +#if want to install cuda-runtime-8-0, uncomment it, +#then comment out cuda-runtime-7-5 +#cuda-runtime-8-0 cuda-runtime-7-5 diff --git a/xCAT/postscripts/config_cuda b/xCAT/postscripts/config_cuda index 42d98b3b9e..db4ee9fb84 100755 --- a/xCAT/postscripts/config_cuda +++ b/xCAT/postscripts/config_cuda @@ -1,8 +1,7 @@ #!/bin/sh -# set the paths required for cuda7.5 -CUDA_VER="cuda-7.5" -FILENAME="/etc/profile.d/xcat-${CUDA_VER}.sh" +# set the paths required for cuda +FILENAME="/etc/profile.d/xcat-cuda.sh" -echo "export PATH=/usr/local/${CUDA_VER}/bin:\$PATH" > ${FILENAME} -echo "export LD_LIBRARY_PATH=/usr/local/${CUDA_VER}/lib64:\$LD_LIBRARY_PATH" >> ${FILENAME} +echo "export PATH=/usr/local/cuda/bin:\$PATH" > ${FILENAME} +echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH" >> ${FILENAME} From c6684895eb2a8ab73b440a44444fcd351f204a23 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 11 Aug 2016 22:13:33 -0400 Subject: [PATCH 098/391] Fix xcatprobe xcatmn(hierarchy) issue --- xCAT-probe/subcmds/xcatmn | 226 +++++++++++++++++++++++++------------- 1 file changed, 152 insertions(+), 74 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 0b72e8886a..1744e3bf63 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -49,7 +49,7 @@ Description: Options: -h : Get usage information of $program_name -V : Output more information for debug - -i : Required. Specify the network interface name of provision network + -i : Required. Specify the network interface name of provision network on Management Node "; @@ -308,11 +308,21 @@ sub do_main_job { } if ($is_sn) { - my $mountoutput = `mount | grep '$masteripinsite' | grep '$installdir'`; + my $mountoutput = `mount | grep '$installdir'`; chomp($mountoutput); + my $mountip; + if ($mountoutput =~ /(.+):$installdir on $installdir /) { + my $mountsource = $1; + if (xCAT::NetworkUtils->isIpaddr($mountsource)) { + $mountip = $mountsource; + } else { + $mountip = xCAT::NetworkUtils->getipaddr($mountsource); + } + } + $msg = "installdir $installdir is mounted on from the Management Node"; - if ($mountoutput =~ /$masteripinsite:$installdir on $installdir/) { + if ($mountip eq $masteripinsite) { probe_utils->send_msg($outputtarget, "o", "$msg"); } else { @@ -330,11 +340,21 @@ sub do_main_job { } if ($is_sn) { - my $mountoutput = `mount | grep '$masteripinsite' | grep '$tftpdir'`; + my $mountoutput = `mount | grep '$tftpdir'`; chomp($mountoutput); + my $mountip; + if ($mountoutput =~ /(.+):$tftpdir on $tftpdir /) { + my $mountsource = $1; + if (xCAT::NetworkUtils->isIpaddr($mountsource)) { + $mountip = $mountsource; + } else { + $mountip = xCAT::NetworkUtils->getipaddr($mountsource); + } + } + $msg = "tftpdir $tftpdir is mounted on from the Management Node"; - if ($mountoutput =~ /$masteripinsite:$tftpdir on $tftpdir/) { + if ($mountip eq $masteripinsite) { probe_utils->send_msg($outputtarget, "o", "$msg"); } else { @@ -599,59 +619,89 @@ sub do_main_job { my $rc = 0; my $msg = "DHCP service is ready on $serverip"; + { #very important brace to create a block - my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "Simulate a node by chdef failed") if ($verbose); - $rc = 1; - last; + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $tmp = `makedhcp -q $sntmp`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp -q $sntmp failed") if ($verbose); + $rc = 1; + last; + } + chomp($tmp); + my $snip = xCAT::NetworkUtils->getipaddr($sntmp); + my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; + chomp ($snmac); + my $tmpmac; + if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { + $tmpmac = $1; + if ($tmpmac !~ $snmac) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + $rc = 1; + } + } else { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + $rc = 1; + } } else { - probe_utils->send_msg($outputtarget, "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); - } - `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "Simulate a node by chdef failed") if ($verbose); + $rc = 1; + last; + } else { + probe_utils->send_msg($outputtarget, "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); + } - open HOSTFILE, ">> /etc/hosts"; - print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; - close HOSTFILE; + `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); - $tmp = `makedhcp xcatmntest 2>&1`; - if ($?) { + open HOSTFILE, ">> /etc/hosts"; + print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; + close HOSTFILE; + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); + $tmp = `makedhcp xcatmntest 2>&1`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); + $rc = 1; + `rmdef xcatmntest`; + last; + } + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); + $tmp = `makedhcp -q xcatmntest`; + if ($?) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + chomp($tmp); + if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { + returncmdoutput($tmp, $outputtarget) if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + + probe_utils->send_msg($outputtarget, "d", "Start to clear simulate information for dhcp test") if ($verbose); + $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); - $tmp = `makedhcp -q xcatmntest`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; } - chomp($tmp); - if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg($outputtarget, "d", "Start to clear simulate information for dhcp test") if ($verbose); - $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; - returncmdoutput($tmp, $outputtarget) if ($verbose); } - - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; - if ($rc) { probe_utils->send_msg($outputtarget, "f", "$msg"); probe_utils->send_msg($outputtarget, "d", "please run 'makedhcp -n' if never run it before."); @@ -675,38 +725,66 @@ sub do_main_job { #------------------------------------- sub summary_all_jobs_output { - print "\n======================do ERROR summary=====================\n"; - my $isprint = 1; + print "\n======================do summary=====================\n"; + my @summary; + push @summary, "[ok]:[MN]: Check on MN PASS."; foreach my $line (@{ $summaryoutput{mn} }) { - if ($line =~ /\[failed\]/) { - if ($isprint) { - print "[mn]:\n"; - $isprint = 0; - } - print "\t$line\n"; + if ($line =~ /(\[failed\]\s*):\s*(.*)/) { + push @summary, "$1:\t$2"; + $summary[0] = "[failed]:[MN]: Check on MN FAILED."; + } elsif ($line =~ /(\[warning\]\s*):\s*(.*)/) { + push @summary, "$1:\t$2"; } } - $isprint = 1; + my %summary_sn = (); foreach my $node (keys %summaryoutput) { next if ($node eq "mn"); + ${ $summary_sn{$node}{"rst"} } = 1; + push @{ $summary_sn{$node}{"details"} }, "[ok]:[SN:$node]: Check on SN $node PASS."; foreach my $log (@{ $summaryoutput{$node} }) { - if ($log =~ /\[failed\]/) { - if ($isprint) { - print "[$node]:\n"; - $isprint = 0; - } - print "\t$log\n"; + if ($log =~ /(\[failed\]\s*):\s*(.*)/) { + push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; + ${ $summary_sn{$node}{"rst"} } = 0; + $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; + } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { + push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { - if ($isprint) { - print "[$node]:\n"; - $isprint = 0; - } - print "\t$log\n"; + push @{ $summary_sn{$node}{"details"} }, "[failed] :\t$log"; + ${ $summary_sn{$node}{"rst"} } = 0; + $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; } } } + if ($summary[0] =~ /^\[ok\]:/) { + foreach (@summary) { + print "$_\n"; + } + } + + foreach my $node (keys %summary_sn) { + if (${ $summary_sn{$node}{"rst"} }) { + foreach (@{ $summary_sn{$node}{"details"} }) { + print "$_\n"; + } + } + } + + if ($summary[0] =~ /^\[failed\]:/) { + foreach (@summary) { + print "$_\n"; + } + } + + foreach my $node (keys %summary_sn) { + if (!${ $summary_sn{$node}{"rst"} }) { + foreach (@{ $summary_sn{$node}{"details"} }) { + print "$_\n"; + } + } + } + } #------------------------------------- @@ -776,10 +854,10 @@ sub send_sn_msg { next if ($node eq "mn"); foreach my $line (@{ $summaryoutput{$node} }) { if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { - print "$1:$node: $2\n"; + print "$1:[SN:$node]: $2\n"; } else { print "[failed] :$node: $line\n"; - } + } } } } @@ -874,8 +952,6 @@ pipe $pipe_parent_read, $pipe_child_write; #handle job dispatch to SN foreach my $sn (keys %dispatchcmd) { my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; - probe_utils->send_msg("$output", "i", "Dispatch cmd $program_name to $sn $1"); - my $snjobfd; my $snjobpid; if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { @@ -904,7 +980,9 @@ pipe $pipe_parent_read, $pipe_child_write; $pipeisnonull{mn} = 0; } else { chomp($line = <$pipe_parent_read>); - print "$line\n"; + if ($line =~ /(\[\w+\]\s*):\s*(.*)/) { + print "$1:[MN]: $2\n"; + } push @{ $summaryoutput{mn} }, $line; } } else { From f7aa0cc2faeb52e1b1710de23d1225d50f210bc5 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 11 Aug 2016 23:33:32 -0400 Subject: [PATCH 099/391] add cleanup function --- xCAT-probe/subcmds/xcatmn | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 1744e3bf63..9b475c1f48 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -725,6 +725,9 @@ sub do_main_job { #------------------------------------- sub summary_all_jobs_output { + if ($terminal) { + return 0; + } print "\n======================do summary=====================\n"; my @summary; @@ -787,6 +790,24 @@ sub summary_all_jobs_output { } +#------------------------------------- +# Clean up test environment +# ------------------------------------- +sub cleanup { + my $tmptest = `lsdef xcatmntest 2>&1`; + if ($tmptest =~ /Error: Could not find an object named 'xcatmntest' of type 'node'./) { + if (-e "/etc/hosts.bak.probe") { + `rm /etc/hosts > /dev/null 2>&1`; + `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; + `makedns -n 2>&1`; + } + } else { + `makedhcp -d xcatmntest && rmdef xcatmntest`; + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; + } +} + #------------------------------------- # Each probe sub command is supposed to support hierarchical. # This funtion is used to caclulate which SN should be dispatched which command @@ -894,6 +915,7 @@ if ($test) { $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; + cleanup(); }; #-------------------------------------------- From 28144017e438578f89120fda9a09d623e48b2bfc Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 12 Aug 2016 14:03:39 +0800 Subject: [PATCH 100/391] update pkglist for redhat sles ubuntu (#1680) --- xCAT-server/share/xcat/netboot/SL/compute.pkglist | 3 +++ xCAT-server/share/xcat/netboot/centos/compute.centos6.pkglist | 3 +++ xCAT-server/share/xcat/netboot/centos/compute.pkglist | 3 +++ xCAT-server/share/xcat/netboot/centos/kvm.centos6.pkglist | 3 +++ xCAT-server/share/xcat/netboot/debian/compute.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora/compute.fedora13.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora/compute.fedora14.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora/compute.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora/compute.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora/service.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora12/compute.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora12/compute.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/fedora12/service.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhas4.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhel5.s390x.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhel6.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhel6.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhel6.s390x.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhels5.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/compute.rhels5.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/kvm.rhels5.4.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/kvm.rhels6.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/nfsroot.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/service.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/service.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/service.rhels6.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/rh/xen.pkglist | 3 +++ .../share/xcat/netboot/sles/compute.sles10.ppc64.pkglist | 3 +++ .../share/xcat/netboot/sles/compute.sles11.s390x.pkglist | 3 +++ xCAT-server/share/xcat/netboot/sles/service.pkglist | 3 +++ .../share/xcat/netboot/sles/service.sles10.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist | 3 +++ .../share/xcat/netboot/sles/service.sles11.ppc64.pkglist | 3 +++ xCAT-server/share/xcat/netboot/sles/service.sles12.pkglist | 1 + xCAT-server/share/xcat/netboot/suse/compute.suse11.pkglist | 3 +++ .../share/xcat/netboot/ubuntu/compute.ubuntu12.04.1.pkglist | 3 +++ .../share/xcat/netboot/ubuntu/compute.ubuntu12.04.2.pkglist | 3 +++ .../xcat/netboot/ubuntu/compute.ubuntu14.04.2.ppc64el.pkglist | 3 +++ .../xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist | 3 +++ .../xcat/netboot/ubuntu/compute.ubuntu14.04.3.ppc64el.pkglist | 3 +++ .../xcat/netboot/ubuntu/compute.ubuntu14.04.3.x86_64.pkglist | 3 +++ .../xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64el.pkglist | 3 +++ .../share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist | 1 + 45 files changed, 131 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/SL/compute.pkglist b/xCAT-server/share/xcat/netboot/SL/compute.pkglist index 30d4e4feb4..42f78c8a22 100644 --- a/xCAT-server/share/xcat/netboot/SL/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/SL/compute.pkglist @@ -12,3 +12,6 @@ ntp sysklogd rpm rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/centos/compute.centos6.pkglist b/xCAT-server/share/xcat/netboot/centos/compute.centos6.pkglist index 46791764c0..908c031cb3 100644 --- a/xCAT-server/share/xcat/netboot/centos/compute.centos6.pkglist +++ b/xCAT-server/share/xcat/netboot/centos/compute.centos6.pkglist @@ -16,3 +16,6 @@ parted bc ntp rsyslog +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/centos/compute.pkglist b/xCAT-server/share/xcat/netboot/centos/compute.pkglist index d6ccc612c4..59545ae2e5 100644 --- a/xCAT-server/share/xcat/netboot/centos/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/centos/compute.pkglist @@ -8,3 +8,6 @@ openssh-clients busybox-anaconda wget rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/centos/kvm.centos6.pkglist b/xCAT-server/share/xcat/netboot/centos/kvm.centos6.pkglist index 60a3da31f6..e04f5aa7ab 100644 --- a/xCAT-server/share/xcat/netboot/centos/kvm.centos6.pkglist +++ b/xCAT-server/share/xcat/netboot/centos/kvm.centos6.pkglist @@ -17,3 +17,6 @@ qemu-kvm e2fsprogs parted bc +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/debian/compute.pkglist b/xCAT-server/share/xcat/netboot/debian/compute.pkglist index 74b91240dd..814e4c4492 100644 --- a/xCAT-server/share/xcat/netboot/debian/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/debian/compute.pkglist @@ -10,3 +10,6 @@ vim ntp rsyslog rsync +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/fedora/compute.fedora13.pkglist b/xCAT-server/share/xcat/netboot/fedora/compute.fedora13.pkglist index 927dd6e36b..8e577d5c65 100644 --- a/xCAT-server/share/xcat/netboot/fedora/compute.fedora13.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora/compute.fedora13.pkglist @@ -12,3 +12,6 @@ ntp rpm rsync rsyslog +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora/compute.fedora14.pkglist b/xCAT-server/share/xcat/netboot/fedora/compute.fedora14.pkglist index 927dd6e36b..8e577d5c65 100644 --- a/xCAT-server/share/xcat/netboot/fedora/compute.fedora14.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora/compute.fedora14.pkglist @@ -12,3 +12,6 @@ ntp rpm rsync rsyslog +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora/compute.pkglist b/xCAT-server/share/xcat/netboot/fedora/compute.pkglist index 332b191e0d..0995c70f7b 100644 --- a/xCAT-server/share/xcat/netboot/fedora/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora/compute.pkglist @@ -10,3 +10,6 @@ wget ntp vim-minimal rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora/compute.ppc64.pkglist b/xCAT-server/share/xcat/netboot/fedora/compute.ppc64.pkglist index c649fd6a1a..59d797324d 100644 --- a/xCAT-server/share/xcat/netboot/fedora/compute.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora/compute.ppc64.pkglist @@ -9,3 +9,6 @@ openssh-server openssh-clients wget rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora/service.pkglist b/xCAT-server/share/xcat/netboot/fedora/service.pkglist index ccc842946a..e8794e18ed 100644 --- a/xCAT-server/share/xcat/netboot/fedora/service.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora/service.pkglist @@ -23,3 +23,6 @@ unixODBC perl-DBD-MySQL mysql-connector-odbc perl-DBD-Pg +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora12/compute.pkglist b/xCAT-server/share/xcat/netboot/fedora12/compute.pkglist index 4f0a1b8cbf..e912391358 100644 --- a/xCAT-server/share/xcat/netboot/fedora12/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora12/compute.pkglist @@ -9,3 +9,6 @@ wget ntp vim-minimal rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora12/compute.ppc64.pkglist b/xCAT-server/share/xcat/netboot/fedora12/compute.ppc64.pkglist index c649fd6a1a..59d797324d 100644 --- a/xCAT-server/share/xcat/netboot/fedora12/compute.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora12/compute.ppc64.pkglist @@ -9,3 +9,6 @@ openssh-server openssh-clients wget rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/fedora12/service.pkglist b/xCAT-server/share/xcat/netboot/fedora12/service.pkglist index df38907b74..2d43295817 100644 --- a/xCAT-server/share/xcat/netboot/fedora12/service.pkglist +++ b/xCAT-server/share/xcat/netboot/fedora12/service.pkglist @@ -19,3 +19,6 @@ wget vsftpd ntp rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.ppc64.pkglist index eae3931563..97b853f423 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.ppc64.pkglist @@ -14,3 +14,6 @@ rpm rsync ppc64-utils iputils +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhas4.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhas4.pkglist index 05192311ce..fa37063813 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhas4.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhas4.pkglist @@ -14,3 +14,6 @@ rpm rsync busybox util-linux +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhel5.s390x.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhel5.s390x.pkglist index b448841a05..4083ebcd88 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhel5.s390x.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhel5.s390x.pkglist @@ -15,3 +15,6 @@ rpm rsync udev s390utils +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.pkglist index 927dd6e36b..8e577d5c65 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.pkglist @@ -12,3 +12,6 @@ ntp rpm rsync rsyslog +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.ppc64.pkglist index 69e3cdf2f7..a705db4141 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.ppc64.pkglist @@ -22,3 +22,6 @@ bc lsvpd irqbalance procps +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.s390x.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.s390x.pkglist index bfa4a7fc07..bcbff43916 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhel6.s390x.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhel6.s390x.pkglist @@ -14,3 +14,6 @@ rsync rsyslog udev s390utils +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist index e235bfabac..914888c937 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhelhpc6.pkglist @@ -20,3 +20,6 @@ rsync rsyslog e2fsprogs parted +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels5.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels5.pkglist index 6175ca1018..261bc3594b 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels5.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels5.pkglist @@ -14,3 +14,6 @@ sysklogd rpm rsync db4-utils +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels5.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels5.ppc64.pkglist index 6eae74b385..e8f6a1a700 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels5.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels5.ppc64.pkglist @@ -15,3 +15,6 @@ rpm rsync ppc64-utils iputils +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/kvm.rhels5.4.pkglist b/xCAT-server/share/xcat/netboot/rh/kvm.rhels5.4.pkglist index 3de9dd585b..f9981f2735 100644 --- a/xCAT-server/share/xcat/netboot/rh/kvm.rhels5.4.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/kvm.rhels5.4.pkglist @@ -23,3 +23,6 @@ python-urlgrabber.noarch python-virtinst screen xnba-kvm +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/kvm.rhels6.pkglist b/xCAT-server/share/xcat/netboot/rh/kvm.rhels6.pkglist index 60a3da31f6..e04f5aa7ab 100644 --- a/xCAT-server/share/xcat/netboot/rh/kvm.rhels6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/kvm.rhels6.pkglist @@ -17,3 +17,6 @@ qemu-kvm e2fsprogs parted bc +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/nfsroot.pkglist b/xCAT-server/share/xcat/netboot/rh/nfsroot.pkglist index 30d4e4feb4..42f78c8a22 100644 --- a/xCAT-server/share/xcat/netboot/rh/nfsroot.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/nfsroot.pkglist @@ -12,3 +12,6 @@ ntp sysklogd rpm rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/service.pkglist b/xCAT-server/share/xcat/netboot/rh/service.pkglist index bcb1155baf..c98d88113a 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/service.pkglist @@ -13,6 +13,9 @@ ksh nfs-utils dhcp bzip2 +tar +gzip +xz rootfiles vixie-cron wget diff --git a/xCAT-server/share/xcat/netboot/rh/service.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/service.ppc64.pkglist index f783e0c783..2ebaa4caae 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/service.ppc64.pkglist @@ -13,6 +13,9 @@ ksh nfs-utils dhcp bzip2 +tar +gzip +xz rootfiles vixie-cron wget diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels6.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/service.rhels6.ppc64.pkglist index 0064ef1366..b059fb0def 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels6.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels6.ppc64.pkglist @@ -13,6 +13,9 @@ ksh nfs-utils dhcp bzip2 +tar +gzip +xz rootfiles cronie wget diff --git a/xCAT-server/share/xcat/netboot/rh/xen.pkglist b/xCAT-server/share/xcat/netboot/rh/xen.pkglist index e39f5b37ee..36aab9d51d 100644 --- a/xCAT-server/share/xcat/netboot/rh/xen.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/xen.pkglist @@ -18,3 +18,6 @@ iscsi-initiator-utils xen libvirt.x86_64 screen +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles10.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles10.ppc64.pkglist index 3030207bd9..ff31bff945 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles10.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles10.ppc64.pkglist @@ -26,3 +26,6 @@ powerpc-utils timezone iputils ntp +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.s390x.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.s390x.pkglist index d21a597025..05d3f016e4 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.s390x.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.s390x.pkglist @@ -27,3 +27,6 @@ s390-tools mdadm udev ntp +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/service.pkglist b/xCAT-server/share/xcat/netboot/sles/service.pkglist index 768ea3a645..8569264874 100644 --- a/xCAT-server/share/xcat/netboot/sles/service.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/service.pkglist @@ -20,3 +20,6 @@ vsftpd rsync timezone ntp +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles10.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/service.sles10.ppc64.pkglist index 1bd102e816..c850779bca 100644 --- a/xCAT-server/share/xcat/netboot/sles/service.sles10.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/service.sles10.ppc64.pkglist @@ -50,3 +50,6 @@ powerpc-utils bc iputils ntp +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist b/xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist index 9bd0bced2f..9c9ca20193 100644 --- a/xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/service.sles11.pkglist @@ -20,6 +20,9 @@ cron wget vsftpd util-linux +tar +gzip +xz module-init-tools mkinitrd apache2 diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist index f10b610c2b..2fe8be0692 100644 --- a/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/service.sles11.ppc64.pkglist @@ -20,6 +20,9 @@ cron wget vsftpd util-linux +tar +gzip +xz module-init-tools mkinitrd apache2 diff --git a/xCAT-server/share/xcat/netboot/sles/service.sles12.pkglist b/xCAT-server/share/xcat/netboot/sles/service.sles12.pkglist index cc15ffcfe1..447e5a3ea7 100644 --- a/xCAT-server/share/xcat/netboot/sles/service.sles12.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/service.sles12.pkglist @@ -23,6 +23,7 @@ e2fsprogs fcoe-utils gpg2 gzip +xz kernel-default keyutils lvm2 diff --git a/xCAT-server/share/xcat/netboot/suse/compute.suse11.pkglist b/xCAT-server/share/xcat/netboot/suse/compute.suse11.pkglist index a097d39d4a..dee4ca23fe 100644 --- a/xCAT-server/share/xcat/netboot/suse/compute.suse11.pkglist +++ b/xCAT-server/share/xcat/netboot/suse/compute.suse11.pkglist @@ -14,3 +14,6 @@ syslog-ng klogd vim rsync +tar +gzip +xz diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.1.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.1.pkglist index c23ba181a1..6e3b04dc24 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.1.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.1.pkglist @@ -12,3 +12,6 @@ rsyslog rsync busybox-static gawk +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.2.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.2.pkglist index 7b6014760c..324fdb29e5 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.2.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu12.04.2.pkglist @@ -12,3 +12,6 @@ rsyslog rsync busybox-static gawk +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.ppc64el.pkglist index 0b69a32dca..65dbbdc7f4 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.ppc64el.pkglist @@ -13,3 +13,6 @@ rsync busybox-static gawk dnsutils +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist index 0b69a32dca..65dbbdc7f4 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.2.x86_64.pkglist @@ -13,3 +13,6 @@ rsync busybox-static gawk dnsutils +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.ppc64el.pkglist index 0ca8402aa1..7ad80186e8 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.ppc64el.pkglist @@ -13,3 +13,6 @@ rsync busybox-static gawk dnsutils +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.x86_64.pkglist index 0ca8402aa1..7ad80186e8 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.3.x86_64.pkglist @@ -13,3 +13,6 @@ rsync busybox-static gawk dnsutils +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64el.pkglist index 818b8f26f0..5b1f2b3276 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.ppc64el.pkglist @@ -13,3 +13,6 @@ rsync busybox-static gawk dnsutils +tar +gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist index a5861a9e0b..5bf569fd16 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.1.pkglist @@ -15,3 +15,4 @@ gawk dnsutils tar gzip +xz-utils From d44176f1d1ea12735649bdec6042db3ae0a9497b Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 12 Aug 2016 14:46:52 +0800 Subject: [PATCH 101/391] update code of packimage (#1685) --- xCAT-server/lib/xcat/plugins/packimage.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index ca92c8f370..c6d96ebb50 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -220,7 +220,7 @@ sub process_request { } } - #before generating rootimg.gz, copy $installroot/postscripts into the image at /xcatpost + #before generating rootimg.$suffix, copy $installroot/postscripts into the image at /xcatpost if (-e "$rootimg_dir/xcatpost") { system("rm -rf $rootimg_dir/xcatpost"); } @@ -240,7 +240,7 @@ sub process_request { `echo TIMESTAMP="'$timestamp'" >> $rootimg_dir/opt/xcat/xcatinfo`; - # before generating rootimg.gz or rootimg.sfs, need to switch the rootimg to stateless mode if necessary + # before generating rootimg.$suffix or rootimg.sfs, need to switch the rootimg to stateless mode if necessary my $rootimg_status = 0; # 0 means stateless mode, while 1 means statelite mode $rootimg_status = 1 if (-f "$rootimg_dir/.statelite/litefile.save"); @@ -418,8 +418,6 @@ sub process_request { return 1; } $callback->({ data => ["Packing contents of $rootimg_dir"] }); - unlink("$destdir/rootimg.gz"); - unlink("$destdir/rootimg.sfs"); my $suffix; if ($compress) { @@ -470,6 +468,8 @@ sub process_request { } $suffix = $method.".".$suffix; + unlink("$destdir/rootimg.$suffix"); + unlink("$destdir/rootimg.sfs"); if ($method =~ /cpio/) { if (!$exlistloc) { $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; From b9d8138395af47ff7c260a1c726ccde0ad19d997 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 12 Aug 2016 02:52:03 -0400 Subject: [PATCH 102/391] fix issue Nodeset for Ubuntu OS displays warning, but we should be more specific and only print on conditions where it might fail #1097 --- xCAT-server/lib/xcat/plugins/debian.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 9278868641..412e8a87fa 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -891,7 +891,7 @@ sub mkinstall { $kcmdline .= "n8r"; } } else { - $callback->({ warning => ["rcons my not work since no serialport specified"], }); + $callback->({ warning => ["rcons may not work since no serialport is specified for $node"], }); } # need to add these in, otherwise aptitude will ask questions @@ -1548,7 +1548,7 @@ sub mknetboot } else { $callback->( { - warning => ["rcons my not work since no serialport specified"], + warning => ["rcons may not work since no serialport is specified for $node"], } ); } From 578fda6663eb0bc40971586b83784f554a9727f5 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 12 Aug 2016 03:46:54 -0400 Subject: [PATCH 103/391] modify depending on comments --- xCAT-probe/subcmds/osdeploy | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index c051e6e567..a468d577d6 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -210,18 +210,34 @@ sub check_noderange { $rst = 1; next; } - $monitor_nodes{$node}{"rst"} = 0; + my $noerror=1; my @macs = split(/\|/, $nodecheckrst{$node}{"mac"}); foreach my $mac (@macs) { + + #[NOTE] don't support 2 adapters in the same network now. TODO + if ($mac =~ /\!\*NOIP\*/) { $mac =~ s/\!\*NOIP\*//g; $macmap{$mac}{"ip"} = "NOIP"; $macmap{$mac}{"node"} = $node; } else { - $macmap{$mac}{"ip"} = $nodecheckrst{$node}{"ip"}; $macmap{$mac}{"node"} = $node; + if($nodecheckrst{$node}{"ip"}){ + $macmap{$mac}{"ip"} = $nodecheckrst{$node}{"ip"}; + }else{ + my $nodeip = xCAT::NetworkUtils->getipaddr($node); + if($nodeip){ + $macmap{$mac}{"ip"} = $nodeip; + }else{ + $noerror = 0; + $rst = 1; + probe_utils->send_msg("$output", "f", "$node : can't be resolved to a IP address"); + } + } } } + + $monitor_nodes{$node}{"rst"} = 0 if($noerror); } unless (%monitor_nodes) { @@ -600,8 +616,8 @@ sub dump_history { last if (!$newloop); } - # print "------------result---------------\n"; - # print Dumper %match_result; + print "------------result---------------\n"; + print Dumper %match_result; my $max_match = 0; foreach my $key (keys %match_result) { @@ -820,6 +836,8 @@ sub get_valid_logs { $filename =~ s/(.+)\.(.+)/$1/g; my $path_only = dirname("$f"); my @rotatefiles; + + #TODO using opendir to refine below code my @alltargetfiles = `ls -lt $path_only |awk -F" " '/ $filename/ {print \$9}'`; foreach my $samenamefile (@alltargetfiles) { chomp($samenamefile); From f9d725808c85bd7c4785904577f18762cc7c93a1 Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 12 Aug 2016 03:13:11 -0400 Subject: [PATCH 104/391] modify dns check and cleanup --- xCAT-probe/subcmds/xcatmn | 52 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 9b475c1f48..d12c2c622a 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -523,32 +523,20 @@ sub do_main_job { } } else { - # if there is no sn, simulate a host to check DNS service - `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + # if there is no sn, nslookup mnip + my $nslkp = `nslookup $serverip $serverip 2>&1`; - { #very important brace to create a block - open HOSTFILE, ">> /etc/hosts"; - print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; - close HOSTFILE; - - probe_utils->send_msg($outputtarget, "d", "To do 'makedns -n xcatmntest'") if ($verbose); - $tmp = `makedns -V -n 2>&1`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedns -n xcatmntest failed") if ($verbose); + if ($?) { + probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed"); + $rc = 1; + } else { + chomp($nslkp); + my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $output); + if (!$tmp) { + probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed"); $rc = 1; - last; - } - - if (!probe_utils->is_dns_ready("$serverip", "$serverip", "xcatmntest", "$domain")) { - probe_utils->send_msg($outputtarget, "d", "nslookup xcatmntest $serverip failed"); - $rc = 1; - last; } } - `rm /etc/hosts > /dev/null 2>&1`; - `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; - `makedns -n 2>&1`; } if ($rc) { probe_utils->send_msg($outputtarget, "f", "$msg"); @@ -754,7 +742,7 @@ sub summary_all_jobs_output { } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "[failed] :\t$log"; + push @{ $summary_sn{$node}{"details"} }, "[failed]:\t$log"; ${ $summary_sn{$node}{"rst"} } = 0; $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; } @@ -794,17 +782,13 @@ sub summary_all_jobs_output { # Clean up test environment # ------------------------------------- sub cleanup { - my $tmptest = `lsdef xcatmntest 2>&1`; - if ($tmptest =~ /Error: Could not find an object named 'xcatmntest' of type 'node'./) { - if (-e "/etc/hosts.bak.probe") { - `rm /etc/hosts > /dev/null 2>&1`; - `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; - `makedns -n 2>&1`; - } - } else { - `makedhcp -d xcatmntest && rmdef xcatmntest`; - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; + my $tmptest = `nodels xcatmntest 2>&1`; + if ($tmptest !~ /Error: Invalid nodes and\/or groups in noderange: xcatmntest/) { + `makedhcp -d xcatmntest && rmdef xcatmntest > /dev/null 2>&1`; + } + if (-e "/etc/hosts.bak.probe") { + `rm /etc/hosts > /dev/null 2>&1`; + `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; } } From 7debe6a95e0fcf8845f91b2afaed5a03c597ad82 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 12 Aug 2016 04:45:22 -0400 Subject: [PATCH 105/391] comment some debug line out --- xCAT-probe/subcmds/osdeploy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index a468d577d6..f0010700fe 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -616,8 +616,8 @@ sub dump_history { last if (!$newloop); } - print "------------result---------------\n"; - print Dumper %match_result; + #print "------------result---------------\n"; + #print Dumper %match_result; my $max_match = 0; foreach my $key (keys %match_result) { From 45bbe0f9ba4fad90daacda604346e696ff22b4f6 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 12 Aug 2016 06:02:03 -0400 Subject: [PATCH 106/391] modefy depending on comments --- xCAT-probe/subcmds/osdeploy | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index f0010700fe..5d3a8e0256 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -57,7 +57,7 @@ my %monitor_nodes; # provision state machine my %state_set = ( "unknown" => 0, - "sever_reboot" => 1, + "server_reboot" => 1, "loaded_kernel_and_initrd" => 2, "kernel_and_initrd_got_ip" => 3, "install_os_packages" => 4, @@ -68,7 +68,7 @@ my %state_set = ( my %state_set_reverse = ( "0" => "unknown", - "1" => "sever_reboot", + "1" => "server_reboot", "2" => "loaded_kernel_and_initrd", "3" => "kernel_and_initrd_got_ip", "4" => "install_os_packages", @@ -81,16 +81,16 @@ my %valid_process; $valid_process{1}{process} = [ $state_set{unknown}, $state_set{done} ]; $valid_process{1}{type} = "reboot"; -$valid_process{2}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{done} ]; +$valid_process{2}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{done} ]; $valid_process{2}{type} = "reboot"; -$valid_process{3}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{3}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; $valid_process{3}{type} = "reboot"; -$valid_process{4}{process} = [ $state_set{unknown}, $state_set{sever_reboot}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{4}{process} = [ $state_set{unknown}, $state_set{server_reboot}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; $valid_process{4}{type} = "deploy"; -$valid_process{5}{process} = [ $state_set{unknown}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{sever_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; +$valid_process{5}{process} = [ $state_set{unknown}, $state_set{loaded_kernel_and_initrd}, $state_set{kernel_and_initrd_got_ip}, $state_set{install_os_packages}, $state_set{run_postscript}, $state_set{server_reboot}, $state_set{run_postbootscript}, $state_set{done} ]; $valid_process{5}{type} = "deploy"; sub reset_state { @@ -99,16 +99,16 @@ sub reset_state { my $reset_flag = 1; if ($$state_ref == $state_set{unknown} && $condition eq "dhcp") { - $$state_ref = $state_set{sever_reboot}; + $$state_ref = $state_set{server_reboot}; } elsif ($$state_ref == $state_set{unknown} && $condition eq "booted") { $$state_ref = $state_set{done}; } elsif (($$state_ref == $state_set{unknown} && $condition eq "tftp") || ($$state_ref == $state_set{unknown} && $condition eq "http")) { $$state_ref = $state_set{loaded_kernel_and_initrd}; - } elsif ($$state_ref == $state_set{sever_reboot} && $condition eq "booted") { + } elsif ($$state_ref == $state_set{server_reboot} && $condition eq "booted") { $$state_ref = $state_set{done}; - } elsif ($$state_ref == $state_set{sever_reboot} && $condition eq "postscript") { + } elsif ($$state_ref == $state_set{server_reboot} && $condition eq "postscript") { $$state_ref = $state_set{run_postbootscript}; - } elsif (($$state_ref == $state_set{sever_reboot} && $condition eq "tftp") || ($$state_ref == $state_set{sever_reboot} && $condition eq "http")) { + } elsif (($$state_ref == $state_set{server_reboot} && $condition eq "tftp") || ($$state_ref == $state_set{server_reboot} && $condition eq "http")) { $$state_ref = $state_set{loaded_kernel_and_initrd}; } elsif ($$state_ref == $state_set{loaded_kernel_and_initrd} && $condition eq "dhcp") { $$state_ref = $state_set{kernel_and_initrd_got_ip}; @@ -117,13 +117,13 @@ sub reset_state { } elsif ($$state_ref == $state_set{install_os_packages} && $condition eq "postscript") { $$state_ref = $state_set{run_postscript}; } elsif ($$state_ref == $state_set{run_postscript} && $condition eq "dhcp") { - $$state_ref = $state_set{sever_reboot}; + $$state_ref = $state_set{server_reboot}; } elsif ($$state_ref == $state_set{run_postbootscript} && $condition eq "booted") { $$state_ref = $state_set{done}; } elsif ($$state_ref == $state_set{done} && $condition eq "dhcp") { - $$state_ref = $state_set{sever_reboot}; + $$state_ref = $state_set{server_reboot}; } elsif ($$state_ref == $state_set{done} && $condition eq "poweron") { - $$state_ref = $state_set{sever_reboot}; + $$state_ref = $state_set{server_reboot}; } else { $reset_flag = 0; } @@ -867,7 +867,6 @@ sub get_valid_logs { last unless ($line = <$fd>); chomp($line); my $needrotate = 0; - my $istorynum = 0; my $logindex = 0; my @splitline = split(/\s+/, $line); my $timestamp; From 5bb901d5eed05ac5f672d7f76ca87ecd96f09d5a Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 12 Aug 2016 08:55:41 -0400 Subject: [PATCH 107/391] add rhels7.3 bundle --- .../autotest/bundle/rhels7.3_x86_64.bundle | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle new file mode 100644 index 0000000000..a9a3aa760a --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -0,0 +1,202 @@ +Diskless_installation_flat_p8_le +Full_installation_flat_p8_le +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 +makehosts_h +makehosts_help +makehosts_n +makehosts_n_noderange +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_h +chtab_v +packimage_o_p_a_m +packimage_p_a_o +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_err_node +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_n +makedns +copycds_iso +copycds_n +copycds_a +copycds_n_a +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_i_linux +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +clean_up_env From 4a270db56f836734e463c3ca5191f7f1acd8f9be Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 12 Aug 2016 10:09:17 -0400 Subject: [PATCH 108/391] modify x86_64 bundle --- xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index a9a3aa760a..8ecfc88662 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -1,5 +1,4 @@ -Diskless_installation_flat_p8_le -Full_installation_flat_p8_le +reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput go_xcat_with_x @@ -38,6 +37,9 @@ lsdef_t lsdef_t_i_o lsdef_t_w lsdef_t_err +lslite_i +lslite_noderange +lslite_h makeconservercf_null makeconservercf_noderange makeconservercf_d @@ -94,6 +96,7 @@ nodels_tablevalue_tablecolumn nodels_noderange_tablecolumn nodels_h nodels_v +xcatstanzafile_normal xcatstanzafile_colon xcatstanzafile_attribute xcatstanzafile_objtype @@ -107,6 +110,7 @@ noderm_null noderm_err_node nodeset_stat nodeset_noderange +nodestat_noderange nodestat_err_node rinv_noderange_err rmdef_null @@ -196,7 +200,15 @@ switchdiscover_range_r switchdiscover_range_x switchdiscover_range_z switchdiscover_range_z_V +nodeset_check_warninginfo nodeset_shell nodeset_cmdline nodeset_runimg +reg_linux_diskless_installation_flat +reg_linux_statelite_installation_flat +SN_setup_case +reg_linux_diskfull_installation_hierarchy +reg_linux_diskless_installation_hierarchy +reg_linux_statelite_installation_hierarchy_by_ramdisk +reg_linux_statelite_installation_hierarchy_by_nfs clean_up_env From 76ed1ab158038d5b017ddb80b5d28d9dfe62232b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Aug 2016 10:07:16 -0400 Subject: [PATCH 109/391] Provide a workaround for SD350 beacon SD350 standard command does not stay on indefinitely. Provide a workaround to cause that to stay on. --- xCAT-server/lib/xcat/plugins/ipmi.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 58eef13ead..77b65bebb5 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -524,6 +524,10 @@ sub on_bmc_connect { } elsif ($command eq "rspreset") { return resetbmc($sessdata); } elsif ($command eq "rbeacon") { + unless (defined $sessdata->{device_id}) { #need get device id data initted for SD350 workaround + $sessdata->{ipmisession}->subcmd(netfn => 6, command => 1, data => [], callback => \&gotdevid, callback_args => $sessdata); + return; + } return beacon($sessdata); } elsif ($command eq "rsetboot") { return setboot($sessdata); @@ -2354,7 +2358,9 @@ sub beacon { #if stuck with 1.5, say light for 255 seconds. In 2.0, specify to turn it on forever if ($subcommand eq "on") { - if ($ipmiv2) { + if ($sessdata->{mfg_id} == 19046 and $sessdata->{prod_id} == 13616) { # Lenovo SD350 + $sessdata->{ipmisession}->subcmd(netfn => 0x3a, command => 6, data => [ 1, 1 ], callback => \&beacon_answer, callback_args => $sessdata); + } elsif ($ipmiv2) { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [ 0, 1 ], callback => \&beacon_answer, callback_args => $sessdata); } else { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [0xff], callback => \&beacon_answer, callback_args => $sessdata); From 2b54a0ed337c0373d5f6d2dc2accb6f1274f20d2 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 12 Aug 2016 15:38:09 -0400 Subject: [PATCH 110/391] genimage failed for rhels7.2 because /etc/selinux/config file didn't exists --- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 3 +++ .../share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall | 4 +++- xCAT-server/share/xcat/netboot/rh/service.postinstall | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index 0819752bba..e99463cbed 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -35,7 +35,10 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Disable SELinux in the rootimg #-- Redhat 7.3 will install selinux-policy and selinux is enabled by default #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +if [ -f "$installroot/etc/selinux/config" ] +then sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config +fi #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall index b8eee319e9..c62bf2c6f8 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall @@ -35,8 +35,10 @@ END #-- Disable SELinux in the rootimg #-- Redhat 7.3 will install selinux-policy and selinux is enabled by default #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +if [ -f "$installroot/etc/selinux/config" ] +then sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config - +fi #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. diff --git a/xCAT-server/share/xcat/netboot/rh/service.postinstall b/xCAT-server/share/xcat/netboot/rh/service.postinstall index 86e295e455..6eb1f16c55 100755 --- a/xCAT-server/share/xcat/netboot/rh/service.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/service.postinstall @@ -39,7 +39,10 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Disable SELinux in the rootimg #-- Redhat 7.3 will install selinux-policy and selinux is enabled by default #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" +if [ -f "$installroot/etc/selinux/config" ] +then sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config +fi #-- Example of booted image versioning #-- We want to know, with what configuration (version of the image) each node was booted. From 22fe457bc197a065218c211826b283c8a1005d8f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 12 Aug 2016 15:57:11 -0400 Subject: [PATCH 111/391] Fix tcons interaction with filename globbing Filename globbing strings are not good to happen to noderanges. Use quotes to avoid it in script. Caller still needs to be careful to quote/escape on their end. --- xCAT-client/bin/tcons | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/bin/tcons b/xCAT-client/bin/tcons index c7f5ea4fb4..cc0af755d6 100755 --- a/xCAT-client/bin/tcons +++ b/xCAT-client/bin/tcons @@ -1,7 +1,7 @@ #!/bin/sh f=1 p=0 -for i in `nodels $1`; do +for i in `nodels "$1"`; do if [ "$f" = 1 ]; then f=0 qdate=$((`date +%s`+5)) From 33d30c8efa8aa41b42af8b969c3f6c2e41b89dfe Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 12 Aug 2016 16:24:13 -0400 Subject: [PATCH 112/391] indent the line space --- .../share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall | 2 +- .../share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall | 2 +- xCAT-server/share/xcat/netboot/rh/service.postinstall | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall index e99463cbed..02effbf98d 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.postinstall @@ -37,7 +37,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then -sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config fi #-- Example of booted image versioning diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall index c62bf2c6f8..e8883be8f9 100755 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.postinstall @@ -37,7 +37,7 @@ END #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then -sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config fi #-- Example of booted image versioning diff --git a/xCAT-server/share/xcat/netboot/rh/service.postinstall b/xCAT-server/share/xcat/netboot/rh/service.postinstall index 6eb1f16c55..192b22c78b 100755 --- a/xCAT-server/share/xcat/netboot/rh/service.postinstall +++ b/xCAT-server/share/xcat/netboot/rh/service.postinstall @@ -41,7 +41,7 @@ echo "co:2345:respawn:/sbin/agetty -L 38400 console" >> $installroot/etc/inittab #-- Need to disable selinux, otherwise, the booting will hang on "Loading selinux policy" if [ -f "$installroot/etc/selinux/config" ] then -sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config + sed -i 's/SELINUX=enforcing\|permissive/SELINUX=disabled/' $installroot/etc/selinux/config fi #-- Example of booted image versioning From e1775355f5382880aebadbc90a9093154cd55c4b Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 12 Aug 2016 21:11:48 -0400 Subject: [PATCH 113/391] refine the tar options --- xCAT-server/lib/xcat/plugins/packimage.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index c6d96ebb50..82e4411f30 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -484,14 +484,14 @@ sub process_request { $oldmask = umask 0077; } elsif ($method =~ /tar/) { if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.$suffix"; + $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.$suffix"; + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { @@ -508,8 +508,15 @@ sub process_request { return 1; } chdir("$rootimg_dir"); - my $outputmsg = `$excludestr`; - $callback->({ info => ["$outputmsg"] }); + my $outputmsg = `$excludestr 2>&1`; + unless($?){ + $callback->({ info => ["$outputmsg"] }); + }else{ + $callback->({ info => ["$outputmsg"] }); + $callback->({ error => ["packimage failed while running: \n $excludestr"], errorcode => [1] }); + system("rm -rf $xcat_packimg_tmpfile"); + return 1; + } if ($method =~ /cpio/) { chmod 0644, "$destdir/rootimg.$suffix"; if ($dotorrent) { From 5699b025dd0602f54124d382265803a3bbe9fae7 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 13 Aug 2016 00:30:56 -0400 Subject: [PATCH 114/391] fix issue [FVT]on rhels6.8, rootimg.tar.gz is only 20 bytes after run packimage -m tar rhels6.8-ppc64-netboot-compute ; fix issue #1689 [FVT]:diskless provision broken using rootimg.tar.gz created by packimage -m tar osimage #1688 --- xCAT-server/share/xcat/netboot/rh/dracut/xcatroot | 4 ++-- xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot | 4 ++-- xCAT-server/share/xcat/netboot/rh/genimage | 4 ++-- xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot | 4 ++-- xCAT-server/share/xcat/netboot/sles/genimage | 4 ++-- xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot | 4 ++-- xCAT-server/share/xcat/netboot/ubuntu/genimage | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 4d20531fa6..3676256184 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -106,9 +106,9 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then cd $NEWROOT echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then - tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz elif [ -r /rootimg.tar.xz ]; then - tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz fi $NEWROOT/etc/init.d/localdisk echo Done diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 0bc2ebcd95..58a33895ef 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -110,9 +110,9 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then - tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz elif [ -r /rootimg.tar.xz ]; then - tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index aa13d2855d..bc5104c419 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1640,9 +1640,9 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index acd7b3ebf6..b12eb9a3f5 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -108,9 +108,9 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then - tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz elif [ -r /rootimg.tar.xz ]; then - tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 3fbe3c6c23..23ca97d2c8 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1658,9 +1658,9 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index 67f40c8edc..2c76d76900 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -64,9 +64,9 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then cd $NEWROOT echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then - tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz elif [ -r /rootimg.tar.xz ]; then - tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz fi echo Done elif [ -r /rootimg-statelite.gz ]; then diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 8934e44b10..e2ba372f0d 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1480,9 +1480,9 @@ EOMS print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " /bin/tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; - print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " /bin/tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; @@ -1624,7 +1624,7 @@ EOMS } # add rsync for statelite - foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { + foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz", "bin/gzip", "bin/tar") { getlibs($_); push @filestoadd, $_; } From be77e5f43f5f55e26da22b9d226972367e4f7287 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 13 Aug 2016 02:53:05 -0400 Subject: [PATCH 115/391] fix issue [DEV] it is ambiguous to determine which compressed rootimg to use among rootimg.tar.gz,rootimg.cpio.gz,rootimg.tar.xz... #1695; update the manpage and usage info of packimage --- .../admin-guides/references/man1/packimage.1.rst | 14 +++++++++++--- xCAT-client/pods/man1/packimage.1.pod | 9 ++++++--- xCAT-server/lib/xcat/plugins/packimage.pm | 12 +++++++++--- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index 20651fbda8..4507bdc5cf 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -23,7 +23,7 @@ SYNOPSIS \ **packimage [-v| -**\ **-version]**\ -\ **packimage**\ \ *imagename*\ +\ **packimage**\ [\ **-m | -**\ **-method**\ \ *cpio|tar*\ ] [\ **-c | -**\ **-compress**\ \ *gzip|pigz|xz*\ ] \ *imagename*\ *********** @@ -62,9 +62,9 @@ OPTIONS \ **-a**\ Architecture (ppc64,x86_64,etc) -\ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio) +\ **-m| -**\ **-method**\ Archive Method (cpio,tar,squashfs, default is cpio) -\ **-c**\ Compress Method (pigz,gzip,xz, default is pigz) +\ **-c| -**\ **-compress**\ Compress Method (pigz,gzip,xz, default is pigz/gzip) ************ @@ -90,6 +90,14 @@ EXAMPLES packimage rhels7.1-x86_64-netboot-compute +2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress: + + +.. code-block:: perl + + packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute + + ***** FILES diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 60b34fe6f9..4daa2d03a7 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -8,7 +8,7 @@ B B -B I +B [B<-m>|B<--method> I] [B<-c>|B<--compress> I] I =head1 DESCRIPTION @@ -36,9 +36,9 @@ B<-p> Profile (compute,service) B<-a> Architecture (ppc64,x86_64,etc) -B<-m> Archive Method (cpio,tar,squashfs, default is cpio) +B<-m| --method> Archive Method (cpio,tar,squashfs, default is cpio) -B<-c> Compress Method (pigz,gzip,xz, default is pigz) +B<-c| --compress> Compress Method (pigz,gzip,xz, default is pigz/gzip) =head1 RETURN VALUE @@ -53,6 +53,9 @@ B<-c> Compress Method (pigz,gzip,xz, default is pigz) packimage rhels7.1-x86_64-netboot-compute +2. To pack the osimage rhels7.1-x86_64-netboot-compute with "tar" to archive and "pigz" to compress: + + packimage -m tar -c pigz rhels7.1-x86_64-netboot-compute =head1 FILES diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 82e4411f30..60062d26dd 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -79,7 +79,7 @@ sub process_request { @ARGV = @{$args}; } if (scalar(@ARGV) == 0) { - $callback->({ info => ["Usage:\n packimage \n packimage [-h| --help]\n packimage [-v| --version]"] }); + $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] \n packimage [-h| --help]\n packimage [-v| --version]"] }); return 0; } @@ -114,7 +114,7 @@ sub process_request { return 0; } if ($help) { - $callback->({ info => ["Usage:\n packimage \n packimage [-h| --help]\n packimage [-v| --version]"] }); + $callback->({ info => ["Usage:\n packimage [-m| --method=cpio|tar] [-c| --compress=gzip|pigz|xz] \n packimage [-h| --help]\n packimage [-v| --version]"] }); return 0; } @@ -468,8 +468,12 @@ sub process_request { } $suffix = $method.".".$suffix; - unlink("$destdir/rootimg.$suffix"); unlink("$destdir/rootimg.sfs"); + unlink("$destdir/rootimg.cpio.xz"); + unlink("$destdir/rootimg.cpio.gz"); + unlink("$destdir/rootimg.tar.xz"); + unlink("$destdir/rootimg.tar.gz"); + if ($method =~ /cpio/) { if (!$exlistloc) { $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; @@ -507,6 +511,7 @@ sub process_request { $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); return 1; } + chdir("$rootimg_dir"); my $outputmsg = `$excludestr 2>&1`; unless($?){ @@ -517,6 +522,7 @@ sub process_request { system("rm -rf $xcat_packimg_tmpfile"); return 1; } + if ($method =~ /cpio/) { chmod 0644, "$destdir/rootimg.$suffix"; if ($dotorrent) { From 665bf66f47cf569d4799e0eeb7d078ae1c66f293 Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Sat, 13 Aug 2016 15:04:55 +0800 Subject: [PATCH 116/391] Fix bug1687 xcatprobe could not surpport xcatmn command on ubuntu (#1691) * fix bug1687 xcatprobe could not surpport xcatmn command on ubuntu * remove useless files --- build-ubunturepo | 6 +- xCAT-probe/lib/perl/xCAT/GlobalDef.pm | 103 - xCAT-probe/lib/perl/xCAT/NetworkUtils.pm | 2651 ---------------------- 3 files changed, 3 insertions(+), 2757 deletions(-) delete mode 100644 xCAT-probe/lib/perl/xCAT/GlobalDef.pm delete mode 100644 xCAT-probe/lib/perl/xCAT/NetworkUtils.pm diff --git a/build-ubunturepo b/build-ubunturepo index c1b02b09ae..769b34b67e 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -234,9 +234,9 @@ then if [ $file_low = "xcat-probe" ]; then CURDIR=$(pwd) mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/ - cp -f ${CURDIR}/perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ - cp -f ${CURDIR}/perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ - cp -f ${CURDIR}/perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/xCAT-probe/lib/perl/xCAT/ + cp -f ${CURDIR}/../perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/lib/perl/xCAT/ + cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/ + cp -f ${CURDIR}/../perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/lib/perl/xCAT/ fi dpkg-buildpackage -uc -us else diff --git a/xCAT-probe/lib/perl/xCAT/GlobalDef.pm b/xCAT-probe/lib/perl/xCAT/GlobalDef.pm deleted file mode 100644 index b953a5168f..0000000000 --- a/xCAT-probe/lib/perl/xCAT/GlobalDef.pm +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env perl -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -package xCAT::GlobalDef; - -#-------------------------------------------------------------------------------- - -=head1 xCAT::GlobalDef - -=head2 Package Description - -This module contains all the global info for xCAT. - - -=cut - -#-------------------------------------------------------------------------------- - - -# valid values for nodelist.hwtype column -$::NODETYPE_LPAR = "lpar"; -$::NODETYPE_BPA = "bpa"; -$::NODETYPE_FSP = "fsp"; -$::NODETYPE_HMC = "hmc"; -$::NODETYPE_IVM = "ivm"; -$::NODETYPE_FRAME = "frame"; -$::NODETYPE_CEC = "cec"; -$::NODETYPE_BLADE = "blade"; -$::NODETYPE_CMM = "cmm"; - -# valid values for nodelist.nodetype column -$::NODETYPE_OSI = "osi"; -$::NODETYPE_PPC = "ppc"; -$::NODETYPE_ZVM = "zvm"; -$::NODETYPE_MP = "mp"; - -#valid values for nodelist.updatestatus -$::STATUS_SYNCING = "syncing"; -$::STATUS_OUT_OF_SYNC = "out-of-sync"; -$::STATUS_SYNCED = "synced"; -$::STATUS_FAILED = "failed"; - - -# valid values for nodelist.status columns or other status -$::STATUS_ACTIVE = "alive"; -$::STATUS_INACTIVE = "unreachable"; -$::STATUS_INSTALLING = "installing"; -$::STATUS_INSTALLED = "installed"; -$::STATUS_BOOTING = "booting"; -$::STATUS_NETBOOTING = "netbooting"; -$::STATUS_BOOTED = "booted"; -$::STATUS_POWERING_ON = "powering-on"; -$::STATUS_POWERING_OFF = "powering-off"; -$::STATUS_DISCOVERING = "discovering"; -$::STATUS_CONFIGURING = "configuring"; -$::STATUS_STANDING_BY = "standingby"; -$::STATUS_SHELL = "shell"; -$::STATUS_DEFINED = "defined"; -$::STATUS_UNKNOWN = "unknown"; -$::STATUS_FAILED = "failed"; -$::STATUS_BMCREADY = "bmcready"; -%::VALID_STATUS_VALUES = ( - $::STATUS_ACTIVE => 1, - $::STATUS_INACTIVE => 1, - $::STATUS_INSTALLING => 1, - $::STATUS_INSTALLED => 1, - $::STATUS_BOOTING => 1, - $::STATUS_NETBOOTING => 1, - $::STATUS_BOOTED => 1, - $::STATUS_POWERING_ON => 1, - $::STATUS_POWERING_OFF => 1, - $::STATUS_DISCOVERING => 1, - $::STATUS_CONFIGURING => 1, - $::STATUS_STANDING_BY => 1, - $::STATUS_SHELL => 1, - $::STATUS_DEFINED => 1, - $::STATUS_UNKNOWN => 1, - $::STATUS_FAILED => 1, - $::STATUS_BMCREADY => 1, - - $::STATUS_SYNCING => 1, - $::STATUS_OUT_OF_SYNC => 1, - $::STATUS_SYNCED => 1, -); - -#defined->[discovering]->[configuring]->[standingby]->installing->[installed]->booting->alive, defined->[discovering]->[configuring]-[standingby]->netbooting->booted->alive, alive/unreachable->booting->alive, powering-off->unreachable, alive->unreachable -%::NEXT_NODESTAT_VAL = ( - $::STATUS_DEFINED => { $::STATUS_DISCOVERING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1, $::STATUS_BOOTING => 1, $::STATUS_CONFIGURING => 1 }, - $::STATUS_DISCOVERING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_BOOTING => 1 }, - $::STATUS_CONFIGURING => { $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_STANDING_BY => 1 }, - $::STATUS_INSTALLING => { $::STATUS_INSTALLED => 1, $::STATUS_BOOTING => 1 }, - $::STATUS_INSTALLED => { $::STATUS_BOOTING => 1 }, - $::STATUS_BOOTING => { $::STATUS_BOOTED => 1, $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 }, - $::STATUS_NETBOOTING => { $::STATUS_BOOTED => 1 }, - $::STATUS_BOOTED => { $::STATUS_ACTIVE => 1, $::STATUS_INACTIVE => 1 }, - $::STATUS_ACTIVE => { $::STATUS_INACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 }, - $::STATUS_INACTIVE => { $::STATUS_ACTIVE => 1, $::STATUS_DISCOVERING => 1, $::STATUS_CONFIGURING => 1, $::STATUS_INSTALLING => 1, $::STATUS_NETBOOTING => 1, $::STATUS_POWERING_OFF => 1, $::STATUS_POWERING_ON => 1 }, - $::STATUS_POWERING_OFF => { $::STATUS_INACTIVE => 1 }, - $::STATUS_POWERING_ON => { $::STATUS_BOOTED => 1 } -); - - -1; - diff --git a/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm b/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm deleted file mode 100644 index ed4694a70d..0000000000 --- a/xCAT-probe/lib/perl/xCAT/NetworkUtils.pm +++ /dev/null @@ -1,2651 +0,0 @@ -#!/usr/bin/env perl -# IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html -package xCAT::NetworkUtils; - -BEGIN -{ - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -} - -# if AIX - make sure we include perl 5.8.2 in INC path. -# Needed to find perl dependencies shipped in deps tarball. -if ($^O =~ /^aix/i) { - unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); -} - -use lib "$::XCATROOT/lib/perl"; -use POSIX qw(ceil); -use File::Path; -use Math::BigInt; -use Socket; -use xCAT::GlobalDef; - -#use Data::Dumper; -use strict; -use warnings "all"; -my $socket6support = eval { require Socket6 }; - -our @ISA = qw(Exporter); -our @EXPORT_OK = qw(getipaddr); - -my $utildata; #data to persist locally - -#-------------------------------------------------------------------------------- - -=head1 xCAT::NetworkUtils - -=head2 Package Description - -This program module file, is a set of network utilities used by xCAT commands. - -=cut - -#------------------------------------------------------------- - -#------------------------------------------------------------------------------- - -=head3 getNodeDomains - - Gets the network domain for a list of nodes - - The domain value comes from the network definition - associated with the node ip address. - - If the network domain is not set then the default is to - use the site.domain value - - Arguments: - list of nodes - Returns: - error - undef - success - hash ref of domains for each node - Globals: - $::VERBOSE - Error: - Example: - my $nodedomains = xCAT::NetworkUtils->getNodeDomains(\@nodes, $callback); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub getNodeDomains() -{ - my $class = shift; - my $nodes = shift; - - my @nodelist = @$nodes; - my %nodedomains; - - # Get the network info for each node - my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist); - - # get the site domain value - my @domains = xCAT::TableUtils->get_site_attribute("domain"); - my $sitedomain = $domains[0]; - - # for each node - set hash value to network domain or default - # to site domain - foreach my $node (@nodelist) { - unless (defined($node)) { next; } - if (defined($nethash{$node}) && $nethash{$node}{domain}) { - $nodedomains{$node} = $nethash{$node}{domain}; - } else { - $nodedomains{$node} = $sitedomain; - } - } - - return \%nodedomains; -} - -#------------------------------------------------------------------------------- - -=head3 gethostnameandip - Works for both IPv4 and IPv6. - Takes either a host name or an IP address string - and performs a lookup on that name, - returns an array with two elements: the hostname, the ip address - if the host name or ip address can not be resolved, - the corresponding element in the array will be undef - Arguments: - hostname or ip address - Returns: the hostname and the ip address - Globals: - - Error: - none - Example: - my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($iporhost); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub gethostnameandip() -{ - my ($class, $iporhost) = @_; - - if (($iporhost =~ /\d+\.\d+\.\d+\.\d+/) || ($iporhost =~ /:/)) #ip address - { - return (xCAT::NetworkUtils->gethostname($iporhost), $iporhost); - } - else #hostname - { - return ($iporhost, xCAT::NetworkUtils->getipaddr($iporhost)); - } -} - -#------------------------------------------------------------------------------- - -=head3 gethostname - Works for both IPv4 and IPv6. - Takes an IP address string and performs a lookup on that name, - returns the hostname of the ip address - if the ip address can not be resolved, returns undef - Arguments: - ip address - Returns: the hostname - Globals: - cache: %::iphosthash - Error: - none - Example: - my $host = xCAT::NetworkUtils->gethostname($ip); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub gethostname() -{ - my ($class, $iporhost) = @_; - - if (!defined($iporhost)) - { - return undef; - } - - if (ref($iporhost) eq 'ARRAY') - { - $iporhost = @{$iporhost}[0]; - if (!$iporhost) - { - return undef; - } - } - - if (($iporhost !~ /\d+\.\d+\.\d+\.\d+/) && ($iporhost !~ /:/)) - { - #why you do so? pass in a hostname and only want a hostname?? - return $iporhost; - } - - #cache, do not lookup DNS each time - if (defined($::iphosthash{$iporhost}) && $::iphosthash{$iporhost}) - { - return $::iphosthash{$iporhost}; - } - else - { - if ($socket6support) # the getaddrinfo and getnameinfo supports both IPv4 and IPv6 - { - my ($family, $socket, $protocol, $ip, $name) = Socket6::getaddrinfo($iporhost, 0, AF_UNSPEC, SOCK_STREAM, 6); #specifically ask for TCP capable records, maximizing chance of no more than one return per v4/v6 - my $host = (Socket6::getnameinfo($ip))[0]; - if ($host eq $iporhost) # can not resolve - { - return undef; - } - if ($host) - { - $host =~ s/\..*//; #short hostname - } - return $host; - } - else - { - #it is possible that no Socket6 available, - #but passing in IPv6 address, such as ::1 on loopback - if ($iporhost =~ /:/) - { - return undef; - } - my $hostname = gethostbyaddr(inet_aton($iporhost), AF_INET); - if ($hostname) { - $hostname =~ s/\..*//; #short hostname - } - return $hostname; - } - } -} - -#------------------------------------------------------------------------------- - -=head3 getipaddr - Works for both IPv4 and IPv6. - Takes a hostname string and performs a lookup on that name, - returns the the ip address of the hostname - if the hostname can not be resolved, returns undef - Arguments: - hostname - Optional: - GetNumber=>1 (return the address as a BigInt instead of readable string) - Returns: ip address - Globals: - cache: %::hostiphash - Error: - none - Example: - my $ip = xCAT::NetworkUtils->getipaddr($hostname); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub getipaddr -{ - my $iporhost = shift; - if ($iporhost eq 'xCAT::NetworkUtils') { #was called with -> syntax - $iporhost = shift; - } - my %extraarguments = @_; - - if (!defined($iporhost)) - { - return undef; - } - - if (ref($iporhost) eq 'ARRAY') - { - $iporhost = @{$iporhost}[0]; - if (!$iporhost) - { - return undef; - } - } - - #go ahead and do the reverse lookup on ip, useful to 'frontend' aton/pton and also to - #spit out a common abbreviation if leading zeroes or using different ipv6 presentation rules - #if ($iporhost and ($iporhost =~ /\d+\.\d+\.\d+\.\d+/) || ($iporhost =~ /:/)) - #{ - # #pass in an ip and only want an ip?? - # return $iporhost; - #} - - #cache, do not lookup DNS each time - if ($::hostiphash and defined($::hostiphash{$iporhost}) && $::hostiphash{$iporhost}) - { - return $::hostiphash{$iporhost}; - } - else - { - if ($socket6support) # the getaddrinfo and getnameinfo supports both IPv4 and IPv6 - { - my @returns; - my $reqfamily = AF_UNSPEC; - if ($extraarguments{OnlyV6}) { - $reqfamily = AF_INET6; - } elsif ($extraarguments{OnlyV4}) { - $reqfamily = AF_INET; - } - my @addrinfo = Socket6::getaddrinfo($iporhost, 0, $reqfamily, SOCK_STREAM, 6); - my ($family, $socket, $protocol, $ip, $name) = splice(@addrinfo, 0, 5); - while ($ip) - { - if ($extraarguments{GetNumber}) { #return a BigInt for compare, e.g. for comparing ip addresses for determining if they are in a common network or range - my $ip = (Socket6::getnameinfo($ip, Socket6::NI_NUMERICHOST()))[0]; - my $bignumber = Math::BigInt->new(0); - foreach (unpack("N*", Socket6::inet_pton($family, $ip))) { #if ipv4, loop will iterate once, for v6, will go 4 times - $bignumber->blsft(32); - $bignumber->badd($_); - } - push(@returns, $bignumber); - } else { - push @returns, (Socket6::getnameinfo($ip, Socket6::NI_NUMERICHOST()))[0]; - } - if (scalar @addrinfo and $extraarguments{GetAllAddresses}) { - ($family, $socket, $protocol, $ip, $name) = splice(@addrinfo, 0, 5); - } else { - $ip = 0; - } - } - unless ($extraarguments{GetAllAddresses}) { - return $returns[0]; - } - return @returns; - } - else - { - #return inet_ntoa(inet_aton($iporhost)) - #TODO, what if no scoket6 support, but passing in a IPv6 hostname? - if ($iporhost =~ /:/) { #ipv6 - return undef; - - #die "Attempt to process IPv6 address, but system does not have requisite IPv6 perl support"; - } - my $packed_ip; - $iporhost and $packed_ip = inet_aton($iporhost); - if (!$packed_ip) - { - return undef; - } - if ($extraarguments{GetNumber}) { #only 32 bits, no for loop needed. - return Math::BigInt->new(unpack("N*", $packed_ip)); - } - return inet_ntoa($packed_ip); - } - } -} - -#------------------------------------------------------------------------------- - -=head3 linklocaladdr - Only for IPv6. - Takes a mac address, calculate the IPv6 link local address - Arguments: - mac address - Returns: - ipv6 link local address. returns undef if passed in a invalid mac address - Globals: - Error: - none - Example: - my $linklocaladdr = xCAT::NetworkUtils->linklocaladdr($mac); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub linklocaladdr { - my ($class, $mac) = @_; - $mac = lc($mac); - my $localprefix = "fe80"; - - my ($m1, $m2, $m3, $m6, $m7, $m8); - - # mac address can be 00215EA376B0 or 00:21:5E:A3:76:B0 - if ($mac =~ /^([0-9A-Fa-f]{2}).*?([0-9A-Fa-f]{2}).*?([0-9A-Fa-f]{2}).*?([0-9A-Fa-f]{2}).*?([0-9A-Fa-f]{2}).*?([0-9A-Fa-f]{2})$/) - { - ($m1, $m2, $m3, $m6, $m7, $m8) = ($1, $2, $3, $4, $5, $6); - } - else - { - #not a valid mac address - return undef; - } - my ($m4, $m5) = ("ff", "fe"); - - #my $bit = (int $m1) & 2; - #if ($bit) { - # $m1 = $m1 - 2; - #} else { - # $m1 = $m1 + 2; - #} - $m1 = hex($m1); - $m1 = $m1 ^ 2; - $m1 = sprintf("%x", $m1); - - $m1 = $m1 . $m2; - $m3 = $m3 . $m4; - $m5 = $m5 . $m6; - $m7 = $m7 . $m8; - - my $laddr = join ":", $m1, $m3, $m5, $m7; - $laddr = join "::", $localprefix, $laddr; - - return $laddr; -} - - -#------------------------------------------------------------------------------- - -=head3 ishostinsubnet - Works for both IPv4 and IPv6. - Takes an ip address, the netmask and a subnet, - chcek if the ip address is in the subnet - Arguments: - ip address, netmask, subnet - Returns: - 1 - if the ip address is in the subnet - 0 - if the ip address is NOT in the subnet - Globals: - Error: - none - Example: - if(xCAT::NetworkUtils->ishostinsubnet($ip, $netmask, $subnet); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub ishostinsubnet { - my ($class, $ip, $mask, $subnet) = @_; - - #safe guard - if (!defined($ip) || !defined($mask) || !defined($subnet)) - { - return 0; - } - my $numbits = 32; - if ($ip =~ /:/) { #ipv6 - $numbits = 128; - } - if ($mask) { - if ($mask =~ /\//) { - $mask =~ s/^\///; - $mask = Math::BigInt->new("0b" . ("1" x $mask) . ("0" x ($numbits - $mask))); - } else { - $mask = getipaddr($mask, GetNumber => 1); - } - } else { #CIDR notation supported - if ($subnet && ($subnet =~ /\//)) { - ($subnet, $mask) = split /\//, $subnet, 2; - $mask = Math::BigInt->new("0b" . ("1" x $mask) . ("0" x ($numbits - $mask))); - } else { - die "ishostinsubnet must either be called with a netmask or CIDR /bits notation"; - } - } - if ($subnet && ($subnet =~ /\//)) #remove CIDR suffix from subnet - { - $subnet =~ s/\/.*$//; - } - $ip = getipaddr($ip, GetNumber => 1); - $subnet = getipaddr($subnet, GetNumber => 1); - $ip &= $mask; - if ($ip && $subnet && ($ip == $subnet)) { - return 1; - } else { - return 0; - } -} - -#----------------------------------------------------------------------------- - -=head3 setup_ip_forwarding - - Sets up ip forwarding on localhost - -=cut - -#----------------------------------------------------------------------------- -sub setup_ip_forwarding -{ - my ($class, $enable) = @_; - if (xCAT::Utils->isLinux()) { - my $conf_file = "/etc/sysctl.conf"; - `grep "net.ipv4.ip_forward" $conf_file`; - if ($? == 0) { -`sed -i "s/^net.ipv4.ip_forward = .*/net.ipv4.ip_forward = $enable/" $conf_file`; -`sed -i "s/^#net.ipv4.ip_forward *= *.*/net.ipv4.ip_forward = $enable/" $conf_file`; #debian/ubuntu have different default format - } else { - `echo "net.ipv4.ip_forward = $enable" >> $conf_file`; - } - `sysctl -e -p $conf_file`; # workaround for redhat bug 639821 - } - else - { - `no -o ipforwarding=$enable`; - } - return 0; -} - -#----------------------------------------------------------------------------- - -=head3 setup_ipv6_forwarding - - Sets up ipv6 forwarding on localhost - -=cut - -#----------------------------------------------------------------------------- -sub setup_ipv6_forwarding -{ - my ($class, $enable) = @_; - if (xCAT::Utils->isLinux()) { - my $conf_file = "/etc/sysctl.conf"; - `grep "net.ipv6.conf.all.forwarding" $conf_file`; - if ($? == 0) { -`sed -i "s/^net.ipv6.conf.all.forwarding = .*/net.ipv6.conf.all.forwarding = $enable/" $conf_file`; - } else { - `echo "net.ipv6.conf.all.forwarding = $enable" >> $conf_file`; - } - `sysctl -e -p $conf_file`; - } - else - { - `no -o ip6forwarding=$enable`; - } - return 0; -} - -#------------------------------------------------------------------------------- - -=head3 prefixtomask - Convert the IPv6 prefix length(e.g. 64) to the netmask(e.g. ffff:ffff:ffff:ffff:0000:0000:0000:0000). - Till now, the netmask format ffff:ffff:ffff:: only works for AIX NIM - - Arguments: - prefix length - Returns: - netmask - netmask like ffff:ffff:ffff:ffff:0000:0000:0000:0000 - 0 - if the prefix length is not correct - Globals: - Error: - none - Example: - my #netmask = xCAT::NetworkUtils->prefixtomask($prefixlength); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub prefixtomask { - my ($class, $prefixlength) = @_; - - if (($prefixlength < 1) || ($prefixlength > 128)) - { - return 0; - } - - my $number = Math::BigInt->new("0b" . ("1" x $prefixlength) . ("0" x (128 - $prefixlength))); - my $mask = $number->as_hex(); - $mask =~ s/^0x//; - $mask =~ s/(....)/$1/g; - return $mask; -} - -#------------------------------------------------------------------------------- - -=head3 my_ip_in_subnet - Get the facing ip for some specific network - - Arguments: - net - subnet, such as 192.168.0.01 - mask - netmask, such as 255.255.255.0 - Returns: - facing_ip - The local ip address in the subnet, - returns undef if no local ip address is in the subnet - Globals: - Error: - none - Example: - my $facingip = xCAT::NetworkUtils->my_ip_in_subnet($net, $mask); - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub my_ip_in_subnet -{ - my ($class, $net, $mask) = @_; - - if (!$net || !$mask) - { - return undef; - } - - my $fmask = xCAT::NetworkUtils::formatNetmask($mask, 0, 1); - - my $localnets = xCAT::NetworkUtils->my_nets(); - - return $localnets->{"$net\/$fmask"}; -} - -#------------------------------------------------------------------------------- - -=head3 ip_forwarding_enabled - Check if the ip_forward enabled on the system - - Arguments: - Returns: - 1 - The ip_forwarding is eanbled - 0 - The ip_forwarding is not eanbled - Globals: - Error: - none - Example: - if(xCAT::NetworkUtils->ip_forwarding_enabled()) - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub ip_forwarding_enabled -{ - - my $enabled; - if (xCAT::Utils->isLinux()) - { - $enabled = `sysctl -n net.ipv4.ip_forward`; - chomp($enabled); - } - else - { - $enabled = `no -o ipforwarding`; - chomp($enabled); - $enabled =~ s/ipforwarding\s+=\s+//; - } - return $enabled; -} - -#------------------------------------------------------------------------------- - -=head3 get_nic_ip - Get the ip address for the node nics - - Arguments: - Returns: - Hash of the mapping of the nic and the ip addresses - Globals: - Error: - none - Example: - xCAT::NetworkUtils->get_nic_ip() - Comments: - none -=cut - -#------------------------------------------------------------------------------- - -sub get_nic_ip -{ - my $nic; - my %iphash; - my $mode = "MULTICAST"; - my $payingattention = 0; - my $interface; - my $keepcurrentiface; - - - if (xCAT::Utils->isAIX()) { - ############################################################## - # Should look like this for AIX: - # en0: flags=4e080863,80 - # inet 30.0.0.1 netmask 0xffffff00 broadcast 30.0.0.255 - # inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255 - # en1: ... - # - ############################################################## - my $cmd = "ifconfig -a"; - my $result = `$cmd`; - ############################################# - # Error running command - ############################################# - if (!$result) { - return undef; - } - my @adapter = split /(\w+\d+):\s+flags=/, $result; - foreach (@adapter) { - if ($_ =~ /^(en\d)/) { - $nic = $1; - next; - } - if (!($_ =~ /LOOPBACK/) and - $_ =~ /UP(,|>)/ and - $_ =~ /$mode/) { - my @ip = split /\n/; - for my $ent (@ip) { - if ($ent =~ /^\s*inet\s+(\d+\.\d+\.\d+\.\d+)/) { - $iphash{$nic} = $1; - next; - } - } - } - } - } - else { # linux - my @ipoutput = `ip addr`; - ############################################# - # Error running command - ############################################# - if (!@ipoutput) { - return undef; - } - foreach my $line (@ipoutput) { - if ($line =~ /^\d/) { # new interface, new context.. - if ($interface and not $keepcurrentiface) { - - #don't bother reporting unusable nics - delete $iphash{$interface}; - } - $keepcurrentiface = 0; - if (!($line =~ /LOOPBACK/) and - $line =~ /UP( |,|>)/ and - $line =~ /$mode/) { - - $payingattention = 1; - $line =~ /^([^:]*): ([^:]*):/; - $interface = $2; - } else { - $payingattention = 0; - next; - } - } - unless ($payingattention) { next; } - if ($line =~ /inet/) { - $keepcurrentiface = 1; - } - if ($line =~ /^\s*inet \s*(\d+\.\d+\.\d+\.\d+)/) { - $iphash{$interface} = $1; - } - } - } - return \%iphash; -} - -#------------------------------------------------------------------------------- - -=head3 classful_networks_for_net_and_mask - - Arguments: - network and mask - Returns: - a list of classful subnets that constitute the entire potentially classless arguments - Globals: - none - Error: - none - Example: - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub classful_networks_for_net_and_mask -{ - my $network = shift; - my $mask = shift; - my $given_mask = 0; - if ($mask =~ /\./) - { - $given_mask = 1; - my $masknumber = unpack("N", inet_aton($mask)); - $mask = 32; - until ($masknumber % 2) - { - $masknumber = $masknumber >> 1; - $mask--; - } - } - - my @results; - my $bitstoeven = (8 - ($mask % 8)); - if ($bitstoeven == 8) { $bitstoeven = 0; } - my $resultmask = $mask + $bitstoeven; - if ($given_mask) - { - $resultmask = - inet_ntoa(pack("N", (2**$resultmask - 1) << (32 - $resultmask))); - } - push @results, $resultmask; - - my $padbits = (32 - ($bitstoeven + $mask)); - my $numchars = int(($mask + $bitstoeven) / 4); - my $curmask = 2**$mask - 1 << (32 - $mask); - my $nown = unpack("N", inet_aton($network)); - $nown = $nown & $curmask; - my $highn = $nown + ((2**$bitstoeven - 1) << (32 - $mask - $bitstoeven)); - - while ($nown <= $highn) - { - push @results, inet_ntoa(pack("N", $nown)); - - #$rethash->{substr($nowhex, 0, $numchars)} = $network; - $nown += 1 << (32 - $mask - $bitstoeven); - } - return @results; -} - - -#------------------------------------------------------------------------------- - -=head3 my_hexnets - - Arguments: - none - Returns: - Globals: - none - Error: - none - Example: - xCAT::NetworkUtils->my_hexnets - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub my_hexnets -{ - my $rethash; - my @nets = split /\n/, `/sbin/ip addr`; - foreach (@nets) - { - my @elems = split /\s+/; - unless (/^\s*inet\s/) - { - next; - } - (my $curnet, my $maskbits) = split /\//, $elems[2]; - my $bitstoeven = (4 - ($maskbits % 4)); - if ($bitstoeven == 4) { $bitstoeven = 0; } - my $padbits = (32 - ($bitstoeven + $maskbits)); - my $numchars = int(($maskbits + $bitstoeven) / 4); - my $curmask = 2**$maskbits - 1 << (32 - $maskbits); - my $nown = unpack("N", inet_aton($curnet)); - $nown = $nown & $curmask; - my $highn = - $nown + ((2**$bitstoeven - 1) << (32 - $maskbits - $bitstoeven)); - - while ($nown <= $highn) - { - my $nowhex = sprintf("%08x", $nown); - $rethash->{ substr($nowhex, 0, $numchars) } = $curnet; - $nown += 1 << (32 - $maskbits - $bitstoeven); - } - } - return $rethash; -} - -#------------------------------------------------------------------------------- - -=head3 get_host_from_ip - Description: - Get the hostname of an IP addresses. First from hosts table, and then try system resultion. - If there is a shortname, it will be returned. Otherwise it will return long name. If the IP cannot be resolved, return undef; - - Arguments: - $ip: the IP to get; - - Returns: - Return: the hostname. -For an example - - Globals: - none - - Error: - none - - Example: - xCAT::NetworkUtils::get_host_from_ip('192.168.200.1') - - Comments: -=cut - -#----------------------------------------------------------------------- -sub get_host_from_ip -{ - my $ip = shift; -} - -#------------------------------------------------------------------------------- - -=head3 isPingable - Description: - Check if an IP address can be pinged - - Arguments: - $ip: the IP to ping; - - Returns: - Return: 1 indicates yes; 0 indicates no. -For an example - - Globals: - none - - Error: - none - - Example: - xCAT::NetworkUtils::isPingable('192.168.200.1') - - Comments: - none -=cut - -#----------------------------------------------------------------------- -my %PING_CACHE; - -sub isPingable -{ - my $ip = shift; - - my $rc; - if (exists $PING_CACHE{$ip}) - { - $rc = $PING_CACHE{$ip}; - } - else - { - my $res = `LANG=C ping -c 1 -w 5 $ip 2>&1`; - if ($res =~ /100% packet loss/g) - { - $rc = 1; - } - else - { - $rc = 0; - } - $PING_CACHE{$ip} = $rc; - } - - return !$rc; -} - -#------------------------------------------------------------------------------- - -=head3 my_nets - Description: - Return a hash ref that contains all subnet and netmask on the mn (or sn). This subroutine can be invoked on both Linux and AIX. - - Arguments: - none. - - Returns: - Return a hash ref. Each entry will be: =>; - For an example: - '192.168.200.0/255.255.255.0' => '192.168.200.246'; -For an example - - Globals: - none - - Error: - none - - Example: - xCAT::NetworkUtils::my_nets(). - - Comments: - none -=cut - -#----------------------------------------------------------------------- -sub my_nets -{ - require xCAT::Table; - my $rethash; - my @nets; - my $v6net; - my $v6ip; - if ($^O eq 'aix') - { - @nets = split /\n/, `/usr/sbin/ifconfig -a`; - } - else - { - @nets = split /\n/, `/sbin/ip addr`; #could use ip route, but to match hexnets... - } - foreach (@nets) - { - $v6net = ''; - my @elems = split /\s+/; - unless (/^\s*inet/) - { - next; - } - my $curnet; my $maskbits; - if ($^O eq 'aix') - { - if ($elems[1] eq 'inet6') - { - $v6net = $elems[2]; - $v6ip = $elems[2]; - $v6ip =~ s/\/.*//; # ipv6 address 4000::99/64 - $v6ip =~ s/\%.*//; # ipv6 address ::1%1/128 - } - else - { - $curnet = $elems[2]; - $maskbits = formatNetmask($elems[4], 2, 1); - } - } - else - { - if ($elems[1] eq 'inet6') - { - next; #Linux IPv6 TODO, do not return IPv6 networks on Linux for now - } - ($curnet, $maskbits) = split /\//, $elems[2]; - } - if (!$v6net) - { - my $curmask = 2**$maskbits - 1 << (32 - $maskbits); - my $nown = unpack("N", inet_aton($curnet)); - $nown = $nown & $curmask; - my $textnet = inet_ntoa(pack("N", $nown)); - $textnet .= "/$maskbits"; - $rethash->{$textnet} = $curnet; - } - else - { - $rethash->{$v6net} = $v6ip; - } - } - - - # now get remote nets - my $nettab = xCAT::Table->new("networks"); - - #my $sitetab = xCAT::Table->new("site"); - #my $master = $sitetab->getAttribs({key=>'master'},'value'); - #$master = $master->{value}; - my @masters = xCAT::TableUtils->get_site_attribute("master"); - my $master = $masters[0]; - my @vnets = $nettab->getAllAttribs('net', 'mgtifname', 'mask'); - - foreach (@vnets) { - my $n = $_->{net}; - my $if = $_->{mgtifname}; - my $nm = $_->{mask}; - if (!$n || !$if || !$nm) - { - next; #incomplete network - } - if ($if =~ /!remote!/) { #only take in networks with special interface - $nm = formatNetmask($nm, 0, 1); - $n .= "/$nm"; - - #$rethash->{$n} = $if; - $rethash->{$n} = $master; - } - } - return $rethash; -} - -#------------------------------------------------------------------------------- - -=head3 my_if_netmap - Arguments: - none - Returns: - hash of networks to interface names - Globals: - none - Error: - none - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub my_if_netmap -{ - my $net; - if (scalar(@_)) - { #called with the other syntax - $net = shift; - } - my @rtable = split /\n/, `netstat -rn`; - if ($?) - { - return "Unable to run netstat, $?"; - } - my %retmap; - foreach (@rtable) - { - if (/^\D/) { next; } #skip headers - if (/^\S+\s+\S+\s+\S+\s+\S*G/) - { - next; - } #Skip networks that require gateways to get to - /^(\S+)\s.*\s(\S+)$/; - $retmap{$1} = $2; - } - return \%retmap; -} - -#------------------------------------------------------------------------------- - -=head3 my_ip_facing - Returns my ip address in the same network with the specified node - Linux only - Arguments: - nodename - Returns: - result and error message or my ip address - 1. If node can not be resolved, the return info will be like this: - [1, "The $node can not be resolved"]. - 2. If no IP found that matching the giving node, the return info will be: - [2, "The IP address of node $node is in an undefined subnet"]. - 3. If IP found: - [0,ip1,ip2,...] - Globals: - none - Error: - none - Example: - my @ip = xCAT::NetworkUtils->my_ip_facing($peerip) # return multiple - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub my_ip_facing -{ - my $peer = shift; - if (@_) - { - $peer = shift; - } - - return my_ip_facing_aix($peer) if ($^O eq 'aix'); - my @rst; - my $peernumber = inet_aton($peer); #TODO: IPv6 support - unless ($peernumber) { - $rst[0] = 1; - $rst[1] = "The $peer can not be resolved"; - return @rst; } - my $noden = unpack("N", $peernumber); - my @nets = split /\n/, `/sbin/ip addr`; - - my @ips; - foreach (@nets) - { - my @elems = split /\s+/; - unless (/^\s*inet\s/) - { - next; - } - (my $curnet, my $maskbits) = split /\//, $elems[2]; - my $curmask = 2**$maskbits - 1 << (32 - $maskbits); - my $curn = unpack("N", inet_aton($curnet)); - if (($noden & $curmask) == ($curn & $curmask)) - { - push @ips, $curnet; - } - } - - if (@ips) { - $rst[0] = 0; - push @rst, @ips; - } else { - $rst[0] = 2; - $rst[1] = "The IP address of node $peer is in an undefined subnet"; - } - return @rst; -} - -#------------------------------------------------------------------------------- - -=head3 my_ip_facing_aix - Returns my ip address - AIX only - Arguments: - nodename - Returns: - Globals: - none - Error: - none - Example: - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub my_ip_facing_aix -{ - my $peer = shift; - my @nets = `ifconfig -a`; - chomp @nets; - my @ips; - my @rst; - foreach my $net (@nets) - { - my ($curnet, $netmask); - if ($net =~ /^\s*inet\s+([\d\.]+)\s+netmask\s+(\w+)\s+broadcast/) - { - ($curnet, $netmask) = ($1, $2); - } - elsif ($net =~ /^\s*inet6\s+(.*)$/) - { - ($curnet, $netmask) = split('/', $1); - } - else - { - next; - } - if (isInSameSubnet($peer, $curnet, $netmask, 2)) - { - push @ips, $curnet; - } - } - if (@ips) - { - $rst[0] = 0; - push @rst, @ips; - } - else - { - $rst[0] = 2; - $rst[1] = "The IP address of node $peer is in an undefined subnet"; - } - return @rst; -} - -#------------------------------------------------------------------------------- - -=head3 formatNetmask - Description: - Transform netmask to one of 3 formats (255.255.255.0, 24, 0xffffff00). - - Arguments: - $netmask: the original netmask - $origType: the original netmask type. The valid value can be 0, 1, 2: - Type 0: 255.255.255.0 - Type 1: 24 - Type 2: 0xffffff00 - $newType: the new netmask type, valid values can be 0,1,2, as above. - - Returns: - Return undef if any error. Otherwise return the netmask in new format. - - Globals: - none - - Error: - none - - Example: - xCAT::NetworkUtils::formatNetmask( '24', 1, 0); #return '255.255.255.0'. - - Comments: - none -=cut - -#----------------------------------------------------------------------- -sub formatNetmask -{ - my $mask = shift; - my $origType = shift; - my $newType = shift; - my $maskn; - if ($origType == 0) - { - $maskn = unpack("N", inet_aton($mask)); - } - elsif ($origType == 1) - { - $maskn = 2**$mask - 1 << (32 - $mask); - } - elsif ($origType == 2) - { - $maskn = hex $mask; - } - else - { - return undef; - } - - if ($newType == 0) - { - return inet_ntoa(pack('N', $maskn)); - } - if ($newType == 1) - { - my $bin = unpack("B32", pack("N", $maskn)); - my @dup = ($bin =~ /(1{1})0*/g); - return scalar(@dup); - } - if ($newType == 2) - { - return sprintf "0x%1x", $maskn; - } - return undef; -} - -#------------------------------------------------------------------------------- - -=head3 isInSameSubnet - Description: - Check if 2 given IP addresses are in same subnet - - Arguments: - $ip1: the first IP - $ip2: the second IP - $mask: the netmask, here are 3 possible netmask types, following are examples for these 3 types: - Type 0: 255.255.255.0 - Type 1: 24 - Type 2: 0xffffff00 - $masktype: the netmask type, 3 possible values: 0,1,2, as indicated above - - Returns: - 1: they are in same subnet - 2: not in same subnet - - Globals: - none - - Error: - none - - Example: - xCAT::NetworkUtils::isInSameSubnet( '192.168.10.1', '192.168.10.2', '255.255.255.0', 0); - - Comments: - none -=cut - -#----------------------------------------------------------------------- -sub isInSameSubnet -{ - my $ip1 = shift; - my $ip2 = shift; - my $mask = shift; - my $maskType = shift; - - $ip1 = xCAT::NetworkUtils->getipaddr($ip1); - $ip2 = xCAT::NetworkUtils->getipaddr($ip2); - - if (!defined($ip1) || !defined($ip2)) - { - return undef; - } - - if ((($ip1 =~ /\d+\.\d+\.\d+\.\d+/) && ($ip2 !~ /\d+\.\d+\.\d+\.\d+/)) - || (($ip1 !~ /\d+\.\d+\.\d+\.\d+/) && ($ip2 =~ /\d+\.\d+\.\d+\.\d+/))) - { - #ipv4 and ipv6 can not be in the same subnet - return undef; - } - - if (($ip1 =~ /\d+\.\d+\.\d+\.\d+/) && ($ip2 =~ /\d+\.\d+\.\d+\.\d+/)) - { - my $maskn; - if ($maskType == 0) - { - $maskn = unpack("N", inet_aton($mask)); - } - elsif ($maskType == 1) - { - $maskn = 2**$mask - 1 << (32 - $mask); - } - elsif ($maskType == 2) - { - $maskn = hex $mask; - } - else - { - return undef; - } - - my $ip1n = unpack("N", inet_aton($ip1)); - my $ip2n = unpack("N", inet_aton($ip2)); - - return (($ip1n & $maskn) == ($ip2n & $maskn)); - } - else - { - #ipv6 - if (($ip1 =~ /\%/) || ($ip2 =~ /\%/)) - { - return undef; - } - my $netipmodule = eval { require Net::IP; }; - if ($netipmodule) { - my $eip1 = Net::IP::ip_expand_address($ip1, 6); - my $eip2 = Net::IP::ip_expand_address($ip2, 6); - my $bmask = Net::IP::ip_get_mask($mask, 6); - my $bip1 = Net::IP::ip_iptobin($eip1, 6); - my $bip2 = Net::IP::ip_iptobin($eip2, 6); - if (($bip1 & $bmask) == ($bip2 & $bmask)) { - return 1; - } - } # else, can not check without Net::IP module - return undef; - } -} - -#------------------------------------------------------------------------------- - -=head3 nodeonmynet - checks to see if node is on any network this server is attached to or remote network potentially managed by this system - Arguments: - Node name - Returns: 1 if node is on the network - Globals: - none - Error: - none - Example: - xCAT::NetworkUtils->nodeonmynet - Comments: - none -=cut - -#------------------------------------------------------------------------------- - -sub nodeonmynet -{ - require xCAT::Table; - my $nodetocheck = shift; - if (scalar(@_)) - { - $nodetocheck = shift; - } - - my $nodeip = getNodeIPaddress($nodetocheck); - if (!$nodeip) - { - return 0; - } - unless ($nodeip =~ /\d+\.\d+\.\d+\.\d+/) - { - #IPv6 - if ($^O eq 'aix') - { - my @subnets = get_subnet_aix(); - for my $net_ent (@subnets) - { - if ($net_ent !~ /-/) - { - #ipv4 - next; - } - my ($net, $interface, $mask, $flag) = split /-/, $net_ent; - if (xCAT::NetworkUtils->ishostinsubnet($nodeip, $mask, $net)) - { - return 1; - } - } - - } else { - my @v6routes = split /\n/, `ip -6 route`; - foreach (@v6routes) { - if (/via/ or /^unreachable/ or /^fe80::\/64/) { - - #only count local ones, remote ones can be caught in next loop - #also, link-local would be a pitfall, - #since more context than address is - #needed to determine locality - next; - } - s/ .*//; #remove all after the space - if (xCAT::NetworkUtils->ishostinsubnet($nodeip, '', $_)) { #bank on CIDR support - return 1; - } - } - } - my $nettab = xCAT::Table->new("networks"); - my @vnets = $nettab->getAllAttribs('net', 'mgtifname', 'mask'); - foreach (@vnets) { - if ((defined $_->{mgtifname}) && ($_->{mgtifname} eq '!remote!')) - { - if (xCAT::NetworkUtils->ishostinsubnet($nodeip, $_->{mask}, $_->{net})) - { - return 1; - } - } - } - return 0; - } - my $noden = unpack("N", inet_aton($nodeip)); - my @nets; - if ($utildata->{nodeonmynetdata} and $utildata->{nodeonmynetdata}->{pid} == $$) { - @nets = @{ $utildata->{nodeonmynetdata}->{nets} }; - } else { - if ($^O eq 'aix') - { - my @subnets = get_subnet_aix(); - for my $net_ent (@subnets) - { - if ($net_ent =~ /-/) - { - #ipv6 - next; - } - my @ents = split /:/, $net_ent; - push @nets, $ents[0] . '/' . $ents[2] . ' dev ' . $ents[1]; - } - - } - else - { - @nets = split /\n/, `/sbin/ip route`; - } - my $nettab = xCAT::Table->new("networks"); - my @vnets = $nettab->getAllAttribs('net', 'mgtifname', 'mask'); - foreach (@vnets) { - if ((defined $_->{mgtifname}) && ($_->{mgtifname} eq '!remote!')) - { #global scoped network - my $curm = unpack("N", inet_aton($_->{mask})); - my $bits = 32; - until ($curm & 1) { - $bits--; - $curm = $curm >> 1; - } - push @nets, $_->{'net'} . "/" . $bits . " dev remote"; - } - } - $utildata->{nodeonmynetdata}->{pid} = $$; - $utildata->{nodeonmynetdata}->{nets} = \@nets; - } - foreach (@nets) - { - my @elems = split /\s+/; - unless ($elems[1] =~ /dev/) - { - next; - } - (my $curnet, my $maskbits) = split /\//, $elems[0]; - my $curmask = 2**$maskbits - 1 << (32 - $maskbits); - my $curn = unpack("N", inet_aton($curnet)); - if (($noden & $curmask) == $curn) - { - return 1; - } - } - return 0; -} - -#------------------------------------------------------------------------------- - -=head3 getNodeIPaddress - Arguments: - Node name only one at a time - Returns: ip address(s) - Globals: - none - Error: - none - Example: my $c1 = xCAT::NetworkUtils::getNodeIPaddress($nodetocheck); - -=cut - -#------------------------------------------------------------------------------- - -sub getNodeIPaddress -{ - require xCAT::Table; - my $nodetocheck = shift; - my $port = shift; - my $nodeip; - - $nodeip = xCAT::NetworkUtils->getipaddr($nodetocheck); - if (!$nodeip) - { - my $hoststab = xCAT::Table->new('hosts'); - my $ent = $hoststab->getNodeAttribs($nodetocheck, ['ip']); - if ($ent->{'ip'}) { - $nodeip = $ent->{'ip'}; - } - } - - if ($nodeip) { - return $nodeip; - } else { - return undef; - } -} - - - -#------------------------------------------------------------------------------- - -=head3 thishostisnot - returns 0 if host is not the same - Arguments: - hostname - Returns: - Globals: - none - Error: - none - Example: - xCAT::NetworkUtils->thishostisnot - Comments: - none -=cut - -#------------------------------------------------------------------------------- - -sub thishostisnot -{ - my $comparison = shift; - if (scalar(@_)) - { - $comparison = shift; - } - - my @ips; - if ($^O eq 'aix') - { - @ips = split /\n/, `/usr/sbin/ifconfig -a`; - } - else - { - @ips = split /\n/, `/sbin/ip addr`; - } - my $comp = xCAT::NetworkUtils->getipaddr($comparison); - if ($comp) - { - foreach (@ips) - { - if (/^\s*inet.?\s+/) - { - my @ents = split(/\s+/); - my $ip = $ents[2]; - $ip =~ s/\/.*//; - $ip =~ s/\%.*//; - if ($ip eq $comp) - { - return 0; - } - } - } - } - return 1; -} - -#----------------------------------------------------------------------------- - -=head3 gethost_ips (AIX and Linux) - Will use ifconfig to determine all possible ip addresses for the - host it is running on and then gethostbyaddr to get all possible hostnames - - input: - output: array of ipaddress(s) and hostnames - example: @ips=xCAT::NetworkUtils->gethost_ips(); - -=cut - -#----------------------------------------------------------------------------- -#sub gethost_ips1 -#{ -# my ($class) = @_; -# my $cmd; -# my @ipaddress; -# $cmd = "ifconfig" . " -a"; -# $cmd = $cmd . "| grep \"inet\""; -# my @result = xCAT::Utils->runcmd($cmd, 0); -# if ($::RUNCMD_RC != 0) -# { -# xCAT::MsgUtils->message("S", "Error from $cmd\n"); -# exit $::RUNCMD_RC; -# } -# foreach my $addr (@result) -# { -# my @ip; -# if (xCAT::Utils->isLinux()) -# { -# if ($addr =~ /inet6/) -# { -# #TODO, Linux ipv6 -# } -# else -# { -# my ($inet, $addr1, $Bcast, $Mask) = split(" ", $addr); -# #@ip = split(":", $addr1); -# #push @ipaddress, $ip[1]; -# $addr1 =~ s/.*://; -# push @ipaddress, $addr1; -# } -# } -# else -# { #AIX -# if ($addr =~ /inet6/) -# { -# $addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/; -# my $v6ip = $1; -# my $v6mask = $2; -# if ($v6ip) -# { -# push @ipaddress, $v6ip; -# } -# } -# else -# { -# my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) = -# split(" ", $addr); -# push @ipaddress, $addr1; -# } -# -# } -# } -# my @names = @ipaddress; -# foreach my $ipaddr (@names) -# { -# my $hostname = xCAT::NetworkUtils->gethostname($ipaddr); -# if ($hostname) -# { -# my @shorthost = split(/\./, $hostname); -# push @ipaddress, $shorthost[0]; -# } -# } -# -# return @ipaddress; -#} - - -sub gethost_ips -{ - my ($class) = @_; - my $cmd; - my @ipaddress; - if (xCAT::Utils->isLinux()) - { - $cmd = "ip -4 --oneline addr show |awk -F ' ' '{print \$4}'|awk -F '/' '{print \$1}'"; - my @result = xCAT::Utils->runcmd($cmd); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("S", "Error from $cmd\n"); - exit $::RUNCMD_RC; - } - - push @ipaddress, @result; - } - else - { #AIX - - $cmd = "ifconfig" . " -a"; - $cmd = $cmd . "| grep \"inet\""; - my @result = xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("S", "Error from $cmd\n"); - exit $::RUNCMD_RC; - } - - foreach my $addr (@result) - { - if ($addr =~ /inet6/) - { - $addr =~ /\s*inet6\s+([\da-fA-F:]+).*\/(\d+)/; - my $v6ip = $1; - my $v6mask = $2; - if ($v6ip) - { - push @ipaddress, $v6ip; - } - } - else - { - my ($inet, $addr1, $netmask, $mask1, $Bcast, $bcastaddr) = - split(" ", $addr); - push @ipaddress, $addr1; - } - - } - } - - my @names = @ipaddress; - foreach my $ipaddr (@names) - { - my $hostname = xCAT::NetworkUtils->gethostname($ipaddr); - if ($hostname) - { - my @shorthost = split(/\./, $hostname); - push @ipaddress, $shorthost[0]; - } - } - return @ipaddress; -} - -#------------------------------------------------------------------------------- - -=head3 get_subnet_aix - Description: - To get present subnet configuration by parsing the output of 'netstat'. Only designed for AIX. - Arguments: - None - Returns: - @aix_nrn : An array with entries in format "net:nic:netmask:flag". Following is an example entry: - 9.114.47.224:en0:27:U - Globals: - none - Error: - none - Example: - my @nrn =xCAT::NetworkUtils::get_subnet_aix - Comments: - none - -=cut - -#------------------------------------------------------------------------------- -sub get_subnet_aix -{ - my @netstat_res = `/usr/bin/netstat -rn`; - chomp @netstat_res; - my @aix_nrn; - for my $entry (@netstat_res) - { - #We need to find entries like: - #Destination Gateway Flags Refs Use If Exp Groups - #9.114.47.192/27 9.114.47.205 U 1 1 en0 - #4000::/64 link#4 UCX 1 0 en2 - - - my ($net, $netmask, $flag, $nic); - if ($entry =~ /^\s*([\d\.]+)\/(\d+)\s+[\d\.]+\s+(\w+)\s+\d+\s+\d+\s(\w+)/) - { - ($net, $netmask, $flag, $nic) = ($1, $2, $3, $4); - my @dotsec = split /\./, $net; - for (my $i = 4 ; $i > scalar(@dotsec) ; $i--) - { - $net .= '.0'; - } - push @aix_nrn, "$net:$nic:$netmask:$flag" if ($net ne '127.0.0.0'); - } - elsif ($entry =~ /^\s*([\dA-Fa-f\:]+)\/(\d+)\s+.*?\s+(\w+)\s+\d+\s+\d+\s(\w+)/) - { - #print "=====$entry====\n"; - ($net, $netmask, $flag, $nic) = ($1, $2, $3, $4); - - # for ipv6, can not use : as the delimiter - push @aix_nrn, "$net-$nic-$netmask-$flag" if ($net ne '::') - } - } - return @aix_nrn; -} - -#----------------------------------------------------------------------------- - -=head3 determinehostname and ip address(s) - - Used on the service node to figure out what hostname and ip address(s) - are valid names and addresses - Input: None - Output: ipaddress(s),nodename -=cut - -#----------------------------------------------------------------------------- -sub determinehostname -{ - my $hostname; - my $hostnamecmd = "/bin/hostname"; - my @thostname = xCAT::Utils->runcmd($hostnamecmd, 0); - if ($::RUNCMD_RC != 0) - { # could not get hostname - xCAT::MsgUtils->message("S", - "Error $::RUNCMD_RC from $hostnamecmd command\n"); - exit $::RUNCMD_RC; - } - $hostname = $thostname[0]; - - #get all potentially valid abbreviations, and pick the one that is ok - #by 'noderange' - my @hostnamecandidates; - my $nodename; - while ($hostname =~ /\./) { - push @hostnamecandidates, $hostname; - $hostname =~ s/\.[^\.]*//; - } - push @hostnamecandidates, $hostname; - my $checkhostnames = join(',', @hostnamecandidates); - my @validnodenames = xCAT::NodeRange::noderange($checkhostnames); - unless (scalar @validnodenames) { #If the node in question is not in table, take output literrally. - push @validnodenames, $hostnamecandidates[0]; - } - - #now, noderange doesn't guarantee the order, so we search the preference order, most to least specific. - foreach my $host (@hostnamecandidates) { - if (grep /^$host$/, @validnodenames) { - $nodename = $host; - last; - } - } - my @ips = xCAT::NetworkUtils->gethost_ips; - my @hostinfo = (@ips, $nodename); - - return @hostinfo; -} - -#----------------------------------------------------------------------------- - -=head3 toIP - - IPv4 function to convert hostname to IP address - -=cut - -#----------------------------------------------------------------------------- -sub toIP -{ - - if (($_[0] =~ /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) || ($_[0] =~ /:/)) - { - return ([ 0, $_[0] ]); - } - my $ip = xCAT::NetworkUtils->getipaddr($_[0]); - if (!$ip) - { - return ([ 1, "Cannot Resolve: $_[0]\n" ]); - } - return ([ 0, $ip ]); -} - -#------------------------------------------------------------------------------- - -=head3 validate_ip - Validate list of IPs - Arguments: - List of IPs - Returns: - 1 - Invalid IP address in the list - 0 - IP addresses are all valid - Globals: - none - Error: - none - Example: - if (xCAT::NetworkUtils->validate_ip($IP)) {} - Comments: - none -=cut - -#------------------------------------------------------------------------------- -sub validate_ip -{ - my ($class, @IPs) = @_; - foreach (@IPs) { - my $ip = $_; - - #TODO need more check for IPv6 address - if ($ip =~ /:/) - { - return ([0]); - } - ################################### - # Length is 4 for IPv4 addresses - ################################### - my (@octets) = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; - if (scalar(@octets) != 4) { - return ([ 1, "Invalid IP address1: $ip" ]); - } - foreach my $octet (@octets) { - if (($octet < 0) or ($octet > 255)) { - return ([ 1, "Invalid IP address2: $ip" ]); - } - } - } - return ([0]); -} - -#------------------------------------------------------------------------------- - -=head3 isIpaddr - - returns 1 if parameter is has a valid IP address form. - - Arguments: - dot qulaified IP address: e.g. 1.2.3.4 - Returns: - 1 - if legal IP address - 0 - if not legal IP address. - Globals: - none - Error: - none - Example: - if ($ipAddr) { blah; } - Comments: - Doesn't test if the IP address is on the network, - just tests its form. - -=cut - -#------------------------------------------------------------------------------- -sub isIpaddr -{ - my $addr = shift; - if (($addr) && ($addr =~ /xCAT::NetworkUtils/)) - { - $addr = shift; - } - - unless ($addr) - { - return 0; - } - - #print "addr=$addr\n"; - if ($addr !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) - { - return 0; - } - - if ($1 > 255 || $1 == 0 || $2 > 255 || $3 > 255 || $4 > 255) - { - return 0; - } - else - { - return 1; - } -} - - - - -#------------------------------------------------------------------------------- - -=head3 getNodeNameservers - Description: - Get nameservers of specified nodes. - The priority: noderes.nameservers > networks.nameservers > site.nameservers - Arguments: - node: node name list - Returns: - Return a hash ref, of the $nameservers{$node} - undef - Failed to get the nameservers - Globals: - none - Error: - none - Example: - my $nameservers = xCAT::NetworkUtils::getNodeNameservers(\@node); - Comments: - none - -=cut - -#------------------------------------------------------------------------------- -sub getNodeNameservers { - my $nodes = shift; - if ($nodes =~ /xCAT::NetworkUtils/) - { - $nodes = shift; - } - my @nodelist = @$nodes; - my %nodenameservers; - my $nrtab = xCAT::Table->new('noderes', -create => 0); - my %nrhash = %{ $nrtab->getNodesAttribs(\@nodelist, ['nameservers']) }; - - my $nettab = xCAT::Table->new("networks"); - my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist); - - my @nameservers = xCAT::TableUtils->get_site_attribute("nameservers"); - my $sitenameservers = $nameservers[0]; - - - foreach my $node (@nodelist) { - if ($nrhash{$node} and $nrhash{$node}->[0] and $nrhash{$node}->[0]->{nameservers}) - { - $nodenameservers{$node} = $nrhash{$node}->[0]->{nameservers}; - } elsif ($nethash{$node}{nameservers}) - { - $nodenameservers{$node} = $nethash{$node}{nameservers}; - } elsif ($sitenameservers) - { - $nodenameservers{$node} = $sitenameservers; - } - } - - return \%nodenameservers; -} - - -#------------------------------------------------------------------------------- - -=head3 getNodeNetworkCfg - Description: - Get node network configuration, including "IP, hostname(the nodename),and netmask" by this node's name. - - Arguments: - node: the nodename - Returns: - Return an array, which contains (IP,hostname,gateway,netmask'). - undef - Failed to get the network configuration info - Globals: - none - Error: - none - Example: - my ($ip,$host,undef,$mask) = xCAT::NetworkUtils::getNodeNetworkCfg('node1'); - Comments: - Presently gateway is always blank. Need to be improved. - -=cut - -#------------------------------------------------------------------------------- -sub getNodeNetworkCfg -{ - my $node = shift; - if ($node =~ /xCAT::NetworkUtils/) - { - $node = shift; - } - - my $ip = xCAT::NetworkUtils->getipaddr($node); - my $mask = undef; - my $gateway = undef; - - my $nettab = xCAT::Table->new("networks"); - if ($nettab) { - my @nets = $nettab->getAllAttribs('net', 'mask', 'gateway'); - foreach my $net (@nets) { - if (xCAT::NetworkUtils::isInSameSubnet($net->{'net'}, $ip, $net->{'mask'}, 0)) { - $gateway = $net->{'gateway'}; - $mask = $net->{'mask'}; - } - } - } - - return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask, 0, 0)); -} - -#------------------------------------------------------------------------------- - -=head3 getNodesNetworkCfg - Description: - Get network configuration (ip,netmask,gateway) for a group of nodes - - Arguments: - nodes: the group of nodes - Returns: - If failed: (1, error_msg) - If success: (0, the hash variable store network configuration info for nodes that get matching network entry) - Error: - none - Example: - my ($ret, $hash) = xCAT::NetworkUtils::getNodesNetworkCfg($noderange); - Comments: - -=cut - -#------------------------------------------------------------------------------- - -sub getNodesNetworkCfg -{ - my $nodes = shift; - if ($nodes =~ /xCAT::NetworkUtils/) { - $nodes = shift; - } - my @nets = (); - my $nettab = xCAT::Table->new("networks"); - if ($nettab) { - my @error_net = (); - my @all_nets = $nettab->getAllAttribs('net', 'mask', 'gateway'); - foreach my $net (@all_nets) { - my $gateway = $net->{gateway}; - if (defined($gateway) and ($gateway eq '')) { - my @gatewayd = xCAT::NetworkUtils->my_ip_facing($net->{'net'}); - unless ($gatewayd[0]) { - $gateway = $gatewayd[1]; - } - } - push @nets, { net => $net->{net}, mask => $net->{mask}, gateway => $gateway }; - } - $nettab->close; - } - else { - return (1, "Open \"networks\" table failed"); - } - if (!scalar(@nets)) { - return (1, "No entry find in \"networks\" table"); - } - my %rethash = (); - foreach my $node (@$nodes) { - my $ip = xCAT::NetworkUtils->getipaddr($node); - foreach my $net (@nets) { - if (xCAT::NetworkUtils::isInSameSubnet($net->{'net'}, $ip, $net->{'mask'}, 0)) { - $rethash{$node}->{ip} = $ip; - $rethash{$node}->{mask} = $net->{'mask'}; - $rethash{$node}->{gateway} = $net->{'gateway'}; - last; - } - } - } - return (0, \%rethash); -} - -#------------------------------------------------------------------------------- - -=head3 get_hdwr_ip - Description: - Get hardware(CEC, BPA) IP from the hosts table, and then /etc/hosts. - - Arguments: - node: the nodename(cec, or bpa) - Returns: - Return the node IP - -1 - Failed to get the IP. - Globals: - none - Error: - none - Example: - my $ip = xCAT::NetworkUtils::get_hdwr_ip('node1'); - Comments: - Used in FSPpower FSPflash, FSPinv. - -=cut - -#------------------------------------------------------------------------------- -sub get_hdwr_ip -{ - require xCAT::Table; - my $node = shift; - my $ip = undef; - my $Rc = undef; - - my $ip_tmp_res = xCAT::NetworkUtils::toIP($node); - ($Rc, $ip) = @$ip_tmp_res; - if ($Rc) { - my $hosttab = xCAT::Table->new('hosts'); - if ($hosttab) { - my $node_ip_hash = $hosttab->getNodeAttribs($node, [qw(ip)]); - $ip = $node_ip_hash->{ip}; - } - - } - - if (!$ip) { - return undef; - } - - return $ip; -} - -#-------------------------------------------------------------------------------- - -=head3 pingNodeStatus - This function takes an array of nodes and returns their status using nmap or fping. - Arguments: - nodes-- an array of nodes. - Returns: - a hash that has the node status. The format is: - {alive=>[node1, node3,...], unreachable=>[node4, node2...]} -=cut - -#-------------------------------------------------------------------------------- -sub pingNodeStatus { - my ($class, @mon_nodes) = @_; - my %status = (); - my @active_nodes = (); - my @inactive_nodes = (); - - #print "NetworkUtils->pingNodeStatus called, nodes=@mon_nodes\n"; - if ((@mon_nodes) && (@mon_nodes > 0)) { - - #get all the active nodes - my $nodes = join(' ', @mon_nodes); - if (-x '/usr/bin/nmap' or -x '/usr/local/bin/nmap') { #use nmap - #print "use nmap\n"; - my %deadnodes; - foreach (@mon_nodes) { - $deadnodes{$_} = 1; - } - - # get additional options from site table - my @nmap_options = xCAT::TableUtils->get_site_attribute("nmapoptions"); - my $more_options = $nmap_options[0]; - - #call namp - open(NMAP, "nmap -PE --system-dns --send-ip -sP $more_options " . $nodes . " 2> /dev/null|") or die("Cannot open nmap pipe: $!"); - my $node; - while () { - if (/Host (.*) \(.*\) appears to be up/) { - $node = $1; - unless ($deadnodes{$node}) { - foreach (keys %deadnodes) { - if ($node =~ /^$_\./) { - $node = $_; - last; - } - } - } - delete $deadnodes{$node}; - push(@active_nodes, $node); - } elsif (/Nmap scan report for ([^ ]*) /) { - $node = $1; - } elsif (/Host is up./) { - unless ($deadnodes{$node}) { - foreach (keys %deadnodes) { - if ($node =~ /^$_\./) { - $node = $_; - last; - } - } - } - delete $deadnodes{$node}; - push(@active_nodes, $node); - } - } - foreach (sort keys %deadnodes) { - push(@inactive_nodes, $_); - } - } else { #use fping - #print "use fping\n"; - - my $temp = `fping -a $nodes 2> /dev/null`; - chomp($temp); - @active_nodes = split(/\n/, $temp); - - #get all the inactive nodes by substracting the active nodes from all. - my %temp2; - if ((@active_nodes) && (@active_nodes > 0)) { - foreach (@active_nodes) { $temp2{$_} = 1 } - foreach (@mon_nodes) { - if (!$temp2{$_}) { push(@inactive_nodes, $_); } - } - } - else { @inactive_nodes = @mon_nodes; } - } - } - - $status{$::STATUS_ACTIVE} = \@active_nodes; - $status{$::STATUS_INACTIVE} = \@inactive_nodes; - - #use Data::Dumper; - #print Dumper(%status); - - return %status; -} - -#------------------------------------------------------------------------------- - -=head3 isValidMAC - Description : Validate whether specified string is a MAC string. - Arguments : macstr - the string to be validated. - Returns : 1 - valid MAC String. - 0 - invalid MAC String. -=cut - -#------------------------------------------------------------------------------- -sub isValidMAC -{ - my ($class, $macstr) = @_; - if ($macstr =~ /^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/) { - return 1; - } - return 0; -} - -#------------------------------------------------------------------------------- - -=head3 isValidHostname - Description : Validate whether specified string is a valid hostname. - Arguments : hostname - the string to be validated. - Returns : 1 - valid hostname String. - 0 - invalid hostname String. -=cut - -#------------------------------------------------------------------------------- -sub isValidHostname -{ - my ($class, $hostname) = @_; - if ($hostname =~ /^[a-z0-9]/) { - if ($hostname =~ /[a-z0-9]$/) { - if ($hostname =~ /^[\-a-z0-9]+$/) { - return 1; - } - } - } - return 0; -} - - -#------------------------------------------------------------------------------- - -=head3 isValidFQDN - Description : Validate whether specified string is a valid FQDN. - Arguments : hostname - the string to be validated. - Returns : 1 - valid hostname FQDN. - 0 - invalid hostname FQDN. -=cut - -#------------------------------------------------------------------------------- -sub isValidFQDN -{ - my ($class, $hostname) = @_; - if ($hostname =~ /^[a-z0-9][\.\-a-z0-9]+[a-z0-9]$/) { - return 1; - } - return 0; -} - - -#------------------------------------------------------------------------------- - -=head3 ip_to_int - Description : convert an IPv4 string into int. - Arguments : ipstr - the IPv4 string. - Returns : ipint - int number -=cut - -#------------------------------------------------------------------------------- -sub ip_to_int -{ - my ($class, $ipstr) = @_; - my $ipint = 0; - my @ipnums = split('\.', $ipstr); - $ipint += $ipnums[0] << 24; - $ipint += $ipnums[1] << 16; - $ipint += $ipnums[2] << 8; - $ipint += $ipnums[3]; - return $ipint; -} - -#------------------------------------------------------------------------------- - -=head3 int_to_ip - Description : convert an int into IPv4 String. - Arguments : ipnit - the input int number. - Returns : ipstr - IPv4 String. -=cut - -#------------------------------------------------------------------------------- -sub int_to_ip -{ - my ($class, $ipint) = @_; - return inet_ntoa(inet_aton($ipint)); -} - -#------------------------------------------------------------------------------- - -=head3 getBroadcast - Description : Get the broadcast ips - Arguments : ipstr - the IPv4 string ip. - netmask - the subnet mask of network - Returns : bcipint - the IPv4 string of broadcast ip. -=cut - -#------------------------------------------------------------------------------- -sub getBroadcast -{ - my ($class, $ipstr, $netmask) = @_; - my $ipint = xCAT::NetworkUtils->ip_to_int($ipstr); - my $maskint = xCAT::NetworkUtils->ip_to_int($netmask); - my $tmp = sprintf("%d", ~$maskint); - my $bcnum = sprintf("%d", ($ipint | $tmp) & hex('0x00000000FFFFFFFF')); - return xCAT::NetworkUtils->int_to_ip($bcnum); -} - -#------------------------------------------------------------------------------- - -=head3 get_allips_in_range - Description : Get all IPs in a IP range, return in a list. - Arguments : $startip - start IP address - $endip - end IP address - $increment - increment factor - Returns : IP list in this range. - Example : - my $startip = "192.168.0.1"; - my $endip = "192.168.0.100"; - xCAT::NetworkUtils->get_allips_in_range($startip, $endip, 1); -=cut - -#------------------------------------------------------------------------------- -sub get_allips_in_range -{ - my $class = shift; - my $startip = shift; - my $endip = shift; - my $increment = shift; - my @iplist = (); - my $tmpip; - - my $startipnum = xCAT::NetworkUtils->ip_to_int($startip); - my $endipnum = xCAT::NetworkUtils->ip_to_int($endip); - - if ($increment > 0) { - while ($startipnum <= $endipnum) { - $tmpip = xCAT::NetworkUtils->int_to_ip($startipnum); - $startipnum += $increment; - push(@iplist, $tmpip); - } - } elsif ($increment < 0) { - while ($endipnum >= $startipnum) { - $tmpip = xCAT::NetworkUtils->int_to_ip($endipnum); - $endipnum += $increment; - push(@iplist, $tmpip); - } - } - return \@iplist; -} - -#------------------------------------------------------------------------------- - -=head3 get_all_ips - Description : Get all IP addresses from table nics, column nicips. - Arguments : hashref - if not set, will return a reference of list, - if set, will return a reference of hash. - Returns : All IPs reference. -=cut - -#------------------------------------------------------------------------------- -sub get_all_nicips { - my ($class, $hashref) = @_; - my %allipshash; - my @allipslist; - - my $table = xCAT::Table->new('nics'); - my @entries = $table->getAllNodeAttribs(['nicips']); - foreach (@entries) { - - # $_->{nicips} looks like "eth0:ip1,eth1:ip2,bmc:ip3..." - if ($_->{nicips}) { - my @nicandiplist = split(',', $_->{nicips}); - - # Each record in @nicandiplist looks like "eth0:ip1" - # delimiter has been changed to use "!" in xCAT 2.8 - foreach (@nicandiplist) { - my @nicandip; - if ($_ =~ /!/) { - @nicandip = split('!', $_); - } else { - @nicandip = split(':', $_); - } - if ($hashref) { - $allipshash{ $nicandip[1] } = 0; - } else { - push(@allipslist, $nicandip[1]); - } - } - } - } - if ($hashref) { - return \%allipshash; - } else { - return \@allipslist; - } -} - -#------------------------------------------------------------------------------- - -=head3 gen_net_boot_params - - Description: - This subroutine is used to generate all possible kernel parameters for network boot (rh/sles/ubuntu + diskfull/diskless) - The supported network boot parameters: - ksdevice - Specify network device for Anaconda. For rh6 and earlier. Format: 'ksdevice={$mac|$nicname}' - BOOTIF - Specify network device for Anaconda. The boot device which set by pxe. xCAT also set it if the bootload is not pxe. Format 'BOOTIF={$mac}' - ifname - Specify a interfacename<->mac pair, it will set the interfacename to the interface which has the . Format 'ifname=$ifname:$mac' - # This will only be generated when linuximage.nodebootif is set. - bootdev - Specify the boot device. Mostly it's used with parameter and when there are multiple params. Format 'bootdev={$mac|$ifname} - ip - Specify the network configuration for an interface. Format: 'ip=dhcp', 'ip=$ifname:dhcp' - - netdevice - Specify network device for Linuxrc (Suse bootloader). Format: 'netdevice={$mac|$nicname}' - - netdev - Specify the interfacename which is used by xCAT diskless boot script to select the network interface. Format: 'netdev=$nicname' - - Reference: - Redhat anaconda doc: https://github.com/rhinstaller/anaconda/blob/master/docs/boot-options.txt - Suse Linuxrc do: https://en.opensuse.org/SDB:Linuxrc - - Arguments: - $installnic <- node.installnic - $primarynic <- node.primarynic - $macmac <- node.mac - $nodebootif <- linuximage.nodebootif - - Returns: - $net_params - The key will be the parameter name, the value for the key will be the parameter value. - Valid Parameter Name: - ksdevice - netdev - netdevice - ip - ifname - BOOTIF - - And following two keys also will be returned for reference - mac - nicname - - Example: - my $netparams = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primmarynic, $macmac, $nodebootif); - -=cut - -#------------------------------------------------------------------------------- - -sub gen_net_boot_params -{ - my $class = shift; - my $installnic = shift; - my $primarynic = shift; - my $macmac = shift; - my $nodebootif = shift; - - my $net_params; - - # arbitrary use primarynic if installnic is not set - unless ($installnic) { - $installnic = $primarynic; - } - - # just use the installnic to generate the nic related kernel parameters - my $mac; - my $nicname; - - # set the default nicname to nodebootif from image definition - if ($nodebootif) { - $nicname = $nodebootif; - } - - if ((!defined($installnic)) || ($installnic eq "") || ($installnic =~ /^mac$/i)) { - $mac = $macmac; - $net_params->{mac} = $mac; - } elsif ($installnic =~ /^[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}$/) { - $mac = $installnic; - $net_params->{mac} = $mac; - $net_params->{setmac} = $mac; - } else { - $mac = $macmac; - $nicname = $installnic; - $net_params->{nicname} = $nicname; - $net_params->{mac} = $mac; - } - - # if nicname is set and mac.mac is NOT set to , use nicname in the boot parameters - if ($nicname && !defined($net_params->{setmac})) { - $net_params->{ksdevice} = "ksdevice=$nicname"; - $net_params->{ip} = "ip=$nicname:dhcp"; - $net_params->{netdev} = "netdev=$nicname"; - $net_params->{netdevice} = "netdevice=$nicname"; - $net_params->{ifname} = "ifname=$nicname:$mac"; # todo: may not use mac arbitrary - } elsif ($mac) { - $net_params->{ksdevice} = "ksdevice=$mac"; - $net_params->{BOOTIF} = "BOOTIF=$mac"; - $net_params->{bootdev} = "bootdev=$mac"; - $net_params->{ip} = "ip=dhcp"; - $net_params->{netdevice} = "netdevice=$mac"; - } - - return $net_params; -} - -1; From 506d0c9660a7e22b5a0c373b565f6b21691a820c Mon Sep 17 00:00:00 2001 From: immarvin Date: Sun, 14 Aug 2016 06:11:04 -0400 Subject: [PATCH 117/391] fix issue [Customer] nodeset failed with meaningless messages #1529 --- xCAT-server/lib/perl/xCAT/Template.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 41511ef3ea..52c8db0349 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -114,7 +114,8 @@ sub subvars { } unless ($master) { - die "Unable to identify master for $node"; + $tmplerr = "Unable to identify master for $node"; + return; } $ENV{XCATMASTER} = $master; @@ -1009,7 +1010,7 @@ sub kickstartnetwork { $line .= $ulaaddr; } elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) { my ($ipaddr, $hostname, $gateway, $netmask) = xCAT::NetworkUtils->getNodeNetworkCfg($node); - unless ($ipaddr) { die "cannot resolve the network configuration of $node"; } + unless ($ipaddr) { $tmplerr = "cannot resolve the network configuration of $node"; return; } if ($gateway eq '') { @@ -1116,9 +1117,9 @@ sub yast2network { my $line; my $hoststab; my $mactab = xCAT::Table->new('mac', -create => 0); - unless ($mactab) { die "mac table should always exist prior to template processing when doing autoula"; } + unless ($mactab) { $tmplerr="mac table should always exist prior to template processing when doing autoula"; return;} my $ent = $mactab->getNodeAttribs($node, ['mac'], prefetchcache => 1); - unless ($ent and $ent->{mac}) { die "missing mac data for $node"; } + unless ($ent and $ent->{mac}) { $tmplerr="missing mac data for $node"; return; } my $suffix = xCAT::Utils->parseMacTabEntry($ent->{mac}, $node); $suffix = lc($suffix); @@ -1128,7 +1129,7 @@ sub yast2network { return "#YAST2NET autoula unsupported" } elsif ($::XCATSITEVALS{managedaddressmode} =~ /static/) { my ($ipaddr, $hostname, $gateway, $netmask) = xCAT::NetworkUtils->getNodeNetworkCfg($node); - unless ($ipaddr) { die "cannot resolve the network configuration of $node"; } + unless ($ipaddr) { $tmplerr = "cannot resolve the network configuration of $node"; return; } if ($gateway eq '') { my @gatewayd = xCAT::NetworkUtils->my_ip_facing($ipaddr); From 0f59a399ee5ae17ef6ec914fb8917834fca53c14 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 15 Aug 2016 02:36:40 -0400 Subject: [PATCH 118/391] update cases for packimage code change --- xCAT-test/autotest/testcase/packimg/cases0 | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 5e0fc612e3..aeca509eac 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -3,17 +3,17 @@ os:Linux description: cmd:copycds $$ISO cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz /rootimg.gz.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz -cmd:mv -f /rootimg.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end @@ -21,17 +21,17 @@ end start:packimage_p_a_o os:Linux cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz /rootimg.gz.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 cmd:packimage -p compute -a __GETNODEATTR($$CN,arch)__ -o __GETNODEATTR($$CN,os)__ check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz -cmd:mv -f /rootimg.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end @@ -40,17 +40,17 @@ start:packimage_imagename os:Linux description: cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz /rootimg.gz.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz -cmd:mv -f /rootimg.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end From d4a397adce112baff1129b8ef91f66c20194a2b5 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Sun, 14 Aug 2016 23:17:23 -0400 Subject: [PATCH 119/391] support tar for redhat6.8 --- xCAT-server/lib/xcat/plugins/packimage.pm | 14 ++++++++++++-- xCAT-server/share/xcat/netboot/rh/dracut/xcatroot | 6 ++++++ .../share/xcat/netboot/rh/dracut_033/xcatroot | 6 ++++++ xCAT-server/share/xcat/netboot/rh/genimage | 6 ++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 60062d26dd..216e21ae12 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -488,14 +488,24 @@ sub process_request { $oldmask = umask 0077; } elsif ($method =~ /tar/) { if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; + my $checkoption = `tar --xattrs-include 2>&1`; + if ($checkoption =~ /unrecognized/) { + $excludestr = "find . -xdev -print0 | tar --selinux --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; + } else { + $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; + } } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; + my $checkoption = `tar --xattrs-include 2>&1`; + if ($checkoption =~ /unrecognized/) { + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; + } else { + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; + } } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 3676256184..b53ccb366e 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -107,8 +107,14 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz + if [ $? -ne 0 ]; then + tar --selinux -zxf /rootimg.tar.gz + fi elif [ -r /rootimg.tar.xz ]; then tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz + if [ $? -ne 0 ]; then + tar --selinux -Jxf /rootimg.tar.xz + fi fi $NEWROOT/etc/init.d/localdisk echo Done diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 58a33895ef..c53a209b61 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -111,8 +111,14 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz + if [ $? -ne 0 ]; then + tar --selinux -zxf /rootimg.tar.gz + fi elif [ -r /rootimg.tar.xz ]; then tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz + if [ $? -ne 0 ]; then + tar --selinux -Jxf /rootimg.tar.xz + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index bc5104c419..a56e157b64 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1641,8 +1641,14 @@ EOMS print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; print $inifile " tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; + print $inifile " if [ \$? -ne 0 ]; then\n"; + print $inifile " tar --selinux -zxf /rootimg.tar.gz\n"; + print $inifile " fi\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; print $inifile " tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; + print $inifile " if [ \$? -ne 0 ]; then\n"; + print $inifile " tar --selinux -Jxf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; From 67d03b2c421b59eeeb9cefeab97c139687a62e9f Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 15 Aug 2016 03:51:08 -0400 Subject: [PATCH 120/391] use dependency on mn to run test --- xCAT-test/autotest/testcase/go-xcat/case2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case2 b/xCAT-test/autotest/testcase/go-xcat/case2 index b0fab9bc14..80049f2291 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case2 +++ b/xCAT-test/autotest/testcase/go-xcat/case2 @@ -163,12 +163,14 @@ cmd:xdsh $$CN "cd /; rm -rf /go-xcat" check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 +cmd:cp /xcat-dep-*.tar.bz2 /install/ +check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Ubuntu/core-snap/core-debs-snap.tar.bz2 --xcat-dep=http://xcat.org/files/xcat/xcat-dep/2.x_Ubuntu/xcat-dep-2.12-ubuntu.tar.bz2 -y install"; else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Linux/core-snap/core-rpms-snap.tar.bz2 --xcat-dep=http://xcat.org/files/xcat/xcat-dep/2.x_Linux/xcat-dep-2.12-linux.tar.bz2 -y install"; fi +cmd:dep=`ls /install/xcat-dep-*.tar.bz2`;if grep Ubuntu /etc/*release;then xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Ubuntu/core-snap/core-debs-snap.tar.bz2 --xcat-dep=http://$$MN/$dep -y install"; else xdsh $$CN "cd /; ./go-xcat --xcat-core=http://xcat.org/files/xcat/xcat-core/devel/Linux/core-snap/core-rpms-snap.tar.bz2 --xcat-dep=http://$$MN/$dep -y install"; fi check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" check:rc==0 From d7a683b200ca41f5d1fc24c991f7ff508f68d69a Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 15 Aug 2016 04:00:03 -0400 Subject: [PATCH 121/391] fix probe bugs --- xCAT-probe/lib/perl/probe_utils.pm | 77 +++++++++++++++++++++ xCAT-probe/subcmds/xcatmn | 103 +++++++---------------------- xCAT-probe/xcatprobe | 1 + xCATsn/debian/control | 2 +- xCATsn/xCATsn.spec | 2 +- 5 files changed, 104 insertions(+), 81 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index 8f2198fcaa..00a3a59f73 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -5,6 +5,7 @@ package probe_utils; use strict; use File::Path; use File::Copy; +use Time::Local; use Socket; #----------------------------------------- @@ -439,4 +440,80 @@ sub get_hostname_from_ip { return $hostname; } +#------------------------------------------ + +=head3 + Description: + Check if the free space of specific directory is more than expected value + Arguments: + targetdir: The directory needed to be checked + expect_free_space: the expected free space for above directory + Returns: + 0: the free space of specific directory is less than expected value + 1: the free space of specific directory is more than expected value + 2: the specific directory isn't mounted on standalone disk. it is a part of "/" +=cut + +#------------------------------------------ +sub is_dir_has_enough_space{ + my $targetdir=shift; + $targetdir = shift if (($targetdir) && ($targetdir =~ /probe_utils/)); + my $expect_free_space = shift; + my @output = `df -k`; + + foreach my $line (@output){ + chomp($line); + my @line_array = split(/\s+/, $line); + if($line_array[5] =~ /^$targetdir$/){ + my $left_space = $line_array[3]/1048576; + if($left_space >= $expect_free_space){ + return 1; + }else{ + return 0; + } + } + } + return 2; +} + +#------------------------------------------ + +=head3 + Description: + Convert input time format to the number of non-leap seconds since whatever time the system considers to be the epoch + the format of input time are two kinds + one like "Aug 15 02:43:31", another likes "15/Aug/2016:01:10:24" + Arguments: + timestr: the time format need to be converted + yday: the year of current time. + Returns: + the number of non-leap seconds since whatever time the system considers to be the epoch +=cut + +#------------------------------------------ +sub convert_to_epoch_seconds { + my $timestr=shift; + $timestr = shift if (($timestr) && ($timestr =~ /probe_utils/)); + my $yday=shift; + my $ref_seconds=shift; + my $mday; + my $dday; + my $h; + my $m; + my $s; + my $epoch_seconds=-1; + my %monthsmap = ("Jan"=>0,"Feb"=>1,"Mar"=>2,"Apr"=>3,"May"=>4,"Jun"=>5,"Jul"=>6,"Aug"=>7,"Sep"=>8,"Oct"=>9,"Nov"=>10,"Dec"=>11); + + if($timestr =~/(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)/){ + ($mday,$dday,$h,$m,$s)=($1,$2,$3,$4,$5); + $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); + if($epoch_seconds>$ref_seconds){ + $yday-=1; + $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); + } + }elsif($timestr =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/){ + $epoch_seconds = timelocal($6,$5,$4,$1,$monthsmap{$2},($3-1900)); + } + return $epoch_seconds; +} 1; diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index d12c2c622a..8a28b045e4 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -363,68 +363,23 @@ sub do_main_job { } } - my $expected = 10; - $msg = "The free space of / directory is more than $expected G"; - my $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/\$"`; - if ($?) { - probe_utils->send_msg($outputtarget, "d", "There isn't any filesystem mount on / directory"); - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg($outputtarget, "d", "The free space of / is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg($outputtarget, "w", "The free space of / is less than $expected G"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); + #check the free space of specific directory + #if "/var" is mounted on standalone disk, more than 1G free space is expected + #if "/tmp" is mounted on standalone disk, more than 1G free space is expected + #if installdir is mounted on standalone disk, more than 10G free space is expected. + #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. + my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); + foreach my $dir (@dir_expectedspace_list){ + next if($dir->[0] eq "/" && $dir->[1] == 0); + my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); + if($checkrst == 2){ + $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; + }elsif($checkrst == 1){ + probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); + }elsif($checkrst == 0){ + probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); } - } - $expected = 1; - $msg = "The free space of /var directory is more than $expected G"; - $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/var\$"`; - if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg($outputtarget, "d", "The free space of /var is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg($outputtarget, "w", "The free space of /var is less than $expected G"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - $expected = 1; - $msg = "The free space of /tmp directory is more than $expected G"; - $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "/tmp\$"`; - if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg($outputtarget, "d", "The free space of /tmp is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg($outputtarget, "w", "The free space of /tmp is less than $expected G"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - $expected = 10; - $msg = "The free space of $installdir directory is more than $expected G"; - $diskspace = `df -h|awk '{print \$4,\$6}'|grep -E "$installdir\$"`; - if (!$?) { - chomp($diskspace); - my ($size, $dir) = split(" ", $diskspace); - $size =~ s/G//g; - probe_utils->send_msg($outputtarget, "d", "The free space of /install is $size G") if ($verbose); - if ($size < $expected) { - probe_utils->send_msg($outputtarget, "w", "The free space of /install is less than $expected G"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } } $msg = "SELinux is disabled on current server"; @@ -444,8 +399,7 @@ sub do_main_job { `which wget > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "wget tool isn't installed on current server, skip checking HTTP service."); - probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing wget"); + probe_utils->send_msg($outputtarget, "w", "'wget' tool isn't installed, skip checking HTTP service. please install wget then try again"); } else { $msg = "HTTP service is ready on $serverip"; if (probe_utils->is_http_ready("$serverip")) { @@ -472,8 +426,7 @@ sub do_main_job { if ($checktftp) { `which tftp > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "tftp tool isn't installed on current server, skip checking tftp service."); - probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing tftp"); + probe_utils->send_msg($outputtarget, "w", "'tftp' tool isn't installed, skip checking tftp service. Please install tftp then try again"); } else { $msg = "TFTP service is ready on $serverip"; if (probe_utils->is_tftp_ready("$serverip")) { @@ -499,14 +452,12 @@ sub do_main_job { if ($checkdns) { `which nslookup > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "nslookup tool isn't installed in current server, skip checking DNS service."); - probe_utils->send_msg($outputtarget, "d", "Please do probe again after installing nslookup"); + probe_utils->send_msg($outputtarget, "w", "'nslookup' tool isn't installed, skip checking DNS service. please install nslookup then try again"); } else { $msg = "DNS server is ready on $serverip"; probe_utils->send_msg($outputtarget, "d", "Domain used to check DNS is $domain") if ($verbose); my $rc = 0; - if (!$is_sn) { # if this is a hierarchical cluster, nslookup one of sn to check DNS service @@ -517,7 +468,7 @@ sub do_main_job { if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { my $snip = "$1.$2.$3.$4"; if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$domain")) { - probe_utils->send_msg("$outputtarget", "d", "nslookup $sntmp $snip failed"); + probe_utils->send_msg("$outputtarget", "d", "nslookup $sntmp $snip failed") if($verbose); $rc = 1; } } @@ -525,17 +476,11 @@ sub do_main_job { # if there is no sn, nslookup mnip my $nslkp = `nslookup $serverip $serverip 2>&1`; - - if ($?) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed"); + chomp($nslkp); + my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); + if (!$tmp) { + probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed") if($verbose); $rc = 1; - } else { - chomp($nslkp); - my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $output); - if (!$tmp) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed"); - $rc = 1; - } } } if ($rc) { @@ -861,7 +806,7 @@ sub send_sn_msg { if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { print "$1:[SN:$node]: $2\n"; } else { - print "[failed] :$node: $line\n"; + print "[failed] :[SN:$node]: $line\n"; } } } diff --git a/xCAT-probe/xcatprobe b/xCAT-probe/xcatprobe index 0ded99666f..6cd0b5e95b 100755 --- a/xCAT-probe/xcatprobe +++ b/xCAT-probe/xcatprobe @@ -31,6 +31,7 @@ Options: -h : get usage information of $program_name -l : list all valid sub commands -V : print verbose information of $program_name + -w : show each line completely. by default if one is too long, the long part will be omitted. "; #----------------------------------- diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 865c489252..105f973046 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: xcatsn Architecture: all -Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.15-2), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl +Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.15-2), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl, xcat-probe (>=2.12) Recommends: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale management, including hardware management and software management. diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index fd0fca2d8a..f18eda6d09 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -17,7 +17,7 @@ Source3: xCATSN Source5: templates.tar.gz Source6: xcat.conf.apach24 Provides: xCATsn = %{version} -Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 +Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 xCAT-probe >= 2.12.2 Conflicts: xCAT From f492ceb7e9254f3637da48ec7d573e475f4930d1 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 15 Aug 2016 08:50:49 -0400 Subject: [PATCH 122/391] use cudaruntime-8-0 as default --- .../xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist | 8 ++++---- .../rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist | 8 ++++---- xCAT/postscripts/config_cuda | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist index a481755371..d5fcc574ab 100644 --- a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist @@ -6,8 +6,8 @@ gcc pciutils dkms #To install cuda-runtime, need to specify the version -#if want to install cuda-runtime-8-0, uncomment it, -#then comment out cuda-runtime-7-5 -#cuda-runtime-8-0 -cuda-runtime-7-5 +#if want to install cuda-runtime-7-5, uncomment it, +#then comment out cuda-runtime-8-0 +#cuda-runtime-7-5 +cuda-runtime-8-0 diff --git a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist index 12c60f80a0..ec78a1deaa 100644 --- a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist @@ -5,8 +5,8 @@ gcc pciutils dkms #To install cuda-runtime, need to specify the version -#if want to install cuda-runtime-8-0, uncomment it, -#then comment out cuda-runtime-7-5 -#cuda-runtime-8-0 -cuda-runtime-7-5 +#if want to install cuda-runtime-7-5, uncomment it, +#then comment out cuda-runtime-8-0 +#cuda-runtime-7-5 +cuda-runtime-8-0 diff --git a/xCAT/postscripts/config_cuda b/xCAT/postscripts/config_cuda index db4ee9fb84..87aa910d39 100755 --- a/xCAT/postscripts/config_cuda +++ b/xCAT/postscripts/config_cuda @@ -1,7 +1,8 @@ #!/bin/sh # set the paths required for cuda +CUDA_PATH=/usr/local/cuda FILENAME="/etc/profile.d/xcat-cuda.sh" -echo "export PATH=/usr/local/cuda/bin:\$PATH" > ${FILENAME} -echo "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:\$LD_LIBRARY_PATH" >> ${FILENAME} +echo "export PATH=$CUDA_PATH/bin:\$PATH" > ${FILENAME} +echo "export LD_LIBRARY_PATH=$CUDA_PATH/lib64:\$LD_LIBRARY_PATH" >> ${FILENAME} From 6a197828ae18cff89daebb130a159af0c905b957 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 15 Aug 2016 14:31:25 -0400 Subject: [PATCH 123/391] modify comments --- .../share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist | 5 ++--- .../netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist index d5fcc574ab..304628eb2d 100644 --- a/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/install/rh/cudaruntime.rhels7.ppc64le.pkglist @@ -5,9 +5,8 @@ kernel-devel gcc pciutils dkms -#To install cuda-runtime, need to specify the version -#if want to install cuda-runtime-7-5, uncomment it, -#then comment out cuda-runtime-8-0 +#To install cuda-runtime-7-5 #cuda-runtime-7-5 +#To install cuda-runtime-8-0 cuda-runtime-8-0 diff --git a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist index ec78a1deaa..f513fcbebb 100644 --- a/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/cudaruntime.rhels7.ppc64le.otherpkgs.pkglist @@ -4,9 +4,8 @@ kernel-devel gcc pciutils dkms -#To install cuda-runtime, need to specify the version -#if want to install cuda-runtime-7-5, uncomment it, -#then comment out cuda-runtime-8-0 +#To install cuda-runtime-7-5 #cuda-runtime-7-5 +#To install cuda-runtime-8-0 cuda-runtime-8-0 From 5f5bb2052f82c790149cd0bd3be25c3b03beb02e Mon Sep 17 00:00:00 2001 From: Patrick Lundgren Date: Mon, 15 Aug 2016 15:50:40 -0400 Subject: [PATCH 124/391] Added check for GTB Model Type to hpm upgrade buffer size --- xCAT-server/lib/xcat/plugins/ipmi.pm | 31 +++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 77b65bebb5..fb0a7fc164 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -524,10 +524,6 @@ sub on_bmc_connect { } elsif ($command eq "rspreset") { return resetbmc($sessdata); } elsif ($command eq "rbeacon") { - unless (defined $sessdata->{device_id}) { #need get device id data initted for SD350 workaround - $sessdata->{ipmisession}->subcmd(netfn => 6, command => 1, data => [], callback => \&gotdevid, callback_args => $sessdata); - return; - } return beacon($sessdata); } elsif ($command eq "rsetboot") { return setboot($sessdata); @@ -1732,9 +1728,22 @@ sub do_firmware_update { } xCAT::SvrUtils::sendmsg("rflash started, please wait.......", $callback, $sessdata->{node}, %allerrornodes); + + # check for 8335-GTB Model Type to adjust buffer size + my $buffer_size = "30000"; + my $cmd = $pre_cmd . " fru print 3"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], + $callback, $sessdata->{node}, %allerrornodes); + return -1; + } + if ($output =~ /8335-GTB/) { + $buffer_size = "15000"; + } # step 1 power off - my $cmd = $pre_cmd . " chassis power off"; + $cmd = $pre_cmd . " chassis power off"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], @@ -1751,14 +1760,14 @@ sub do_firmware_update { return -1; } - #check reset status + # check reset status unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 24)) { xCAT::SvrUtils::sendmsg([ 1, "Timeout to check the bmc status" ], $callback, $sessdata->{node}, %allerrornodes); return -1; } - #step 3 protect network + # step 3 protect network $cmd = $pre_cmd . " raw 0x32 0xba 0x18 0x00"; $output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) { @@ -1768,9 +1777,9 @@ sub do_firmware_update { } # step 4 upgrade firmware - $cmd = $pre_cmd . " -z 30000 hpm upgrade $hpm_file force"; + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force"; $output = xCAT::Utils->runcmd($cmd, -1); - + if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed." ], $callback, $sessdata->{node}, %allerrornodes); @@ -2358,9 +2367,7 @@ sub beacon { #if stuck with 1.5, say light for 255 seconds. In 2.0, specify to turn it on forever if ($subcommand eq "on") { - if ($sessdata->{mfg_id} == 19046 and $sessdata->{prod_id} == 13616) { # Lenovo SD350 - $sessdata->{ipmisession}->subcmd(netfn => 0x3a, command => 6, data => [ 1, 1 ], callback => \&beacon_answer, callback_args => $sessdata); - } elsif ($ipmiv2) { + if ($ipmiv2) { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [ 0, 1 ], callback => \&beacon_answer, callback_args => $sessdata); } else { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [0xff], callback => \&beacon_answer, callback_args => $sessdata); From 91e29ba7f52e3e3bf013eb7cd3aa2a4e9a953f14 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Mon, 15 Aug 2016 23:03:54 -0400 Subject: [PATCH 125/391] Fix issue, xcat-core builed failed in ubuntu due to xcat probe code checking --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index 769b34b67e..6eae013940 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -233,7 +233,7 @@ then #3 symbolic link can't work during package if [ $file_low = "xcat-probe" ]; then CURDIR=$(pwd) - mkdir -p ${CURDIR}/xCAT-probe/lib/perl/xCAT/ + mkdir -p ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/lib/perl/xCAT/ From 433cd390687786120524ab1b39a6aeef19643e03 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 16 Aug 2016 02:32:54 -0400 Subject: [PATCH 126/391] modify doc to add arch keyword for ubuntu online repo --- .../guides/install-guides/apt/configure_xcat.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/install-guides/apt/configure_xcat.rst b/docs/source/guides/install-guides/apt/configure_xcat.rst index 435b57ba98..887ef327fc 100644 --- a/docs/source/guides/install-guides/apt/configure_xcat.rst +++ b/docs/source/guides/install-guides/apt/configure_xcat.rst @@ -12,14 +12,20 @@ From the xCAT download page, find the build you want to install and add to ``/et To configure the xCAT development build, add the following line to ``/etc/apt/sources.list``: :: - deb http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main + [For x86_64 servers] + deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main + [For ppc64el servers] + deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/devel/core-snap trusty main **[xcat-dep]** To configure the xCAT deps online repository, add the following line to ``/etc/apt/sources.list``: :: - deb http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main + [For x86_64 servers] + deb [arch=amd64] http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main + [For ppc64el servers] + deb [arch=ppc64el] http://xcat.org/files/xcat/repos/apt/xcat-dep trusty main If using internet repositories, continue to the next step to install xCAT. From 47b37f57897a600051cc50e8a823dd9851684277 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Tue, 16 Aug 2016 04:59:26 -0400 Subject: [PATCH 127/391] add dependency to support rhels7.2+IB --- xCAT-server/share/xcat/ib/netboot/rh/ib.rhels7.ppc64le.pkglist | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/share/xcat/ib/netboot/rh/ib.rhels7.ppc64le.pkglist b/xCAT-server/share/xcat/ib/netboot/rh/ib.rhels7.ppc64le.pkglist index 90723aa519..f951d4ac95 100644 --- a/xCAT-server/share/xcat/ib/netboot/rh/ib.rhels7.ppc64le.pkglist +++ b/xCAT-server/share/xcat/ib/netboot/rh/ib.rhels7.ppc64le.pkglist @@ -17,3 +17,4 @@ cairo gcc createrepo libnl +ethtool From 91bd846c451dd2a31b4f7cb990c11fa0667a58aa Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Tue, 16 Aug 2016 05:32:23 -0400 Subject: [PATCH 128/391] Fix bug 1017 --- xCAT-probe/subcmds/osdeploy | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 5d3a8e0256..23effab683 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -570,6 +570,11 @@ sub dump_history { print "\t$line\n"; } } + my $statelist = ""; + for (my $i = 0 ; $i < scalar(@{ $rawdata{$node}{statehistory} }) ; $i++) { + $statelist .= "$state_set_reverse{$rawdata{$node}{statehistory}[$i]} "; + } + probe_utils->send_msg("$output", "d", "[$node] state history: $statelist"); } my @tmpnodestatehistory = @{ $rawdata{$node}{statehistory} }; @@ -817,7 +822,6 @@ sub get_valid_logs { my $year = shift; my $epoch_seconds_of_now = shift; my $bthistory_ref = shift; - my $nics = "eth0"; my @orglogfilelist = ("/var/log/xcat/cluster.log", "/var/log/messages", "/var/log/xcat/computes.log"); @@ -851,7 +855,7 @@ sub get_valid_logs { my $fd; my $filetype = `file $file 2>&1`; chomp($filetype); - if ($filetype =~ /ASCII text/) { + if ($filetype =~ /ASCII/) { if (!open($fd, "$file")) { print "open $files failed\n"; next; @@ -926,7 +930,7 @@ sub get_valid_logs { $timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now); } - if (($splitline[4] =~ /dhcpd:/i && $_ =~ /$nics/) + if (($splitline[4] =~ /dhcpd:/i && $_ =~ /$installnic/) || ($splitline[4] =~ /in.tftpd/i) || (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i)) || ($splitline[5] =~ /GET/ && $splitline[7] =~ /HTTP/)) { @@ -965,7 +969,7 @@ sub do_replay { foreach my $line (@bthistory) { $line =~ s/(\d+) (.+)/$2/g; my @tmp = split(/\s+/, $line); - if ($tmp[4] =~ /dhcpd:/i && $line =~ /$nics/) { + if ($tmp[4] =~ /dhcpd:/i && $line =~ /$installnic/) { handle_dhcp_msg("$line"); } elsif ($tmp[4] =~ /in.tftpd/i) { handle_tftp_msg("$line"); From 484cf08bfde7377ca46b83dd6f68288ec0d5bad0 Mon Sep 17 00:00:00 2001 From: Patrick Lundgren Date: Tue, 16 Aug 2016 09:49:46 -0400 Subject: [PATCH 129/391] Removed unintended changes that were result of scp from dev machine --- xCAT-server/lib/xcat/plugins/ipmi.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index fb0a7fc164..f9a1a3434d 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -524,6 +524,10 @@ sub on_bmc_connect { } elsif ($command eq "rspreset") { return resetbmc($sessdata); } elsif ($command eq "rbeacon") { + unless (defined $sessdata->{device_id}) { #need get device id data initted for SD350 workaround + $sessdata->{ipmisession}->subcmd(netfn => 6, command => 1, data => [], callback => \&gotdevid, callback_args => $sessdata); + return; + } return beacon($sessdata); } elsif ($command eq "rsetboot") { return setboot($sessdata); @@ -2367,7 +2371,9 @@ sub beacon { #if stuck with 1.5, say light for 255 seconds. In 2.0, specify to turn it on forever if ($subcommand eq "on") { - if ($ipmiv2) { + if ($sessdata->{mfg_id} == 19046 and $sessdata->{prod_id} == 13616) { # Lenovo SD350 + $sessdata->{ipmisession}->subcmd(netfn => 0x3a, command => 6, data => [ 1, 1 ], callback => \&beacon_answer, callback_args => $sessdata); + } elsif ($ipmiv2) { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [ 0, 1 ], callback => \&beacon_answer, callback_args => $sessdata); } else { $sessdata->{ipmisession}->subcmd(netfn => 0, command => 4, data => [0xff], callback => \&beacon_answer, callback_args => $sessdata); From fc1f1c575d556f14ffb54536b7ea073db122c302 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 Aug 2016 13:07:29 -0400 Subject: [PATCH 130/391] xcat-probe grammar and spelling fixes --- xCAT-probe/subcmds/detect_dhcpd | 28 +++++++------- xCAT-probe/subcmds/discovery | 64 ++++++++++++++++---------------- xCAT-probe/subcmds/osdeploy | 45 +++++++++++----------- xCAT-probe/subcmds/switch-macmap | 12 +++--- xCAT-probe/subcmds/xcatmn | 60 +++++++++++++++--------------- xCAT-probe/xcatprobe | 4 +- 6 files changed, 106 insertions(+), 107 deletions(-) diff --git a/xCAT-probe/subcmds/detect_dhcpd b/xCAT-probe/subcmds/detect_dhcpd index f1a2947b83..b8430761ee 100755 --- a/xCAT-probe/subcmds/detect_dhcpd +++ b/xCAT-probe/subcmds/detect_dhcpd @@ -26,10 +26,10 @@ Description: This command can be used to detect the dhcp server in a network for a specific mac address. Options: - -i interface: Required. The interface which facing the target network. - -m macaddress: The mac that will be used to detect dhcp server. Recommend to use the real mac of the node that will be netboot. If no specified, the mac of interface which specified by -i will be used. + -i interface: Required. The interface facing the target network. + -m macaddress: The mac that will be used to detect dhcp server. Use the real mac of the node that will be netboot. If not specified, the mac specified by -i will be used. -d duration: The time to wait to detect the dhcp messages. The default value is 10s. - -V verbose: To print additional debug information. + -V verbose: Print additional debug information. "; #--------------------------- @@ -59,7 +59,7 @@ if ($::HELP) { } if ($::TEST) { - probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, please install tcpdump command ahead. The operating system supported are redhat, sles, ubuntu and debian."); + probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, install 'tcpdump' command. The operating system supported are RedHat, SLES, Ubuntu and Debian."); exit 0; } @@ -72,12 +72,12 @@ unless (-x "/usr/sbin/tcpdump") { if ($::IF) { $nic = $::IF; } else { - probe_utils->send_msg("$output", "f", "Option '-i' needs to be assigned value for $program_name"); + probe_utils->send_msg("$output", "f", "Option '-i' needs to be assigned a value for $program_name"); probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } -my $msg = "Find right IP/MAC to do dhcp discover"; +my $msg = "Find correct IP/MAC to do dhcp discover"; my $IP = `ip addr show dev $nic | awk -F" " '/inet / {print \$2}' | head -n 1 |awk -F"/" '{print \$1}'`; chomp($IP); my $MAC; @@ -88,7 +88,7 @@ if ($::MACADD) { } chomp($MAC); -probe_utils->send_msg("$output", "d", "Send out dhcp discover from: NIC = $nic, IP = $IP, MAC = $MAC") if ($::VERBOSE); +probe_utils->send_msg("$output", "d", "Send dhcp discover from: NIC = $nic, IP = $IP, MAC = $MAC") if ($::VERBOSE); if (!$IP || !$MAC) { probe_utils->send_msg("$output", "f", $msg); @@ -108,7 +108,7 @@ if (-f "/etc/redhat-release") { $os = "debian"; } else { probe_utils->send_msg("$output", "f", $msg); - probe_utils->send_msg("$output", "d", "Only support the redhat, sles, ubuntu and debian OS"); + probe_utils->send_msg("$output", "d", "Only support the RedHat, SLES, Ubuntu and Debian OS"); exit 1; } probe_utils->send_msg("$output", "d", "Current operating system is $os") if ($::VERBOSE); @@ -118,7 +118,7 @@ if ($::DURATION) { $duration = $::DURATION; } -probe_utils->send_msg("$output", "d", "The duration of capturing DHCP package is $duration second") if ($::VERBOSE); +probe_utils->send_msg("$output", "d", "The duration of capturing DHCP package is $duration second(s)") if ($::VERBOSE); # send out the package $msg = "Build the socket to send out DHCP request"; @@ -204,7 +204,7 @@ while () { if ($line =~ /^\d\d:\d\d:\d\d/) { # A new packet was captured. Parse the last one. - probe_utils->send_msg("$output", "d", "The server I found: mac = $chaddr, clientip = $ciaddr, serverip = $siaddr, offer = $offer") if ($::VERBOSE); + probe_utils->send_msg("$output", "d", "The server found: mac = $chaddr, clientip = $ciaddr, serverip = $siaddr, offer = $offer") if ($::VERBOSE); if ($os eq "sles") { $offer = 1; } if ($chaddr =~ /$MAC/i && $offer && $ciaddr && $siaddr && $rsiaddr) { $output{$rsiaddr}{'client'} = $ciaddr; @@ -245,15 +245,15 @@ close(FILE); my $sn = scalar(keys %output); probe_utils->send_msg("$output", "i", "++++++++++++++++++++++++++++++++++"); -probe_utils->send_msg("$output", "i", "There are $sn servers reply the dhcp discover."); +probe_utils->send_msg("$output", "i", "There are $sn servers replied to dhcp discover."); foreach my $server (keys %output) { - probe_utils->send_msg("$output", "i", " Server:$server assign IP [$output{$server}{'client'}] to you. The next server is [$output{$server}{'nextsv'}]!"); + probe_utils->send_msg("$output", "i", " Server:$server assign IP [$output{$server}{'client'}]. The next server is [$output{$server}{'nextsv'}]!"); } probe_utils->send_msg("$output", "i", "++++++++++++++++++++++++++++++++++"); if (scalar(@snack)) { probe_utils->send_msg("$output", "i", "==================================="); - probe_utils->send_msg("$output", "i", "The dhcp servers which sending out NACK in present network:"); + probe_utils->send_msg("$output", "i", "The dhcp servers sending out NACK in present network:"); foreach my $nack (@snack) { probe_utils->send_msg("$output", "i", " $nack"); } @@ -379,5 +379,5 @@ sub kill_child { foreach my $cpid (@pidoftcpdump) { kill 15, $cpid; } - probe_utils->send_msg("$output", "d", "Kill process $pid which is used to capture the packet by tcpdump") if ($::VERBOSE); + probe_utils->send_msg("$output", "d", "Kill process $pid used to capture the packet by 'tcpdump'") if ($::VERBOSE); } diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index bfcec74f43..efdae9901e 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -35,16 +35,16 @@ $::USAGE = "Usage: $program_name [-V] [-m -n ] [--noprecheck] Description: - Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process. - If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name exit for error. - In order to do realtime monitor, $program_name probe program must be run along with the node discovery procedure. Plese trigger this command before trigger node discovery procedure. + Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process. + If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name will exit. + In order to do realtime monitor, $program_name probe must be run along with the node discovery procedure. Trigger this command before triggering node discovery procedure. Currently, this command does not support hierarchy. Options: -h : Get usage information of $program_name. -V : Output more information for debug. -m : The method of discovery, the valid values are $valid_discovery_type_str. - -n : The range of predefined node, must used with option -m. + -n : The range of predefined nodes, must be used with option -m. --noprecheck : skip pre-checking discovery to validate correct configuration. "; @@ -64,12 +64,12 @@ Options: sub check_genesis_file { my $arch = shift; if (($arch ne "ppc64") and ($arch ne "x86_64")) { - probe_utils->send_msg("$output", "d", "Please input correct arch type") if ($verbose); + probe_utils->send_msg("$output", "d", "Specify correct arch type") if ($verbose); return 1; } my $rst_f = 0; - probe_utils->send_msg("$output", "d", "Start to check genesis files for $arch...") if ($verbose); + probe_utils->send_msg("$output", "d", "Starting to check genesis files for $arch...") if ($verbose); my $os = probe_utils->get_os(); my $genesis_base; @@ -92,11 +92,11 @@ sub check_genesis_file { $genesis_scripts = `rpm -qa | grep -i "xcat-genesis-scripts" | grep -i "$arch"`; } unless ($genesis_base and $genesis_scripts) { - probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch did not be installed.") if ($verbose); + probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch is not installed.") if ($verbose); return 1; } - probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch installed, start to check files...") if ($verbose); + probe_utils->send_msg("$output", "d", "xCAT-genesis for $arch is installed, starting to check files...") if ($verbose); my $tftpdir = `tabdump site | awk -F',' '/^"tftpdir",/ { gsub(/"/, "", \$2) ; print \$2 }'`; chomp($tftpdir); @@ -109,7 +109,7 @@ sub check_genesis_file { if ($arch eq "ppc64") { $genesis_folder = "$tftpdir/pxelinux.cfg/p"; unless (-d "$genesis_folder") { - probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Please run 'mknb ppc64' if you use ppc64/ppc64le machine.") if ($verbose); + probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Run 'mknb ppc64' if using ppc64/ppc64le machine.") if ($verbose); return 1; } @@ -131,7 +131,7 @@ sub check_genesis_file { $initrd_path = $initrd_info[1]; $wget_rst = system("wget -q --spider $initrd_path -T 0.5 -t 3"); if ($wget_rst) { - probe_utils->send_msg("$output", "d", "initrd cannot be downloaded from $initrd_path.") if ($verbose); + probe_utils->send_msg("$output", "d", "'initrd' cannot be downloaded from $initrd_path.") if ($verbose); $rst_f = 1; } else { probe_utils->send_msg("$output", "d", "Check initrd file: $initrd_path PASS.") if ($verbose); @@ -154,7 +154,7 @@ sub check_genesis_file { } else { $genesis_folder = "$tftpdir/xcat/xnba/nets"; unless (-d "$genesis_folder") { - probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Please run 'mknb x86_64' if you use x86_64 machine.") if ($verbose); + probe_utils->send_msg("$output", "d", "There is no genesis file for $arch. Run 'mknb x86_64' if using x86_64 machine.") if ($verbose); return 1; } @@ -185,13 +185,13 @@ sub check_genesis_file { } unless ($host_ip) { - probe_utils->send_msg("$output", "d", "There is no ip for range $ip_range") if ($verbose); + probe_utils->send_msg("$output", "d", "There is no IP for range $ip_range") if ($verbose); $rst_f = 1; next; } unless (open(FILE, $_)) { - probe_utils->send_msg("$output", "d", "Can not open file $_."); + probe_utils->send_msg("$output", "d", "Cannot open file $_."); $rst_f = 1; next; } @@ -222,7 +222,7 @@ sub check_genesis_file { } else { probe_utils->send_msg("$output", "d", "Check elilo file: $elilo_http PASS.") if ($verbose); unless (open(FILE_ELILO, $elilo_path)) { - probe_utils->send_msg("$output", "d", "Can not open file $_.") if ($verbose); + probe_utils->send_msg("$output", "d", "Cannot open file $_.") if ($verbose); $rst_f = 1; next; } @@ -250,7 +250,7 @@ sub check_genesis_file { $wget_rst = system("wget -q --spider $initrd_http -T 0.5 -t 3"); if ($wget_rst) { - probe_utils->send_msg("$output", "d", "initrd cannot be downloaded from $initrd_http.") if ($verbose); + probe_utils->send_msg("$output", "d", "'initrd' cannot be downloaded from $initrd_http.") if ($verbose); $rst_f = 1; } else { probe_utils->send_msg("$output", "d", "Check initrd file: $initrd_http PASS.") if ($verbose); @@ -286,7 +286,7 @@ sub get_node_ip { foreach my $node (keys %nodeip) { $ip_net = xCAT::NetworkUtils->getipaddr($node); if ($nodeip{$node} and ($nodeip{$node} ne $ip_net)) { - probe_utils->send_msg("$output", "d", "IP $nodeip{$node} of definition for $node is not correct") if ($verbose); + probe_utils->send_msg("$output", "d", "IP $nodeip{$node} definition for $node is not correct") if ($verbose); } $nodeip{$node} = $ip_net; } @@ -424,7 +424,7 @@ sub dhcp_dynamic_range_check { } } } else { - probe_utils->send_msg("$output", "d", "Dynamic range for net $net did not be configured.") if ($verbose); + probe_utils->send_msg("$output", "d", "Dynamic range for net $net is not configured.") if ($verbose); $rst = 1; next; } @@ -631,7 +631,7 @@ sub handle_compute_msg { my $node = `lsdef -i mac -c 2>&1 | awk -F: '/$ipmacmap{$ip}/ {print \$1}'`; chomp($node); $monitor_nodes{$node} = 1 if (defined($monitor_nodes{$node})); - probe_utils->send_msg("$output", "o", "Node $node has finished it's discovery process"); + probe_utils->send_msg("$output", "o", "Node $node has finished its discovery process"); my $output = `lsdef $node 2>&1`; print "-------------------\n$output-------------------\n"; } @@ -757,7 +757,7 @@ sub check_pre_defined_node { if (!exists($nodecheckrst{$node}{error})) { if ($discovery_type eq "mtms") { if (!(exists($nodecheckrst{$node}{"mtm"}) && exists($nodecheckrst{$node}{"serial"}))) { - $nodecheckrst{$node}{"error"} = "node definition is wrong for '$discovery_type' type discovery"; + $nodecheckrst{$node}{"error"} = "Node definition is wrong for '$discovery_type' type discovery"; $rst = 1; } } elsif ($discovery_type eq "switch") { @@ -770,23 +770,23 @@ sub check_pre_defined_node { my $tmpoutput = `lsdef $nodecheckrst{$node}{"switch"} 2>&1`; if ($?) { - $nodecheckrst{$node}{"error"} = "Miss definition for related switch $nodeswitch"; + $nodecheckrst{$node}{"error"} = "Missing definition for related switch $nodeswitch"; $rst = 1; last; } if ($tmpoutput !~ /snmpversion=/) { - $nodecheckrst{$node}{"error"} = "Miss attribute 'snmpversion' definition for related switch $nodeswitch"; + $nodecheckrst{$node}{"error"} = "Missing attribute 'snmpversion' definition for related switch $nodeswitch"; $rst = 1; last; } if ($tmpoutput !~ /username=/) { - $nodecheckrst{$node}{"error"} = "Miss attribute 'username' definition for related switch $nodeswitch"; + $nodecheckrst{$node}{"error"} = "Missing attribute 'username' definition for related switch $nodeswitch"; $rst = 1; last; } if ($tmpoutput !~ /password=/) { - $nodecheckrst{$node}{"error"} = "Miss attribute 'password' definition for related switch $nodeswitch"; + $nodecheckrst{$node}{"error"} = "Missing attribute 'password' definition for related switch $nodeswitch"; $rst = 1; last; } @@ -852,7 +852,7 @@ sub do_pre_check { exit 1; } - $msg = "The input network interfaces $nics exist and are configured well on current server"; + $msg = "The input network interfaces $nics exist and are configured correctly on current server"; my $miss = 0; my @nic_array = split(",", $nics); foreach my $nic (@nic_array) { @@ -884,13 +884,13 @@ sub do_pre_check { my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; chomp($masteripinsite); if ($masteripinsite eq "") { - probe_utils->send_msg("$output", "d", "There isn't 'master' definition in 'site' talbe") if ($verbose); + probe_utils->send_msg("$output", "d", "There isn't 'master' definition in 'site' table") if ($verbose); probe_utils->send_msg("$output", "f", $msg); exit 1; } if (!xCAT::NetworkUtils->isIpaddr("$masteripinsite")) { - probe_utils->send_msg("$output", "d", "The value of 'master' in 'site' table isn't a IP address") if ($verbose); + probe_utils->send_msg("$output", "d", "The value of 'master' in 'site' table isn't an IP address") if ($verbose); probe_utils->send_msg("$output", "f", $msg); exit 1; } @@ -921,7 +921,7 @@ sub do_pre_check { probe_utils->send_msg("$output", "o", $msg); if (check_genesis_file("x86_64")) { probe_utils->send_msg("$output", "w", "Genesis files for x86 are not available"); - probe_utils->send_msg("$output", "i", "If don't plan to manage a x86 server, please ignore above warning"); + probe_utils->send_msg("$output", "i", "Ignore above warning if not planning on managing x86 server"); } else { probe_utils->send_msg("$output", "o", "Genesis files for x86 are available"); } @@ -934,7 +934,7 @@ sub do_pre_check { probe_utils->send_msg("$output", "o", $msg); if (check_genesis_file("ppc64")) { probe_utils->send_msg("$output", "w", "Genesis files for ppc64/ppc64le are not available"); - probe_utils->send_msg("$output", "i", "If don't plan to manage a ppc64/ppc64le server, please ignore above warning"); + probe_utils->send_msg("$output", "i", "ignore above warning if not planning on managing ppc64/ppc64le server"); } else { probe_utils->send_msg("$output", "o", "Genesis files for ppc64/ppc64le are available"); } @@ -978,7 +978,7 @@ sub do_monitor { $nics = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`; chomp($nics); if (!$nics) { - probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface"); + probe_utils->send_msg("$output", "f", "The value of 'master' in 'site' table is $masteripinsite, can't get corresponding network interface"); return 1; } } @@ -993,7 +993,7 @@ sub do_monitor { /_/\\_\\\\____/_/ \\_\\_| .+|______|__.-||__)`-'(((/ (((/ ------------------------------------------------------------- "; - print "$startline\nStart to capture every message during discovery process......\n"; + print "$startline\nStart capturing every message during discovery process......\n"; my $varlogmsg = "/var/log/messages"; my $clusterlog = "/var/log/xcat/cluster.log"; @@ -1088,7 +1088,7 @@ sub do_monitor { if ($terminal) { probe_utils->send_msg("$output", "d", "Got from STDIN"); } else { - probe_utils->send_msg("$output", "o", "All nodes need to monitor have finished discovery process"); + probe_utils->send_msg("$output", "o", "All nodes specified to monitor have finished discovery process"); } last; } @@ -1136,7 +1136,7 @@ if ($help) { } if ($test) { - probe_utils->send_msg("$output", "o", "Do probe for discovery process, including pre-check for required configuration and realtime monitor of discovery process.Before using this command, please install nslookup command ahead. Currently, this command does not support hierarchy."); + probe_utils->send_msg("$output", "o", "Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process. Before using this command, please install 'nslookup' command. Currently, this command does not support hierarchy."); exit 0; } diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 23effab683..049d125afa 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -148,19 +148,18 @@ $::USAGE = "Usage: $program_name -n -r [-V] Description: - Do probe for os provision process. Realtime monitor or replay history of os provision process. - If do realtime monitor, please run this before rpower node. - Unsupport hierarchial structure now. + Probe for OS provision process. Realtime monitor or replay history of OS provision process. + If realtime monitor, run this before 'rpower' node. + Currently, hierarchial structure is not supported. Options: -h : Get usage information of $program_name - -T : To verify if $program_name can work, reserve option for probe framework + -T : Verify if $program_name can work, reserved option for probe framework -V : Output more information for debug - -n : The range of node to be monitor or replay log. - -t : The maximum time to wait when doing monitor, the unit is minute, default is 60 minutes. - -r : Replay history log to probe provision. need input a start time when probe should begin from. - Support time format are xxhxxm, xxh, or xxm. h means hour, m means minute. - If there isn't unit input, using hour by default. + -n : The range of nodes for monitor or replay log. + -t : The maximum time in minutes to wait when doing monitor, default is 60. + -r : Replay history log for probe provisioniong. Input a start time when probe should begin. + Supported time formats are xxhxxm, xxh, or xxm. If units not specified, hour will be used by default. "; #------------------------------------------ @@ -231,7 +230,7 @@ sub check_noderange { }else{ $noerror = 0; $rst = 1; - probe_utils->send_msg("$output", "f", "$node : can't be resolved to a IP address"); + probe_utils->send_msg("$output", "f", "$node : can't be resolved to an IP address"); } } } @@ -313,7 +312,7 @@ sub handle_dhcp_msg { push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp")); if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { - my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different with the ip($macmap{$mac}{'ip'}) in node definition."; + my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different from the ip($macmap{$mac}{'ip'}) in node definition."; probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $warn_msg); } @@ -341,7 +340,7 @@ sub handle_dhcp_msg { push(@{ $rawdata{$node}{statehistory} }, $rawdata{$node}{state}) if (reset_state(\$rawdata{$node}{state}, "dhcp")); if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { - my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different with the ip($macmap{$mac}{'ip'}) in node definition."; + my $warn_msg = "The ip($ip) assigned to $mac via DHCP is different from the ip($macmap{$mac}{'ip'}) in node definition."; probe_utils->send_msg("$output", "w", "$warn_msg") if ($monitor); push(@{ $rawdata{$node}{"history"} }, $warn_msg); } @@ -655,7 +654,7 @@ sub dump_history { } elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] == $state_set{done})) { probe_utils->send_msg("$output", "f", "[$node] reboot completed, without deployment process"); } elsif (($valid_process{ $match_result{$max_match}[0] }{type} eq "reboot") && ($valid_process{ $match_result{$max_match}[0] }{process}[ $max_match - 1 ] != $state_set{done})) { - probe_utils->send_msg("$output", "f", "[$node] reboot failed,without deployment process, stop at $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage"); + probe_utils->send_msg("$output", "f", "[$node] reboot failed, without deployment process, stop at $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match-1]} stage, something wrong during $state_set_reverse{$valid_process{$match_result{$max_match}[0]}{process}[$max_match]} stage"); } } } @@ -680,7 +679,7 @@ sub do_monitor { my $rst = 0; my $startline = "------------------------------------------------------------- -Start to capture every message during os provision process...... +Start capturing every message during OS provision process...... ------------------------------------------------------------- "; @@ -717,7 +716,7 @@ Start to capture every message during os provision process...... if (!-e "$clusterlog") { probe_utils->send_msg("$output", "w", "$clusterlog doesn't exist"); - probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x is using, please ignore above warning"); + probe_utils->send_msg("$output", "i", "If using SLES11 or xCAT2.11.x, ignore above warning"); } else { if (!($clusterpid = open(CLUSTERLOGFILE, "tail -f -n 0 $clusterlog 2>&1 |"))) { probe_utils->send_msg("$output", "f", "Can't open $clusterlog to get logs"); @@ -736,7 +735,7 @@ Start to capture every message during os provision process...... } if (!-e "$computelog") { probe_utils->send_msg("$output", "w", "$computelog doesn't exist"); - probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x is using, please ignore above warning"); + probe_utils->send_msg("$output", "i", "If sles11 or xCAT2.11.x, ignore above warning"); } else { if (!($computerpid = open(COMPUTERFILE, "tail -f -n 0 $computelog 2>&1 |"))) { probe_utils->send_msg("$output", "f", "Can't open $computelog to get logs"); @@ -792,13 +791,13 @@ Start to capture every message during os provision process...... if ($terminal) { probe_utils->send_msg("$output", "d", "Get INT or TERM signal from STDIN"); } else { - probe_utils->send_msg("$output", "o", "All nodes need to monitor have finished os provision process"); + probe_utils->send_msg("$output", "o", "All nodes specified to monitor, have finished OS provision process"); } last; } if (time() - $starttime > ($maxwaittime * 60)) { - probe_utils->send_msg("$output", "i", "$maxwaittime minutes are expired, stop monitor"); + probe_utils->send_msg("$output", "i", "$maxwaittime minutes have expired, stop monitoring"); last; } sleep 0.01; @@ -959,7 +958,7 @@ sub do_replay { my $ref_timestamp = shift; my $timestr = scalar(localtime($ref_timestamp)); - print "Start to search logs after '$timestr', please waiting for a while.............\n"; + print "Start logs search after '$timestr', waiting for a while.............\n"; my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst) = localtime(time()); my $epoch_seconds_of_now = time(); @@ -1013,12 +1012,12 @@ if ($help) { } if ($test) { - probe_utils->send_msg("$output", "o", "Do probe for os provision process, realtime monitor of os provision process."); + probe_utils->send_msg("$output", "o", "Probe for OS provision process, realtime monitor of OS provision process."); exit 0; } unless ($noderange) { - probe_utils->send_msg("$output", "f", "A noderange is needed"); + probe_utils->send_msg("$output", "f", "A noderange is required"); probe_utils->send_msg("$output", "d", "$::USAGE"); exit 1; } @@ -1032,7 +1031,7 @@ if ($replaylog) { } elsif ($replaylog =~ /^(\d+)m$/) { $epoch_starttime -= $1 * 60; } else { - probe_utils->send_msg("$output", "f", "Unsupport time format for replay history log"); + probe_utils->send_msg("$output", "f", "Unsupported time format for history log replay"); print "$::USAGE"; exit 1; } @@ -1053,7 +1052,7 @@ unless ($installnic) { $installnic = `ip addr |grep -B2 $masteripinsite|awk -F" " '/mtu/{gsub(/:/,"",\$2); print \$2}'`; chomp($installnic); if (!$installnic) { - probe_utils->send_msg("$output", "f", "The value of master in site table is $masteripinsite, can't get corresponding network interface"); + probe_utils->send_msg("$output", "f", "The value of 'master' in 'site' table is $masteripinsite, can't get corresponding network interface"); $rst = 1; } else { probe_utils->send_msg("$output", "i", "The installation network interface is $installnic"); diff --git a/xCAT-probe/subcmds/switch-macmap b/xCAT-probe/subcmds/switch-macmap index ca567a26ea..fbbb0cc6ed 100755 --- a/xCAT-probe/subcmds/switch-macmap +++ b/xCAT-probe/subcmds/switch-macmap @@ -23,8 +23,8 @@ Description: Currently, this command does not support hierarchy. Options: - -c: To check whether the switch is OK to retrieve MAC address mapping. - -V: Output verbose information when accessing switch + -c: Check if the switch is OK to retrieve MAC address mapping. + -V: Output verbose information when accessing the switch "; my $help; @@ -36,13 +36,13 @@ if (!GetOptions("help|h" => \$help, "T" => \$test, "c" => \$check, "V" => \$verbose)) { - probe_utils->send_msg("$output", "f", "Option not support"); + probe_utils->send_msg("$output", "f", "Option not supported"); probe_utils->send_msg("$output", "d", $::USAGE); exit 1; } foreach (@ARGV) { if (/^-\w*/) { - probe_utils->send_msg("$output", "f", "Option $_ not support"); + probe_utils->send_msg("$output", "f", "Option $_ not supported"); exit 1; } else { push @nodes, $_; @@ -63,10 +63,10 @@ if (!-e "$currdir/bin/switchprobe") { if ($test) { `$currdir/bin/switchprobe -h`; if ($?) { - probe_utils->send_msg("$output", "f", "No switchprobe tool is available at $currdir/bin/"); + probe_utils->send_msg("$output", "f", "No 'switchprobe' tool is available at $currdir/bin/"); exit 1; } else { - probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. Currently, this command does not support hierarchy."); + probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in 'switches' table in xCAT db. Currently, this command does not support hierarchy."); exit 0; } } diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 8a28b045e4..6890bfc8f2 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -35,8 +35,8 @@ my @tmpargv; # below are some options rules used by default # -h : Get usage information of current sub command # -V : Output more information for debug -# -T : To verify if $program_name can work, reserve option for probe framework, dosen't use by customer -# -n : In xCAT probe, -n is uesd to specify node range uniformly +# -T : To verify if $program_name can work, reserved option for probe framework, not for use by customer +# -n : In xCAT probe, -n is used to specify node range uniformly #-------------------------------- $::USAGE = "Usage: $program_name -h @@ -44,12 +44,12 @@ $::USAGE = "Usage: Description: After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. - For hierarchical cluster, just support that the provision network is in the same network with management node. If in the different nework, please ignore the results. + For hierarchical cluster, only the provision network on the same network as the management node is supported. If in the different network, ignore the results. Options: -h : Get usage information of $program_name -V : Output more information for debug - -i : Required. Specify the network interface name of provision network on Management Node + -i : Required. Specify the network interface name of provision network on management node "; @@ -171,9 +171,9 @@ sub do_main_job { my $masteripinsite = `lsdef -t site -i master -c | awk -F'=' '{print \$2}'`; chomp($masteripinsite); probe_utils->send_msg($outputtarget, "d", "The value of 'master' in 'site' table is $masteripinsite") if ($verbose); - probe_utils->send_msg($outputtarget, "f", "There isn't 'master' definition in 'site' talbe") if ($masteripinsite eq ""); + probe_utils->send_msg($outputtarget, "f", "There isn't 'master' definition in 'site' table") if ($masteripinsite eq ""); - $msg = "The value of 'master' in 'site' table is a IP address"; + $msg = "The value of 'master' in 'site' table is an IP address"; if (probe_utils->is_ip_addr("$masteripinsite")) { probe_utils->send_msg($outputtarget, "o", "$msg"); } else { @@ -188,18 +188,18 @@ sub do_main_job { my $nics = `ip addr show $installnic >/dev/null 2>&1`; if ($?) { probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Please use 'ip addr show' to check if there is NIC named $installnic on current server"); + probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is NIC named $installnic on current server"); return 1; } else { probe_utils->send_msg($outputtarget, "o", "$msg"); } - $msg = "Get ip address of NIC $installnic"; + $msg = "Get IP address of NIC $installnic"; $serverip = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; chomp($serverip); if (!defined($serverip) || ($serverip eq "")) { probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Please use 'ip addr show' to check if there is ip assigned to $installnic"); + probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is IP assigned to $installnic"); return 1; } else { probe_utils->send_msg($outputtarget, "d", "The IP of NIC $installnic is $serverip") if ($verbose); @@ -220,7 +220,7 @@ sub do_main_job { if (probe_utils->is_static_ip("$serverip", "$installnic")) { probe_utils->send_msg($outputtarget, "o", "$msg"); } else { - probe_utils->send_msg($outputtarget, "w", "IP $serverip of $installnic is not a static ip on current server"); + probe_utils->send_msg($outputtarget, "w", "IP $serverip of $installnic is not a static IP on current server"); } } else { @@ -236,7 +236,7 @@ sub do_main_job { } } - $msg = "Get ip address that in the same network with master $masteripinsite"; + $msg = "Get IP address that on the same network as master $masteripinsite"; if (!defined($serverip) || ($serverip eq "")) { probe_utils->send_msg($outputtarget, "f", "$msg"); return 1; @@ -280,13 +280,13 @@ sub do_main_job { $rst = 1; } - $msg = "There is configuration in 'passwd' table for 'system' for node provision"; + $msg = "There is a configuration in 'passwd' table for 'system' for node provisioning"; my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; chomp($passwd); my ($username, $pw) = split(" ", $passwd); if ($username eq "" || $pw eq "") { probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Please define username and password for 'system' in 'passwd' table"); + probe_utils->send_msg($outputtarget, "d", "Define username and password for 'system' in 'passwd' table"); $rst = 1; } else { probe_utils->send_msg($outputtarget, "o", "$msg"); @@ -297,7 +297,7 @@ sub do_main_job { probe_utils->send_msg($outputtarget, "d", "The 'install' directory is set to $installdir in 'site' table on current server") if ($verbose); my $tftpdir = `lsdef -t site -i tftpdir -c | awk -F'=' '{print \$2}'`; chomp($tftpdir); - probe_utils->send_msg($outputtarget, "d", "The 'tftp' directory is set to $tftpdir in 'site' talbe on current server") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "The 'tftp' directory is set to $tftpdir in 'site' table on current server") if ($verbose); $msg = "There is $installdir directory on current server"; if (-e "$installdir/postscripts/") { @@ -321,7 +321,7 @@ sub do_main_job { } } - $msg = "installdir $installdir is mounted on from the Management Node"; + $msg = "installdir $installdir is mounted from the management node"; if ($mountip eq $masteripinsite) { probe_utils->send_msg($outputtarget, "o", "$msg"); } @@ -353,7 +353,7 @@ sub do_main_job { } } - $msg = "tftpdir $tftpdir is mounted on from the Management Node"; + $msg = "tftpdir $tftpdir is mounted from the management node"; if ($mountip eq $masteripinsite) { probe_utils->send_msg($outputtarget, "o", "$msg"); } @@ -399,7 +399,7 @@ sub do_main_job { `which wget > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "'wget' tool isn't installed, skip checking HTTP service. please install wget then try again"); + probe_utils->send_msg($outputtarget, "w", "'wget' tool isn't installed, skip checking HTTP service. Install 'wget' then try again"); } else { $msg = "HTTP service is ready on $serverip"; if (probe_utils->is_http_ready("$serverip")) { @@ -426,7 +426,7 @@ sub do_main_job { if ($checktftp) { `which tftp > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "'tftp' tool isn't installed, skip checking tftp service. Please install tftp then try again"); + probe_utils->send_msg($outputtarget, "w", "'tftp' tool isn't installed, skip checking tftp service. Install 'tftp' then try again"); } else { $msg = "TFTP service is ready on $serverip"; if (probe_utils->is_tftp_ready("$serverip")) { @@ -452,7 +452,7 @@ sub do_main_job { if ($checkdns) { `which nslookup > /dev/null 2>&1`; if ($?) { - probe_utils->send_msg($outputtarget, "w", "'nslookup' tool isn't installed, skip checking DNS service. please install nslookup then try again"); + probe_utils->send_msg($outputtarget, "w", "'nslookup' tool isn't installed, skip checking DNS service. Install 'nslookup' then try again"); } else { $msg = "DNS server is ready on $serverip"; probe_utils->send_msg($outputtarget, "d", "Domain used to check DNS is $domain") if ($verbose); @@ -573,12 +573,12 @@ sub do_main_job { $tmpmac = $1; if ($tmpmac !~ $snmac) { returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); $rc = 1; } } else { returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); $rc = 1; } } else { @@ -586,7 +586,7 @@ sub do_main_job { my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; if ($?) { returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "Simulate a node by chdef failed") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "Node simulation by 'chdef' has failed") if ($verbose); $rc = 1; last; } else { @@ -603,31 +603,31 @@ sub do_main_job { $tmp = `makedhcp xcatmntest 2>&1`; if ($?) { returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); $rc = 1; `rmdef xcatmntest`; last; } - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); $tmp = `makedhcp -q xcatmntest`; if ($?) { returncmdoutput($tmp, $outputtarget) if ($verbose); probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; + `makedhcp -d xcatmntest && rmdef xcatmntest`; last; } chomp($tmp); if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server's reply is wrong") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); $rc = 1; `makedhcp -d xcatmntest && rmdef xcatmntest`; last; } - probe_utils->send_msg($outputtarget, "d", "Start to clear simulate information for dhcp test") if ($verbose); + probe_utils->send_msg($outputtarget, "d", "Start clearing simulation information for dhcp test") if ($verbose); $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; returncmdoutput($tmp, $outputtarget) if ($verbose); @@ -637,7 +637,7 @@ sub do_main_job { } if ($rc) { probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "please run 'makedhcp -n' if never run it before."); + probe_utils->send_msg($outputtarget, "d", "Run 'makedhcp -n' if it has not been ran before."); $rst = 1; } else { probe_utils->send_msg($outputtarget, "o", "$msg"); @@ -750,7 +750,7 @@ sub caclulate_dispatch_cmd { if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); } else { - probe_utils->send_msg("$output", "f", "There is error in command line attribute node range, please using nodels to check"); + probe_utils->send_msg("$output", "f", "There is an error in command line attribute node range, use 'nodels' to check"); } return 1; } else { @@ -838,7 +838,7 @@ if ($help) { } if ($test) { - probe_utils->send_msg("$output", "o", "After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. Before using this command, please install tftp, nslookup and wget commands ahead. The platform supported are redhat, sles and ubuntu."); + probe_utils->send_msg("$output", "o", "After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. Before using this command, install 'tftp', 'nslookup' and 'wget' commands. Supported platforms are RedHat, SLES and Ubuntu."); exit 0; } diff --git a/xCAT-probe/xcatprobe b/xCAT-probe/xcatprobe index 6cd0b5e95b..dae96b42a1 100755 --- a/xCAT-probe/xcatprobe +++ b/xCAT-probe/xcatprobe @@ -31,7 +31,7 @@ Options: -h : get usage information of $program_name -l : list all valid sub commands -V : print verbose information of $program_name - -w : show each line completely. by default if one is too long, the long part will be omitted. + -w : show each line completely. By default long lines are truncated. "; #----------------------------------- @@ -275,7 +275,7 @@ if ($ARGV[0] eq "-l") { } if (!defined($pluginname)) { - print "There isn't sub command input from command line, please use '-l' to list all valid subcommand\n"; + print "There isn't sub command input from command line, use '-l' to list all valid subcommand\n"; exit 0; } From 8abf2b0334301bcb9f92712b245ab12fd15350da Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 16 Aug 2016 14:34:32 -0400 Subject: [PATCH 131/391] Provide Security Notice for Vulnerability created on 2016-08-15 --- docs/source/security/2016/20160815_openssl.rst | 18 ++++++++++++++++++ docs/source/security/2016/index.rst | 1 + 2 files changed, 19 insertions(+) create mode 100644 docs/source/security/2016/20160815_openssl.rst diff --git a/docs/source/security/2016/20160815_openssl.rst b/docs/source/security/2016/20160815_openssl.rst new file mode 100644 index 0000000000..1a99c972d8 --- /dev/null +++ b/docs/source/security/2016/20160815_openssl.rst @@ -0,0 +1,18 @@ +2016-08-16 - OpenSSL Vulnerabilities +==================================== + +This vulnerability has no fix available at this time (other then mentioned patches below) + +Issue: https://bugzilla.redhat.com/show_bug.cgi?id=1359615 + +Patch: https://github.com/openssl/openssl/commit/0ed26acce328ec16a3aa635f1ca37365e8c7403a + +Advisory CVEs +------------- + +`CVE-2016-2180 `_ - OpenSSL is vulnerable to a denial of service, caused by an out-of-bounds read in the TS_OBJ_print_bio function. + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. It is highly recommended to keep your OpenSSL levels up-to-date to prevent any potential security threats. diff --git a/docs/source/security/2016/index.rst b/docs/source/security/2016/index.rst index 3017c40ddd..3a564ae525 100644 --- a/docs/source/security/2016/index.rst +++ b/docs/source/security/2016/index.rst @@ -8,3 +8,4 @@ 20160301_openssl.rst 20160128_openssl.rst 20160115_openssl.rst + 20160815_openssl.rst From 60f54f7fb2addb0bdf24defcadca42d31990c12f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 Aug 2016 20:34:15 -0400 Subject: [PATCH 132/391] Support --resize option for chvm (#1598) * Support --resize option for chvm * Handle generic error from libvirt when resizing VM * Improve finding the disk to resize --- .../admin-guides/references/man1/chvm.1.rst | 18 ++++-- xCAT-client/pods/man1/chvm.1.pod | 14 +++-- xCAT-server/lib/xcat/plugins/kvm.pm | 60 ++++++++++++++++++- 3 files changed, 80 insertions(+), 12 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/chvm.1.rst b/docs/source/guides/admin-guides/references/man1/chvm.1.rst index 056aa31e36..bd81a7f173 100644 --- a/docs/source/guides/admin-guides/references/man1/chvm.1.rst +++ b/docs/source/guides/admin-guides/references/man1/chvm.1.rst @@ -62,7 +62,7 @@ VMware/KVM specific: ==================== -\ **chvm**\ \ *noderange*\ [\ **-a**\ \ *size*\ ] [\ **-d**\ \ *disk*\ ] [\ **-p**\ \ *disk*\ ] [\ **-**\ **-resize**\ \ **disk**\ =\ *size*\ ] [\ **-**\ **-cpus**\ \ *count*\ ] [\ **-**\ **-mem**\ \ *memory*\ ] +\ **chvm**\ \ *noderange*\ [\ **-a**\ \ *size*\ ] [\ **-d**\ \ *disk*\ ] [\ **-p**\ \ *disk*\ ] [\ **-**\ **-resize**\ \ *disk*\ =\ *size*\ ] [\ **-**\ **-cpus**\ \ *count*\ ] [\ **-**\ **-mem**\ \ *memory*\ ] zVM specific: @@ -318,7 +318,7 @@ VMware/KVM specific: \ **-d**\ \ *disk*\ - Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB. + Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. @@ -330,13 +330,13 @@ VMware/KVM specific: \ **-p**\ \ *disk*\ - Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB. + Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. -\ **-**\ **-resize**\ \ **disk**\ =\ *size*\ +\ **-**\ **-resize**\ \ *disk*\ =\ *size*\ - Change the size of the Hard disk. The disk can never be set to less than it's current size. Multiple disks can be resized to \ *size*\ by using comma separated values on the left side of \ **=**\ . The disks are specified by SCSI id. Size defaults to GB. + Change the size of the Hard disk. The disk in \ *qcow2*\ format can not be set to less than it's current size. The disk in \ *raw*\ format can be resized smaller, please use caution. Multiple disks can be resized by using comma separated \ *disk*\ \ **=**\ \ *size*\ pairs. The disks are specified by SCSI id. Size defaults to GB. @@ -976,6 +976,14 @@ Output is similar to: gpok3: Replacing user entry of LNX3... Done +8. To resize virtual machine's disk sdb to 10G and sdc to 15G: + + +.. code-block:: perl + + chvm gpok3 --resize sdb=10G,sdc=15G + + ***** diff --git a/xCAT-client/pods/man1/chvm.1.pod b/xCAT-client/pods/man1/chvm.1.pod index 4a52a7a38b..615ec1fca6 100644 --- a/xCAT-client/pods/man1/chvm.1.pod +++ b/xCAT-client/pods/man1/chvm.1.pod @@ -38,7 +38,7 @@ B I [B<--devdetach> I...] =head2 VMware/KVM specific: -B I [B<-a> I] [B<-d> I] [B<-p> I] [B<--resize> B=I] [B<--cpus> I] [B<--mem> I] +B I [B<-a> I] [B<-d> I] [B<-p> I] [B<--resize> I=I] [B<--cpus> I] [B<--mem> I] =head2 zVM specific: @@ -236,7 +236,7 @@ Set the number of CPUs. =item B<-d> I -Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB. +Deregister the Hard disk but leave the backing files. Multiple can be done with comma separated values. The disks are specified by SCSI id. =item B<--mem> I @@ -244,11 +244,11 @@ Set the memory, defaults to MB. =item B<-p> I -Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. Size defaults to GB. +Purge the Hard disk. Deregisters and deletes the files. Multiple can be done with comma separated values. The disks are specified by SCSI id. -=item B<--resize> B=I +=item B<--resize> I=I -Change the size of the Hard disk. The disk can never be set to less than it's current size. Multiple disks can be resized to I by using comma separated values on the left side of B<=>. The disks are specified by SCSI id. Size defaults to GB. +Change the size of the Hard disk. The disk in I format can not be set to less than it's current size. The disk in I format can be resized smaller, please use caution. Multiple disks can be resized by using comma separated IB<=>I pairs. The disks are specified by SCSI id. Size defaults to GB. =back @@ -640,6 +640,10 @@ Output is similar to: gpok3: Replacing user entry of LNX3... Done +8. To resize virtual machine's disk sdb to 10G and sdc to 15G: + + chvm gpok3 --resize sdb=10G,sdc=15G + =head1 FILES /opt/xcat/bin/chvm diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index d0d8eab119..32b73c72ae 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1807,7 +1807,7 @@ sub rmvm { sub chvm { shift; my @addsizes; - my %resize; + my $resize; my $cpucount; my @purge; my @derefdisks; @@ -1831,7 +1831,7 @@ sub chvm { "eject" => \$eject, "cpus|cpu=s" => \$cpucount, "p=s" => \@purge, - "resize=s%" => \%resize, + "resize=s" => \$resize, "cpupin=s" => \$pcpuset, "membind=s" => \$numanodeset, "devpassthru=s" => \$passthrudevices, @@ -2096,6 +2096,62 @@ sub chvm { $updatetable->{kvm_nodedata}->{$node}->{xml} = $vmxml; } } + if ($resize) { + my $shrinking_not_supported = "qcow2 doesn't support shrinking images yet"; + # Get a list of disk=size pairs + my @resize_disks = split(/,/, $resize); + for my $single_disk (@resize_disks) { + # For each comma separated disk, get disk name and the size to change it to + my ($disk_to_resize, $value) = split(/=/, $single_disk); + if ($disk_to_resize) { + unless (exists $useddisks{$disk_to_resize}) { + # Disk name given does not match any disks for this vm + xCAT::SvrUtils::sendmsg([ 1, "Disk $disk_to_resize does not exist" ], $callback, $node); + next; + } + # Get desired (new) disk size + $value = getUnits($value, "G", 1); + # Now search kvm_nodedata table to find the volume for this disk + my $myxml = $parser->parse_string($vmxml); + my @alldisks = $myxml->findnodes("/domain/devices/disk"); + # Look through all the disk entries + foreach my $disknode (@alldisks) { + my $devicetype = $disknode->getAttribute("device"); + # Skip cdrom devices + if ($devicetype eq "cdrom") { next; } + # Get name of the disk + my $diskname = $disknode->findnodes('./target')->[0]->getAttribute('dev'); + # Is this a disk we were looking for to resize ? + if ($diskname eq $disk_to_resize) { + my $file = $disknode->findnodes('./source')->[0]->getAttribute('file'); + my $vol = $hypconn->get_storage_volume_by_path($file); + if ($vol) { + # Always pass RESIZE_SHRINK flag to resize(). It is required when shrinking + # the volume size and is ignored when growing volume size + eval { + $vol->resize($value, &Sys::Virt::StorageVol::RESIZE_SHRINK); + }; + if ($@) { + if ($@ =~ /$shrinking_not_supported/) { + # qcow2 does not support shrinking volumes, display more readable error + xCAT::SvrUtils::sendmsg([ 1, "Resizing disk $disk_to_resize failed, $shrinking_not_supported" ], $callback, $node); + } + else { + # some other resize error from libvirt, just display it + xCAT::SvrUtils::sendmsg([ 1, "Resizing disk $disk_to_resize failed, $@" ], $callback, $node); + } + } + else { + # success + xCAT::SvrUtils::sendmsg([ 0, "Resized disk $disk_to_resize" ], $callback, $node); + } + } + last; # Found the disk we were looking for. Go to the next disk. + } + } + } + } + } if ($cpucount or $memory) { if ($currstate eq 'on') { if ($cpucount) { xCAT::SvrUtils::sendmsg([ 1, "Hot add of cpus not supported (VM must be powered down to successfuly change)" ], $callback, $node); } From 758b1c9b96311c22b2fa2de5d3c2faae4a183b6d Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 17 Aug 2016 01:36:02 -0400 Subject: [PATCH 133/391] Remove the Debian Support Message in the xcatprobe command. --- xCAT-probe/subcmds/detect_dhcpd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/detect_dhcpd b/xCAT-probe/subcmds/detect_dhcpd index b8430761ee..c95f784c80 100755 --- a/xCAT-probe/subcmds/detect_dhcpd +++ b/xCAT-probe/subcmds/detect_dhcpd @@ -59,7 +59,7 @@ if ($::HELP) { } if ($::TEST) { - probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, install 'tcpdump' command. The operating system supported are RedHat, SLES, Ubuntu and Debian."); + probe_utils->send_msg("$output", "o", "$program_name can be used to detect the dhcp server in a network for a specific mac address. Before using this command, install 'tcpdump' command. The operating system supported are RedHat, SLES and Ubuntu."); exit 0; } @@ -104,11 +104,11 @@ if (-f "/etc/redhat-release") { $os = "sles"; } elsif (-f "/etc/lsb-release") { $os = "ubuntu"; -} elsif (-f "/etc/debian_version") { - $os = "debian"; +#} elsif (-f "/etc/debian_version") { +# $os = "debian"; } else { probe_utils->send_msg("$output", "f", $msg); - probe_utils->send_msg("$output", "d", "Only support the RedHat, SLES, Ubuntu and Debian OS"); + probe_utils->send_msg("$output", "d", "Only support the RedHat, SLES and Ubuntu."); exit 1; } probe_utils->send_msg("$output", "d", "Current operating system is $os") if ($::VERBOSE); From b0f59c3757389ffa0b5db60a2947f911337636d1 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 17 Aug 2016 13:47:15 +0800 Subject: [PATCH 134/391] [xcat-wizard] User-interface text tweaking based on Victor's suggestion --- .../share/xcat/tools/wizard/xcat-wizard | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xCAT-server/share/xcat/tools/wizard/xcat-wizard b/xCAT-server/share/xcat/tools/wizard/xcat-wizard index 6d2f7e04a4..32ec1cbe39 100755 --- a/xCAT-server/share/xcat/tools/wizard/xcat-wizard +++ b/xCAT-server/share/xcat/tools/wizard/xcat-wizard @@ -8,7 +8,7 @@ function step_0100_welcome() --title 'Welcome' \ --cr-wrap \ --yesno \ - "Welcome to use xCAT Wizard.\n\nDuring this wizard session, a bunch of questions are going to be asked. Based on the answers of these questions, xCAT will be configured afterward." \ + "Welcome to use xCAT Wizard.\n\nBy answering a series of questions, this wizard will help assist in the configuration of xCAT." \ 18 72 ret="$?" case "${ret}" in @@ -19,14 +19,14 @@ function step_0100_welcome() esac } -function step_0200_how_many_nodes() +function step_0200_cluster_size() { local -i ret=0 exec 3>&1 XCAT_WIZARD_0200_NODES="$(dialog --backtitle 'xCAT Wizard' \ --ok-label 'Next' --cancel-label 'Prev' \ --extra-button --extra-label 'Skip' \ - --title 'How many nodes' \ + --title 'Cluster size' \ --inputbox \ "In the cluster of which this xCAT management node will manage, how many nodes are plan to have? Based on the number of this answer, xCAT Wizard will do some optimization and performance tunning.\n\nA precise number is not needed, but please enter a rough number below." \ 18 72 "${XCAT_WIZARD_0200_NODES:-100}" \ @@ -122,7 +122,7 @@ function step_0300_network_adapter() esac } -function step_0400_act_as_dns_server() +function step_0400_configure_name_server() { local -i ret=0 local use_external_dns="" @@ -131,7 +131,7 @@ function step_0400_act_as_dns_server() --ok-label 'Next' --cancel-label 'Prev' \ --extra-button --extra-label 'Skip' \ --default-item "${XCAT_WIZARD_0400_DNS_SERVER}" \ - --title 'Be primary master name server?' \ + --title 'Configure name server' \ --menu \ "Will this cluster have a separate DNS subdomain?\n\nIf you only have a small amount of nodes in this cluster, use external DNS server to do all the name resolution may be preferred. In this case, either all nodes in this cluster can be resolved with external DNS server, or a simple /etc/hosts file will be used to do all the name resolving in this cluster.\n\nOn the other hand, If you have a really large cluster with a great number of nodes, use a separate DNS subdomain for the whole cluster may be a good idea. In this case, this management node will act as the primary master name server of this subdomain." \ 20 74 14 \ @@ -216,7 +216,7 @@ function step_0600_dns_domain_name() esac } -function step_0700_name_servers() +function step_0700_dns_servers() { local -i ret=0 local -a nameservers=() @@ -329,15 +329,15 @@ function step_0800_ntp_servers() esac } -function step_9900_accomplished() +function step_9900_summary() { local -i ret=0 dialog --backtitle 'xCAT Wizard' \ --yes-label 'Okay' --no-label 'Prev' \ - --title 'Accomplished' \ + --title 'Summary' \ --cr-wrap \ --yesno \ - "The basic configuration of xCAT is accomplished. You may continue setup the cluster by refer the document below.\n\nhttps://xcat-docs.readthedocs.io/en/stable/guides/admin-guides/" \ + "The basic configuration of xCAT is complete. Refer to the xCAT documentation for more information at:\n\nhttps://xcat-docs.readthedocs.io/" \ 18 72 ret="$?" case "${ret}" in From 4d65a9fc3fc67711f0d438e510d2f23ba3567ebc Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 17 Aug 2016 14:00:45 +0800 Subject: [PATCH 135/391] [xcat-wizard] Flow diagram --- xCAT-server/share/xcat/tools/wizard/README | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/xCAT-server/share/xcat/tools/wizard/README b/xCAT-server/share/xcat/tools/wizard/README index e69de29bb2..2e6a763ed6 100644 --- a/xCAT-server/share/xcat/tools/wizard/README +++ b/xCAT-server/share/xcat/tools/wizard/README @@ -0,0 +1,48 @@ +xCAT Wizard + + - - - - - - + + +-------------+ Do service + | Welcome | + - ->| node stuff | + +-------------+ - - - - - - - + | >= 500 + v + +-------------+ | + |Cluster size |- - - + +-------------+ + | + v + +-------------+ + | Network | + | adapter | + +-------------+ + | + v + +-------------+ + | Configure | + | name server | + +-------------+ + | + v + +-------------+ + | Hostname | + +-------------+ + | + v + +-------------+ + | DNS domain | + | name | + +-------------+ + | + v + +-------------+ + | DNS servers | + +-------------+ + | + v + +-------------+ + | NTP servers | + +-------------+ + | + v + +-------------+ + | Summary | + +-------------+ From 6c43f8f716ae3b228806588a19d41e58ee1646b5 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 17 Aug 2016 02:55:28 -0400 Subject: [PATCH 136/391] run mknb for both ppc64 and x86_64 --- xCAT-server/sbin/xcatconfig | 48 +++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 2686e9b98d..e960e16400 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1911,7 +1911,8 @@ sub setupLinuxexports Creates a network boot root image on Linux Run mknb to put xCAT-genesis-scripts-x86_64 and xCAT-genesis-base-x86_64 together and in /tftpboot - + From 2.12.2, both xCAT-genesis-scripts-x86_64 and xCAT-genesis-scripts-ppc64 will be installed. + So, will run mknb twice, one for ppc64 and another for x86_64 =cut #----------------------------------------------------------------------------- @@ -1920,35 +1921,30 @@ sub mknb # The xCAT-genesis-scripts.spec file touches /etc/xcat/genesis-scripts-updated or # the xCAT-genesis-base.spec file touches /etc/xcat/genesis-base-updated, # so we know to run mknb here. - my $cmd; - if ($::arch =~ /ppc/) { - $::arch = "ppc64"; - } - if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-scripts-updated')) { + my $cmd = "$::XCATROOT/sbin/mknb"; + my $run_mknb = 0; + if (-f '/etc/xcat/genesis-scripts-updated') { unlink '/etc/xcat/genesis-scripts-updated'; - - # Do not print messages or run command twice - if (-f '/etc/xcat/genesis-base-updated') { - unlink '/etc/xcat/genesis-base-updated'; - } - $cmd = "$::XCATROOT/sbin/mknb $::arch"; - xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-$::arch ..."); + $run_mknb = 1; + xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts ..."); } - if ((($::arch eq "x86_64") || ($::arch =~ /ppc/)) && (-f '/etc/xcat/genesis-base-updated')) { + if (-f '/etc/xcat/genesis-base-updated') { unlink '/etc/xcat/genesis-base-updated'; - $cmd = "$::XCATROOT/sbin/mknb $::arch"; - xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base-$::arch ..."); - } - - # my $outref = xCAT::Utils->runcmd("$cmd", 0); - if ($cmd) { - system($cmd); - if ($? != 0) { - my $rc = $? >> 8; - xCAT::MsgUtils->message('E', "The 'mknb $::arch' command returned error code: $rc."); + unless ($run_mknb) { + $run_mknb = 1; + xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-base ..."); } - else { - xCAT::MsgUtils->message('I', "The 'mknb $::arch' command completed successfully."); + } + if ($run_mknb) { + foreach (qw(ppc64 x86_64)) { + system("$cmd $_"); + if ($? != 0) { + my $rc = $? >> 8; + xCAT::MsgUtils->message('E', "The 'mknb $_' command returned error code: $rc."); + } + else { + xCAT::MsgUtils->message('I', "The 'mknb $_' command completed successfully."); + } } } } From 823e1380993d49d575ce4888bd830d4024d2f12a Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 17 Aug 2016 04:04:53 -0400 Subject: [PATCH 137/391] add cases for the packimage -m -c option --- xCAT-test/autotest/testcase/packimg/cases0 | 292 +++++++++++++++++++++ 1 file changed, 292 insertions(+) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index aeca509eac..5029ab9d77 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -69,3 +69,295 @@ cmd:packimage -v check:output=~version|Version end +start:packimage_m_cpio_c_gzip +os:Linux +description:test packimage -m cpio -c gzip +cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c gzip +check:rc==0 +check:output=~archive method:cpio +check:output=~compress method:gzip +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_cpio_c_pigz +os:Linux +description:test packimage -m cpio -c pigz +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:if grep SUSE /etc/*release;then zypper install -y pigz;fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then apt-get install pigz -y; fi +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c pigz +check:rc==0 +check:output=~archive method:cpio +check:output=~compress method:pigz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_cpio_c_xz +os:Linux +description:test packimage -m cpio -c xz +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz /rootimg.cpio.xz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c xz +check:rc==0 +check:output=~archive method:cpio +check:output=~compress method:xz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz +cmd:mv -f /rootimg.cpio.xz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.xz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_tar_c_pigz +os:Linux +description:test packimage -m tar -c pigz +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:if grep SUSE /etc/*release;then zypper install -y pigz;fi +check:rc==0 +cmd:if grep Ubuntu /etc/*release;then apt-get install pigz -y; fi +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c pigz +check:rc==0 +check:output=~archive method:tar +check:output=~compress method:pigz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:mv -f /rootimg.tar.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_tar_c_gzip +os:Linux +description:test packimage -m tar -c gzip +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz /rootimg.tar.gz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c gzip +check:rc==0 +check:output=~archive method:tar +check:output=~compress method:gzip +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:mv -f /rootimg.tar.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.gz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_tar_c_xz +os:Linux +description:test packimage -m tar -c xz +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz /rootimg.tar.xz.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c xz +check:rc==0 +check:output=~archive method:tar +check:output=~compress method:xz +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz +check:rc==0 +cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi +check:rc==0 +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN mount +check:rc==0 +check:output=~on / type tmpfs +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz +cmd:mv -f /rootimg.tar.xz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.tar.xz +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_invalid_archive_method +os:Linux +description:test packimage with invalid archive method +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m invalid +check:rc!=0 +check:output=~Error: Invalid archive method 'invalid' requested +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + +start:packimage_m_invalid_compress_method +os:Linux +description:test packimage with invalid compress method +#cmd:copycds $$ISO +cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +check:rc==0 +cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -c invalid +check:rc!=0 +check:output=~Error: Invalid compress method 'invalid' requested +cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg +end + From d58495a39194804aabb38a20a4926409015960a1 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 17 Aug 2016 16:21:07 +0800 Subject: [PATCH 138/391] [go-xcat] Fix typo --- xCAT-server/share/xcat/tools/go-xcat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 610bf3ebcf..62b7ed9e6b 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -142,7 +142,7 @@ GO_XCAT_CORE_PACKAGE_LIST=(perl-xCAT xCAT xCAT-SoftLayer xCAT-buildkit # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_CORE_PACKAGE_LIST=(perl-xcat xcat xcat-buildkit xcat-client - xcat-confluent xcat-genesis-scripts-amd64 xcat-genesis-script-ppc64 + xcat-confluent xcat-genesis-scripts-amd64 xcat-genesis-scripts-ppc64 xcat-server xcat-test xcat-vlan xcatsn) GO_XCAT_DEP_PACKAGE_LIST=() @@ -154,7 +154,7 @@ GO_XCAT_INSTALL_LIST=(perl-xCAT xCAT xCAT-buildkit xCAT-client # For Debian/Ubuntu, it will need a sight different package list type dpkg >/dev/null 2>&1 && GO_XCAT_INSTALL_LIST=(perl-xcat xcat xcat-buildkit xcat-client - xcat-genesis-scripts-amd64 xcat-genesis-script-ppc64 xcat-server + xcat-genesis-scripts-amd64 xcat-genesis-scripts-ppc64 xcat-server conserver-xcat elilo-xcat grub2-xcat ipmitool-xcat syslinux-xcat xcat-genesis-base-amd64 xcat-genesis-base-ppc64 xnba-undi) From fe7475b4d0cb4158d662fa5f5f39bc7f07e6c10d Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 17 Aug 2016 05:26:24 -0400 Subject: [PATCH 139/391] modify depending on comments --- xCAT-probe/subcmds/code_template | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index e087ba8af4..a681e9649c 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -108,15 +108,17 @@ sub do_main_job { # A simple example of how to dump %summaryoutput has been written in function #------------------------------------- sub summary_all_jobs_output { + my $rst = 0; #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED - print "\n======================do summary=====================\n"; + probe_utils->send_msg("$output", "d", "======================do summary====================="); foreach my $sn (keys %summaryoutput) { - print "[$sn]\n"; + probe_utils->send_msg("$output", "d", "[$sn]"); foreach my $log (@{ $summaryoutput{$sn} }) { - print "\t$log\n"; + probe_utils->send_msg("$output", "d", "$log"); } } + return $rst; } #------------------------------------- From 7225f2e5866b53300375c84b126d9a45967021b6 Mon Sep 17 00:00:00 2001 From: Matt Ezell Date: Wed, 17 Aug 2016 11:00:18 -0400 Subject: [PATCH 140/391] Protect umount_chroot from running with rootimage_dir undefined --- xCAT-server/share/xcat/netboot/rh/genimage | 6 +++++- xCAT-server/share/xcat/netboot/ubuntu/genimage | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index a56e157b64..95f95351c0 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -70,7 +70,7 @@ my $noupdate; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); - umount_chroot($rootimage_dir); + umount_chroot($rootimg_dir); die @_; } @@ -112,6 +112,10 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; + if ($rootimage_dir eq "") { + print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; + return 1; + } if (majversion($osver) > 6) { system("umount -l $rootimage_dir/proc"); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index e2ba372f0d..112f4a0f8d 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -2094,6 +2094,11 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; + if ($rootimage_dir eq "") { + print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; + return 1; + } + system("umount -l $rootimage_dir/proc"); system("umount -l $rootimage_dir/sys"); From 25865721325cc01661716ce15b4c5b5b6dcda7bd Mon Sep 17 00:00:00 2001 From: Patrick Lundgren Date: Wed, 17 Aug 2016 11:07:54 -0400 Subject: [PATCH 141/391] Added check for GRS hardware current firmware version above 1.7_2.55 (1610A) --- xCAT-server/lib/xcat/plugins/ipmi.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index f9a1a3434d..c8d9335714 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1746,6 +1746,27 @@ sub do_firmware_update { $buffer_size = "15000"; } + # check for 8335-GTB Firmware above 1610A release. If below, exit + if ($output =~ /8335-GTB/) { + $cmd = $pre_cmd . " fru print 47"; + $output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) { + xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], + $callback, $sessdata->{node}, %allerrornodes); + return -1; + } + my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/; + if ($grs_version =~ /\d\.(\d+)_(\d+\.\d+)/) { + my $prim_grs_version = $1; + my $sec_grs_version = $2; + if ($prim_grs_version <= 7 && $sec_grs_version < 2.55) { + xCAT::SvrUtils::sendmsg([ 1, "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55" ], + $callback, $sessdata->{node}, %allerrornodes); + return -1; + } + } + } + # step 1 power off $cmd = $pre_cmd . " chassis power off"; $output = xCAT::Utils->runcmd($cmd, -1); From 13388737ac9fa44fc2f218425eb3dca2d1bc8d96 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 17 Aug 2016 15:02:47 -0400 Subject: [PATCH 142/391] Update create_img.rst Fix type of install on this page --- .../manage_clusters/common/deployment/create_img.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst index c07b65f786..ce750d3465 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst @@ -61,7 +61,7 @@ For ubuntu ppc64le, the initrd.gz shipped with the ISO does not support network * Copy the netboot initrd.gz to osimage :: mkdir -p /install//ppc64el/install/netboot - cp /tmp/iso/install/initrd.gz /install//ppc64el/installe/netboot + cp /tmp/iso/install/initrd.gz /install//ppc64el/install/netboot **[Below tips maybe helpful for you]** From 918127991337d5360710597d60d1b176807bdcf0 Mon Sep 17 00:00:00 2001 From: cxhong Date: Wed, 17 Aug 2016 19:44:19 -0400 Subject: [PATCH 143/391] mysqlsetup failed becuase /usr/bin/mysql_install_db is not available (#1702) * mysqlsetup failed becuase /usr/bin/mysql_install_db is not available * use variable * chang "-e" to "-x" --- xCAT-client/bin/mysqlsetup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index e61857a206..e242ed930d 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -916,7 +916,13 @@ sub initmysqldb } else { - $cmd = "/usr/bin/mysql_install_db --user=mysql"; + my $sqlcmd = "/usr/bin/mysql_install_db"; + if (!(-x ($sqlcmd))) { + xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages"); + exit(1); + } + + $cmd = "$sqlcmd --user=mysql"; } xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) From a4a1706d4444d8bc335c917ef23017b3006a8c45 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 17 Aug 2016 21:49:38 -0400 Subject: [PATCH 144/391] fix bug #1717 [fvt]2.12.2 xcatprobe osdeploy -n could not monitor the node deploy process if message's log : dhcp[process id] --- xCAT-probe/subcmds/osdeploy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 049d125afa..9699414539 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -763,7 +763,7 @@ Start capturing every message during OS provision process...... if ($hdl == \*VARLOGMSGFILE) { chomp($line = ); my @tmp = split(/\s+/, $line); - if ($tmp[4] =~ /dhcpd:/i && $line =~ /$installnic/) { + if ($tmp[4] =~ /dhcpd/i && $line =~ /$installnic/) { handle_dhcp_msg("$line"); } elsif ($tmp[4] =~ /in.tftpd/i) { handle_tftp_msg("$line"); @@ -848,7 +848,7 @@ sub get_valid_logs { } my $ishttplog = 0; - $ishttplog = 1 if ($filename =~ /access[\._]log/); + $ishttplog = 1 if ($filename =~ /access/); foreach my $file (@rotatefiles) { my $fd; @@ -929,7 +929,7 @@ sub get_valid_logs { $timestampepoch = probe_utils->convert_to_epoch_seconds($timestamp, $year, $epoch_seconds_of_now); } - if (($splitline[4] =~ /dhcpd:/i && $_ =~ /$installnic/) + if (($splitline[4] =~ /dhcpd/i && $_ =~ /$installnic/) || ($splitline[4] =~ /in.tftpd/i) || (($splitline[4] =~ /^xcat/i) || ($splitline[5] =~ /^xcat/i)) || ($splitline[5] =~ /GET/ && $splitline[7] =~ /HTTP/)) { @@ -968,7 +968,7 @@ sub do_replay { foreach my $line (@bthistory) { $line =~ s/(\d+) (.+)/$2/g; my @tmp = split(/\s+/, $line); - if ($tmp[4] =~ /dhcpd:/i && $line =~ /$installnic/) { + if ($tmp[4] =~ /dhcpd/i && $line =~ /$installnic/) { handle_dhcp_msg("$line"); } elsif ($tmp[4] =~ /in.tftpd/i) { handle_tftp_msg("$line"); From 8dc30b1e4056259933a5fb9db90c84681c72b1a5 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 18 Aug 2016 03:13:07 -0400 Subject: [PATCH 145/391] add packimage cases in the daily run bundle --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 6 ++++++ xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 6 ++++++ xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 6 ++++++ xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 6 ++++++ xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 6 ++++++ xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 6 ++++++ xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 8 ++++++++ xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 8 ++++++++ 14 files changed, 100 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 50cf777875..17ab440e57 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -299,6 +299,12 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 1ea9aa5443..7130513254 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -205,6 +205,12 @@ nodeset_cmdline nodeset_runimg nodeset_check_warninginfo reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index f2b8df3fc4..2843be128d 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -299,6 +299,12 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 016cc6e184..abca029576 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -23,6 +23,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index b49f7d3d5e..192781e59d 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -205,6 +205,12 @@ nodeset_shell nodeset_cmdline nodeset_runimg reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index a9a3aa760a..cb5e4d8dbc 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -23,6 +23,12 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 8ecfc88662..4886078229 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -22,6 +22,12 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index e87ae4427c..5c9b5b1960 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -33,6 +33,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 908c9e3365..11fd597204 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -25,6 +25,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index de0b6e2943..3eba1e79f1 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -217,3 +217,11 @@ assign_certain_command_permission_systemd sles_migration1 sles_migration2 reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 5e2b828c7d..f2e48965ff 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -23,6 +23,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 94301d77bc..9eaf3f4228 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -23,6 +23,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 28cd9b4c03..6d53f9ed96 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -23,6 +23,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index fe60349549..fb803c3b90 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -23,6 +23,14 @@ packimage_p_a_o packimage_imagename packimage_h packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method pping_h pping_v pping_node From 2d08093120f9c684fe71c6f9965d06063bb4ccbb Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 18 Aug 2016 05:33:05 -0400 Subject: [PATCH 146/391] fix bug #1727, probe sub_command discovery has syntax error in ubuntu --- xCAT-probe/subcmds/discovery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index efdae9901e..4d4859c279 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -204,7 +204,7 @@ sub check_genesis_file { my @file_path = split(' ', $genesis_line); my $elilo_efi = $file_path[1]; my $elilo_path = $file_path[3]; - $elilo_efi =~ s/\${next-server}/$host_ip/i; + $elilo_efi =~ s/\$\{next-server\}/$host_ip/i; $wget_rst = system("wget -q --spider $elilo_efi -T 0.5 -t 3"); if ($wget_rst) { From b90fe2709697bac01b00ddf6f07746d41aedafcc Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 18 Aug 2016 09:29:42 -0400 Subject: [PATCH 147/391] Created the security notices that were on SF for 2015 into the xCAT documentation so we can clean up the GitHub Wiki to remove security notices from that location. I think saving the last 2 years is sufficient and probably should get removed over time. --- .../source/security/2015/20150312_openssl.rst | 20 +++++++++ .../source/security/2015/20150324_openssl.rst | 12 ++++++ .../source/security/2015/20150403_openssl.rst | 14 +++++++ .../source/security/2015/20150519_openssl.rst | 27 ++++++++++++ .../source/security/2015/20150520_openssl.rst | 20 +++++++++ .../source/security/2015/20151203_openssl.rst | 42 +++++++++++++++++++ docs/source/security/2015/index.rst | 12 ++++++ docs/source/security/index.rst | 1 + 8 files changed, 148 insertions(+) create mode 100644 docs/source/security/2015/20150312_openssl.rst create mode 100644 docs/source/security/2015/20150324_openssl.rst create mode 100644 docs/source/security/2015/20150403_openssl.rst create mode 100644 docs/source/security/2015/20150519_openssl.rst create mode 100644 docs/source/security/2015/20150520_openssl.rst create mode 100644 docs/source/security/2015/20151203_openssl.rst create mode 100644 docs/source/security/2015/index.rst diff --git a/docs/source/security/2015/20150312_openssl.rst b/docs/source/security/2015/20150312_openssl.rst new file mode 100644 index 0000000000..698b5e76cc --- /dev/null +++ b/docs/source/security/2015/20150312_openssl.rst @@ -0,0 +1,20 @@ +2015-03-12 - OpenSSL Vulnerabilities (FREAK) +============================================= + +OpenSSL announced security fixes on 01/08/15 in the following bulletin: https://www-origin.openssl.org/news/secadv/20150108.txt + +Advisory CVEs +------------- + +* CVE-2015-0204 **RSA silently downgrades to EXPORT_RSA [Client]** (Severity: Low) + +FREAK vulnerability CVE-2015-0204 is involved when 'RSA_EXPORT' ssl cipher suit is used in ssl server/client. + +Action +------ + +xCAT does not use RSA_EXPORT ciphers for ssl communication by default. However, xCAT does allow user to choose the ciphers from the site.xcatsslciphers attribute. + +Please make sure you do not put RSA_EXPORT related ciphers in this attribute. + +It is recommended that you upgrade openssl to 1.0.1L and upper version for the fix of this problem. Please go to the os distribution to get the latest openssl package. diff --git a/docs/source/security/2015/20150324_openssl.rst b/docs/source/security/2015/20150324_openssl.rst new file mode 100644 index 0000000000..973bfa57fe --- /dev/null +++ b/docs/source/security/2015/20150324_openssl.rst @@ -0,0 +1,12 @@ +2015-03-24 - OpenSSL Vulnerabilities +==================================== + +OpenSSL 1.0.2 introduced the "multiblock" performance improvement. This feature only applies on 64 bit x86 architecture platforms that support AES NI instructions. A defect in the implementation of "multiblock" can cause a segmentation fault within OpenSSL, thus enabling a potential DoS attack. + +This issue affects OpenSSL version: 1.0.2 + + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. Please upgrade OpenSSL to 1.0.2a or higher. diff --git a/docs/source/security/2015/20150403_openssl.rst b/docs/source/security/2015/20150403_openssl.rst new file mode 100644 index 0000000000..12262015cf --- /dev/null +++ b/docs/source/security/2015/20150403_openssl.rst @@ -0,0 +1,14 @@ +2015-04-03 - OpenSSL Vulnerabilities (BAR MITZVAH) +================================================== + +The RC4 Bar mitzvah attack is an attack on the SSL/TLS protocols when both the client and server have RC4 enabled. + +* http://www.darkreading.com/attacks-breaches/ssl-tls-suffers-bar-mitzvah-attack-/d/d-id/1319633 +* http://www.imperva.com/docs/HII_Attacking_SSL_when_using_RC4.pdf. + +Action +------ + +xCAT uses OpenSSL shipped with OS distribution for client-server communication. It does not use RC4 ciphers explicitly. However, it allows user to specify xcatsslciphers on the site table for ssl communication. It is recommended that the user not specify RC4 ciphers to avoid the Bar mitzvah attack. + +It is also recommended that the user go to the OS distribution to get latest OpenSSL package for the fix of this problem. diff --git a/docs/source/security/2015/20150519_openssl.rst b/docs/source/security/2015/20150519_openssl.rst new file mode 100644 index 0000000000..280cf6eb79 --- /dev/null +++ b/docs/source/security/2015/20150519_openssl.rst @@ -0,0 +1,27 @@ +2015-05-19 - OpenSSL Vulnerabilities (VENOM) +============================================ + +Advisory CVEs +------------- + +* CVE-2015-3456 - **(aka VENOM) is a security flaw in the QEMU's Floppy Disk Controller (FDC) emulation.** + +VENOM vulnerability could expose virtual machines on unpatched host systems + +A new vulnerability known as VENOM has been discovered, which could allow an attacker to escape a guest virtual machine (VM) and access the host system along with other VMs running on this system. The VENOM bug could potentially allow an attacker to steal sensitive data on any of the virtual machines on this system and gain elevated access to the host''''s local network and its systems. + +The VENOM bug (CVE-2015-3456) exists in the virtual Floppy Disk Controller for the open-source hypervisor QEMU, which is installed by default in a number of virtualization infrastructures such as Xen hypervisors, the QEMU client, and Kernel-based Virtual Machine (KVM). VENOM does not affect VMware, Microsoft Hyper-V, and Bochs hypervisors. + +* QEMU: http://git.qemu.org/?p=qemu.git;a=commitdiff;h=e907746266721f305d67bc0718795fedee2e824c +* Xen Project: http://xenbits.xen.org/xsa/advisory-133.html +* Red Hat: https://access.redhat.com/articles/1444903 +* SUSE: https://www.suse.com/support/kb/doc.php?id=7016497 +* Ubuntu: http://www.ubuntu.com/usn/usn-2608-1/ + + +Action +------ + +xCAT does not ship any rpms that have QEMU component directly. However xCAT does make system calls to QEMU when doing KVM/Xen visualization. If you are using xCAT to manage KVM or Xen hosts and quests, please get the latest rpms that have QEMU component from the os distro and do a upgrade on both xCAT management node and the KVM/Xen hosts. + + diff --git a/docs/source/security/2015/20150520_openssl.rst b/docs/source/security/2015/20150520_openssl.rst new file mode 100644 index 0000000000..8cbaf20c0f --- /dev/null +++ b/docs/source/security/2015/20150520_openssl.rst @@ -0,0 +1,20 @@ +2015-05-20 - OpenSSL Vulnerabilities (LOGJAM) +============================================= + +A Logjam vulnerability attacks openssl and web services on weak (512-bit) Diffie-Hellman key groups. Please refer to the following documents for details. + +Main site: https://weakdh.org/ + +Server test: https://weakdh.org/sysadmin.html + +Please refer to the following openssl link for more details regarding the fix: https://www.openssl.org/blog/blog/2015/05/20/logjam-freak-upcoming-changes/ + + OpenSSL 1.0.2 users should upgrade to 1.0.2b + OpenSSL 1.0.1 users should upgrade to 1.0.1n + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. It uses the default ciphers from openssl. It also allows the user to customize it through site.xcatsslversion and site.xcatsslciphers. Please make sure you do not enable DH or DHE ciphers. + +Please get the latest openssl package from the os distros and upgrade it on all the xCAT management nodes, the service nodes and xCAT client nodes. diff --git a/docs/source/security/2015/20151203_openssl.rst b/docs/source/security/2015/20151203_openssl.rst new file mode 100644 index 0000000000..da5e9e7725 --- /dev/null +++ b/docs/source/security/2015/20151203_openssl.rst @@ -0,0 +1,42 @@ +2015-12-03 - OpenSSL Vulnerabilities +==================================== + +OpenSSL announced security fixes on 12/03/15 in the following bulletin: http://openssl.org/news/secadv/20151203.txt + +Advisory CVEs +------------- + +* CVE-2015-3193 - **BN_mod_exp may produce incorrect results on x86_64** (Severity:Moderate) + + OpenSSL 1.0.2 users should upgrade to 1.0.2e + +* CVE-2015-3194 - **Certificate verify crash with missing PSS parameter** (Severity:Moderate) + + OpenSSL 1.0.2 users should upgrade to 1.0.2e + OpenSSL 1.0.1 users should upgrade to 1.0.1q + +* CVE-2015-3195 - **X509_ATTRIBUTE memory leak** (Severity:Moderate) + + OpenSSL 1.0.2 users should upgrade to 1.0.2e + OpenSSL 1.0.1 users should upgrade to 1.0.1q + OpenSSL 1.0.0 users should upgrade to 1.0.0t + OpenSSL 0.9.8 users should upgrade to 0.9.8zh + +* CVE-2015-3196 - **Race condition handling PSK identify hint** (Severity:Low) + + OpenSSL 1.0.2 users should upgrade to 1.0.2d + OpenSSL 1.0.1 users should upgrade to 1.0.1p + OpenSSL 1.0.0 users should upgrade to 1.0.0t + +* CVE-2015-1794 - **Anon DH ServerKeyExchange with 0 p parameter** (Severity:Low) + + OpenSSL 1.0.2 users should upgrade to 1.0.2e + + +Action +------ + +xCAT uses OpenSSL for client-server communication but **does not** ship it. + +It is recommended to keep your OpenSSL levels up-to-date with the indicated versions in the security bulletins to prevent any potential security threats. + diff --git a/docs/source/security/2015/index.rst b/docs/source/security/2015/index.rst new file mode 100644 index 0000000000..4da7c19287 --- /dev/null +++ b/docs/source/security/2015/index.rst @@ -0,0 +1,12 @@ +2015 Notices +============ + +.. toctree:: + :maxdepth: 1 + + 20151203_openssl.rst + 20150520_openssl.rst + 20150519_openssl.rst + 20150403_openssl.rst + 20150324_openssl.rst + 20150312_openssl.rst diff --git a/docs/source/security/index.rst b/docs/source/security/index.rst index 9952ab44f8..4f9535ac92 100644 --- a/docs/source/security/index.rst +++ b/docs/source/security/index.rst @@ -5,3 +5,4 @@ Security Notices :maxdepth: 2 2016/index.rst + 2015/index.rst From edc454edffb96cc535bbc892d04e290c2a455fe1 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 18 Aug 2016 10:51:04 -0400 Subject: [PATCH 148/391] Add the URL for the 16.04.1 mini.iso --- .../manage_clusters/common/deployment/create_img.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst index ce750d3465..a7dbc54ec2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/create_img.rst @@ -53,6 +53,8 @@ For ubuntu ppc64le, the initrd.gz shipped with the ISO does not support network [ubuntu 16.04]: http://xcat.org/files/netboot/ubuntu16.04/ppc64el/mini.iso + [ubuntu 16.04.1]: http://xcat.org/files/netboot/ubuntu16.04.1/ppc64el/mini.iso + * Mount mini.iso :: mkdir /tmp/iso From 4396cb3b7189d2e7d74accebd8502ded213bb7a1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 18 Aug 2016 15:08:03 -0400 Subject: [PATCH 149/391] Check output of xdsh commaned before continuing --- xCAT-probe/subcmds/image | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xCAT-probe/subcmds/image b/xCAT-probe/subcmds/image index a79f16ab6e..f7a26745ae 100755 --- a/xCAT-probe/subcmds/image +++ b/xCAT-probe/subcmds/image @@ -214,9 +214,21 @@ probe_utils->send_msg("$output", "d", "---- Gathering information from all diskl my $pingable_hostname_list = join ",", @pingable_nodes; my $all_xdsh_output = `xdsh $pingable_hostname_list "cat /opt/xcat/xcatinfo"`; my $xcatinfo_image_UUID = ` echo "$all_xdsh_output" | awk -F"=" '/IMAGEUUID/ {gsub(/IMAGEUUID/,"",\$1); gsub(/'"'"'/,"",\$2);; print \$1 \$2}'`; + +# Check to verify xdsh worked and returned some usefull information +if (length($xcatinfo_image_UUID) <= 1) { + probe_utils->send_msg("$output", "w", "Unable to extract image UUID information from compute nodes using xdsh command. No image consistency verification will be performed."); + exit 1; +} my @xdsh_UUID_lines = split("[\n\r]", $xcatinfo_image_UUID); my $xcatinfo_image_name = ` echo "$all_xdsh_output" | awk -F"=" '/IMAGENAME/ {gsub(/IMAGENAME/,"",\$1); gsub(/'"'"'/,"",\$2); print \$1 \$2}'`; + +# Check to verify xdsh worked and returned some usefull information +if (length($xcatinfo_image_name) <= 1) { + probe_utils->send_msg("$output", "w", "Unable to extract image name information from compute nodes using xdsh command. No image consistency verification will be performed."); + exit 1; +} my @xdsh_name_lines = split("[\n\r]", $xcatinfo_image_name); my %node_running_image_uuid_hash; From a89c5c6c7592cadc8bcff0919f88420841f1d251 Mon Sep 17 00:00:00 2001 From: Xiaopeng Wang Date: Fri, 19 Aug 2016 16:56:31 +0800 Subject: [PATCH 150/391] add release info for 2.12.2 --- docs/source/overview/xcat2_release.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 1f128f8558..f3d2da69ab 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,6 +14,14 @@ xCAT 2.12.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ +|| xCAT 2.12.2 |- UBT 16.04.1 | |- nodeset offline | +|| 2016/08/19 | | |- Enhance: node status update | +|| | | |- Support Bond for install nics | +| `2.12.2 Release Notes `_ | | | | +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ || xCAT 2.12.1 | | |- New xCAT install tool: go-xcat | || 2016/07/08 | | |- New opt: mkdef/lsdef --template | || | | |- Support rinstall for all OS/ARCH| From cbf665f2d1c31c580dec3f9d57beb06ee0116975 Mon Sep 17 00:00:00 2001 From: Xiaopeng Wang Date: Fri, 19 Aug 2016 18:12:04 +0800 Subject: [PATCH 151/391] bump up the version to 2.12.3 --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 371a952d65..ccc99d0214 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.12.2 +2.12.3 From c4a536a18f46cae82c0c5943b68715bdbaea237b Mon Sep 17 00:00:00 2001 From: penguhyang Date: Mon, 22 Aug 2016 13:39:09 +0800 Subject: [PATCH 152/391] use the same way to promote error msg (#1749) --- xCAT-server/lib/xcat/plugins/packimage.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 216e21ae12..c1963d2078 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -417,7 +417,6 @@ sub process_request { $callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"] }); return 1; } - $callback->({ data => ["Packing contents of $rootimg_dir"] }); my $suffix; if ($compress) { @@ -462,6 +461,11 @@ sub process_request { $suffix = "gz"; } + unless (($method eq 'cpio') or ($method eq 'tar') or ($method eq 'squashfs')) { + $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); + return 1; + } + $callback->({ data => ["Packing contents of $rootimg_dir"] }); $callback->({ info => ["archive method:$method"] }); unless ($method =~ /squashfs/) { $callback->({ info => ["compress method:$compress"] }); @@ -517,9 +521,6 @@ sub process_request { system("$includestr >> $xcat_packimg_tmpfile"); } $excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath"; - } else { - $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); - return 1; } chdir("$rootimg_dir"); From 310ba8c1aaeaca569f58df1236e302308b599abc Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 22 Aug 2016 15:53:21 +0800 Subject: [PATCH 153/391] [xCAT Jenkins Email Report] Fix a issue while no test was run in a day. Handle NULL properly --- .../jenkins/testreport/xCATjkLogAnalyzer.sql | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql index 93dd428b0b..e10e9eda05 100644 --- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql +++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql @@ -466,7 +466,7 @@ NOW(), ' ', REPLACE(CONCAT('+', TIME_FORMAT(TIMEDIFF(NOW(), UTC_TIMESTAMP), '%H% '' ) AS HTML FROM ( -SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +SELECT IFNULL(GROUP_CONCAT(HTML SEPARATOR ''), '') AS HTML FROM ( SELECT CONCAT( 'Total', "\n", '-', "\n", '', -SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))), '', "\n" +IFNULL(SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))), 'N/A'), '', "\n" '', -SUM(Passed), '', "\n", +IFNULL(SUM(Passed), 'N/A'), '', "\n", '', -SUM(Failed), '', "\n", +IFNULL(SUM(Failed), 'N/A'), '', "\n", '', -SUM(`No run`), '', "\n", +IFNULL(SUM(`No run`), 'N/A'), '', "\n", '', -SUM(Subtotal), '', "\n", +IFNULL(SUM(Subtotal), 'N/A'), '', "\n", '', IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", '', "\n" ) AS HTML FROM LatestDailyReport ) AS LatestDailyReportSummary, ( -SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +SELECT IFNULL(GROUP_CONCAT(HTML SEPARATOR ''), '') AS HTML FROM ( SELECT CONCAT( 'Total', "\n", '-', "\n", '', -SUM(`Test runs`), '', "\n", +IFNULL(SUM(`Test runs`), 'N/A'), '', "\n", '', -SUM(Passed), '', "\n", +IFNULL(SUM(Passed), 'N/A'), '', "\n", '', -SUM(Failed), '', "\n", +IFNULL(SUM(Failed), 'N/A'), '', "\n", '', -SUM(`No run`), '', "\n", +IFNULL(SUM(`No run`), 'N/A'), '', "\n", '', -SUM(Subtotal), '', "\n", +IFNULL(SUM(Subtotal), 'N/A'), '', "\n", '', IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", '', "\n" ) AS HTML FROM SevenDayLookBack ) AS SevenDayLookBackSummary, ( -SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +SELECT IFNULL(GROUP_CONCAT(HTML SEPARATOR ''), '') AS HTML FROM ( SELECT CONCAT( 'Total', "\n", '-', "\n", '', -SUM(`Test runs`), '', "\n", +IFNULL(SUM(`Test runs`), 'N/A'), '', "\n", '', -SUM(Passed), '', "\n", +IFNULL(SUM(Passed), 'N/A'), '', "\n", '', -SUM(Failed), '', "\n", +IFNULL(SUM(Failed), 'N/A'), '', "\n", '', -SUM(`No run`), '', "\n", +IFNULL(SUM(`No run`), 'N/A'), '', "\n", '', -SUM(Subtotal), '', "\n", +IFNULL(SUM(Subtotal), 'N/A'), '', "\n", '', IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", '', "\n" ) AS HTML FROM ThirtyDayLookBack ) AS ThirtyDayLookBackSummary, ( -SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +SELECT IFNULL(GROUP_CONCAT(HTML SEPARATOR ''), '') AS HTML FROM ( SELECT CONCAT( 'Total', "\n", '-', "\n", '', -SUM(`Test runs`), '', "\n", +IFNULL(SUM(`Test runs`), 'N/A'), '', "\n", '', -SUM(Passed), '', "\n", +IFNULL(SUM(Passed), 'N/A'), '', "\n", '', -SUM(Failed), '', "\n", +IFNULL(SUM(Failed), 'N/A'), '', "\n", '', -SUM(`No run`), '', "\n", +IFNULL(SUM(`No run`), 'N/A'), '', "\n", '', -SUM(Subtotal), '', "\n", +IFNULL(SUM(Subtotal), 'N/A'), '', "\n", '', IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A'), '', "\n", '', "\n" ) AS HTML FROM NinetyDayLookBack ) AS NinetyDayLookBackSummary, ( -SELECT GROUP_CONCAT(HTML SEPARATOR '') AS HTML +SELECT IFNULL(GROUP_CONCAT(HTML SEPARATOR ''), '') AS HTML FROM ( SELECT CONCAT( ' Date: Tue, 23 Aug 2016 22:05:32 -0400 Subject: [PATCH 155/391] update cases since -o -p and -a is not supported anymore --- xCAT-test/autotest/testcase/packimg/cases0 | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 5029ab9d77..b7b7d398f6 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -8,7 +8,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m cpio check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz check:rc==0 @@ -18,24 +18,6 @@ cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/ cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg end -start:packimage_p_a_o -os:Linux -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg /rootimg.bak;fi -cmd:ls /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz;if [ $? -eq 0 ];then mv -f /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz /rootimg.cpio.gz.bak;fi -cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg -check:rc==0 -cmd:packimage -p compute -a __GETNODEATTR($$CN,arch)__ -o __GETNODEATTR($$CN,os)__ -check:rc==0 -cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz -check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz -cmd:mv -f /rootimg.cpio.gz.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg.cpio.gz -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg -cmd:mv -f /rootimg.bak /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg -end - start:packimage_imagename os:Linux description: @@ -79,7 +61,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c gzip +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m cpio -c gzip check:rc==0 check:output=~archive method:cpio check:output=~compress method:gzip @@ -125,7 +107,7 @@ cmd:if grep SUSE /etc/*release;then zypper install -y pigz;fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then apt-get install pigz -y; fi check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c pigz +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m cpio -c pigz check:rc==0 check:output=~archive method:cpio check:output=~compress method:pigz @@ -167,7 +149,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m cpio -c xz +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m cpio -c xz check:rc==0 check:output=~archive method:cpio check:output=~compress method:xz @@ -213,7 +195,7 @@ cmd:if grep SUSE /etc/*release;then zypper install -y pigz;fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then apt-get install pigz -y; fi check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c pigz +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m tar -c pigz check:rc==0 check:output=~archive method:tar check:output=~compress method:pigz @@ -255,7 +237,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c gzip +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m tar -c gzip check:rc==0 check:output=~archive method:tar check:output=~compress method:gzip @@ -297,7 +279,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m tar -c xz +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m tar -c xz check:rc==0 check:output=~archive method:tar check:output=~compress method:xz From 55968a0321cda953d61caa3b91872b1bdf269c1f Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 24 Aug 2016 10:59:29 +0800 Subject: [PATCH 156/391] delete long time wait sleep delete long time wait sleep --- xCAT-test/autotest/testcase/packimg/cases0 | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 5029ab9d77..c3a65a7fc0 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -89,8 +89,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -135,8 +134,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -177,8 +175,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -223,8 +220,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -265,8 +261,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN @@ -307,8 +302,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]]; then rnetboot $$CN;else rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 150 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN From 4c1c47e2425d449b8b4119033186e1f1712b59b0 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 24 Aug 2016 11:06:23 +0800 Subject: [PATCH 157/391] delete long time wait sleep delete long time wait sleep --- xCAT-test/autotest/testcase/runcmdinstaller/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 index f39db8a1a3..2ad618f198 100644 --- a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 +++ b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 @@ -28,7 +28,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ins check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi check:rc==0 -cmd:sleep 1200 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 300 ];then break;fi done cmd:cat /var/log/messages /var/log/xcat/computes.log 2>/dev/null | grep "Running post-installation scripts" cmd:rc==0 cmd:cat /var/log/messages /var/log/xcat/computes.log 2>/dev/null | grep "program: ++" From 816376645e391c4cd4b373e2a3c3365d12a6b1e0 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 24 Aug 2016 11:15:53 +0800 Subject: [PATCH 158/391] delete long time wait sleep --- .../installation/reg_linux_diskfull_installation_flat | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 5ee4a9d223..242c77ea3d 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -35,11 +35,8 @@ check:rc==0 cmd:if [ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" ];then rnetboot $$CN;else rpower $$CN boot;fi else rpower $$CN boot;fi check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,mgt)__" =~ "ipmi" ]]; then sleep 1800;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]];then sleep 1200;else sleep 600;fi - -cmd:lsdef -l $$CN | grep status - -cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 300 ];then break;fi done +cmd:sleep 300 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 20;((a++));if [ $a -gt 300 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 From ce65a730ff8395992e4a4b9aa5234fec345bdb7b Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 24 Aug 2016 11:18:57 +0800 Subject: [PATCH 159/391] delete long time wait sleep --- .../installation/ubuntu_full_installation_vm_docker | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index 15dcce60aa..cca833817a 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -26,10 +26,10 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-in check:rc==0 cmd:rpower $$CN boot check:rc==0 -cmd:sleep 40 -cmd:lsdef -l $$CN | grep status -cmd:sleep 2400 -check:rc==0 + +cmd:sleep 900 +cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done + cmd:ping $$CN -c 3 check:output=~64 bytes from $$CN check:rc==0 From a4abdbffae687f4d514a87e2a77ec0f526af4f1d Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 24 Aug 2016 11:26:38 +0800 Subject: [PATCH 160/391] delete stop label --- xCAT-test/autotest/testcase/migration/redhat_migration | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index 472a71644d..a0495ec39d 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -1,7 +1,6 @@ start:redhat_migration1 os:Linux description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file -stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN From c93b215c2c1fe101d34016fadf97a05d089bddb8 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Wed, 24 Aug 2016 12:13:36 +0800 Subject: [PATCH 161/391] fix sles11.4 packimage return error when use tar compress method (#1743) --- xCAT-server/lib/xcat/plugins/packimage.pm | 23 +++++++++---------- .../xcat/netboot/sles/dracut_033/xcatroot | 6 +++++ xCAT-server/share/xcat/netboot/sles/genimage | 10 ++++++-- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index c1963d2078..d0434eb060 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -491,25 +491,24 @@ sub process_request { } $oldmask = umask 0077; } elsif ($method =~ /tar/) { + my $checkoption1 = `tar --xattrs-include 2>&1`; + my $checkoption2 = `tar --selinux 2>&1`; + my $option; + if ($checkoption1 !~ /unrecognized/) { + $option .= "--xattrs-include='*' "; + } + if ($checkoption2 !~ /unrecognized/) { + $option .= "--selinux "; + } if (!$exlistloc) { - my $checkoption = `tar --xattrs-include 2>&1`; - if ($checkoption =~ /unrecognized/) { - $excludestr = "find . -xdev -print0 | tar --selinux --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; - } else { - $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; - } + $excludestr = "find . -xdev -print0 | tar $option --no-recursion --use-compress-program=$compress --null -T - -cf ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - my $checkoption = `tar --xattrs-include 2>&1`; - if ($checkoption =~ /unrecognized/) { - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; - } else { - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; - } + $excludestr = "cat $xcat_packimg_tmpfile| tar $option --no-recursion --use-compress-program=$compress -T - -cf ../rootimg.$suffix"; } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index b12eb9a3f5..80b366d9ab 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -109,8 +109,14 @@ elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo -n "Extracting root filesystem:" if [ -r /rootimg.tar.gz ]; then tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz + if [ $? -ne 0 ]; then + tar -zxf /rootimg.tar.gz + fi elif [ -r /rootimg.tar.xz ]; then tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz + if [ $? -ne 0 ]; then + tar -Jxf /rootimg.tar.xz + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 23ca97d2c8..e4d0d76865 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1659,8 +1659,14 @@ EOMS print $inifile " echo -n \"Extracting root filesystem:\"\n"; print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; print $inifile " tar --selinux --xattrs-include='*' -zxf /rootimg.tar.gz\n"; + print $inifile " if [ \$? -ne 0 ]; then\n"; + print $inifile " tar -zxf /rootimg.tar.gz\n"; + print $inifile " fi\n"; print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; print $inifile " tar --selinux --xattrs-include='*' -Jxf /rootimg.tar.xz\n"; + print $inifile " if [ \$? -ne 0 ]; then\n"; + print $inifile " tar -Jxf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; @@ -1770,7 +1776,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { getlibs($_); push @filestoadd, $_; } @@ -1782,7 +1788,7 @@ EOMS } } else { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { getlibs($_); push @filestoadd, $_; } From ea839ee02ae4c42194c0447ac68797180ff54882 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 24 Aug 2016 03:14:00 -0400 Subject: [PATCH 162/391] increase the time since we add some time-consuming test cases --- xCAT-server/share/xcat/tools/jenkins/xcatjktest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index ffec553af4..0518cd60e5 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -1277,7 +1277,7 @@ while(! $sub_process_rt) { } } - if(time() - $regstarttime > 28800) { + if(time() - $regstarttime > 36000) { send_msg(1, "[timing] 8 hours is expired"); last; } From 6a242e8936e1fbf45126fc32b4b1b4c902542ccd Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 24 Aug 2016 03:21:15 -0400 Subject: [PATCH 163/391] update the message --- xCAT-server/share/xcat/tools/jenkins/xcatjktest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/jenkins/xcatjktest b/xCAT-server/share/xcat/tools/jenkins/xcatjktest index 0518cd60e5..55c1306c5e 100755 --- a/xCAT-server/share/xcat/tools/jenkins/xcatjktest +++ b/xCAT-server/share/xcat/tools/jenkins/xcatjktest @@ -1278,7 +1278,7 @@ while(! $sub_process_rt) { } if(time() - $regstarttime > 36000) { - send_msg(1, "[timing] 8 hours is expired"); + send_msg(1, "[timing] 10 hours is expired"); last; } sleep 1; From bc48e8520524c60e64feefdd100174fbd426dc5c Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 24 Aug 2016 08:49:05 -0400 Subject: [PATCH 164/391] modify genesis test code --- xCAT-test/autotest/testcase/genesis/cases0 | 37 +- .../autotest/testcase/genesis/genesistest.pl | 494 ++++++++++++------ 2 files changed, 346 insertions(+), 185 deletions(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 9459ff83da..977261ad09 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -1,48 +1,29 @@ start:nodeset_shell description: verify could log in genesis shell -cmd:nodeset $$CN shell +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -t -n $$CN -cmd:xdsh $$CN cat /proc/cmdline -check:rc==0 -check:output=~destiny=shell -cmd:nodeset $$CN boot -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 end start:nodeset_cmdline description:verify could run cmdline successfully -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -d -r __GETNODEATTR($$CN,arch)__ -cmd:nodeset $$CN runcmd="cmdtest,shell" +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -d check:rc==0 -cmd: perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -t -n $$CN -cmd:xdsh $$CN "cat /tmp/testresult" -check:rc==0 -check:output=~testcmd -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -c -n $$CN -r __GETNODEATTR($$CN,arch)__ -check:rc==0 -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 end start:nodeset_runimg description:verify runimg could work -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -g -n $$CN -i $$imgip +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g check:rc==0 -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -i check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -t -n $$CN -check:rc==0 -cmd:xdsh $$CN "cat /tmp/testresult" -check:output=~testimg -check:rc==0 -cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -c -n $$CN -r __GETNODEATTR($$CN,arch)__ -check:rc==0 -cmd:rpower $$CN boot +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c check:rc==0 end diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index 87a07189fb..4ba5216088 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -1,6 +1,11 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html - +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; +} +use lib "$::XCATROOT/lib/perl"; +use xCAT::Utils; use strict; use warnings; use Getopt::Long; @@ -10,182 +15,357 @@ use Time::Local; use File::Basename; use File::Path; use File::Copy; - -BEGIN -{ - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; -} -use lib "$::XCATROOT/lib/perl"; -my $rungenesiscmd = 0; -my $rungenesisimg = 0; -my $shellmode = 0; -my $cmdtest = "/tmp/cmdtest"; -my $timesleep = 0; +use Sys::Hostname; +my $program_name = basename("$0"); +my $genesis_runcmd_test = 0; +my $genesis_runimg_test = 0; +my $genesis_nodesetshell_test = 0; +my $check_genesis_file; my $noderange; -my $clearenv = 0; -my $arch; -my $imgip; -my $runimgtest = "/tmp/imgtest"; -my $testresult = "/tmp/testresult"; -my $genesisdir = "/opt/xcat/share/xcat/netboot/genesis"; -my $genesisfiledir; - +my $clear_env; +my $help = 0; +$::USAGE = "Usage: + $program_name -h + $program_name -n -s + $program_name -n -d + $program_name -n -i + $program_name -n -c + $program_name -n -g +Description: + Run genesis testcase + There will be default scripts for genesis's runcmd and runimg test if anyone want to use this function to test genesis please write scripts in /tmp/cmdtest for runcmd test and in /tmp/imgtest for runimg test +Options: + -n : The range of node + -i : Run genesis runimage + -d : Run genesis runcmd + -s : Run genesis nodeshell mode + -c : Clear genesis test environment + -g : Check genesis file +"; +################################## +# main process +################################## if ( - !GetOptions("h|?" => \$::HELP, - "d" => \$rungenesiscmd, - "g" => \$rungenesisimg, - "t" => \$timesleep, - "c" => \$clearenv, - "n=s" => \$::NODE, - "i=s" => \$::IMGIP, - "r=s" => \$::ARCH) - ) + !GetOptions("h|?" => \$help, + "s" => \$genesis_nodesetshell_test, + "d" => \$genesis_runcmd_test, + "i" => \$genesis_runimg_test, + "n=s" => \$noderange, + "g" => \$check_genesis_file, + "c" => \$clear_env + )) { - &usage; + send_msg(0, "$::USAGE"); + print "$::USAGE"; exit 1; } - -sub usage -{ - print "Usage:run for genesis cases.\n"; - print " genesistest.pl [-?|-h]\n"; - print " genesistest.pl [-d] [-n node] [-r arch] Test runcmd for genesis \n"; - print " genesistest.pl [-g] [-n ndoe] [-i imgip] Test runimg for genesis\n"; - print " genesistest.pl [-t] [-n node] Sleep for genesis test\n"; - print " genesistest.pl [-c] [-n node][-r arch] Clear environment for genesis test\n"; - print "\n"; - return; +if ($help) { + print "$::USAGE"; + exit 0; } - -sub runcmd -{ - my ($cmd) = @_; - my $rc = 0; - $::RUNCMD_RC = 0; - my $outref = []; - @$outref = `$cmd 2>&1`; - if ($?) - { - $rc = $?; - $rc = $rc >> 8; - $::RUNCMD_RC = $rc; - } - chomp(@$outref); - return @$outref; - +############################### +# init +############################## +if (!defined($noderange)) { + send_msg(0, "Option -n is required"); + print "$::USAGE"; + exit 1; } - -sub rungenesiscmd -{ - open(TESTCMD, ">$cmdtest") - or die "Can't open testscripts for writing: $!"; - print TESTCMD join("\n", "#!/bin/bash"), "\n"; - print TESTCMD join("\n", "#This is test for genesis scripts"), "\n"; - print TESTCMD join("\n", "echo \"testcmd\" >> $testresult"), "\n"; - close(TESTCMD); - if ($arch =~ /ppc64/) - { - $arch = "ppc64"; +my $os = xCAT::Utils->osver("all"); +if ($check_genesis_file) { + send_msg(2, "[$$]:Check genesis file..............."); + &check_genesis_file(&get_arch); + if ($?) { + send_msg(0, "genesis file not available"); + } else { + send_msg(2, "genesis file available"); } - $genesisfiledir = "$genesisdir/$arch/fs/bin"; - copy("$cmdtest", "$genesisfiledir"); - chmod 0755, "$genesisfiledir/cmdtest"; +} +my $master=xCAT::TableUtils->get_site_Master(); +if (!$master) { $master=hostname(); } + +#################################### +####nodesetshell test for genesis +#################################### +if ($genesis_nodesetshell_test) { + send_msg(2, "[$$]:Running nodesetshell test..............."); + `nodeset $noderange shell`; + if ($?) { + send_msg(0, "[$$]:nodeset shell failed..............."); + exit 1; + } + `rpower $noderange boot`; + if ($?) { + send_msg(0, "[$$]:rpower node failed..............."); + exit 1; + } + #run nodeshell test + send_msg(2, "prepare for nodeshell script."); + if ( &testxdsh(3)) { + send_msg(0, "[$$]:Could not verify test results using xdsh..............."); + exit 1; + } + send_msg(2, "[$$]:Running nodesetshell test success..............."); +} +#################################### +####runcmd test for genesis +#################################### +if ($genesis_runcmd_test) { + send_msg(2, "[$$]:Running runcmd test..............."); + if (&testxdsh(&rungenesiscmd(&get_arch))) { + send_msg(0, "[$$]:Could not verify test results using xdsh..............."); + exit 1; + } + send_msg(2, "[$$]:Running runcmd test success..............."); +} +################################## +####runimg test for genesis +################################## +if ($genesis_runimg_test) { + send_msg(2, "[$$]:Run runimg test..............."); + if (&testxdsh(&rungenesisimg)) { + send_msg(0, "[$$]:Could not verify test results using xdsh ..............."); + exit 1; + } + + send_msg(2, "[$$]:Running runimage test success..............."); +} +################################### +####clear test environment +################################### +if ($clear_env) { + send_msg(2, "[$$]:clear genesis test enviroment..............."); + if (&clearenv(&get_arch)) { + send_msg(0, "[$$]:clear environment failed..............."); + exit 1; + } + send_msg(2, "[$$]:clear genesis test enviroment success..............."); +} +################################## +#check_genesis_file +################################# +sub check_genesis_file { + my $arch = shift; + my $genesis_base; + my $genesis_scripts; + if ($os =~ "unknown") { + send_msg(0, "The OS is not supported."); + return 1; + } elsif ($os =~ "ubuntu") { + $genesis_base = `dpkg -l | grep -i "ii xcat-genesis-base" | grep -i "$arch"`; + $genesis_scripts = `dpkg -l | grep -i "ii xcat-genesis-scripts" | grep -i "$arch"`; + } else { + $genesis_base = `rpm -qa | grep -i "xcat-genesis-base" | grep -i "$arch"`; + $genesis_scripts = `rpm -qa | grep -i "xcat-genesis-scripts" | grep -i "$arch"`; + } + unless ($genesis_base and $genesis_scripts) { + send_msg(0, "xCAT-genesis for $arch did not be installed."); + return 1; + } + return 0; +} +################################################### +###write runcmd script to verify runcmd could work +################################################## +sub rungenesiscmd { + my $runcmd_script = "/tmp/cmdtest"; + my $result = "/tmp/testresult"; + my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + my $genesis_bin_dir; + my $value = 0; + my $arch = shift; + if (!(-e $runcmd_script)) { + $value = 1; + + #means runcmd test using test scripts genesistest.pl writes + send_msg(2, "no runcmd scripts for test prepared."); + open(TESTCMD, ">$runcmd_script") + or die "Can't open testscripts for writing: $!"; + print TESTCMD join("\n", "#!/bin/bash"), "\n"; + print TESTCMD join("\n", "#This is test for genesis scripts"), "\n"; + print TESTCMD join("\n", "echo \"testcmd\" >> $result"), "\n"; + close(TESTCMD); + } else { + $value = 3; + + #means runcmd test using test scripts user writes + send_msg(2, "runcmd scripts for test ready."); + } + $genesis_bin_dir = "$genesis_base_dir/$arch/fs/bin"; + copy("$runcmd_script", "$genesis_bin_dir"); + chmod 0755, "$genesis_bin_dir/cmdtest"; `mknb $arch`; - print "mknb $arch\n"; + if ($?) { + send_msg(0, "mknb $arch failed for runcmd test."); + } + `nodeset $noderange "runcmd=cmdtest,shell"`; + if ($?) { + send_msg(0, "nodeset noderange shell failed for runcmd test"); + } + `rpower $noderange boot`; + if ($?) { + send_msg(0, "rpower noderange boot failed for runcmd test"); + } + return $value; } - -sub rungenesisimg -{ +####################################################################################################################### +####write runimage script to verify runimage could work eg.runimage=http:////image.tgz +####################################################################################################################### +sub rungenesisimg { + my $runimg_script = "/tmp/imgtest"; + my $result = "/tmp/testresult"; + my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + my $genesis_bin_dir; + my $value = 0; mkdir("/install/my_image"); - open(TESTIMG, ">$runimgtest") - or die "Can't open testscripts for writing: $!"; - print TESTIMG join("\n", "#!/bin/bash"), "\n"; - print TESTIMG join("\n", "#This is test for genesis scripts"), "\n"; - print TESTIMG join("\n", "echo \"testimg\" >> $testresult"), "\n"; - close(TESTIMG); - copy("$runimgtest", "/install/my_image/runme.sh") or die "Copy failed: $!"; + if (!(-e $runimg_script)) { + $value = 2; + + #means runimg test using test scripts genesistest.pl writes + send_msg(2, "no runimg scripts for test prepared."); + open(TESTIMG, ">$runimg_script") + or die "Can't open testscripts for writing: $!"; + print TESTIMG join("\n", "#!/bin/bash"), "\n"; + print TESTIMG join("\n", "#This is test for genesis scripts"), "\n"; + print TESTIMG join("\n", "echo \"testimg\" >> $result"), "\n"; + close(TESTIMG); + print "value is $value \n"; + } else { + $value = 3; + + #means runimg test using test scripts user writes + send_msg(2, "runimg scripts for test ready."); + } + copy("$runimg_script", "/install/my_image/runme.sh") or die "Copy failed: $!"; chmod 0755, "/install/my_image/runme.sh"; - `cd /install/my_image ;tar -zcvf my_image.tgz .`; -`nodeset $noderange "runimage=http://$imgip/install/my_image/my_image.tgz",shell`; + `tar -zcvf /tmp/my_image.tgz -C /install/my_image .`; + copy("/tmp/my_image.tgz", "/install/my_image") or die "Copy failed: $!"; + `nodeset $noderange "runimage=http://$master/install/my_image/my_image.tgz",shell`; + if ($?) { + send_msg(0, "nodeset noderange failed for runimg"); + } + `rpower $noderange boot`; + if ($?) { + send_msg(0, "rpower boot failed for runimg test"); + } + return $value; } - -sub timesleep -{ - my @output = runcmd("ping $noderange -c 10"); - my $value = 0; - print "output is $value ,@output\n"; - if ($::RUNCMD_RC) { - foreach $value (1 .. 60) { - @output = runcmd("ping $noderange -c 10"); - last if ($::RUNCMD_RC == 0); +######################################## +####sleep while for xdsh $$CN could work +######################################### +sub testxdsh { + my $value = shift; + print "value is $value \n"; + my $checkstring; + my $checkfile; + if ($value == 1) { + #mean runcmd test using test scripts genesistest.pl writes + $checkstring = "testcmd"; + $checkfile = "/tmp/testresult"; + } elsif ($value == 2) { + $checkstring = "testimg"; + $checkfile = "/tmp/testresult"; + } elsif ($value == 3) { + $checkstring = "xcatd=$master:3001"; + $checkfile = "/proc/cmdline"; + } + if (($value == 1) || ($value == 2) || ($value == 3)) { + `xdsh $noderange -t 2 cat $checkfile |grep $checkstring`; + if ($?) { + foreach (1 .. 1500) { + `xdsh $noderange -t 2 cat $checkfile | grep $checkstring`; + last if ($? == 0); + } } } - my @output1 = runcmd("xdsh $noderange date"); - if ($::RUNCMD_RC) { - foreach $value (1 .. 60) { - @output1 = runcmd("xdsh $noderange -t 1 date"); - print "sleep $value\n"; - last if ($::RUNCMD_RC == 0); - } - } - if ($::RUNCMD_RC == 0) { - print "test ok\n"; - } + return $?; } - -sub clearenv -{ - if (-f "/tmp/imgtest") { - unlink("/install/my_image/runme.sh"); - unlink("/install/my_image/my_image.tgz"); - unlink("$runimgtest"); - rmdir("/install/my_image"); - print "img del ok\n"; +########################## +####clear test environment +########################## +sub clearenv { + my $arch = shift; + my $runcmd_script = "/tmp/cmdtest"; + my $runimg_script = "/tmp/imgtest"; + my $runme = "/install/my_image/runme.sh"; + my $runmetar = "/install/my_image/my_image.tgz"; + my $runmetar_tmp = "/tmp/my_image.tgz"; + my $runmedir = "/install/my_image"; + my $genesis_base_dir = "$::XCATROOT/share/xcat/netboot/genesis"; + if (-e "$runimg_script") { + unlink("$runme"); + unlink("$runmetar_tmp"); + unlink("$runmetar"); + unlink("$runimg_script"); + rmdir("$runmedir"); + send_msg(2, "clear runimage test environment"); } - if (-f "/tmp/cmdtest") { - if ($arch =~ /ppc64/) - { - $arch = "ppc64"; - } - - $genesisfiledir = "$genesisdir/$arch/fs/bin"; - my $genesisfile = "$genesisfiledir/cmdtest"; - print "genesis file is $genesisfile\n"; - unlink("$genesisfile"); - unlink("$cmdtest"); + if (-e "$runcmd_script") { + my $genesis_bin_dir = "$genesis_base_dir/$arch/fs/bin"; + my $genesis_test_script = "$genesis_bin_dir/cmdtest"; + unlink("$genesis_test_script"); + unlink("$runcmd_script"); `mknb $arch`; - print "mknb $arch\n"; + if ($?) { + send_msg(0, "mknb for runcmd test environment failed"); + exit 1; + } } `nodeset $noderange boot`; + if ($?) { + send_msg(0, "nodeset node failed"); + exit 1; + } + `rpower $noderange boot`; + if ($?) { + send_msg(0, "rpower node failed"); + exit 1; + } + return 0; } -if ($::NODE) -{ - $noderange = $::NODE; +#################################### +#get arch +################################### +sub get_arch { + use POSIX qw(uname); + my @uname = uname(); + my $arch = $uname[4]; + if ($arch =~ /ppc64/i) { + $arch = "ppc64"; + } elsif (($arch =~ /x86/i)&&($os =~ /ubuntu/i)) { + if ($check_genesis_file) { + $arch = "amd64"; + } + } + return $arch; } -if ($::ARCH) -{ - $arch = $::ARCH; -} -if ($::IMGIP) -{ - $imgip = $::IMGIP; -} -if ($::HELP) { - usage; -} -if ($rungenesiscmd) -{ - &rungenesiscmd; -} -if ($timesleep) -{ - ×leep; -} -if ($rungenesisimg) -{ - &rungenesisimg; -} -if ($clearenv) -{ - &clearenv; +####################################### +## send messages +######################################## +sub send_msg { + my $log_level = shift; + my $msg = shift; + my $content; + my $logfile = ""; + my $logfiledir = "/tmp/genesistestlog"; + my $date = `date +"%Y%m%d"`; + chomp($date); + if (!-e $logfiledir) + { + mkpath( $logfiledir ); + } + $logfile = "genesis" . $date . ".log"; + if ($log_level == 0) { + $content = "Fatal error:"; + } elsif ($log_level == 1) { + $content = "Warning:"; + } elsif ($log_level == 2) { + $content = "Notice:"; + } + if (!open(LOGFILE, ">> $logfiledir/$logfile")) { + return 1; + } + print LOGFILE "$date $$ $content $msg\n"; + close LOGFILE; + } From fd747d5fc624c30c51e5e00212014bc4bf749f9e Mon Sep 17 00:00:00 2001 From: penguhyang Date: Thu, 25 Aug 2016 11:10:27 +0800 Subject: [PATCH 165/391] give warnings and return when use -o -p -a for packimage (#1757) --- xCAT-server/lib/xcat/plugins/packimage.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index d0434eb060..c4c91149c1 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -108,6 +108,10 @@ sub process_request { "help|h" => \$help, "version|v" => \$version ); + if ($arch or $osver or $profile) { + $callback->({ error => ["-o, -p and -a options are obsoleted, please use 'packimage ' instead."], errorcode => [1] }); + return 1; + } if ($version) { my $version = xCAT::Utils->Version(); $callback->({ info => [$version] }); From 65e992157cc64309130443cc0870c6d5170e8d0e Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 25 Aug 2016 00:14:12 -0400 Subject: [PATCH 166/391] delete case packimage_p_a_o --- xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle | 1 - xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle | 1 - xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 1 - xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 1 - xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 1 - xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 1 - xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 1 - xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 1 - xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 9 ++++++++- xCAT-test/autotest/bundle/sles12.1_ppc64.bundle | 1 - xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 1 - xCAT-test/autotest/bundle/sles12_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/sles12_x86_64.bundle | 1 - xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle | 1 - xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle | 1 - 24 files changed, 8 insertions(+), 24 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle index ee6a786f9c..ba479da63e 100644 --- a/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle @@ -42,7 +42,6 @@ copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle index 01a401041b..49377b6123 100644 --- a/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle @@ -13,7 +13,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 17ab440e57..aa5c1bbd2a 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -47,7 +47,6 @@ copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 7130513254..2f89789488 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -18,7 +18,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index 2843be128d..2a5935debb 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -47,7 +47,6 @@ copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index abca029576..38be7be149 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index 192781e59d..7d731ecc92 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -18,7 +18,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index cb5e4d8dbc..718bcc2705 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 4886078229..69eae50c33 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -18,7 +18,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index 5c9b5b1960..5e36e9c51d 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -29,7 +29,6 @@ copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index 7a7e5fd188..d89d7e1bf2 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -20,7 +20,6 @@ chtab_err_table chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v @@ -215,6 +214,14 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64.bundle index f7f478c0ae..6869e65ce0 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64.bundle @@ -24,7 +24,6 @@ copycds_n_a copycds_a_err copycds_n_err packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 11fd597204..7316e85f7b 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -21,7 +21,6 @@ chtab_err_table chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index 3eba1e79f1..98a3a37b9d 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -20,7 +20,6 @@ chtab_err_table chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle index 2caa4876bb..f535233023 100644 --- a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle @@ -16,7 +16,6 @@ chtab_err_table chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/sles12_x86_64.bundle b/xCAT-test/autotest/bundle/sles12_x86_64.bundle index 8e3413dd17..78af439410 100644 --- a/xCAT-test/autotest/bundle/sles12_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12_x86_64.bundle @@ -15,7 +15,6 @@ chtab_err_table chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle index c369a3c47f..4c1d1b7bd2 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle @@ -14,7 +14,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle index a43d7cf691..9fac0a0f20 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle @@ -14,7 +14,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index f2e48965ff..843c15613f 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 9eaf3f4228..a601f8cb42 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 6d53f9ed96..e5e3bc079a 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index fb803c3b90..c7ac8a3044 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index 28cd9b4c03..6a8bad79ae 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle index fe60349549..ec034a3afe 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle @@ -19,7 +19,6 @@ chtab_modify_key chtab_h chtab_v packimage_o_p_a_m -packimage_p_a_o packimage_imagename packimage_h packimage_v From f9d339c3bad2d004039f30bf1139400e9bb00ff2 Mon Sep 17 00:00:00 2001 From: chenglch Date: Wed, 17 Aug 2016 04:24:39 -0400 Subject: [PATCH 167/391] Update rest api for rinstall and console - Refactor console api, console will be looked as a service resource - Add rest api to support rinstall --- xCAT-server/xCAT-wsapi/xcatws.cgi | 52 ++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index 20306c00d5..3b9fde3c51 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -217,17 +217,17 @@ my %URIdef = ( outhdler => \&noout, } }, - console => { - desc => "[URI:/nodes/{noderange}/console] - The console configuration for the node {noderange}", - matcher => '^/nodes/[^/]*/console$', - PUT => { - desc => "Update conserver configuration for the node {noderange}.", - usage => "|Json Formatted DataBody: {action:on/off}.|$usagemsg{non_getreturn}|", - example => "|Enable the console capability for node1|PUT|/nodes/node1/console {\"action\":\"on\", \"trust_host\": \"host\"}||", - cmd => "makeconservercf", + provision => { + desc => "[URI:/nodes/{noderange}/provision] - The deployment resource for the node {noderange}", + matcher => '^/nodes/[^/]*/provision$', + PUT => { + desc => "OS provision for the node {noderange}.", + usage => "|Json Formatted DataBody: {osimage: ubuntu16.04.1-x86_64-install-compute, action: boot}.|$usagemsg{non_getreturn}|", + example => "|Provision the node|PUT|/nodes/node1/provision {\"osimage\":\"ubuntu16.04.1-x86_64-install-compute\"}||", + cmd => "rinstall", fhandler => \&actionhdl, outhdler => \&noout, - } + } }, energy => { desc => "[URI:/nodes/{noderange}/energy] - The energy resource for the node {noderange}", @@ -773,7 +773,7 @@ my %URIdef = ( }, #### definition for mknb [-c] nbimage => { - desc => "[URI:/nbimage] - Create netboot root image for specified arch.", + desc => "[URI:/services/nbimage] - Create netboot root image for specified arch.", matcher => '^/services/nbimage/arch/[ppc64|x86_64]', POST => { desc => "creates a network boot root image", @@ -783,6 +783,18 @@ my %URIdef = ( fhandler => \&actionhdl, }, }, + console => { + desc => "[URI:/services/console] - Conserver configuration on management node.", + matcher => '^/services/console$', + PUT => { + desc => "Update conserver configuration", + usage => "|Json Formatted DataBody: {nodes: [node1, node2], action: on/off trust_host: }.|$usagemsg{non_getreturn}|", + example => "|Enable the console capability for node1|PUT|/services/console {\"nodes\":\n[\"node1\", \"node2\"]\"\n, \"action\": \"on\", \n\"trust_host\": \"host\"}||", + cmd => "makeconservercf", + fhandler => \&actionhdl, + outhdler => \&noout, + } + }, }, #### definition for network resources @@ -2194,15 +2206,25 @@ sub actionhdl { } } elsif ($params->{'resourcename'} eq "console") { + delete $request->{noderange}; if ($paramhash->{'action'}) { my %action = ('on' => '', 'off' => '-d'); push @args, $action{$paramhash->{'action'}}; - if ($paramhash->{'trust_host'}) { - push @args, '-t'; - push @args, $paramhash->{'trust_host'}; + if ($paramhash->{'nodes'}) { + $request->{noderange} = join(',', @{$paramhash->{'nodes'}}); + } else { + error("Missed node.") } - } else { - error("Missed Action.", $STATUS_NOT_FOUND); + } + if ($paramhash->{'trust_host'}) { + push @args, '-t'; + push @args, $paramhash->{'trust_host'}; + } + } elsif ($params->{'resourcename'} eq "provision") { + if ($paramhash->{'osimage'}) { + push @args, 'osimage='.$paramhash->{'osimage'}; + } elsif ($paramhash->{'action'}) { + push @args, $paramhash->{'action'}; } } From 12773c44fc9b48c8615e8f6352c1f0e52c815b65 Mon Sep 17 00:00:00 2001 From: bybai Date: Thu, 25 Aug 2016 01:52:19 -0400 Subject: [PATCH 168/391] fix issue 1553 makedns failed when input invalid hostname into /etc/hosts --- xCAT-server/lib/xcat/plugins/ddns.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 266d154106..4d14a8f228 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -423,6 +423,8 @@ sub process_request { my $names; my @hosts; my %nodehash; + my @eachhost; + my $invalid; foreach (@contents) { chomp; #no newline @@ -440,6 +442,18 @@ sub process_request { next; } + @eachhost = split(/ /,$names); + foreach my $hname (@eachhost) { + unless ($hname !~ /^\.[a-z0-9]+/i) { + xCAT::SvrUtils::sendmsg(":Ignoring line $_ in /etc/hosts, names $names start with . ", $callback); + $invalid = $names; + last; + } + } + if ($invalid) { + next; + } + my ($host, $ip) = xCAT::NetworkUtils->gethostnameandip($addr); push @hosts, $host; $nodehash{$addr}{names} = $names; From 6d0bf02cfa3b935e1cf5ec094f5670a7538d16f3 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Thu, 25 Aug 2016 14:48:23 +0800 Subject: [PATCH 169/391] fix return code is 0 when there are errors (#1763) --- xCAT-server/lib/xcat/plugins/packimage.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index c4c91149c1..d5ab79c764 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -418,7 +418,7 @@ sub process_request { my $temppath; my $oldmask; unless (-d $rootimg_dir) { - $callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"] }); + $callback->({ error => ["$rootimg_dir does not exist, run genimage -o $osver -p $profile on a server with matching architecture"], errorcode => [1] }); return 1; } @@ -427,21 +427,21 @@ sub process_request { if ($compress eq 'gzip') { my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); unless ($isgzip == 0) { - $callback->({ error => ["Command gzip does not exist, please make sure it is installed."] }); + $callback->({ error => ["Command gzip does not exist, please make sure it is installed."], errorcode => [1] }); return 1; } $suffix = "gz"; } elsif ($compress eq 'pigz') { my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); unless ($ispigz == 0) { - $callback->({ error => ["Command pigz does not exist, please make sure it is installed."] }); + $callback->({ error => ["Command pigz does not exist, please make sure it is installed."], errorcode => [1] }); return 1; } $suffix = "gz"; } elsif ($compress eq 'xz') { my $isxz = system("bash -c 'type -p xz' >/dev/null 2>&1"); unless ($isxz == 0) { - $callback->({ error => ["Command xz does not exist, please make sure it is installed."] }); + $callback->({ error => ["Command xz does not exist, please make sure it is installed."], errorcode => [1] }); return 1; } $suffix = "xz"; @@ -458,7 +458,7 @@ sub process_request { if ($isgzip == 0) { $compress = "gzip"; } else { - $callback->({ error => ["The default compress tool 'gzip' and 'pigz' does not exist, please specify an available compress method with '-c'."] }); + $callback->({ error => ["The default compress tool 'gzip' and 'pigz' does not exist, please specify an available compress method with '-c'."], errorcode => [1] }); return 1; } } From 547516d848432e879462ff72742f87e469fffad4 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 25 Aug 2016 04:10:41 -0400 Subject: [PATCH 170/391] update the case bundle for some cases are not supported on the specific os --- xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 2 -- xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 2 -- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 - xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 - 6 files changed, 8 deletions(-) diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index 5e36e9c51d..94459a3111 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -33,9 +33,7 @@ packimage_imagename packimage_h packimage_v packimage_m_cpio_c_gzip -packimage_m_cpio_c_pigz packimage_m_cpio_c_xz -packimage_m_tar_c_pigz packimage_m_tar_c_gzip packimage_m_tar_c_xz packimage_m_invalid_archive_method diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index d89d7e1bf2..c4548264d0 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -215,9 +215,7 @@ disable_root_permission_in_policy_table assign_certain_command_permission reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip -packimage_m_cpio_c_pigz packimage_m_cpio_c_xz -packimage_m_tar_c_pigz packimage_m_tar_c_gzip packimage_m_tar_c_xz packimage_m_invalid_archive_method diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 843c15613f..e4c01d5b3b 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -2,7 +2,6 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 go_xcat_noinput -go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 makehosts_h diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index a601f8cb42..0b405b1ae7 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -2,7 +2,6 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm go_xcat_local_repo_case7 go_xcat_noinput -go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 makehosts_h diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index e5e3bc079a..bc050eb583 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -2,7 +2,6 @@ Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 go_xcat_noinput -go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 makehosts_h diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index c7ac8a3044..cb7c8a4ceb 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -2,7 +2,6 @@ Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm go_xcat_local_repo_case7 go_xcat_noinput -go_xcat_with_x go_xcat_with_xcat-version-1 go_xcat_online_repo_case6 makehosts_h From 2a0529876a3207aa6ad38b94c2e4a9998bd50965 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 25 Aug 2016 21:56:05 -0400 Subject: [PATCH 171/391] fix issue enimage deleted /dev/* on the management node... #1767 --- xCAT-server/share/xcat/netboot/rh/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index a56e157b64..83087242d3 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -70,7 +70,7 @@ my $noupdate; sub xdie { system("rm -rf /tmp/xcatinitrd.$$"); - umount_chroot($rootimage_dir); + umount_chroot($rootimg_dir); die @_; } From 3a80d1b1bbf58ababa276766a7e2e11b4c1da0db Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 26 Aug 2016 02:46:37 -0400 Subject: [PATCH 172/391] update bundle since rh does not have pigz --- xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 2 -- xCAT-test/autotest/testcase/packimg/cases0 | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 38be7be149..77cc051730 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -23,9 +23,7 @@ packimage_imagename packimage_h packimage_v packimage_m_cpio_c_gzip -packimage_m_cpio_c_pigz packimage_m_cpio_c_xz -packimage_m_tar_c_pigz packimage_m_tar_c_gzip packimage_m_tar_c_xz packimage_m_invalid_archive_method diff --git a/xCAT-test/autotest/testcase/packimg/cases0 b/xCAT-test/autotest/testcase/packimg/cases0 index 9cdb681d09..b0e2d1502d 100644 --- a/xCAT-test/autotest/testcase/packimg/cases0 +++ b/xCAT-test/autotest/testcase/packimg/cases0 @@ -314,7 +314,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -m invalid +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -m invalid check:rc!=0 check:output=~Error: Invalid archive method 'invalid' requested cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg @@ -330,7 +330,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 cmd:ls -l /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg check:rc==0 -cmd:packimage -o __GETNODEATTR($$CN,os)__ -p compute -a __GETNODEATTR($$CN,arch)__ -c invalid +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute -c invalid check:rc!=0 check:output=~Error: Invalid compress method 'invalid' requested cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg From 80ba704a154b8cf1c83d4beb3a7638406173bc03 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 26 Aug 2016 16:52:06 +0800 Subject: [PATCH 173/391] [go-xcat] Fix github issue #1641, issue #1748 --- xCAT-server/share/xcat/tools/go-xcat | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 62b7ed9e6b..794355cef7 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.2 +# Version 1.0.3 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -483,7 +483,8 @@ function check_repo_version_dnf() function check_repo_version_yum() { type yum >/dev/null 2>&1 || return 255 - check_exec_or_exit repoquery + check_executes repoquery + exit_if_bad "$?" "Install the 'yum-utils' package and rerun." local -a name=() local -a ver=() while read -r name ver @@ -588,12 +589,12 @@ function get_package_list_dnf() function get_package_list_yum() { type yum >/dev/null 2>&1 || return 255 - check_exec_or_exit repoquery + check_executes repoquery + exit_if_bad "$?" "Install the 'yum-utils' package and rerun." local repo_id="$1" [[ -z "${repo_id}" ]] && return 1 repoquery -qa "--repoid=${repo_id}" --qf "%{name}" 2>/dev/null } - # $1 repo id function get_package_list_zypper() { @@ -611,8 +612,13 @@ function get_package_list_apt() local repo_id="$1" [[ -z "${repo_id}" ]] && return 1 awk '/^Package: / { print $2 }' \ - <"/var/lib/apt/lists/"*"_${repo_id}_dists"*"_main_binary-"*"_Packages" \ + "/var/lib/apt/lists/"*"_${repo_id}_dists"*"_main_binary-"*"_Packages" \ 2>/dev/null + # This is a dirty hack, and use recursion. + # For the `devel' branch of the online repo for apt, it has the + # subdirectory name of `core-snap' instead of `xcat-core'. + [[ "$?" -ne "0" && "${repo_id}" = "xcat-core" ]] && + "${FUNCNAME}" "core-snap" } # $1 repo id @@ -1519,7 +1525,10 @@ case "${GO_XCAT_ACTION}" in esac fi ( - "${GO_XCAT_INSTALLER}" "${GO_XCAT_YES[@]}" 2>&1 1>&42 | + # Use `-y' here. Since the STDOUT is redirect to tee. + # `yum' does not display the prompt message properly when + # working with tee. + "${GO_XCAT_INSTALLER}" -y 2>&1 1>&42 | tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stderr" >&2 exit "${PIPESTATUS[0]}" ) 42>&1 | tee "${TMP_DIR}/${GO_XCAT_INSTALLER}.stdout" @@ -1557,8 +1566,6 @@ case "${GO_XCAT_ACTION}" in fi fi >"${TMP_DIR}/go-xcat.log.008" - list_xcat_packages | tee "${TMP_DIR}/go-xcat.log.099" - if [[ "${RET}" -ne "0" ]] then GO_XCAT_LOG="/tmp/go-xcat.log" @@ -1600,6 +1607,7 @@ case "${GO_XCAT_ACTION}" in xCAT has been updated! ====================== + Congratulations! EOF ;; esac From c8e77245939887abb8ce94cb24ea85c8a79744f5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 26 Aug 2016 18:50:07 -0400 Subject: [PATCH 174/391] Do not reuse cdrom device label when adding new disks to KVM (#1751) * Do not reuse cdrom device label when adding new disks to KVM * Return array of cdrom devices instead of just one --- xCAT-server/lib/xcat/plugins/kvm.pm | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 32b73c72ae..9832e158ff 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1894,6 +1894,18 @@ sub chvm { } } } + + # The function get_multiple_paths_by_url() is used to polulate useddisks hash, + # but it only returns disk volumes from kvm host. + # cdrom is not returned by get_multiple_paths_by_url() but is defined as a disk device + # in xml definition of the VM. + # We add cdrom entry to useddisks hash to make sure the device name used by cdrom is not + # selected for the new disk about to be added (chvm -a) + my @cdrom_names = get_cdrom_device_names($vmxml); + foreach my $cdrom_name (@cdrom_names) { + $useddisks{$cdrom_name} = 1; + } + if (@addsizes) { #need to add disks, first identify used devnames my @diskstoadd; my $location = $confdata->{vm}->{$node}->[0]->{storage}; @@ -1938,6 +1950,7 @@ sub chvm { $dev = $prefix . shift(@suffixes); } while ($useddisks{$dev}); + #ok, now I need a volume created to attach push @diskstoadd, get_filepath_by_url(url => $location, dev => $dev, create => $_, format => $format); } @@ -4093,4 +4106,25 @@ sub dohyp { #print $out $msgtoparent; #$node.": $_\n"; } +# Return array of device names used by cdrom as defined in the kvm_nodedata table +sub get_cdrom_device_names() { + my $xml = shift; + my $device_name; + my @cdrom_device_names; + + my $myxml = $parser->parse_string($xml); + my @alldisks = $myxml->findnodes("/domain/devices/disk"); + # Look through all the disk entries defined in the xml + foreach my $disknode (@alldisks) { + my $devicetype = $disknode->getAttribute("device"); + # Check if it is cdrom + if ($devicetype eq "cdrom") { + # Get name of the cdrom + $device_name = $disknode->findnodes('./target')->[0]->getAttribute('dev'); + push @cdrom_device_names, $device_name; + } + } + return @cdrom_device_names; +} + 1; From a9b9c89c28fa9c914aee3423edd264476bcf10ca Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 25 Aug 2016 01:14:13 -0400 Subject: [PATCH 175/391] Remove the hardcoded password for FSP --- .../references/man1/rspconfig.1.rst | 26 +---- perl-xCAT/xCAT/PPCcfg.pm | 45 +------- perl-xCAT/xCAT/PPCfsp.pm | 102 +----------------- perl-xCAT/xCAT/Usage.pm | 4 - xCAT-client/pods/man1/rspconfig.1.pod | 22 +--- xCAT-server/lib/perl/xCAT/PPC.pm | 2 - 6 files changed, 9 insertions(+), 192 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index 911a802225..e737ef070b 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -80,16 +80,12 @@ FSP/CEC specific: ================= -\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ } +\ **rspconfig**\ \ *noderange*\ {\ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ } \ **rspconfig**\ \ *noderange*\ \ **autopower**\ ={\ **enable | disable**\ } \ **rspconfig**\ \ *noderange*\ \ **iocap**\ ={\ **enable | disable**\ } -\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ } - -\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ } - \ **rspconfig**\ \ *noderange*\ \ **time**\ =\ *hh:mm:ss*\ \ **rspconfig**\ \ *noderange*\ \ **date**\ =\ *mm:dd:yyyy*\ @@ -142,7 +138,7 @@ BPA/Frame Specific: =================== -\ **rspconfig**\ \ *noderange*\ {\ **network | dev | celogin1**\ } +\ **rspconfig**\ \ *noderange*\ {\ **network**\ } \ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,**\ \*} @@ -150,10 +146,6 @@ BPA/Frame Specific: \ **rspconfig**\ \ *noderange*\ \ **network**\ ={\ **nic,0.0.0.0**\ } -\ **rspconfig**\ \ *noderange*\ \ **dev**\ ={\ **enable | disable**\ } - -\ **rspconfig**\ \ *noderange*\ \ **celogin1**\ ={\ **enable | disable**\ } - \ **rspconfig**\ \ *noderange*\ \ **HMC_passwd**\ ={\ *currentpasswd,newpasswd*\ } \ **rspconfig**\ \ *noderange*\ \ **admin_passwd**\ ={\ *currentpasswd,newpasswd*\ } @@ -255,7 +247,7 @@ DESCRIPTION \ **rspconfig**\ configures various settings in the nodes' service processors. If only a keyword is specified, without the \ **=**\ , it displays the current value. -For options \ **autopower | iocap | dev | celogin1 | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first. For options \ **dev | celogin1**\ , user also need to contact IBM service to get the dynamic password for 'celogin' and put it in passwd table. After completed the command, user should use \ *chdef -t site enableASMI=no*\ to disable ASMI. +For options \ **autopower | iocap | decfg | memdecfg | procdecfg | time | date | spdump | sysdump | network**\ , user need to use \ *chdef -t site enableASMI=yes*\ to enable ASMI first. ******* @@ -396,18 +388,6 @@ OPTIONS -\ **dev**\ ={\ **enable**\ | \ **disable**\ } - - Enable or disable the CEC|Frame 'dev' account or display account status if no value specified. - - - -\ **celogin1**\ ={\ **enable**\ | \ **disable**\ } - - Enable or disable the CEC|Frame 'celogin1' account or display account status if no value specified. - - - \ **ip**\ The ip address. diff --git a/perl-xCAT/xCAT/PPCcfg.pm b/perl-xCAT/xCAT/PPCcfg.pm index 9c0f1c2af1..cae3b79075 100644 --- a/perl-xCAT/xCAT/PPCcfg.pm +++ b/perl-xCAT/xCAT/PPCcfg.pm @@ -50,9 +50,7 @@ sub parse_args { "general_passwd", "*_passwd", "hostname", - "resetnet", - "dev", - "celogin1" + "resetnet" ); my @bpa = ( "frame", @@ -63,9 +61,7 @@ sub parse_args { "general_passwd", "*_passwd", "hostname", - "resetnet", - "dev", - "celogin1" + "resetnet" ); my @ppc = ( "sshcfg" @@ -169,16 +165,6 @@ sub parse_args { return (usage("No argument specified for '$_'")); } } - { - if ($request->{dev} eq '1' && $request->{other} eq '1') { - return (usage("Invalid command arrays")); - } - - # my $result = parse_dev_option( $request, \%cmds); - # if ($result) { - # return ( usage($result)); - # } - } #################################### # Return method to invoke #################################### @@ -216,25 +202,6 @@ sub parse_args { return (\%opt); } - -sub parse_dev_option { - my $req = shift; - my $cmds = shift; - foreach my $cmd (keys %$cmds) { - if ($cmd =~ /^(dev|celogin1)$/) { - if ($cmds->{$cmd} and ($cmds->{$cmd} !~ /^(enable|disable)$/i)) { - return ("Invalid argument " . $cmds->{$cmd} . " for " . $cmd); - } - $req->{dev} = 1; - } else { - $req->{other} = 1; - } - } - if ($req->{dev} eq '1' && $req->{other} eq '1') { - return ("Invalid command arrays"); - } - return undef; -} ########################################################################## # Parse the command line optional arguments ########################################################################## @@ -324,14 +291,6 @@ sub parse_option { } } - if ($command eq 'dev' or $command eq 'celogin1') { - if ($value !~ /^(enable|disable)$/i) { - return ("Invalid argument '$value'"); - } - $request->{dev} = 1; - } else { - $request->{other} = 1; - } return undef; } diff --git a/perl-xCAT/xCAT/PPCfsp.pm b/perl-xCAT/xCAT/PPCfsp.pm index 081ac42174..be754ee57c 100644 --- a/perl-xCAT/xCAT/PPCfsp.pm +++ b/perl-xCAT/xCAT/PPCfsp.pm @@ -38,9 +38,7 @@ my %cmds = ( autopower => [ "Auto Power Restart", \&autopower ], sysdump => [ "System Dump", \&sysdump ], spdump => [ "Service Processor Dump", \&spdump ], - network => [ "Network Configuration", \&netcfg ], - dev => [ "Service Processor Command Line", \&devenable ], - celogin1 => [ "Service Processor Command Line", \&ce1enable ] }, + network => [ "Network Configuration", \&netcfg ]}, ); @@ -216,55 +214,6 @@ sub connect { } -sub ce1enable { - return &loginenable($_[0], $_[1], $_[2], "celogin1"); -} - -sub devenable { - return &loginenable($_[0], $_[1], $_[2], "dev"); -} -my %cmdline_for_log = ( - dev => { - enable => "registry -Hw nets/DevEnabled 1", - disable => "registry -Hw nets/DevEnabled 0", - check_pwd => "registry -l DevPwdFile", - create_pwd => "netsDynPwdTool --create dev FipSdev", - password => "FipSdev" - }, - celogin1 => { - enable => "registry -Hw nets/CE1Enabled 1", - disable => "registry -Hw nets/CE1Enabled 0", - check_pwd => "registry -l Ce1PwdFile", - create_pwd => "netsDynPwdTool --create celogin1 FipSce1", - password => "FipSce1" - }, -); - -sub send_command { - my $ua = shift; - my $server = shift; - my $id = shift; - my $log_name = shift; - my $cmd = shift; - my $cmd_line = $cmdline_for_log{$log_name}{$cmd}; - if (!defined($cmd_line)) { - return undef; - } - my $res = $ua->post("https://$server/cgi-bin/cgi", - [ form => $id, - cmd => $cmd_line, - submit => "Execute" ] - ); - - if (!$res->is_success()) { - return undef; - } - if ($res->content =~ /(not allowed.*\.|Invalid entry)/) { - return undef; - } - return $res->content; -} - sub loginstate { my $ua = shift; my $server = shift; @@ -282,55 +231,6 @@ sub loginstate { } } -sub loginenable { - my $exp = shift; - my $request = shift; - my $id = shift; - my $log_name = shift; - my $ua = @$exp[0]; - my $server = @$exp[1]; - - my $value = $request->{method}{$log_name}; - if (!defined($value)) { - return &loginstate($ua, $server, $log_name); - } - my $url = "https://$server/cgi-bin/cgi?form=$id"; - my $res = $ua->get($url); - if (!$res->is_success()) { - return ([ RC_ERROR, $res->status_line ]); - } - - $res = &send_command($ua, $server, $id, $log_name, $value); - if (!defined($res)) { - return ([ RC_ERROR, "Send command Failed" ]); - } - if ($value =~ m/^disable$/) { - my $out = sprintf("%9s: Disabled", $log_name); - return ([ SUCCESS, $out ]); - } - - #check password# - $res = &send_command($ua, $server, $id, $log_name, "check_pwd"); - if (!defined($res)) { - return ([ RC_ERROR, "Send command Failed" ]); - } - my $password = undef; - if ($res =~ m/\[\d+([a-zA-Z]+)\d+\]/) { - $password = $1; - } else { - - # create password # - $res = &send_command($ua, $server, $id, $log_name, "create_pwd"); - if (!defined($res)) { - return ([ RC_ERROR, "Send command Failed" ]); - } - $password = $cmdline_for_log{$log_name}{password}; - print "create password for $log_name is '$cmdline_for_log{$log_name}{password}'\n"; - } - my $out = sprintf("%9s: Enabled, password: $password", $log_name); - return ([ SUCCESS, $out ]); -} - sub disconnect { my $exp = shift; diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 523ba6acb6..b978a03d17 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -187,10 +187,6 @@ my %usage = ( HMC specific: rspconfig [sshcfg] rspconfig [sshcfg=] - CEC|Frame(using ASM)Specific: - rspconfig [dev|celogin1] - rspconfig [dev=]| - rspconfig [celogin1=] ", "getmacs" => "Usage: diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index e2f89c4b1c..eabf3cb614 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -54,16 +54,12 @@ B I B={[B],[B],[B],[ =head2 FSP/CEC specific: -B I {B|B|B|B|B|B|B|B