mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	add fork
This commit is contained in:
		| @@ -286,26 +286,27 @@ sub git_update { | ||||
| # copy code | ||||
| ####################################### | ||||
| sub copy_code { | ||||
|     my $mn = shift; | ||||
|     my $codedir = $confhash{srcdir}; | ||||
|     send_msg("src code directory is $confhash{srcdir}");  | ||||
|      | ||||
|     ##will modify to $rhppc64config{var}{MNIP}  | ||||
|     my $mn = $management_node; | ||||
|     #my $mn = $management_node; | ||||
|     send_msg("mn is $mn"); | ||||
|      | ||||
|     #install dep for buildlocal | ||||
|     send_msg("begin to install build required packages on mn"); | ||||
|     send_msg("begin to install build required packages on mn $mn"); | ||||
|     $res = system("xdsh $mn yum install -y rpm-build perl-Time-HiRes perl-DBI createrepo"); | ||||
|      | ||||
|      | ||||
|     #need to copy /etc/hosts to mn | ||||
|     send_msg("copy /etc/hosts to mn"); | ||||
|     send_msg("copy /etc/hosts to mn $mn"); | ||||
|     system("scp /etc/hosts $mn:/etc"); | ||||
|      | ||||
|     send_msg("begin to copy code"); | ||||
|     send_msg("begin to copy code to $mn"); | ||||
|     $res = system("scp -r $codedir root\@$mn:/"); | ||||
|     if ($res != 0){ | ||||
|         send_msg("code copy failed"); | ||||
|         send_msg("code copy failed $mn"); | ||||
|         exit 1; | ||||
|     } | ||||
|     return 0; | ||||
| @@ -323,7 +324,7 @@ sub build_xcat { | ||||
|     #will changed /code/xcat-core to $confkeys{srcdir}   | ||||
|     $res = system("xdsh $mn /xcat-core/buildlocal.sh CURDIR=/xcat-core"); | ||||
|     if ($res != 0){ | ||||
|               send_msg("build failed on mn"); | ||||
|               send_msg("build failed on mn $mn"); | ||||
|               exit 1; | ||||
|           } | ||||
|      | ||||
| @@ -361,8 +362,10 @@ sub config_mn { | ||||
| ####################################### | ||||
| sub init | ||||
| { | ||||
|     my $mn = shift; | ||||
|     if (exists $rhppc64config{var}){ | ||||
|         my $MN=$rhppc64config{var}{MN}; | ||||
|         #my $MN=$rhppc64config{var}{MN}; | ||||
|         my $MN=$mn; | ||||
|         my $MNIP=$rhppc64config{var}{MNIP}; | ||||
|         my $CN=$rhppc64config{var}{CN}; | ||||
|         my $CNIP=$rhppc64config{var}{CNIP}; | ||||
| @@ -379,7 +382,7 @@ sub init | ||||
|         print "--prepareing redhat iso file.......\n"; | ||||
|         print "--mount NF ......."; | ||||
|         system ("scp -r /iso/*.iso $MN:/iso"); | ||||
|         system("xdsh $MN mount -o loop /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso /iso/mountpoint"); | ||||
|        system("xdsh $MN mount -o loop /iso/RHEL6.4-20130130.0-Server-ppc64-DVD1.iso /iso/mountpoint"); | ||||
|        system ("scp -r /etc/hosts $MN:/etc/hosts"); | ||||
|        system ("scp -r /etc/resolv.conf $MN:/etc/resolv.conf"); | ||||
|        print "[OK]\n"; | ||||
| @@ -426,15 +429,16 @@ sub init | ||||
| # do test | ||||
| ####################################### | ||||
| sub do_test { | ||||
|     my $mn = shift; | ||||
|     # step 7.1 Install xcat and init mn | ||||
|     send_msg("began to install xCAT and initialize mn"); | ||||
|     $res = &init; | ||||
|     $res = &init($mn); | ||||
|     if ($res != 0){ | ||||
|         exit 1; | ||||
|     } | ||||
|      | ||||
|     send_msg("Begin to do test"); | ||||
|     $res = &do_test1; | ||||
|     $res = &do_test1($mn); | ||||
|     if ($res) { | ||||
|         send_msg("DO TEST returns error, exit"); | ||||
|         exit 1; | ||||
| @@ -447,12 +451,14 @@ sub do_test { | ||||
| ####################################### | ||||
| sub  do_test1 | ||||
| { | ||||
|     my $MN=$rhppc64config{var}{MN}; | ||||
|     my $mn = shift; | ||||
|     #my $MN=$rhppc64config{var}{MN}; | ||||
|     my $MN=$mn; | ||||
|     my $nodedir=$rhppc64config{var}{nodedir}; | ||||
|     print "copy config file "; | ||||
|     system("scp -r default.conf $MN:$rhppc64configfile"); | ||||
|      | ||||
|     print "Start to run diskless installation ...\n"; | ||||
|     print "Start to run diskless installation $MN ...\n"; | ||||
|     send_msg("******************************"); | ||||
|     send_msg("start diskless test"); | ||||
|     send_msg("******************************"); | ||||
| @@ -462,10 +468,10 @@ sub  do_test1 | ||||
|     #   exit 1; | ||||
|     #} | ||||
|     #if($bundlerun){ | ||||
|          print "Start to run the automation test bucket ....\n"; | ||||
|     #     print "Start to run the automation test bucket ....\n"; | ||||
|     #    system("xdsh $MN mkdir -p /autotest/result"); | ||||
|          system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle"); | ||||
|          system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #     system("xdsh $MN /opt/xcat/bin/xcattest -b /opt/xcat/share/xcat/tools/autotest/bundle/bat.bundle"); | ||||
|     #     system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #    $output = ("xdsh $MN tail /autotest/result/xcattest.log.$timestamp"); | ||||
|     #    if($output =~ /Total: (\d+) , Failed: (\d+)/){ | ||||
| @@ -484,8 +490,8 @@ sub  do_test1 | ||||
|     #    } | ||||
|     #    } | ||||
|     #if($stateliteinst){ | ||||
|         system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf  -t Linux_statelite_installation_flat_ppc64"); | ||||
|         system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf  -t Linux_statelite_installation_flat_ppc64"); | ||||
|     #    system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #   system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #   $output = system(" xdsh $MN tail /autotest/result/xcattest.log.$timestamp"); | ||||
|     #   if($output =~ /Failed: (\d+)/){ | ||||
| @@ -498,8 +504,8 @@ sub  do_test1 | ||||
|     #   } | ||||
|     #} | ||||
|     #if($fullinst){ | ||||
|         system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64"); | ||||
|         system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64"); | ||||
|     #    system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #   system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #   $output = xdsh $MN tail /autotest/result/xcattest.log.$timestamp; | ||||
|     #   if($output =~ /Failed: (\d+)/){ | ||||
| @@ -512,8 +518,8 @@ sub  do_test1 | ||||
|     #   } | ||||
|     #} | ||||
|     #if($snfullinst){ | ||||
|          system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm"); | ||||
|          system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #     system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm"); | ||||
|     #     system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #    $output = xdsh $MN tail /autotest/result/xcattest.log.$timestamp; | ||||
|     #    if($output =~ /Failed: (\d+)/){ | ||||
| @@ -526,8 +532,8 @@ sub  do_test1 | ||||
|     #    } | ||||
|     #} | ||||
|     #if($dsklscnsninst){ | ||||
|          system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf  -t Linux_cn_with_sn_diskless_installation_flat_x86_vm"); | ||||
|          system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #     system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf  -t Linux_cn_with_sn_diskless_installation_flat_x86_vm"); | ||||
|     #     system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #    if($output =~ /Failed: (\d+)/){ | ||||
|     #       if($1 != 0){ | ||||
| @@ -539,17 +545,17 @@ sub  do_test1 | ||||
|     #    } | ||||
|     #} | ||||
|     #if($statelitecnsninst){ | ||||
|         system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_statelite_installation_flat_x86_vm"); | ||||
|         system(" xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_statelite_installation_flat_x86_vm"); | ||||
|     #    system(" xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #   system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #} | ||||
|     #if($fullcnsninst){ | ||||
|         system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_full_installation_flat_x86_vm"); | ||||
|         system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #    system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_cn_with_sn_full_installation_flat_x86_vm"); | ||||
|     #    system("xdsh $MN mv /opt/xcat/share/xcat/tools/autotest/result/* /autotest/result/"); | ||||
|     #   system("xdsh $MN cp /autotest/result/xcattest.log.$timestamp /autotest/result/log/xcattest.log.$timestamp.current"); | ||||
|     #} | ||||
|     #system("mkdir -p $nodedir/result"); | ||||
|      system("scp -r $MN:/autotest/result /regression/rhppc64"); | ||||
|     # system("scp -r $MN:/autotest/result /regression/rhppc64"); | ||||
| } | ||||
|  | ||||
| ####################################### | ||||
| @@ -611,14 +617,34 @@ sub trim { | ||||
|    return $str; | ||||
| } | ||||
|  | ||||
| ##################################### | ||||
| #repo | ||||
| #################################### | ||||
| sub repo{ | ||||
| my @osname = &runcmd("uname -a"); | ||||
| if ( $osname [0]  =~ /^Linux\s*/  &&  -f "/etc/redhat-release" && $osname [0] =~ /ppc64/){ | ||||
|    send_msg ("ppc64 redhat env\n"); | ||||
|    my $os="rhels6.4"; | ||||
|    my $arch="ppc64"; | ||||
|     send_msg ("os is $os,arch is $arch\n"); | ||||
|     &runcmd( "  echo [rhe-6.4-server]>>rhel6.4.repo"); | ||||
|     &runcmd( "  echo name=RHEL 6.4 SERVER packages>>rhel6.4.repo"); | ||||
|     &runcmd("   echo baseurl=file:///iso/mountpoint/Server/>>rhel6.4.repo"); | ||||
|     &runcmd("   echo enabled=1>>rhel6.4.repo"); | ||||
|     &runcmd("   echo gpgcheck=1>>rhel6.4.repo"); | ||||
|    # system("scp -r  rhel6.4.repo $MN:/etc/yum.repos.d/rhel6.4.repo"); | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| ####################################### | ||||
| # send messages | ||||
| ####################################### | ||||
| sub send_msg { | ||||
|     my $msg = shift; | ||||
|     my $data = `date`; | ||||
|     open (LOGFILE, ">> /home/xcatreg.lob"); | ||||
|     print LOGFILE "$data : $msg.\n"; | ||||
|     open (LOGFILE, ">> /home/xcatreg.log"); | ||||
|     print LOGFILE "$timestamp: $msg.\n"; | ||||
|     close LOGFILE; | ||||
| } | ||||
| ####################################### | ||||
| @@ -666,28 +692,27 @@ sub read_conf{ | ||||
|         } | ||||
|         if ($line =~ /^\s*rhpmn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{rhpmn} = $1; | ||||
|             $mns{rhpmn} = $confkeys{rhpmn}; | ||||
|             $mns{rhpmn} = $confkeys{rhpmn} if ($confkeys{rhpmn}); | ||||
|         } | ||||
|         if ($line =~ /^\s*slespmn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{slespmn} = $1; | ||||
|             $mns{slespmn} = $confkeys{slespmn}; | ||||
|             $mns{slespmn} = $confkeys{slespmn} if ($confkeys{slespmn}); | ||||
|         } | ||||
|         if ($line =~ /^\s*aixmn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{aixmn} = $1; | ||||
| 			$mns{aixmn} = $confkeys{aixmn}; | ||||
|              | ||||
| 	    $mns{aixmn} = $confkeys{aixmn}if ($confkeys{aixmn}); | ||||
|         } | ||||
|         if ($line =~ /^\s*rhxmn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{rhxmn} = $1; | ||||
| 			$mns{rhxmn} = $confkeys{rhxmn}; | ||||
| 	    $mns{rhxmn} = $confkeys{rhxmn}if ($confkeys{rhxmn}); | ||||
|         } | ||||
|         if ($line =~ /^\s*slesxmn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{slesxmn} = $1; | ||||
| 			$mns{slesxmn} = $confkeys{slesxmn}; | ||||
| 	    $mns{slesxmn} = $confkeys{slesxmn} if ($confkeys{slesxmn}); | ||||
|         } | ||||
|         if ($line =~ /^\s*ubuntumn\s*=\s*(\S*)\s*/) { | ||||
|             $confkeys{ubuntumn} = $1; | ||||
| 			$mns{ubuntumn} = $confkeys{ubuntumn}; | ||||
|        	    $mns{ubuntumn} = $confkeys{ubuntumn} if ($confkeys{ubuntumn}); | ||||
|         } | ||||
|     } | ||||
|     send_msg("finish reading global vars"); | ||||
| @@ -779,7 +804,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|             # step 4. Copy code to MNs | ||||
|             ####################################### | ||||
|             send_msg("\n\n\n== Running copy_code..............."); | ||||
|             $res = copy_code(); | ||||
|             $res = copy_code($mn); | ||||
|             if ($res) { | ||||
|                 send_msg("COPY CODE returns error, exit"); | ||||
|                 exit 1; | ||||
| @@ -809,7 +834,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|             ####################################### | ||||
|             exit 1; | ||||
|             send_msg("\n\n\n== Running do_test..............."); | ||||
|             $res = do_test(); | ||||
|             $res = do_test($mn); | ||||
|             if ($res) { | ||||
|                 send_msg("DO TEST returns error, exit"); | ||||
|                 exit 1; | ||||
| @@ -847,7 +872,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|         # step 4. Copy code to MNs | ||||
|         ####################################### | ||||
|         send_msg("\n\n\n== Running copy_code..............."); | ||||
|         $res = copy_code(); | ||||
|         #$res = copy_code($mn); | ||||
|         if ($res) { | ||||
|             send_msg("COPY CODE returns error, exit"); | ||||
|             exit 1; | ||||
| @@ -856,7 +881,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|         # step 5. Build xcat code in MNs | ||||
|         ####################################### | ||||
|         send_msg("\n\n\n== Running build_xcat..............."); | ||||
|         $res = build_xcat($mn); | ||||
|         #$res = build_xcat($mn); | ||||
|         if ($res) { | ||||
|             send_msg("BUILD XCAT returns error, exit"); | ||||
|             exit 1; | ||||
| @@ -865,7 +890,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|         # step 6. Read xCAT MN's configuration | ||||
|         ####################################### | ||||
|         send_msg("\n\n\n== Running config_mn..............."); | ||||
|         $res = config_mn($mn); | ||||
|         #$res = config_mn($mn); | ||||
|         if ($res) { | ||||
|             send_msg("CONFIGURE MN returns error, exit"); | ||||
|             exit 1; | ||||
| @@ -876,7 +901,7 @@ unless ($ENV{'REGDEBUG'}) { #used for debug. | ||||
|         #         Write log | ||||
|         ####################################### | ||||
|         send_msg("\n\n\n== Running do_test..............."); | ||||
|         $res = do_test(); | ||||
|         $res = do_test($mn); | ||||
|         if ($res) { | ||||
|             send_msg("DO TEST returns error, exit"); | ||||
|             exit 1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user