mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-12-28 03:41:45 +00:00
Merge pull request #1028 from hu-weihua/sncase
Add new SN setup case to support using bundle only in jenkins environment
This commit is contained in:
95
xCAT-test/autotest/testcase/installation/SN_setup_case
Normal file
95
xCAT-test/autotest/testcase/installation/SN_setup_case
Normal file
@@ -0,0 +1,95 @@
|
||||
start:SN_setup_case
|
||||
os:Linux
|
||||
stop:yes
|
||||
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/pre_deploy_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__
|
||||
check:rc==0
|
||||
|
||||
cmd:chtab key=nameservers site.value="<xcatmaster>"
|
||||
check:rc==0
|
||||
cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then chdef -t node -o $$SN vmstorage=dir:///var/lib/libvirt/images/ && rmvm $$SN -f -p && mkvm $$SN -s 25G; fi
|
||||
|
||||
cmd:makedns -n
|
||||
check:rc==0
|
||||
cmd:makeconservercf
|
||||
check:rc==0
|
||||
cmd:cat /etc/conserver.cf | grep $$SN
|
||||
check:output=~$$SN
|
||||
cmd:sleep 10
|
||||
cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "ppc64" ]]; then getmacs -D $$SN; fi
|
||||
check:rc==0
|
||||
cmd:makedhcp -n
|
||||
check:rc==0
|
||||
cmd:makedhcp -a
|
||||
check:rc==0
|
||||
cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi
|
||||
check:output=~$$SN
|
||||
|
||||
cmd:chdef -t node $$SN groups=service,all
|
||||
check:rc==0
|
||||
cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac
|
||||
check:rc==0
|
||||
cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1
|
||||
check:rc==0
|
||||
cmd:chdef -t group -o service nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN monserver=$$MN
|
||||
check:rc==0
|
||||
cmd:chtab node=service postscripts.postscripts="servicenode"
|
||||
check:rc==0
|
||||
|
||||
cmd:copycds $$ISO
|
||||
check:rc==0
|
||||
|
||||
cmd:chdef -t site clustersite installloc="/install"
|
||||
check:rc==0
|
||||
|
||||
cmd:cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-core && createrepo .
|
||||
check:rc==0
|
||||
|
||||
cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path$ver/__GETNODEATTR($$SN,arch)__ && createrepo .;
|
||||
check:rc==0
|
||||
|
||||
cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkgdir=/install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__
|
||||
check:rc==0
|
||||
|
||||
cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then path="sles";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist;
|
||||
check:rc==0
|
||||
|
||||
#cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service pkgdir="/install/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__"
|
||||
#check:rc==0
|
||||
|
||||
cmd:nodeset $$SN osimage=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service
|
||||
check:rc==0
|
||||
cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "ppc64" ]]; then rnetboot $$SN;elif [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rpower $$SN boot; fi
|
||||
check:rc==0
|
||||
|
||||
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/installation/customize_sleep_for_sn __GETNODEATTR($$SN,os)__ __GETNODEATTR($$SN,arch)__
|
||||
|
||||
cmd:ping $$SN -c 3
|
||||
check:rc==0
|
||||
check:output=~64 bytes from $$SN
|
||||
cmd:lsdef -l $$SN | grep status
|
||||
check:rc==0
|
||||
check:output=~booted
|
||||
cmd:xdsh $$SN date
|
||||
check:rc==0
|
||||
check:output=~\d\d:\d\d:\d\d
|
||||
cmd:xdsh $$SN "ps -ef |grep xcatd"
|
||||
check:rc==0
|
||||
check:output=~xcatd:
|
||||
cmd:xdsh $$SN "lsdef"
|
||||
check:rc==0
|
||||
check:output=~$$SN: $$SN
|
||||
cmd:xdsh $$SN "tabdump site"
|
||||
check:rc==0
|
||||
check:output=~tftpdir
|
||||
cmd:xdsh $$SN "mount"
|
||||
check:rc==0
|
||||
check:output=~/install on /install
|
||||
cmd:xdsh $$SN "mount"
|
||||
check:rc==0
|
||||
check:output=~/tftpboot on /tftpboot
|
||||
|
||||
cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]];then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi
|
||||
check:rc==0
|
||||
|
||||
end
|
||||
28
xCAT-test/autotest/testcase/installation/customize_sleep_for_sn
Executable file
28
xCAT-test/autotest/testcase/installation/customize_sleep_for_sn
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
my $os=$ARGV[0];
|
||||
my $arch=$ARGV[1];
|
||||
my $log="/tmp/pre_deploy_sn.log";
|
||||
|
||||
my $orgclusterconffile="/opt/xcat/share/xcat/tools/autotest/default.conf";
|
||||
my $snnodename = `cat $orgclusterconffile |grep SN|grep =|awk -F'=' '{print \$2}'`;
|
||||
chomp($snnodename);
|
||||
`echo "SN=$snnodename" >> $log`;
|
||||
sleep 300;
|
||||
|
||||
my $timecnt=0;
|
||||
while($timecnt < 200){
|
||||
my $booted=system("lsdef -l $snnodename|grep status|grep booted");
|
||||
last if($booted==0);
|
||||
|
||||
if($os =~ /rhel/i && $arch =~ /^ppc64$/i){
|
||||
my $booting=system("lsdef -l $snnodename|grep status|grep booting");
|
||||
system("xdsh $snnodename \"echo 1\"") if($booting==0);
|
||||
`echo "send signal to $snnodename for the $timecnt times" >> $log`;
|
||||
}
|
||||
|
||||
sleep 10;
|
||||
$timecnt++;
|
||||
}
|
||||
|
||||
exit 0;
|
||||
39
xCAT-test/autotest/testcase/installation/pre_deploy_sn
Executable file
39
xCAT-test/autotest/testcase/installation/pre_deploy_sn
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
my $os=$ARGV[0];
|
||||
my $arch=$ARGV[1];
|
||||
my $log="/tmp/pre_deploy_sn.log";
|
||||
|
||||
sub runcmd{
|
||||
my $cmd=shift;
|
||||
`$cmd >> $log 2>&1`;
|
||||
if($?){
|
||||
#print "run $cmd ....[error]\n";
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
my $setupmysqlscript="#!/usr/bin/expect -f
|
||||
set timeout -1
|
||||
spawn mysqlsetup -i
|
||||
expect \"in the MySQL database:\"
|
||||
send \"12345\\r\"
|
||||
expect \"in the MySQL database:\"
|
||||
send \"12345\\r\"
|
||||
interact
|
||||
";
|
||||
|
||||
my $cmd = "echo '$setupmysqlscript' > /tmp/setupmysqlscript && chmod +x /tmp/setupmysqlscript";
|
||||
runcmd("$cmd");
|
||||
|
||||
$cmd="bash -lic \"/tmp/setupmysqlscript > /tmp/setupmysqlscript.rst\" ";
|
||||
runcmd("$cmd");
|
||||
|
||||
$cmd="echo \"GRANT ALL on xcatdb.* TO xcatadmin@\'%\' IDENTIFIED BY \'12345\'\;\" | mysql -u root -p12345";
|
||||
runcmd("$cmd");
|
||||
|
||||
my $xcatballpath = "/install/post/otherpkgs/$os/$arch/xcat";
|
||||
$cmd="mkdir -p $xcatballpath/xcat-core && cp -r /xcat-core/* $xcatballpath/xcat-core && cp -r /xcat-dep $xcatballpath";
|
||||
runcmd("$cmd");
|
||||
|
||||
exit 0;
|
||||
Reference in New Issue
Block a user