From 6a44ddea084179fa714dec744fdd89ea1499c814 Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 26 Sep 2013 14:51:52 +0800 Subject: [PATCH 01/80] update xcatconfig to call mknb ppc64 on power --- xCAT-server/sbin/xcatconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 95723cf2b..111cf5497 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1873,20 +1873,20 @@ sub mknb # the xCAT-genesis-base.spec file touches /etc/xcat/genesis-base-updated, # so we know to run mknb here. my $cmd; - if ($::arch eq "x86_64" && (-f '/etc/xcat/genesis-scripts-updated') ) { + if ((($::arch eq "x86_64") ||($::arch =~ /ppc/)) && (-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-x86_64 ..."); + xCAT::MsgUtils->message('I', "Running '$cmd', triggered by the installation/update of xCAT-genesis-scripts-$::arch ..."); } - if ($::arch eq "x86_64" && (-f '/etc/xcat/genesis-base-updated')) { + if ((($::arch eq "x86_64") ||($::arch =~ /ppc/)) && (-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-x86_64 ..."); + 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) { From 04f26ded54119692f9bb8790fa59f1b7cd0ab8cc Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 21 Aug 2014 10:49:08 -0700 Subject: [PATCH 02/80] minor fix --- xCAT-server/share/xcat/tools/xCATreg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index cc4198d0d..3e883b54b 100644 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -1480,7 +1480,7 @@ sub send_mail { my $msg = shift; my $head; if($num == 0) { - $head = "xCATreg got fital error with: "; + $head = "xCATreg got fatal error with: "; } elsif ($num == 1) { $head = "AUTOMATED REGRESSION TEST REPORT\n"; } From d12e49efe30e3b8ccc8f9f4e9cea6fc222db9bc7 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 18 Sep 2014 01:16:33 -0700 Subject: [PATCH 03/80] remove temp files in the git --- xCAT-OpenStack-baremetal/debian/files | 2 - .../xcat-openstack-baremetal.debhelper.log | 201 ------------------ 2 files changed, 203 deletions(-) delete mode 100644 xCAT-OpenStack-baremetal/debian/files delete mode 100644 xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log diff --git a/xCAT-OpenStack-baremetal/debian/files b/xCAT-OpenStack-baremetal/debian/files deleted file mode 100644 index 0bf4353c0..000000000 --- a/xCAT-OpenStack-baremetal/debian/files +++ /dev/null @@ -1,2 +0,0 @@ -xcat-openstack-baremetal_2.8.4-1_all.deb admin extra -xcat-openstack-baremetal_2.8.4-1_all.deb admin extra diff --git a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log b/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log deleted file mode 100644 index a151b91a0..000000000 --- a/xCAT-OpenStack-baremetal/debian/xcat-openstack-baremetal.debhelper.log +++ /dev/null @@ -1,201 +0,0 @@ -dh_installdirs -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb -dh_installdirs -dh_install -dh_link -dh_installman -dh_compress -dh_installdeb -dh_gencontrol -dh_md5sums -dh_builddeb -dh_builddeb From 425f741435e94904538024a23c05eb27c53991e9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 18 Sep 2014 01:19:02 -0700 Subject: [PATCH 04/80] remove temp file fron git --- xCAT-rmc/debian/files | 1 - 1 file changed, 1 deletion(-) delete mode 100644 xCAT-rmc/debian/files diff --git a/xCAT-rmc/debian/files b/xCAT-rmc/debian/files deleted file mode 100644 index 0cd53ffdc..000000000 --- a/xCAT-rmc/debian/files +++ /dev/null @@ -1 +0,0 @@ -xcat-rmc_2.5.0-1_all.deb admin extra From ec400ad4b457648dd9d6fb5f17a92570f26fa710 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Thu, 18 Sep 2014 05:35:23 -0400 Subject: [PATCH 05/80] add pkg1 sample for debian kit to let default buildkit.conf work --- .../source_packages/sample/pkg1/pkg1_1-2_all.deb | Bin 0 -> 1788 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb b/xCAT-buildkit/share/xcat/kits/kit_template/source_packages/sample/pkg1/pkg1_1-2_all.deb new file mode 100644 index 0000000000000000000000000000000000000000..4a445c94a1b13491779824d2427f787d13f3dddc GIT binary patch literal 1788 zcmai#X*3&%8iqrvOsEDmjawv9LOUd(mRdt8wZwLfy$Dib9fWI3w6#@LYYQd1Sc0P3 zs_3;elv_$%L`!Nfp-n7PMa6FPF7tPu^PTsc?|kR|_nh;=4RDcufkq&Iye|P4rshis z!$royU@&z}b#?Rw4P6Z#7z};1|3B5yXl+eR80={NhYv^ti3a(FhY=&gLy$yVBr+iW zulrh>7yj%+GerPD5CpEUO@b%Tr-WBazMmsbiqndK66+~&%D@nop;eDO+Of1AvY(InTO<91l+x^#gJ5gRDj50Cy;e35#^N3s>FLokg z4LCR7^}KS=CVM?l+vtX6>%|#1$&L|>sn`ZaVEKc|GoxL#T?ZNpaG=|9#PKa57 zenH|*>%aWYyxzh`XV-E~H+VSgtkGpG5~snsmyU2*7poS{@mgB>2;BcHRjPwl!VrlD z{drCLGZO?tOi~1Sy&}|{o1TfDG_mn{l8Lj{%HnMP<4by%0e5OPX;?4Vbu*`K`kB(< zz_xtlVL=k&HfOK4S<&af+eEx~es>v_-v7_v4Xb7iKPLq*G)~wm?`56lAL_1KY@eoe z?6n`q*A}#PQ?vr7o$E(B7DplY5FlMEKTUmsZ(jA%<54C4mEng>{NP2WtbHZrV(W7u zBj~DNm!=jL{X@;Dz25V6(GJW>C6Pi;Q6Cx}M!h{TK00tEkWy{@!rh^T>T48AOqopc z7U~b#7&3vjEK9mSORq~%6we0_UE<_BKRqwTvC{9MmYo{rZf@V`+yawcS-OHGE{VWX zz<;iM zai~u9My^MjBxR)w`Rff>qG2|Q21V%G<#~8=oFJGvxU-9k?)cwR6()40So&5&Jdy89 zwu77!kZ;s!*TU4+14^k%2-Z$Pa_cI2!1SNdiUAD_(7qAJD zfRoM*V*DDv&v*KIu)kO=YlI1$&Fhy#NcuL*!)}g?QtVLEAqTkE=akJtb_wk@n?IGB zHQHL z4=j?Fw89m*fmawNY9;Bb=J6t5B)P9vTDsH%k1OdmgtpcZ^agW^1PT{Ma zirX&4_rFc7Xe;!(e;0V7Tf#a30uP}^^)BGdW$de;77-BIo~$0drClwL{oejDVe#L* znrTePHE}bJESXw<_<(z?TuABR`!|zf%egL&*A&AH-0=o?roHZG7)OcE0ML~Y8D*|( zx{{wFi56-GG%GdP1zHjDu^?F9urswNLuD&f^)gSp#MrKWuvh8hPcx)2iF>HWA9+yM z4TelrtaUd+57L`RmFx&qDq-=bK&y}9uJi#HD5z*&Qa#% zVskfDy_xb;Z##>FvObXhMO0oTHq^d{@cnqL*fxom$1VtaCJ}aCU30V!#(>3|nTb|qf1ll`G*qqhNk;;zDZqAhV=W+k>{G?Tu;uZl zgAw{0pX9#yAnL$;W$!kP%y2IkZ-w8;dW#}y6JJ&EN4h6Eddf&;vR(>n`}>)r9bda7 zWM;vb+u+GGOF_AJO_q)y8C56E=!xI7yGK>twPg>*kb~BLrau?>w(w>sbiwvie^E^I zb Date: Thu, 18 Sep 2014 20:01:37 -0700 Subject: [PATCH 06/80] remove the lsslp defined pbmc node from the found nodes --- xCAT-server/lib/perl/xCAT/PPC.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) mode change 100755 => 100644 xCAT-server/lib/perl/xCAT/PPC.pm diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm old mode 100755 new mode 100644 index 8a53afdeb..e32ac42c9 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2155,11 +2155,28 @@ sub findme { push @attr_array, "mtm==$request->{mtm}->[0]"; push @attr_array, "serial==$request->{serial}->[0]"; - my @nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + my @nodes = (); + my %nodes_hash = (); + foreach (@tmp_nodes) { + $nodes_hash{$_->{node}} = '1'; + } + @nodes = keys (%nodes_hash); + # remove the pbmc node defined by lsslp from the node groups + my $ppctab = xCAT::Table->new('ppc'); + if ($ppctab) { + my $ppchash = $ppctab->getNodesAttribs(\@nodes, ['node', 'nodetype']); + foreach (@nodes) { + if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') { + delete $nodes_hash{$_}; + } + } + @nodes = keys (%nodes_hash); + } foreach (@nodes) { my $req = {%$request}; $req->{command} = ['discovered']; - $req->{noderange} = [$_->{node}]; + $req->{noderange} = [$_]; $req->{discoverymethod} = ['mtms']; $subreq->($req); %{$req} = (); From ba706470d0765ee289689229985efad533cdee3b Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 19 Sep 2014 07:50:53 -0700 Subject: [PATCH 07/80] support rspconfig ip/netmask/gateway for Power LE machine --- xCAT-server/lib/xcat/plugins/ipmi.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index f6c02a0ca..a6334f063 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -789,12 +789,25 @@ sub setnetinfo { else { return(1,"configuration of $subcommand is not implemented currently"); } + unless ($sessdata->{netinfo_setinprogress}) { + $sessdata->{netinfo_setinprogress} = '1'; + $sessdata->{ipmisession}->subcmd(netfn=>$netfun, command=>0x01, data=>[$channel_number,0x0,0x1], callback=>\&setnetinfo,callback_args=>$sessdata); + } my $command = shift @cmd; $sessdata->{ipmisession}->subcmd(netfn=>$netfun,command=>$command,data=>\@cmd,callback=>\&netinfo_set,callback_args=>$sessdata); } sub netinfo_set { my $rsp = shift; my $sessdata = shift; + if ($sessdata->{netinfo_setinprogress}) { + my $channel_number = $sessdata->{ipmisession}->{currentchannel}; + delete $sessdata->{netinfo_setinprogress}; + $sessdata->{rsp}->{error} = $rsp->{error}; + $sessdata->{rsp}->{code} = $rsp->{code}; + $sessdata->{ipmisession}->subcmd(netfn=>0x0c, command=>0x01, data=>[$channel_number,0x0,0x0], callback=>\&netinfo_set,callback_args=>$sessdata); + } else { + $rsp = $sessdata->{rsp}; + } if ($rsp->{error}) { xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); return; @@ -886,6 +899,7 @@ sub getnetinfo_response { my $rsp = shift; my $sessdata = shift; my $subcommand = $sessdata->{subcommand}; + $subcommand =~ s/=.*//; $sessdata->{subcommand} = shift @{$sessdata->{extraargs}}; if ($rsp->{error}) { xCAT::SvrUtils::sendmsg([1,$rsp->{error}],$callback,$sessdata->{node},%allerrornodes); From 1407d0044ef8a16ed9d81f79a556c0d19fe7e354 Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 19 Sep 2014 08:00:13 -0700 Subject: [PATCH 08/80] Do clean up things for Power LE hardware discovery --- xCAT-server/lib/perl/xCAT/PPC.pm | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index e32ac42c9..8699034a0 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2157,6 +2157,7 @@ sub findme { my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); my @nodes = (); + my $pbmc_node; my %nodes_hash = (); foreach (@tmp_nodes) { $nodes_hash{$_->{node}} = '1'; @@ -2169,6 +2170,7 @@ sub findme { foreach (@nodes) { if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') { delete $nodes_hash{$_}; + $pbmc_node = $_; } } @nodes = keys (%nodes_hash); @@ -2181,6 +2183,67 @@ sub findme { $subreq->($req); %{$req} = (); } + &cleanup_for_powerLE_hardware_discovery($nodes[-1], $pbmc_node, $subreq); +} + +sub cleanup_for_powerLE_hardware_discovery { + my $host_node = shift; + my $pbmc_node = shift; + my $subreq = shift; + my $ipmitab = xCAT::Table->new("ipmi"); + unless($ipmitab) { + xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); + return; + } + my @nodes = ($host_node, $pbmc_node); + my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); + if ($ipmihash) { + my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; + my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; + + xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); + if($new_bmc_ip) { + xCAT::Utils->runxcmd( + { + command => ["rspconfig"], + node => ["$pbmc_node"], + arg => [ "ip=$new_bmc_ip" ], + }, + $subreq, 0,1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); + return; + } + xCAT::Utils->runxcmd( + { + command => ["chdef"], + node => ["$pbmc_node"], + arg => [ "bmc=$new_bmc_ip" ], + }, + $subreq, 0,1); + } + xCAT::MsgUtils->message("S", "Discovery info: configure password:$new_bmc_password for pbmc_node:$pbmc_node."); + if ($new_bmc_password) { + xCAT::Utils->runxcmd( + { + command => ["rspconfig"], + node => ["$pbmc_node"], + arg => [ "password=$new_bmc_password" ], + }, + $subreq, 0,1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); + return; + } + } + xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); + xCAT::Utils->runxcmd( + { + command => ["rmdef"], + node => ["$pbmc_node"], + }, + $subreq, 0,1); + } } ########################################################################## # Process request from xCat daemon From a5dceadccf89209b1137be9bb579cd094584a7d7 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 04:09:22 -0400 Subject: [PATCH 09/80] NEW_kit_addpkgs support debian --- xCAT-buildkit/bin/buildkit | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 2f02f447f..53b7662c4 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -776,8 +776,8 @@ sub kit_buildrepo1 return 1; } } - if ( system("cd $repo;dpkg-scanpackages . > Packages") ) { - print "Error building the repository meta-data with the dpkg-scanpackages command \n"; + if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { + print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; } } @@ -1145,6 +1145,7 @@ sub edit_bldkitconf my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + my $kitcomponent_basename = $kitname."_compute"; if ($debianflag==1) { @@ -3594,9 +3595,13 @@ sub NEW_kit_addpkgs if ($kp->{isexternalpkg} eq 'yes') { my $ext_filename = $kp->{filename}; my $ext_reponames = $kp->{kitreponame}; - - my $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); - + my $files; + if($debianflag){ + $files = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirlist, $ext_filename); + } + else { + $files = xCAT::BuildKitUtils->find_latest_pkg(\@pkgdirlist, $ext_filename); + } if (!defined($files) ) { print "Error: The product package file $ext_filename was not found in the package directory(s) @pkgdirlist.\n"; # Cleanup From 25ffc91f0f44561e6f7a984c790207b54cb5a0d9 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 04:24:00 -0400 Subject: [PATCH 10/80] find latest deb pkg --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 120 +++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 18d7df37c..a410e1b6d 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -160,6 +160,7 @@ sub find_latest_pkg my @rpms; my %foundrpm; + # need to check each pkgdir for the rpm(s) # - if more than one match need to pick latest # find all the matches in all the directories @@ -223,6 +224,125 @@ sub find_latest_pkg } } +#-------------------------------------------------------------------------- +=head3 find_latest_pkg_deb + + Find the latest deb package give the deb name and a list of + possible package locations. + + Arguments: + - a list of package directories + - the name of the deb + Returns: + - \@founddeblist + - undef + Example: + my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub find_latest_pkg_deb +{ + my ($class, $pkgdirs, $debname) = @_; + my @pkgdirlist = @$pkgdirs; + + my @debs; + my %founddeb; + + + # need to check each pkgdir for the deb(s) + # - if more than one match need to pick latest + # find all the matches in all the directories + foreach my $debdir (@pkgdirlist) { + my $ffile = $debdir."/".$debname; + + if ( system("/bin/ls $ffile > /dev/null 2>&1") ){ + # if not then skip to next dir + next; + } else { + # if so then get the details and add it to the %founddeb hash + my $cmd = "/bin/ls $ffile 2>/dev/null"; + my $output = `$cmd`; + my @deblist = split(/\n/, $output); + + if ( scalar(@deblist) == 0) { + next; + } + + foreach my $r (@deblist) { + my $basename = `dpkg -I $r* |grep Package|awk '{print \$2}'`; + chomp $basename; + + my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`; + print "$basename:$version"; + + $founddeb{$basename}{$r}{version}=$version; + } + } + } + + # for each unique deb basename + foreach my $r (keys %founddeb ) { + # if more than one with same basename then find the latest + my $latestmatch=""; + foreach my $fdeb (keys %{$founddeb{$r}} ) { + # if we already found a match in some other dir + if ($latestmatch) { + # then we need to figure out which is the newest + # if the $fdeb is newer than use it + if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, ">", $founddeb{$r}{$latestmatch}{version}) ) { + $latestmatch = $fdeb; + } + + } else { + $latestmatch = $fdeb; + } + } + push(@debs, $latestmatch); + } + + if (scalar(@debs)) { + return \@debs; + } else { + return undef; + } +} + + +#------------------------------------------------------------------------------ + + +=head3 testVersion_deb + + Compare version1 and version2 according to the operator and + return 1 0 or 0. + + Arguments: + $version1 + $operator + $version2 + Returns: + 1 or 0 + Example: + + Comments: + The return value is generated with the Require query + +=cut + +#----------------------------------------------------------------------------- +sub testVersion_deb +{ + my ($class, $version1, $operator, $version2) = @_; + + my $result =`dpkg --compare-versions $version1 $operator $version2`; + + return $result; + +} + + #------------------------------------------------------------------------------ From 547cbd42179454e161e86f3de5769cb7719c6e76 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 22 Sep 2014 10:28:08 -0400 Subject: [PATCH 11/80] add xmlapi test cases, they do not need to ship with rpm --- xCAT-test/xmlapi/README | 55 ++++++++++++++++++ xCAT-test/xmlapi/Table.pm.routines | 13 +++++ xCAT-test/xmlapi/delEntriesreq | 11 ++++ xCAT-test/xmlapi/delEntriesreq2 | 17 ++++++ xCAT-test/xmlapi/delEntriesreq3 | 7 +++ xCAT-test/xmlapi/deltblreq | 35 ++++++++++++ xCAT-test/xmlapi/getAllEntries | 37 ++++++++++++ xCAT-test/xmlapi/getAllEntries.save1 | 37 ++++++++++++ xCAT-test/xmlapi/getAllEntriesreq | 5 ++ xCAT-test/xmlapi/getAllEntriesreq.save | 5 ++ xCAT-test/xmlapi/getAllEntriesreq.save1 | 5 ++ xCAT-test/xmlapi/getAttribsreq | 10 ++++ xCAT-test/xmlapi/getAttribsreq.old | 8 +++ xCAT-test/xmlapi/getAttribsreq2 | 11 ++++ xCAT-test/xmlapi/getNodeAttribs | 50 ++++++++++++++++ xCAT-test/xmlapi/getNodeAttribs1 | 50 ++++++++++++++++ xCAT-test/xmlapi/getNodesAttribsreq | 8 +++ xCAT-test/xmlapi/getNodesAttribsreq1 | 7 +++ xCAT-test/xmlapi/getNodesAttribsreq2 | 7 +++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq | 9 +++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 | 14 +++++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 | 13 +++++ xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 | 36 ++++++++++++ xCAT-test/xmlapi/getTablesAllRowAttribsreq | 12 ++++ xCAT-test/xmlapi/getTablesNodesAttribsreq | 9 +++ xCAT-test/xmlapi/getTablesNodesAttribsreq1 | 13 +++++ xCAT-test/xmlapi/getTablesNodesAttribsreq2 | 9 +++ xCAT-test/xmlapi/noderange | 14 +++++ xCAT-test/xmlapi/noderangereq | 5 ++ xCAT-test/xmlapi/noderangereq.save | 5 ++ xCAT-test/xmlapi/noderangereq.save1 | 5 ++ xCAT-test/xmlapi/readtblreq | 34 +++++++++++ xCAT-test/xmlapi/readtblreq.node | 34 +++++++++++ xCAT-test/xmlapi/setAttribs | 17 ++++++ xCAT-test/xmlapi/setAttribsreq | 12 ++++ xCAT-test/xmlapi/setAttribsreq1 | 13 +++++ xCAT-test/xmlapi/setAttribsreq2 | 13 +++++ xCAT-test/xmlapi/setNodeAttribs | 19 +++++++ xCAT-test/xmlapi/setNodesAttribsreq | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq1 | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq1.1 | 21 +++++++ xCAT-test/xmlapi/setNodesAttribsreq1.new | 14 +++++ xCAT-test/xmlapi/setNodesAttribsreq2 | 17 ++++++ xCAT-test/xmlapi/setNodesAttribsreq3 | 19 +++++++ xCAT-test/xmlapi/xmldriver | 40 +++++++++++++ xCAT-test/xmlapi/xmldriver.old | 60 ++++++++++++++++++++ xCAT-test/xmlapi/xmldriver.org | 43 ++++++++++++++ xCAT-test/xmlapi/xmlrequest.org | 6 ++ xCAT-test/xmlapi/xmlresponse | 9 +++ 49 files changed, 921 insertions(+) create mode 100644 xCAT-test/xmlapi/README create mode 100644 xCAT-test/xmlapi/Table.pm.routines create mode 100644 xCAT-test/xmlapi/delEntriesreq create mode 100644 xCAT-test/xmlapi/delEntriesreq2 create mode 100644 xCAT-test/xmlapi/delEntriesreq3 create mode 100644 xCAT-test/xmlapi/deltblreq create mode 100644 xCAT-test/xmlapi/getAllEntries create mode 100644 xCAT-test/xmlapi/getAllEntries.save1 create mode 100644 xCAT-test/xmlapi/getAllEntriesreq create mode 100644 xCAT-test/xmlapi/getAllEntriesreq.save create mode 100644 xCAT-test/xmlapi/getAllEntriesreq.save1 create mode 100644 xCAT-test/xmlapi/getAttribsreq create mode 100644 xCAT-test/xmlapi/getAttribsreq.old create mode 100644 xCAT-test/xmlapi/getAttribsreq2 create mode 100644 xCAT-test/xmlapi/getNodeAttribs create mode 100644 xCAT-test/xmlapi/getNodeAttribs1 create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/getNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 create mode 100644 xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 create mode 100644 xCAT-test/xmlapi/getTablesAllRowAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/getTablesNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/noderange create mode 100644 xCAT-test/xmlapi/noderangereq create mode 100644 xCAT-test/xmlapi/noderangereq.save create mode 100644 xCAT-test/xmlapi/noderangereq.save1 create mode 100644 xCAT-test/xmlapi/readtblreq create mode 100644 xCAT-test/xmlapi/readtblreq.node create mode 100644 xCAT-test/xmlapi/setAttribs create mode 100644 xCAT-test/xmlapi/setAttribsreq create mode 100644 xCAT-test/xmlapi/setAttribsreq1 create mode 100644 xCAT-test/xmlapi/setAttribsreq2 create mode 100644 xCAT-test/xmlapi/setNodeAttribs create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1.1 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq1.new create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq2 create mode 100644 xCAT-test/xmlapi/setNodesAttribsreq3 create mode 100755 xCAT-test/xmlapi/xmldriver create mode 100755 xCAT-test/xmlapi/xmldriver.old create mode 100644 xCAT-test/xmlapi/xmldriver.org create mode 100644 xCAT-test/xmlapi/xmlrequest.org create mode 100644 xCAT-test/xmlapi/xmlresponse diff --git a/xCAT-test/xmlapi/README b/xCAT-test/xmlapi/README new file mode 100644 index 000000000..4d770945b --- /dev/null +++ b/xCAT-test/xmlapi/README @@ -0,0 +1,55 @@ +xCAT has an XML input interface to the xCAT tables. The routines are in tabutils.pm and map to the +Table.pm routines by the same name. These routines were written for PCM but are also used in the restapi. They are not a documented api. +For the restapi, check the following for how and which routines are used. +xCAT-server/xCAT-wsapi/xcatws.cgi at all the functions between tablenodehdl() and tablerowdelhdl(). + + getAllEntries => "tabutils", + getNodesAttribs => "tabutils", + getTablesAllNodeAttribs => "tabutils", + getTablesNodesAttribs => "tabutils", + getTablesAllRowAttribs => "tabutils", + setNodesAttribs => "tabutils", + delEntries => "tabutils", + getAttribs => "tabutils", + setAttribs => "tabutils", + NodeRange => "tabutils", + +If you vi /opt/xcat/lib/perl/xCAT_plugin/tabutils.pm, and search for example "sub getAllEntries", you will see documented in the routines comments to input XML format requried and the output XML sent. + +To test these routines, I put together a driver program pcmdriver, that generates the test XML and sends it and displays the returned output. + + +For example: +vi xmldriver in this directory + +You will see + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /.../xmlapi/getTablesAllRowAttribsreq`; +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + +If you vi getTablesAllRowAttribsreq, you will see the following. This is an XML request to get the all rows from the passwd table the attributes username and rack. These is one of these XML request files for all +possible input to the routines in the directory. + +XCATXMLTRACE is exported to show the XML that is being sent to xcatd. XCATSHOWXML is exported to display the XML returned to the client. + +To get the XML request you must not be running in XCATBYPASS mode, you can get the reponse in XCATBYPASS mode. + + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
+ diff --git a/xCAT-test/xmlapi/Table.pm.routines b/xCAT-test/xmlapi/Table.pm.routines new file mode 100644 index 000000000..83336e081 --- /dev/null +++ b/xCAT-test/xmlapi/Table.pm.routines @@ -0,0 +1,13 @@ +sub setNodeAttribs +sub addNodeAttribs +sub setAttribs +sub setAttribsWhere +sub setNodesAttribs +sub getNodesAttribs +sub getNodeAttribs +sub getAllEntries +sub getAllAttribsWhere +sub getAllNodeAttribs +sub getAllAttribs +sub delEntries +sub getAttribs diff --git a/xCAT-test/xmlapi/delEntriesreq b/xCAT-test/xmlapi/delEntriesreq new file mode 100644 index 000000000..f1d01807a --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq @@ -0,0 +1,11 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq2 b/xCAT-test/xmlapi/delEntriesreq2 new file mode 100644 index 000000000..4958726c3 --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq2 @@ -0,0 +1,17 @@ + +PCM +delEntries + + nodelist + + compute1,lissa + down + +
+ + nodelist + + compute2 + +
+
diff --git a/xCAT-test/xmlapi/delEntriesreq3 b/xCAT-test/xmlapi/delEntriesreq3 new file mode 100644 index 000000000..373df9f7c --- /dev/null +++ b/xCAT-test/xmlapi/delEntriesreq3 @@ -0,0 +1,7 @@ + +PCM +delEntries + + nodelist +
+
diff --git a/xCAT-test/xmlapi/deltblreq b/xCAT-test/xmlapi/deltblreq new file mode 100644 index 000000000..6030b4ce4 --- /dev/null +++ b/xCAT-test/xmlapi/deltblreq @@ -0,0 +1,35 @@ + +PCM +deltbl +tablename
+key1 +value1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries b/xCAT-test/xmlapi/getAllEntries new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntries.save1 b/xCAT-test/xmlapi/getAllEntries.save1 new file mode 100644 index 000000000..30d39721c --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntries.save1 @@ -0,0 +1,37 @@ +# Reads all entries from the input Table + +PCM +getAllEntries +tablename
+
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/getAllEntriesreq b/xCAT-test/xmlapi/getAllEntriesreq new file mode 100644 index 000000000..cbb3b83ac --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq @@ -0,0 +1,5 @@ + +PCM +getAllEntries +switch
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save b/xCAT-test/xmlapi/getAllEntriesreq.save new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAllEntriesreq.save1 b/xCAT-test/xmlapi/getAllEntriesreq.save1 new file mode 100644 index 000000000..5f20af2d8 --- /dev/null +++ b/xCAT-test/xmlapi/getAllEntriesreq.save1 @@ -0,0 +1,5 @@ + +PCM +getAllEntries +nodelist
+
diff --git a/xCAT-test/xmlapi/getAttribsreq b/xCAT-test/xmlapi/getAttribsreq new file mode 100644 index 000000000..de8172e18 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq @@ -0,0 +1,10 @@ + +PCM +getAttribs +site
+ + domain + +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq.old b/xCAT-test/xmlapi/getAttribsreq.old new file mode 100644 index 000000000..bee39d797 --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq.old @@ -0,0 +1,8 @@ + +PCM +getAttribs +site
+domain +value +comments +
diff --git a/xCAT-test/xmlapi/getAttribsreq2 b/xCAT-test/xmlapi/getAttribsreq2 new file mode 100644 index 000000000..a4029372d --- /dev/null +++ b/xCAT-test/xmlapi/getAttribsreq2 @@ -0,0 +1,11 @@ + +PCM +getAttribs +networks
+ + 11.35.0.0 + 255.255.0.0 + +netname +dhcpserver +
diff --git a/xCAT-test/xmlapi/getNodeAttribs b/xCAT-test/xmlapi/getNodeAttribs new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodeAttribs1 b/xCAT-test/xmlapi/getNodeAttribs1 new file mode 100644 index 000000000..7eabc87d1 --- /dev/null +++ b/xCAT-test/xmlapi/getNodeAttribs1 @@ -0,0 +1,50 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +getNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ +nodename1 + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + +. +. +. +nodenameN + +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN + + + + + + diff --git a/xCAT-test/xmlapi/getNodesAttribsreq b/xCAT-test/xmlapi/getNodesAttribsreq new file mode 100644 index 000000000..fcc79224c --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq @@ -0,0 +1,8 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +groups +status +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq1 b/xCAT-test/xmlapi/getNodesAttribsreq1 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq1 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getNodesAttribsreq2 b/xCAT-test/xmlapi/getNodesAttribsreq2 new file mode 100644 index 000000000..a2a2dd491 --- /dev/null +++ b/xCAT-test/xmlapi/getNodesAttribsreq2 @@ -0,0 +1,7 @@ + +PCM +getNodesAttribs +nodelist
+blade01-blade02 +ALL +
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq new file mode 100644 index 000000000..ba523421c --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesAllNodeAttribs + +nodelist +groups +comments +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 new file mode 100644 index 000000000..943cd0439 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +groups +status +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 new file mode 100644 index 000000000..350ba547b --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +os +nodetype +
+ +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 new file mode 100644 index 000000000..4dece144e --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllNodeAttribsreq3 @@ -0,0 +1,36 @@ + +PCM +getTablesAllNodeAttribs + +nodetype +ALL +
+ +nodelist +ALL +
+ +noderes +ALL +
+ +postscripts +ALL +
+ +mac +ALL +
+ +mp +ALL +
+ +nodehm +ALL +
+ +mpa +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesAllRowAttribsreq b/xCAT-test/xmlapi/getTablesAllRowAttribsreq new file mode 100644 index 000000000..cb06e9beb --- /dev/null +++ b/xCAT-test/xmlapi/getTablesAllRowAttribsreq @@ -0,0 +1,12 @@ + +PCM +getTablesAllRowAttribs + +passwd +username +
+ +rack +rackname +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq b/xCAT-test/xmlapi/getTablesNodesAttribsreq new file mode 100644 index 000000000..c4862f5d3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq1 b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 new file mode 100644 index 000000000..923444bb3 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +getTablesNodesAttribs +test + +nodelist +ALL +
+ +nodetype +nodetype +
+
diff --git a/xCAT-test/xmlapi/getTablesNodesAttribsreq2 b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 new file mode 100644 index 000000000..d85e7be03 --- /dev/null +++ b/xCAT-test/xmlapi/getTablesNodesAttribsreq2 @@ -0,0 +1,9 @@ + +PCM +getTablesNodesAttribs +test + +noderes +ALL +
+
diff --git a/xCAT-test/xmlapi/noderange b/xCAT-test/xmlapi/noderange new file mode 100644 index 000000000..91f850065 --- /dev/null +++ b/xCAT-test/xmlapi/noderange @@ -0,0 +1,14 @@ +# Reads the table input for the noderange and returns list of attributes +# requested + +PCM +NodeRange +compute1-compute2 + + +node1 +. +. +. +noden + diff --git a/xCAT-test/xmlapi/noderangereq b/xCAT-test/xmlapi/noderangereq new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save b/xCAT-test/xmlapi/noderangereq.save new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/noderangereq.save1 b/xCAT-test/xmlapi/noderangereq.save1 new file mode 100644 index 000000000..2b6131df8 --- /dev/null +++ b/xCAT-test/xmlapi/noderangereq.save1 @@ -0,0 +1,5 @@ + +PCM +NodeRange +compute1-compute2 + diff --git a/xCAT-test/xmlapi/readtblreq b/xCAT-test/xmlapi/readtblreq new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/readtblreq.node b/xCAT-test/xmlapi/readtblreq.node new file mode 100644 index 000000000..4b9d2346f --- /dev/null +++ b/xCAT-test/xmlapi/readtblreq.node @@ -0,0 +1,34 @@ + +PCM +readtbl +tablename
+noderange1 +noderange2 +. +. +. +or ALL +attribute1 +attribute2 +. +. +. +attributeN +
+ + +attribute1 +value1 +attribute2 +value2 +. +. +. +. +attributeN +valueN + + + + + diff --git a/xCAT-test/xmlapi/setAttribs b/xCAT-test/xmlapi/setAttribs new file mode 100644 index 000000000..6ce815a27 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribs @@ -0,0 +1,17 @@ + +PCM +setAttribs +tablename
+ +value1 +value2 For multiple key tables + + + value1 + value2 + +
+ + + + diff --git a/xCAT-test/xmlapi/setAttribsreq b/xCAT-test/xmlapi/setAttribsreq new file mode 100644 index 000000000..739822823 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq @@ -0,0 +1,12 @@ + +PCM +setAttribs +site
+ + domain + + + pok.com + This is a test + +
diff --git a/xCAT-test/xmlapi/setAttribsreq1 b/xCAT-test/xmlapi/setAttribsreq1 new file mode 100644 index 000000000..4f5daeeaa --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq1 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + 10.0.1.254 + +
+ diff --git a/xCAT-test/xmlapi/setAttribsreq2 b/xCAT-test/xmlapi/setAttribsreq2 new file mode 100644 index 000000000..04b0f63d3 --- /dev/null +++ b/xCAT-test/xmlapi/setAttribsreq2 @@ -0,0 +1,13 @@ + +PCM +setAttribs +networks
+ + 10.0.1.0 + 255.255.255.0 + + + mynet + 10.0.1.254 + +
diff --git a/xCAT-test/xmlapi/setNodeAttribs b/xCAT-test/xmlapi/setNodeAttribs new file mode 100644 index 000000000..45f4cbf39 --- /dev/null +++ b/xCAT-test/xmlapi/setNodeAttribs @@ -0,0 +1,19 @@ + +PCM +setNodeAttribs +tablename
+noderange +attribute1 +value1 +attribute2 +value2 +. +. +. +attributeN +valueN +
+ + + + diff --git a/xCAT-test/xmlapi/setNodesAttribsreq b/xCAT-test/xmlapi/setNodesAttribsreq new file mode 100644 index 000000000..1fa4d38f6 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + all,compute,lissa + This is a another test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1 b/xCAT-test/xmlapi/setNodesAttribsreq1 new file mode 100644 index 000000000..ebaece6cc --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1 @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute,lissa,newtest + This is a another testtest + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.1 b/xCAT-test/xmlapi/setNodesAttribsreq1.1 new file mode 100644 index 000000000..79b45ffec --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.1 @@ -0,0 +1,21 @@ + +PCM +setNodesAttribs +blade01-blade02 + + + nodelist + + lissa + This is a another testx + +
+ + nodetype + + Redhat2 + This is a another testy + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq1.new b/xCAT-test/xmlapi/setNodesAttribsreq1.new new file mode 100644 index 000000000..35856d42c --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq1.new @@ -0,0 +1,14 @@ + +PCM +setNodesAttribs1 +blade01-blade02 + + + nodelist + + all,compute + This is a test + +
+
+
diff --git a/xCAT-test/xmlapi/setNodesAttribsreq2 b/xCAT-test/xmlapi/setNodesAttribsreq2 new file mode 100644 index 000000000..665213e45 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq2 @@ -0,0 +1,17 @@ + +PCM +setNodesAttribs + + ppc
+ + + fsp1 + 1 + + + cec1 + + +
+
+ diff --git a/xCAT-test/xmlapi/setNodesAttribsreq3 b/xCAT-test/xmlapi/setNodesAttribsreq3 new file mode 100644 index 000000000..e82933b40 --- /dev/null +++ b/xCAT-test/xmlapi/setNodesAttribsreq3 @@ -0,0 +1,19 @@ + +PCM +setNodesAttribs +compute2 + + + nodelist + + allxxx + +
+ + nodetype + + Redhat20 + +
+
+
diff --git a/xCAT-test/xmlapi/xmldriver b/xCAT-test/xmlapi/xmldriver new file mode 100755 index 000000000..c355b976c --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver @@ -0,0 +1,40 @@ +#!/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 strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi to Table.pm ( via tabutils.pm) + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/xmlapi/getTablesAllRowAttribsreq`; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.old b/xCAT-test/xmlapi/xmldriver.old new file mode 100755 index 000000000..581d5f400 --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.old @@ -0,0 +1,60 @@ +#!/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 strict; +use File::Basename; +use Cwd; +use Socket; +use XML::Simple; +require xCAT::MsgUtils; +use xCAT::Utils; +require xCAT::Client; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + $ENV{'XCATXMLTRACE'}=1; +my $XML=`cat /root/lissa/PCM/api/getTablesAllRowAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq `; +#y $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesAllNodeAttribsreq3`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq2`; +#my $XML=`cat /root/lissa/PCM/api/getTablesNodesAttribsreq1`; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq1.1 `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq1 `; +#y $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getNodesAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setNodesAttribsreq3 `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq `; +#my $XML=`cat /root/lissa/PCM/api/delEntriesreq3 `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/getAttribsreq2 `; +#my $XML=`cat /root/lissa/PCM/api/setAttribsreq `; +#my $XML=`cat /root/lissa/PCM/api/noderangereq `; + +my $data=$XML; + +$ENV{'XCATSHOWXML'}=1; + +xCAT::Client::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmldriver.org b/xCAT-test/xmlapi/xmldriver.org new file mode 100644 index 000000000..dbc4bbc5e --- /dev/null +++ b/xCAT-test/xmlapi/xmldriver.org @@ -0,0 +1,43 @@ +#!/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 strict; +use File::Basename; +use Cwd; +use Socket; + +#use Data::Dumper; +use Getopt::Long; +require xCAT::MsgUtils; +require xCAT::DSHCLI; +use xCAT::Utils; +use xCAT::RemoteShellExp; +require xCAT::PCMClient; +my $bname = basename($0); + +#----------------------------------------------------------------------------- + +=head1 pcmdriver - test XMLapi for PCM + + +=cut + +#----------------------------------------------------------------------------- +# Main + + +my $XML=`cat /root/lissa/PCM/api/getAllEntriesreq `; +my $data=$XML; + + + +xCAT::PCMClient::submit_request($data, \&xCAT::Client::handle_response); +exit $xCAT::Client::EXITCODE; + diff --git a/xCAT-test/xmlapi/xmlrequest.org b/xCAT-test/xmlapi/xmlrequest.org new file mode 100644 index 000000000..3a1dac456 --- /dev/null +++ b/xCAT-test/xmlapi/xmlrequest.org @@ -0,0 +1,6 @@ + +cli +nodels +/svn/xcat-core/2.6/perl-xCAT/xCAT +service + diff --git a/xCAT-test/xmlapi/xmlresponse b/xCAT-test/xmlapi/xmlresponse new file mode 100644 index 000000000..da2dce15a --- /dev/null +++ b/xCAT-test/xmlapi/xmlresponse @@ -0,0 +1,9 @@ + + +rhsn + + +rhsn + + + From f39c0f46a1890dbaf80051a5402125918f7f4593 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 22 Sep 2014 19:09:11 -0700 Subject: [PATCH 12/80] enhance for MTM based p8 hardware discovery --- perl-xCAT/xCAT/Utils.pm | 64 +++++++++++++++++ xCAT-server/lib/perl/xCAT/PPC.pm | 73 +++----------------- xCAT-server/lib/xcat/plugins/nodediscover.pm | 4 ++ 3 files changed, 79 insertions(+), 62 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index a284eb806..f8efb5dd0 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4232,4 +4232,68 @@ sub disableservice{ xCAT::Utils->runcmd($cmd, -1); return $::RUNCMD_RC; } + +sub cleanup_for_powerLE_hardware_discovery { + my $host_node = shift; + if( $host_node =~ /xCAT::Utils/) + { + $host_node=shift; + } + my $pbmc_node = shift; + my $subreq = shift; + my $ipmitab = xCAT::Table->new("ipmi"); + unless($ipmitab) { + xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); + return; + } + my @nodes = ($host_node, $pbmc_node); + my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); + if ($ipmihash) { + my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; + my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; + + xCAT::MsgUtils->message("S", "Discovery info: configure password for pbmc_node:$pbmc_node."); + `rspconfig $pbmc_node password=$new_bmc_password`; + #if ($new_bmc_password) { + # xCAT::Utils->runxcmd( + # { + # command => ["rspconfig"], + # node => ["$pbmc_node"], + # arg => [ "password=$new_bmc_password" ], + # }, + # $subreq, 0,1); + # if ($::RUNCMD_RC != 0) { + # xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); + # return; + # } + #} + + xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); + `rspconfig $pbmc_node ip=$new_bmc_ip`; + #if($new_bmc_ip) { + # xCAT::Utils->runxcmd( + # { + # command => ["rspconfig"], + # node => ["$pbmc_node"], + # arg => [ "ip=$new_bmc_ip" ], + # }, + # $subreq, 0,1); + # if ($::RUNCMD_RC != 0) { + # xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); + # return; + # } + #} + xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); + `rmdef $pbmc_node`; + #xCAT::Utils->runxcmd( + # { + # command => ["rmdef"], + # node => ["$pbmc_node"], + # }, + # $subreq, 0,1); + } +} + + + 1; diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 8699034a0..95063a76c 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2175,76 +2175,25 @@ sub findme { } @nodes = keys (%nodes_hash); } - foreach (@nodes) { + my $nodenum = $#nodes; + if ($nodenum < 0) { + xCAT::MsgUtils->message("S", "Discovery Error: Could not find any node."); + return; + } elsif ($nodenum > 0) { + xCAT::MsgUtils->message("S", "Discovery Error: More than one node were found."); + return; + } + { my $req = {%$request}; $req->{command} = ['discovered']; - $req->{noderange} = [$_]; + $req->{noderange} = [$nodes[0]]; + $req->{pbmc_node} = [$pbmc_node]; $req->{discoverymethod} = ['mtms']; $subreq->($req); %{$req} = (); } - &cleanup_for_powerLE_hardware_discovery($nodes[-1], $pbmc_node, $subreq); } -sub cleanup_for_powerLE_hardware_discovery { - my $host_node = shift; - my $pbmc_node = shift; - my $subreq = shift; - my $ipmitab = xCAT::Table->new("ipmi"); - unless($ipmitab) { - xCAT::MsgUtils->message("S", "Discovery Error: can not open ipmi table."); - return; - } - my @nodes = ($host_node, $pbmc_node); - my $ipmihash = $ipmitab->getNodesAttribs(\@nodes, ['node', 'bmc', 'username', 'password']); - if ($ipmihash) { - my $new_bmc_ip = $ipmihash->{$host_node}->[0]->{bmc}; - my $new_bmc_password = $ipmihash->{$host_node}->[0]->{password}; - - xCAT::MsgUtils->message("S", "Discover info: configure ip:$new_bmc_ip for pbmc_node:$pbmc_node."); - if($new_bmc_ip) { - xCAT::Utils->runxcmd( - { - command => ["rspconfig"], - node => ["$pbmc_node"], - arg => [ "ip=$new_bmc_ip" ], - }, - $subreq, 0,1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("S", "Discovery Error: configure IP address failed for FSP."); - return; - } - xCAT::Utils->runxcmd( - { - command => ["chdef"], - node => ["$pbmc_node"], - arg => [ "bmc=$new_bmc_ip" ], - }, - $subreq, 0,1); - } - xCAT::MsgUtils->message("S", "Discovery info: configure password:$new_bmc_password for pbmc_node:$pbmc_node."); - if ($new_bmc_password) { - xCAT::Utils->runxcmd( - { - command => ["rspconfig"], - node => ["$pbmc_node"], - arg => [ "password=$new_bmc_password" ], - }, - $subreq, 0,1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("S", "Discovery Error: configure password failed for FSP."); - return; - } - } - xCAT::MsgUtils->message("S", "Discovery info: remove pbmc_node:$pbmc_node."); - xCAT::Utils->runxcmd( - { - command => ["rmdef"], - node => ["$pbmc_node"], - }, - $subreq, 0,1); - } -} ########################################################################## # Process request from xCat daemon ########################################################################## diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index f5a8e88ea..d8b3c1c32 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -353,6 +353,10 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } + if (defined ($request->{pbmc_node})) { + my $pbmc_node = $request->{pbmc_node}->[0]; + xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); + } my $restartstring = "restart"; if (scalar @forcenics > 0) { From 92d313bb20829a57737e45eda1d61d407ed143c1 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 22 Sep 2014 23:11:15 -0400 Subject: [PATCH 13/80] change ubu arch in validate_os --- xCAT-buildkit/bin/buildkit | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 53b7662c4..983f4eb79 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1872,6 +1872,11 @@ sub validate_os my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + if ($debianflag==1) { + if($osarch == "ppc64le"){ + $osarch="ppc64el"; + } + } chomp($osarch); $osinfo =~ s/\,//; my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; From 5576b8b1f41c8209b54fcfe2a201ac391406ca90 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 22 Sep 2014 20:35:18 -0700 Subject: [PATCH 14/80] enhance for finding bootnic in genesis --- xCAT-genesis-scripts/bin/doxcat | 20 +++++++++++++++++--- xCAT-server/lib/xcat/plugins/nodediscover.pm | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 2820e48be..7d6203531 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -146,10 +146,24 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then else echo "Setting IP via DHCP..." # This section is for System P hardware discovery, which won't have a BOOTIF value set + tries=0 + while [ $tries -lt 5 ]; do + if [ -z "$bootnic" ]; then + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` + for tmp1 in $ALLUP_NICS; do + bootnic=$tmp1 + break + done + else + break + fi + sleep 2 + tries=$(($tries+1)) + done if [ -z "$bootnic" ]; then - ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` - for tmp1 in $ALLUP_NICS; do - bootnic=$tmp1 + ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` + for tmp in $ALL_NICS; do + bootnic=$tmp break done fi diff --git a/xCAT-server/lib/xcat/plugins/nodediscover.pm b/xCAT-server/lib/xcat/plugins/nodediscover.pm index d8b3c1c32..4dd348e36 100644 --- a/xCAT-server/lib/xcat/plugins/nodediscover.pm +++ b/xCAT-server/lib/xcat/plugins/nodediscover.pm @@ -353,7 +353,7 @@ sub process_request { $callback->({error=> ["The node [$node] should have a correct IP address which belongs to the management network."], errorcode=>["1"]}); return; } - if (defined ($request->{pbmc_node})) { + if (defined ($request->{pbmc_node}) and defined($request->{pbmc_node}->[0]) ) { my $pbmc_node = $request->{pbmc_node}->[0]; xCAT::Utils->cleanup_for_powerLE_hardware_discovery($node, $pbmc_node, $doreq); } From 7edce8ec57889c02da97b7b0310df6cf6119f752 Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 23 Sep 2014 04:36:31 -0400 Subject: [PATCH 15/80] add pkglist for sysclone on sles 11 and p system --- .../xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist | 1 + 1 file changed, 1 insertion(+) create mode 100644 xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..691b8e05a --- /dev/null +++ b/xCAT-server/share/xcat/install/sles/sysclone.sles11.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/sles11/ppc64/systemimager-client From 0fa2dbd486798809958d96c7b46b12bb77b8489b Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 23 Sep 2014 04:38:37 -0400 Subject: [PATCH 16/80] add otherpkgs.pkglist for sysclone on rh6+p, rh7+x, rh7+p --- .../xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist | 1 + .../xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist | 1 + .../xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist | 1 + 3 files changed, 3 insertions(+) create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..6d3bbd5dd --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels6.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh6/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist new file mode 100644 index 000000000..a10301209 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.ppc64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/ppc64/systemimager-client diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..5b8feb497 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels7.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh7/x86_64/systemimager-client From fc8b2cc4eb16093aef07722919cffe24f753b7cc Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 23 Sep 2014 06:39:08 -0400 Subject: [PATCH 17/80] prep deb support in buildrepo --- xCAT-buildkit/bin/buildkit | 132 ++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 983f4eb79..68ca2384d 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -776,6 +776,7 @@ sub kit_buildrepo1 return 1; } } + # if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) { if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; @@ -1872,12 +1873,13 @@ sub validate_os my ($osbasename,$osmore) = split(/\,/, $osinfo); my ($osmajorversion,$osminorversion) = split(/\./, $osmore); my $osarch=`uname -p`; + chomp($osarch); + if ($debianflag==1) { if($osarch == "ppc64le"){ $osarch="ppc64el"; } } - chomp($osarch); $osinfo =~ s/\,//; my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; if (defined($repo->{osminorversion})){ @@ -2420,14 +2422,45 @@ sub build_kitcomp_debian{ } } + #run the dpkg-buildpackage command my $curdir = $::workdir; my $cmd = "rm -Rf $debbuilddir"; system($cmd); mkpath($debbuilddir); - #Create debian directory for this kit component - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + $::VALID_PRER_COMPONENT = 0; + + if ( !$::PREREQUISITE ) { + if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) { + + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; } + $::VALID_PRER_COMPONENT = 1; + # build prep deb + my $prep_compversion = $comp->{version} . "-" . $comp->{release}; + my $prep_buildstring = "Prep Kit component build package."; + my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname}; + my $prep_debianbuildcmd = "cd $prep_debbuilddir;dch -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage -uc -us"; + + if ( system($prep_debianbuildcmd) ) { + print "Error running \"dpkg-buildpackage -uc -us\" command for kit component prep-$comp->{kitcompname} meta package\n"; + return 1; + } + } + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + + } else { + #Create debian directory for this kit component + + if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + + } + + if (defined($comp->{non_native_pkgs}) ) { my $sourcedir = $::workdir."/source_packages"; @@ -2469,6 +2502,99 @@ sub build_kitcomp_debian{ return 0; } + +#----------------------------------------------------------------------------- + +=head3 gen_kitcomp_debdir_prep + + + +=cut + +#----------------------------------------------------------------------------- +sub gen_kitcomp_debdir_prep{ + my $comp = shift; + my $repo = shift; + my $scriptdir = $::workdir."/scripts/"; + my $combuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname}; + + #copy the debian dir template to the build path + mkpath("$combuilddir/debian"); + my $cmd = "cp -Rf " . $::XCATSHARE . "/kits/debian_template/* $combuilddir/debian/"; + system($cmd); + + my $kitname = $::bldkit_config->{kit}{entries}[0]->{basename}; + my $kitcompname = "prep-".$comp->{kitcompname}; + my $upgradeflag = "pre-".$comp->{basename} . ".tmp"; + + my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = ''; + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + + #replace all special sub string in all files under debian + unless (opendir(DH, "${combuilddir}/debian/")){ + print "Can not open the xCAT Kit Component debian dir: ${combuilddir}/debian/"; + return 1; + } + + foreach (readdir(DH)){ + my $file = "${combuilddir}/debian/$_"; + if ( -d $file){ + next; + } + + unless ( open ( FH, "<", $file )){ + print "Error attempting to open the xCAT Kit Component ${kitcompname}'s debian template file $file.\n"; + close(DH); + return 1; + } + + if ($::VERBOSE){ + print "Reading the xCAT Kit Component ${kitcompname}'s debian template file $file. \n"; + } + my @lines = ; + close(FH); + my $prep_comp_name="prep-".$comp->{basename}; + for(@lines) { + chomp; + s/<<>>/$prep_comp_name/; + s/<<>>/$comp->{ospkgdeps}/; + s/<<>>/$comp->{kitpkgdeps}/; + s/<<>>/$comp->{kitcompdeps}/; + s/<<>>/$comp->{description}/; + s/<<>>/$upgradeflag/; + s/<<>>/$prescript/; + s/<<>>/$postscript/; + s/<<>>/$preupscript/; + s/<<>>/$postupscript/; + s/<<>>/$preunscript/; + s/<<>>/$postunscript/; + + } + my $joined_lines = join("\n", @lines); + @lines = split(/\\n/,$joined_lines); + + open (FH, ">", $file); + if ($::VERBOSE){ + print "Created kitcomponent ${kitcompname}'s build file under debian dir $file"; + } + print FH @lines; + close(FH); + } + closedir(DH); + + return 0; +} + + + #----------------------------------------------------------------------------- =head3 gen_kitcomp_debdir From 4100dd77e4158be3a1ae63429572fb0317e8c7e4 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 23 Sep 2014 10:44:56 -0400 Subject: [PATCH 18/80] Add capability for plugins to supply a description in update_tables_with_templates --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 40dc6f33a..e2bef10eb 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -713,6 +713,9 @@ sub update_tables_with_templates osarch=>$arch, synclists=>$synclistfile, osdistroname=>$osdistroname); + if ($args{description}) { + $tb_cols{description} = $args{description}; + } $osimagetab->setAttribs(\%key_col, \%tb_cols); if ($osname =~ /^win/) { From ec61ef27da6d3dcf6fa50dfeb019d13b21d40948 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Tue, 23 Sep 2014 22:47:52 -0400 Subject: [PATCH 19/80] add metadeb and all support --- xCAT-buildkit/bin/buildkit | 94 +++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 68ca2384d..ff1a456dd 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -764,20 +764,20 @@ sub kit_buildrepo1 } } - # Build kitcomponent metapackages + # Build kitcomponent preppackages and metapackages if ( $debianflag ){ foreach my $kc (@{$::bldkit_config->{kitcomponent}{entries}}) { if ($repoid ne $kc->{kitrepoid}) { next; } my $debname = "$repodir/".&comppkgname($kc); if (-r $debname) { next; } - if ($::VERBOSE) { print "building kitcomponent metapackage for $kc->{basename} \n";} + if ($::VERBOSE) { print "building kitcomponent package for $kc->{basename} \n";} if (&build_kitcomp_debian($kc)) { print "Error building kitcomponent metapackage for $kc->{basename} \n"; return 1; } } - # if ( system("dpkg-scanpackages $repodir > $repodir/Packages") ) { - if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { + + if ( system("cd $repodir;dpkg-scanpackages . > Packages") ) { print "Error building the repository meta-data with the dpkg-scanpackages command \n"; return 1; } @@ -2429,15 +2429,15 @@ sub build_kitcomp_debian{ system($cmd); mkpath($debbuilddir); - $::VALID_PRER_COMPONENT = 0; + $::VALID_PREP_COMPONENT = 0; if ( !$::PREREQUISITE ) { if ( $comp->{ospkgdeps} || $comp->{preinstall} || $comp->{preupgrade} || $comp->{preuninstall} ) { - #Create debian directory for this kit component + #Create debian directory for this kit component preppackage if ( &gen_kitcomp_debdir_prep($comp,\%repo) ) { return 1; } - $::VALID_PRER_COMPONENT = 1; + $::VALID_PREP_COMPONENT = 1; # build prep deb my $prep_compversion = $comp->{version} . "-" . $comp->{release}; my $prep_buildstring = "Prep Kit component build package."; @@ -2449,14 +2449,14 @@ sub build_kitcomp_debian{ return 1; } } - #Create debian directory for this kit component + #Create debian directory for this kit component metapackage - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + if ( &gen_kitcomp_debdir($comp,\%repo,'METADEB') ) { return 1; } } else { #Create debian directory for this kit component - if ( &gen_kitcomp_debdir($comp,\%repo) ) { return 1; } + if ( &gen_kitcomp_debdir($comp,\%repo,'ALL') ) { return 1; } } @@ -2566,16 +2566,16 @@ sub gen_kitcomp_debdir_prep{ chomp; s/<<>>/$prep_comp_name/; s/<<>>/$comp->{ospkgdeps}/; - s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + s/<<>>//; + s/<<>>//; s/<<>>/$comp->{description}/; s/<<>>/$upgradeflag/; s/<<>>/$prescript/; - s/<<>>/$postscript/; + s/<<>>//; s/<<>>/$preupscript/; - s/<<>>/$postupscript/; + s/<<>>//; s/<<>>/$preunscript/; - s/<<>>/$postunscript/; + s/<<>>//; } my $joined_lines = join("\n", @lines); @@ -2607,6 +2607,7 @@ sub gen_kitcomp_debdir_prep{ sub gen_kitcomp_debdir{ my $comp = shift; my $repo = shift; + my $level = shift; my $scriptdir = $::workdir."/scripts/"; my $combuilddir = $::workdir."/debbuild/".$comp->{kitcompname}; @@ -2620,29 +2621,38 @@ sub gen_kitcomp_debdir{ my $upgradeflag = $comp->{basename} . ".tmp"; my ($prescript,$postscript,$preupscript,$postupscript,$preunscript,$postunscript,$nonnativepkgs) = ''; - if (defined($comp->{preinstall})) { - $prescript = &load_script("$scriptdir$comp->{preinstall}"); - } - if (defined($comp->{postinstall})) { - $postscript = &load_script("$scriptdir$comp->{postinstall}"); - } - if (defined($comp->{preupgrade})) { - $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); - } - if (defined($comp->{postupgrade})) { - $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); - } - if (defined($comp->{preuninstall})) { - $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); - } - if (defined($comp->{postuninstall})) { - $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); - } - if (defined($comp->{non_native_pkgs})) { - $nonnativepkgs = "\n"; - $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; - $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + + if ($level eq 'METADEB' || $level eq 'ALL') + { + if (defined($comp->{postinstall})) { + $postscript = &load_script("$scriptdir$comp->{postinstall}"); + } + + if (defined($comp->{postupgrade})) { + $postupscript = &load_script("$scriptdir$comp->{postupgrade}"); + } + if (defined($comp->{postuninstall})) { + $postunscript = &load_script("$scriptdir$comp->{postuninstall}"); + } + if (defined($comp->{non_native_pkgs})) { + $nonnativepkgs = "\n"; + $nonnativepkgs .= "mkdir -p \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + $nonnativepkgs .= "cp -a * \$RPM_BUILD_ROOT/opt/xcat/kits/$kitname/$kitcompname \n"; + } } + if ($level eq 'ALL') + { + if (defined($comp->{preinstall})) { + $prescript = &load_script("$scriptdir$comp->{preinstall}"); + } + if (defined($comp->{preupgrade})) { + $preupscript = &load_script("$scriptdir$comp->{preupgrade}"); + } + if (defined($comp->{preuninstall})) { + $preunscript = &load_script("$scriptdir$comp->{preuninstall}"); + } + } + #replace all special sub string in all files under debian unless (opendir(DH, "${combuilddir}/debian/")){ @@ -2667,12 +2677,20 @@ sub gen_kitcomp_debdir{ } my @lines = ; close(FH); + my $prepcomp="prep-".$comp->{basename}; for(@lines) { chomp; s/<<>>/$comp->{basename}/; s/<<>>/$comp->{ospkgdeps}/; s/<<>>/$comp->{kitpkgdeps}/; - s/<<>>/$comp->{kitcompdeps}/; + if ( $::VALID_PREP_COMPONENT ) { + s/<<>>/$comp->{kitcompdeps},$prepcomp/; + } + else + { + s/<<>>/$comp->{kitcompdeps}/; + } + s/<<>>/$comp->{description}/; s/<<>>/$upgradeflag/; s/<<>>/$prescript/; From ac34247aba1ffb6fc1a0d858ac87898b77a6b2f8 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 24 Sep 2014 03:14:32 -0400 Subject: [PATCH 20/80] defect 4726: cold reset bmc for specific firmware in the end of bmcsetup to make bmc take effect. --- xCAT-genesis-scripts/bin/bmcsetup | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 195c32159..d0590abc8 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -387,6 +387,21 @@ if [ ! "$IPMIVER" == "1.5" ]; then if [ $TRIES -gt $TIMEOUT ]; then echo "ERROR"; else echo "OK"; fi fi +# Reset the BMC for the x3755 M4 (8722), otherwise the BMC will not be pingable after running of bmcsetup +XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'` +if [ "$XPROD" = "309" ] ; then + echo "Resetting BMC ..." + ipmitool mc reset cold + echo "Waiting for the BMC to appear ..." + sleep 15 + TRIES=0 + while ! ipmitool lan print $LANCHAN > /dev/null; do + sleep 3 + let TRIES=TRIES+1 + if [ $TRIES -gt $TIMEOUT ]; then break; fi + done +fi + # update the node status to 'bmcready' for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` From d8eeeb306b7a4d5f8a71b8bc0019376efbd3c4de Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 24 Sep 2014 04:19:33 -0400 Subject: [PATCH 21/80] fix dpkg compare version op --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index a410e1b6d..551950c7f 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -291,7 +291,7 @@ sub find_latest_pkg_deb if ($latestmatch) { # then we need to figure out which is the newest # if the $fdeb is newer than use it - if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, ">", $founddeb{$r}{$latestmatch}{version}) ) { + if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, "gt", $founddeb{$r}{$latestmatch}{version}) ) { $latestmatch = $fdeb; } From ee1a1574c361ce85b30c04b118c12fe611607bf9 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 02:38:54 -0700 Subject: [PATCH 22/80] generate default netboot configure file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/dhcp.pm | 3 +++ xCAT-server/lib/xcat/plugins/mknb.pm | 20 ++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index e86bb20d3..1a427824d 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2416,6 +2416,9 @@ sub addnet push @netent, " } else if option client-architecture = 00:02 { #ia64\n "; push @netent, " filename \"elilo.efi\";\n"; + push @netent, + " } else if option client-architecture = 00:0e { #OPAL-v3\n "; + push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/default\";\n"; push @netent, " } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n "; push @netent, " filename \"/yaboot\";\n"; diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index bdb2bcd17..381b95af0 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -117,6 +117,7 @@ sub process_request { system("ssh-keygen -t rsa -f $tempdir/etc/ssh_host_rsa_key -C '' -N ''"); system("ssh-keygen -t dsa -f $tempdir/etc/ssh_host_dsa_key -C '' -N ''"); } + my $initrd_file = undef; my $lzma_exit_value=1; if ($invisibletouch) { my $done=0; @@ -129,18 +130,25 @@ sub process_request { unlink ("$tftpdir/xcat/genesis.fs.$arch.lzma"); } else { $done = 1; + $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.lzma"; } } if (not $done) { $callback->({data=>["Creating genesis.fs.$arch.gz in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/genesis.fs.$arch.gz"); + $initrd_file = "$tftpdir/xcat/genesis.fs.$arch.gz"; } } else { $callback->({data=>["Creating nbfs.$arch.gz in $tftpdir/xcat"]}); system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz"); + $initrd_file = "$tftpdir/xcat/nbfs.$arch.gz"; } system ("rm -rf $tempdir"); + unless ($initrd_file) { + $callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]}); + return; + } my $hexnets = xCAT::NetworkUtils->my_hexnets(); my $normnets = xCAT::NetworkUtils->my_nets(); my $consolecmdline; @@ -170,7 +178,7 @@ sub process_request { chmod(0644,"$tftpdir/pxelinux.0"); } } elsif ($arch =~ /ppc/) { - mkpath("$tftpdir/etc"); + mkpath("$tftpdir/pxelinux.cfg/p/"); } my $dopxe=0; foreach (keys %{$normnets}) { @@ -262,11 +270,11 @@ sub process_request { close($cfgfile); } elsif ($arch =~ /ppc/) { open($cfgfile,">","$tftpdir/etc/".lc($_)); - print $cfgfile "timeout=5\n"; - print $cfgfile " label=xcat\n"; - print $cfgfile " image=xcat/nbk.$arch\n"; - print $cfgfile " initrd=xcat/nbfs.$arch.gz\n"; - print $cfgfile ' append="quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n"; + print $cfgfile "default xCAT\n"; + print $cfgfile " label xCAT\n"; + print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; + print $cfgfile " initrd http://".$hexnets->{$_}.":80/$initrd_file\n"; + print $cfgfile ' append "quiet xcatd='.$hexnets->{$_}.":$xcatdport $consolecmdline\"\n"; close($cfgfile); } } From 08e0ce42f0fc8a83db2e1b6d03b33abd4e67af25 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 02:41:55 -0700 Subject: [PATCH 23/80] correct the default configuration file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/mknb.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 381b95af0..a8874cf67 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -269,7 +269,7 @@ sub process_request { print $cfgfile " APPEND initrd=xcat/nbfs.$arch.gz quiet xcatd=".$hexnets->{$_}.":$xcatdport $consolecmdline\n"; close($cfgfile); } elsif ($arch =~ /ppc/) { - open($cfgfile,">","$tftpdir/etc/".lc($_)); + open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/default"); print $cfgfile "default xCAT\n"; print $cfgfile " label xCAT\n"; print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; From d29aea3c017a10caaf5c27f62ad94e09599bd198 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 24 Sep 2014 06:46:59 -0400 Subject: [PATCH 24/80] add get_latest_version_deb --- xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm | 90 +++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm index 551950c7f..cf2254abd 100644 --- a/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm +++ b/xCAT-buildkit/lib/perl/xCAT/BuildKitUtils.pm @@ -134,6 +134,87 @@ sub get_latest_version } } +#-------------------------------------------------------------------------- +=head3 get_latest_version_deb + + Find the latest version in a list of debs with the same basename + + Arguments: + - the repo location + - a list of debs with the same basename + Returns: + - name of deb + - undef + Example: + my $new_d = xCAT::BuildKitUtils->get_latest_version($repodir, \@rpmlist); + Comments: + +=cut +#-------------------------------------------------------------------------- +sub get_latest_version_deb +{ + my ($class, $repodir, $debs) = @_; + + my @deblist = @$debs; + + my %localversions_hash = (); + my $file_name; + my %founddeb; + my $latest; + my $i = 0; + foreach my $deb (@deblist) + { + + # include path + my $fulldebpath = "$repodir/$deb*"; + chomp $deb; + # get the basename, version, and release for this deb + print "dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'"; + my $basenamedeb = `dpkg -I $repodir/$deb |grep Package|awk '{print \$2}'`; + chomp $basenamedeb; + + my $versiondeb = `dpkg -I $repodir/$deb |grep Version|awk '{print \$2}'`; + chomp $versiondeb; + + $founddeb{$basenamedeb}{$deb}{version}=$versiondeb; + + $i++; + } + if ($i == 0) + { + print "error\n"; + return undef; + } + + + foreach my $r (keys %founddeb ) { + # if more than one with same basename then find the latest + my $latestmatch=""; + foreach my $fdeb (keys %{$founddeb{$r}} ) { + # if we already found a match in some other dir + if ($latestmatch) { + # then we need to figure out which is the newest + # if the $fdeb is newer than use iti + if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) { + $latestmatch = $fdeb; + } + + } else { + $latestmatch = $fdeb; + } + } + $latest=$latestmatch; + + } + if ($i == 0) + { + print "Error: Could not determine the latest version for the following list of debs: @deblist\n"; + return undef; + } else { + return ($latest); + } +} + #-------------------------------------------------------------------------- =head3 find_latest_pkg @@ -235,6 +316,7 @@ sub find_latest_pkg - the name of the deb Returns: - \@founddeblist + - undef Example: my $newrpm = xCAT::BuildKitUtils->find_latest_pkg_deb(\@pkgdirs, $debname); @@ -275,7 +357,7 @@ sub find_latest_pkg_deb chomp $basename; my $version = `dpkg -I $r* |grep Version|awk '{print \$2}'`; - print "$basename:$version"; + chomp $version; $founddeb{$basename}{$r}{version}=$version; } @@ -291,7 +373,7 @@ sub find_latest_pkg_deb if ($latestmatch) { # then we need to figure out which is the newest # if the $fdeb is newer than use it - if ( xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, "gt", $founddeb{$r}{$latestmatch}{version}) ) { + if ( ! xCAT::BuildKitUtils->testVersion_deb($founddeb{$r}{$fdeb}{version}, 'gt', $founddeb{$r}{$latestmatch}{version}) ) { $latestmatch = $fdeb; } @@ -335,7 +417,9 @@ sub find_latest_pkg_deb sub testVersion_deb { my ($class, $version1, $operator, $version2) = @_; - + if ($::VERBOSE) { + print "dpkg --compare-versions $version1 $operator $version2 \n"; + } my $result =`dpkg --compare-versions $version1 $operator $version2`; return $result; From b0eff0cf94eb64c54eec60ba1785a3fdc19871a7 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 24 Sep 2014 07:12:23 -0400 Subject: [PATCH 25/80] fix build of http://xcat.sourceforge.net/man5/xcatdb.5.html --- perl-xCAT/db2man | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/db2man b/perl-xCAT/db2man index f05cfb5b5..43190a9d6 100755 --- a/perl-xCAT/db2man +++ b/perl-xCAT/db2man @@ -266,7 +266,7 @@ See http://www.perl.com/doc/manual/html/pod/perlre.html for information on perl As of xCAT 2.8.1, you can use a modified version of the regular expression support described in the previous section. You do not need to enter the node information (1st part of the expression), it will be derived from the input nodename. You only need to supply the 2nd part of the expression to determine the value to give the attribute. For examples, see -https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Listing_and_Modifying_the_Database#Easy_Regular_expressions +https://sourceforge.net/p/xcat/wiki/Listing_and_Modifying_the_Database/#easy-regular-expressions =head1 OBJECT DEFINITIONS From 7ae2e3d8f38883d62b26c82328d3ccb82c415a68 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 24 Sep 2014 22:58:51 -0400 Subject: [PATCH 26/80] change the xCAT-genesis-base version from 2.8 to 2.9 --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index c4e537d96..64dafcb51 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%define version 2.8 +%define version 2.9 %ifarch i386 i586 i686 x86 %define tarch x86 %endif From b06aa3afb06842e1e9a36d51931a110102e15949 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 24 Sep 2014 20:23:20 -0700 Subject: [PATCH 27/80] enhance of creating default netboot configuration file for p8 hardware discovery --- xCAT-server/lib/xcat/plugins/dhcp.pm | 2 +- xCAT-server/lib/xcat/plugins/mknb.pm | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 1a427824d..a4e2f64b8 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2418,7 +2418,7 @@ sub addnet push @netent, " filename \"elilo.efi\";\n"; push @netent, " } else if option client-architecture = 00:0e { #OPAL-v3\n "; - push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/default\";\n"; + push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/".$net."_".$maskbits."\";\n"; push @netent, " } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n "; push @netent, " filename \"/yaboot\";\n"; diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index a8874cf67..f9c3316ba 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -239,6 +239,14 @@ sub process_request { close($cfg); } + } elsif ($arch =~ /ppc/) { + open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/$net"); + print $cfgfile "default xCAT\n"; + print $cfgfile " label xCAT\n"; + print $cfgfile " kernel http://".$normnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; + print $cfgfile " initrd http://".$normnets->{$_}.":80/$initrd_file\n"; + print $cfgfile ' append "quiet xcatd='.$normnets->{$_}.":$xcatdport $consolecmdline\"\n"; + close($cfgfile); } } $dopxe=0; @@ -269,7 +277,7 @@ sub process_request { print $cfgfile " APPEND initrd=xcat/nbfs.$arch.gz quiet xcatd=".$hexnets->{$_}.":$xcatdport $consolecmdline\n"; close($cfgfile); } elsif ($arch =~ /ppc/) { - open($cfgfile,">", "$tftpdir/pxelinux.cfg/p/default"); + open($cfgfile,">","$tftpdir/etc/".lc($_)); print $cfgfile "default xCAT\n"; print $cfgfile " label xCAT\n"; print $cfgfile " kernel http://".$hexnets->{$_}.":80/$tftpdir/xcat/genesis.kernel.$arch\n"; From 641d9bd78ac152972f1ae1b3cd3c0740827ca6d7 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 25 Sep 2014 02:10:42 -0400 Subject: [PATCH 28/80] add otherpkgs.pkglist file for rh5 + system x --- .../xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist | 1 + 1 file changed, 1 insertion(+) create mode 100644 xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist diff --git a/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist new file mode 100644 index 000000000..51cbbf9d0 --- /dev/null +++ b/xCAT-server/share/xcat/install/rh/sysclone.rhels5.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +xcat/xcat-dep/rh5/x86_64/systemimager-client From 0541a3361abd3a181dd0221016d2aee97651cb6f Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 25 Sep 2014 02:17:35 -0400 Subject: [PATCH 29/80] add Requires: xCAT-genesis-scripts-ppc64 in xCAT.spec for ppc64 arch --- xCAT/xCAT.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 893f04996..713d273bc 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -63,6 +63,9 @@ Requires: syslinux xCAT-genesis-scripts-x86_64 elilo-xcat Requires: ipmitool-xcat >= 1.8.9 Requires: xnba-undi %endif +%ifarch ppc ppc64 +Requires: xCAT-genesis-scripts-ppc64 +%endif %if %notpcm %ifarch i386 i586 i686 x86 x86_64 From 6aabbe5ae23b26d08aa2a2a9e00238aa765dd79b Mon Sep 17 00:00:00 2001 From: ligc Date: Thu, 25 Sep 2014 02:22:46 -0400 Subject: [PATCH 30/80] build xCAT-genesis-scripts for ppc64 --- buildcore.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildcore.sh b/buildcore.sh index 3517040e2..41866121e 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -265,6 +265,8 @@ if [ "$OSNAME" != "AIX" ]; then ORIGFAILEDRPMS="$FAILEDRPMS" ./makerpm xCAT-genesis-scripts x86_64 "$EMBED" if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-x86_64"; fi + ./makerpm xCAT-genesis-scripts ppc64 "$EMBED" + if [ $? -ne 0 ]; then FAILEDRPMS="$FAILEDRPMS xCAT-genesis-scripts-ppc64"; fi if [ "$FAILEDRPMS" = "$ORIGFAILEDRPMS" ]; then # all succeeded rm -f $DESTDIR/xCAT-genesis-scripts*rpm rm -f $SRCDIR/xCAT-genesis-scripts*rpm From 365b378f4b86f6ddc515d3c3654ebdafa7c87365 Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 25 Sep 2014 15:31:11 -0700 Subject: [PATCH 31/80] add check before sending mail to avoid mail warning --- xCAT-server/share/xcat/tools/xCATreg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index b469b5729..2d8ba1fb1 100755 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -1501,9 +1501,13 @@ sub send_mail { my $mailprog = "/bin/mail"; my $sendmail = "echo \"$content\""; send_msg(2, "begin to send mail , the contents is $sendmail\n"); - my $send = $sendmail." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" "; - system($send); - send_msg(2, "finish sending mail, $send\n"); + if ($confkeys{mailgroup}) { + my $send = "$sendmail"." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" "; + system($send); + send_msg(2, "finish sending mail, $send\n"); + } else { + send_msg(1, "can't send mail to nobody "); + } return 0; } From 769f05bd917aa143b4e158341e4637ba9ed74464 Mon Sep 17 00:00:00 2001 From: litingt Date: Thu, 25 Sep 2014 04:35:31 -0400 Subject: [PATCH 32/80] add time delay --- xCAT-server/share/xcat/tools/xCATreg | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index 2d8ba1fb1..507e5e38b 100755 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -1044,11 +1044,11 @@ sub do_test1 send_msg(2, "start test"); send_msg(2, "******************************"); system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64"); - + sleep 300; system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle"); - system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64"); - 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 /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm"); + #system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_diskless_installation_flat_ppc64"); + #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 /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm"); #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/"); @@ -1081,7 +1081,8 @@ sub do_test1 send_msg(2, "start test"); send_msg(2, "******************************"); system("xdsh $MN perl /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_full_installation_flat_ppc64"); - # system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle"); + sleep 300; + system("xdsh $MN /opt/xcat/bin/xcattest -b bat.bundle"); # system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_diskless_installation_ppc64_flat"); # system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sles_statelite_installation_flat_ppc64"); # system("xdsh $MN /opt/xcat/bin/xcattest -f /opt/xcat/share/xcat/tools/autotest/default.conf -t Linux_sn_installation_flat_x86_vm"); From d0198f8592e34fd59739895ca0aaad3987e1e7c0 Mon Sep 17 00:00:00 2001 From: litingt Date: Thu, 25 Sep 2014 04:39:38 -0400 Subject: [PATCH 33/80] add waiting time --- .../autotest/testcase/installation/linux_full_installation | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/linux_full_installation b/xCAT-test/autotest/testcase/installation/linux_full_installation index 7c0850c8a..1b927c496 100644 --- a/xCAT-test/autotest/testcase/installation/linux_full_installation +++ b/xCAT-test/autotest/testcase/installation/linux_full_installation @@ -25,7 +25,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-ins check:rc==0 cmd:rnetboot $$CN check:rc==0 -cmd:sleep 1200 +cmd:sleep 1800 cmd:ping $$CN -c 3 check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status From e2e8463d645da7da5db1b6a09472dab59c3cf269 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 25 Sep 2014 22:48:53 -0400 Subject: [PATCH 34/80] add test for update delta changes --- xCAT-test/autotest/testcase/sysclone/cases0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-test/autotest/testcase/sysclone/cases0 b/xCAT-test/autotest/testcase/sysclone/cases0 index f09bf7b0b..53cabf3eb 100644 --- a/xCAT-test/autotest/testcase/sysclone/cases0 +++ b/xCAT-test/autotest/testcase/sysclone/cases0 @@ -98,6 +98,19 @@ check:output=~test.file cmd:xdsh $$TARGET_NODE "hostname" check:output=~$$TARGET_NODE: $$TARGET_NODE +cmd:xdsh $$GOLDEN_CLIENT "cd / && date > update.flag" +check:rc==0 +cmd:imgcapture $$GOLDEN_CLIENT -t sysclone -o goldenclient-osimage-$$GOS-$$MODE -V +check:rc==0 +cmd:updatenode $$TARGET_NODE -S +check:rc==0 + +cmd:xdsh $$TARGET_NODE "ls -l / |grep update.flag" +check:rc==0 +check:output=~update.flag + +cmd:xdsh $$TARGET_NODE "rm -f /update.flag" +check:rc==0 end From 4e008d7895ada4a6632f6775078dca4ad401d3af Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 26 Sep 2014 03:54:52 -0700 Subject: [PATCH 35/80] enhance for p8 hardware discovery --- xCAT-server/sbin/xcatd | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index f2cad92f7..3ad667574 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -542,8 +542,15 @@ sub do_discovery_process { my $vintage = time(); $dispatch_requests=0; populate_site_hash(); + populate_vpd_hash(); + populate_ppc_hash(); while (not $quit) { - if ((time()-$vintage)> 15) { populate_site_hash(); } #site table reread every 15 second + if ((time()-$vintage)> 15) { + populate_site_hash(); + populate_vpd_hash(); + populate_ppc_hash(); + $vintage = time(); + } #site table reread every 15 second my $msg = fd_retrieve($broker); my $data; my $client; @@ -2035,6 +2042,29 @@ sub populate_site_hash { } } +sub populate_vpd_hash { + %::XCATVPDHASH=(); + my $vpdtab = xCAT::Table->new('vpd',-create=>0); + unless ($vpdtab) {return;} + my @entries = $vpdtab->getAllAttribs(qw/node serial mtm/); + foreach (@entries) { + unless ($_->{mtm} and $_->{serial}) {next;} + my $mtms = $_->{mtm}."*".$_->{serial}; + push @{$::XCATVPDHASH{$mtms}}, $_->{node}; + } +} +sub populate_ppc_hash { + %::XCATPPCHASH=(); + my $ppctab = xCAT::Table->new('ppc',-create=>0); + unless ($ppctab) {return;} + my @entries = $ppctab->getAllAttribs(qw/node nodetype/); + foreach (@entries) { + if ($_->{nodetype} and $_->{nodetype} eq 'pbmc') { + $::XCATPPCHASH{$_->{node}}=$_->{nodetype}; + } + } +} + sub send_response { my $response = shift; my $sock = shift; From 87840527c2b148b31554b6cfe6c4656f3bee0f6a Mon Sep 17 00:00:00 2001 From: mellor Date: Fri, 26 Sep 2014 03:55:57 -0700 Subject: [PATCH 36/80] enhance for p8 hardware discovery --- xCAT-server/lib/perl/xCAT/PPC.pm | 31 +++++--------------- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 16 ++++++++++ xCAT-server/lib/xcat/plugins/switch.pm | 13 ++++++++ 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/PPC.pm b/xCAT-server/lib/perl/xCAT/PPC.pm index 95063a76c..bd02042c7 100644 --- a/xCAT-server/lib/perl/xCAT/PPC.pm +++ b/xCAT-server/lib/perl/xCAT/PPC.pm @@ -2142,38 +2142,21 @@ sub findme { my $request = shift; my $callback = shift; my $subreq = shift; - my $vpdtab = xCAT::Table->new('vpd'); if (!defined $request->{'mtm'} or !defined $request->{'serial'}) { xCAT::MsgUtils->message("S", "Discovery Error: 'mtm' or 'serial' not found."); return; } - unless ($vpdtab) { - xCAT::MsgUtils->message("S", "Discovery Error: Could not open table: vpd."); - return; - } my @attr_array = (); - push @attr_array, "mtm==$request->{mtm}->[0]"; - push @attr_array, "serial==$request->{serial}->[0]"; - - my @tmp_nodes = $vpdtab->getAllAttribsWhere(\@attr_array, 'node'); + my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0]; + my $tmp_nodes = $::XCATVPDHASH{$mtms}; my @nodes = (); my $pbmc_node; - my %nodes_hash = (); - foreach (@tmp_nodes) { - $nodes_hash{$_->{node}} = '1'; - } - @nodes = keys (%nodes_hash); - # remove the pbmc node defined by lsslp from the node groups - my $ppctab = xCAT::Table->new('ppc'); - if ($ppctab) { - my $ppchash = $ppctab->getNodesAttribs(\@nodes, ['node', 'nodetype']); - foreach (@nodes) { - if (defined($ppchash->{$_}->[0]) && defined($ppchash->{$_}->[0]->{'nodetype'}) && $ppchash->{$_}->[0]->{'nodetype'} eq 'pbmc') { - delete $nodes_hash{$_}; - $pbmc_node = $_; - } + foreach (@$tmp_nodes) { + if ($::XCATPPCHASH{$_}) { + $pbmc_node = $_; + } else { + push @nodes, $_; } - @nodes = keys (%nodes_hash); } my $nodenum = $#nodes; if ($nodenum < 0) { diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 590071920..60577d5de 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -130,6 +130,17 @@ sub findme { $node = $allnodes[0]; } } + my $pbmc_node = undef; + if ($request->{'mtm'}->[0] and $request->{'serial'}->[0]) { + my $mtms = $request->{'mtm'}->[0]."*".$request->{'serial'}->[0]; + my $tmp_nodes = $::XCATVPDHASH{$mtms}; + foreach (@$tmp_nodes) { + if ($::XCATPPCHASH{$_}) { + $pbmc_node = $_; + } + } + } + if ($node) { my $skiphostip; @@ -363,8 +374,13 @@ sub findme { } # call the discovered command to update the discovery request to a node + $request->{command}=['discovered']; $request->{noderange} = [$node]; + if ($pbmc_node) { + $request->{pbmc_node} = [$pbmc_node]; + } + $request->{discoverymethod} = ['sequential']; $request->{updateswitch} = ['yes']; $subreq->($request); diff --git a/xCAT-server/lib/xcat/plugins/switch.pm b/xCAT-server/lib/xcat/plugins/switch.pm index 29b00a4bc..bf86a3875 100644 --- a/xCAT-server/lib/xcat/plugins/switch.pm +++ b/xCAT-server/lib/xcat/plugins/switch.pm @@ -157,6 +157,16 @@ sub process_request { if ($node) { last; } } } + my $pbmc_node = undef; + if ($req->{'mtm'}->[0] and $req->{'serial'}->[0]) { + my $mtms = $req->{'mtm'}->[0]."*".$req->{'serial'}->[0]; + my $tmp_nodes = $::XCATVPDHASH{$mtms}; + foreach (@$tmp_nodes) { + if ($::XCATPPCHASH{$_}) { + $pbmc_node = $_; + } + } + } if ($node) { my $mactab = xCAT::Table->new('mac',-create=>1); @@ -169,6 +179,9 @@ sub process_request { #$doreq->(\%request); $req->{command}=['discovered']; $req->{noderange} = [$node]; + if ($pbmc_node) { + $req->{pbmc_node} = [$pbmc_node]; + } $req->{discoverymethod} = ['switch']; $doreq->($req); %{$req}=();#Clear req structure, it's done.. From 1aa1f30cdcd2f5a6165e34dd3b4981040ea3e315 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 29 Sep 2014 17:57:23 -0400 Subject: [PATCH 37/80] added xCAT-buildkit package to build-ubunturepo --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index 09bdd2f90..75160e52a 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -194,7 +194,7 @@ then if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi - packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal" + packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" target_archs=(amd64 ppc64el) for file in `echo $packages` do From 88003827c9110902023b225e25c5e9627b713903 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 29 Sep 2014 20:25:37 -0700 Subject: [PATCH 38/80] build xCAT-genesis-scripts for p8LE --- build-ubunturepo | 8 ++++---- xCAT-genesis-scripts/debian/changelog | 2 +- xCAT-genesis-scripts/debian/control | 8 ++++---- xCAT-genesis-scripts/debian/dirs | 1 - xCAT-genesis-scripts/debian/install | 3 --- xCAT-genesis-scripts/debian/rules | 14 +++++++++++++- 6 files changed, 22 insertions(+), 14 deletions(-) delete mode 100644 xCAT-genesis-scripts/debian/dirs delete mode 100644 xCAT-genesis-scripts/debian/install diff --git a/build-ubunturepo b/build-ubunturepo index 75160e52a..b06829c9a 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -194,12 +194,12 @@ then if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi - packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" + packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal" target_archs=(amd64 ppc64el) for file in `echo $packages` do file_low=`echo $file | tr '[A-Z]' '[a-z]'` - if [ "$file" = "xCAT" ]; then + if [ "$file" = "xCAT" -o "$file" = "xCAT-genesis-scripts" ]; then target_archs="amd64 ppc64el" else target_archs="all" @@ -208,8 +208,8 @@ then do if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb - #only for genesis package - rm -f ../../$package_dir_name/${file_low}-amd64_*.deb + #genesis scripts package, don't remove genesis amd64 files + #rm -f ../../$package_dir_name/${file_low}-amd64_*.deb cd $file dch -v $pkg_version -b -c debian/changelog $build_string if [ "$target_arch" = "all" ]; then diff --git a/xCAT-genesis-scripts/debian/changelog b/xCAT-genesis-scripts/debian/changelog index 461db1cf3..1780cb54a 100644 --- a/xCAT-genesis-scripts/debian/changelog +++ b/xCAT-genesis-scripts/debian/changelog @@ -1,4 +1,4 @@ -xcat-genesis-scripts-amd64 (2.8-snap20130205) precise; urgency=low +xcat-genesis-scripts (2.8-snap20130205) precise; urgency=low * Nightly_Builds diff --git a/xCAT-genesis-scripts/debian/control b/xCAT-genesis-scripts/debian/control index 9e3b2f2ba..5ae63c3fb 100644 --- a/xCAT-genesis-scripts/debian/control +++ b/xCAT-genesis-scripts/debian/control @@ -1,13 +1,13 @@ -Source: xcat-genesis-scripts-amd64 +Source: xcat-genesis-scripts Section: admin Priority: extra Maintainer: xCAT Build-Depends: debhelper (>= 8.0.0) Standards-Version: 3.9.2 -Package: xcat-genesis-scripts-amd64 -Architecture: all -Depends: xcat-genesis-base-amd64 +Package: xcat-genesis-scripts +Architecture: amd64 ppc64el +Depends: xcat-genesis-base-amd64[any-amd64],xcat-genesis-base-ppc64[any-ppc64el] 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/debian/dirs b/xCAT-genesis-scripts/debian/dirs deleted file mode 100644 index 699b7d54d..000000000 --- a/xCAT-genesis-scripts/debian/dirs +++ /dev/null @@ -1 +0,0 @@ -/opt/xcat/share/xcat/netboot/genesis/x86_64/fs diff --git a/xCAT-genesis-scripts/debian/install b/xCAT-genesis-scripts/debian/install deleted file mode 100644 index 5cb0e422d..000000000 --- a/xCAT-genesis-scripts/debian/install +++ /dev/null @@ -1,3 +0,0 @@ -./etc/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs -./bin/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs -./sbin/ opt/xcat/share/xcat/netboot/genesis/x86_64/fs diff --git a/xCAT-genesis-scripts/debian/rules b/xCAT-genesis-scripts/debian/rules index c64076ab2..de2866385 100755 --- a/xCAT-genesis-scripts/debian/rules +++ b/xCAT-genesis-scripts/debian/rules @@ -9,6 +9,15 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 + +ifneq ($(DEB_BUILD_ARCH),ppc64el) + export TARGET_ARCH=x86_64 +else + export TARGET_ARCH=ppc64 +endif +export installdir=/opt/xcat/share/xcat/netboot/genesis/$(TARGET_ARCH)/fs +export installtodir=opt/xcat/share/xcat/netboot/genesis/$(TARGET_ARCH)/fs + build: pwd @@ -21,8 +30,11 @@ install: pwd dh_testdir dh_testroot - dh_installdirs + dh_installdirs $(installdir) dh_install -X".svn" + dh_install ./etc/ $(installtodir) + dh_install ./bin/ $(installtodir) + dh_install ./sbin/ $(installtodir) dh_compress dh_installdeb dh_gencontrol From 03c9a1756694008efa9045a9934a94e674141fe7 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 29 Sep 2014 20:28:05 -0700 Subject: [PATCH 39/80] Miss xCAT-buildkit in build-ubunturepo --- build-ubunturepo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-ubunturepo b/build-ubunturepo index b06829c9a..2fe0621d1 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -194,7 +194,7 @@ then if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi - packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal" + packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack xCAT-OpenStack-baremetal xCAT-buildkit" target_archs=(amd64 ppc64el) for file in `echo $packages` do From 3133cbeb3f982aca9d9df4243f7e0369b1ae6c14 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 29 Sep 2014 21:26:52 -0700 Subject: [PATCH 40/80] 1. add xCAT depend on xcat-genesis-scripts, 2. fix mknb issue, 3. modify xcatconfig to call mknb --- xCAT-server/lib/xcat/plugins/mknb.pm | 3 +++ xCAT-server/sbin/xcatconfig | 5 ++++- xCAT/debian/control | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index f9c3316ba..e4cd41283 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -78,6 +78,9 @@ sub process_request { $callback->({error=>["Failed to create a temporary directory"],errorcode=>[1]}); return; } + unless (-e "$tftpdir/xcat") { + mkpath("$tftpdir/xcat"); + } my $rc; my $invisibletouch=0; if (-e "$::XCATROOT/share/xcat/netboot/genesis/$arch") { diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 111cf5497..088388a3b 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1873,6 +1873,9 @@ sub mknb # 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') ) { unlink '/etc/xcat/genesis-scripts-updated'; # Do not print messages or run command twice @@ -1888,7 +1891,7 @@ sub mknb $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); + my $outref = xCAT::Utils->runcmd("$cmd", 0); if ($cmd) { system($cmd); if ($? != 0) { diff --git a/xCAT/debian/control b/xCAT/debian/control index 069be17d8..31c38c62d 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.9), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi[any-amd64], xcat-genesis-scripts-amd64[any-amd64], elilo-xcat[any-amd64] +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.9), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat[any-amd64], xnba-undi[any-amd64], xcat-genesis-scripts, elilo-xcat[any-amd64] 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 From 1d241dedf0cd8a048f693124c492c7e166ed7375 Mon Sep 17 00:00:00 2001 From: mellor Date: Wed, 1 Oct 2014 15:16:54 -0400 Subject: [PATCH 41/80] added undocumented flag to buildkit to allow our local build team to create Ubuntu kits on our RH build servers --- xCAT-buildkit/bin/buildkit | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index ff1a456dd..695eda497 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -322,6 +322,7 @@ if ( 'k|kitversion=s' => \$::KITVERSION, 'r|kitrelease=s' => \$::KITRELEASE, 'l|kitloc=s' => \$::KITLOC, + 'for=s' => \$::FOROSVERSARCH, ) ) { @@ -337,11 +338,26 @@ if ($::HELP) } my $debianflag = 0; +my $dpkg_flag = '-uc -us'; my $tempstring = xCAT::BuildKitUtils->osver(); if ( $tempstring =~ /debian/ || $tempstring =~ /ubuntu/ ){ $debianflag = 1; } +# This is an undocumented flag to support our local build team +# to allow building Ubuntu kits on our RH build machines. +# It requires RH rpms such as dep, fakeroot, perl-File-DesktopEntry, +# perl-File-BaseDir, and html2text to be installed on the build server +# for this to work. To use this flag: +# buildkit --for ubuntu buildrepo +# buildkit --for ubuntu buildtar +if ($::FOROSVERSARCH) { + if ( $::FOROSVERSARCH =~ /debian/ || $::FOROSVERSARCH =~ /ubuntu/ ) { + $debianflag=1; + $dpkg_flag .= ' -A -d'; + } +} + # display the version statement if -v or --version is specified if ($::VERSION) { @@ -2442,10 +2458,10 @@ sub build_kitcomp_debian{ my $prep_compversion = $comp->{version} . "-" . $comp->{release}; my $prep_buildstring = "Prep Kit component build package."; my $prep_debbuilddir = $::workdir."/debbuild/"."prep-".$comp->{kitcompname}; - my $prep_debianbuildcmd = "cd $prep_debbuilddir;dch -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage -uc -us"; + my $prep_debianbuildcmd = "cd $prep_debbuilddir;debchange -v $prep_compversion -b -c debian/changelog $prep_buildstring;dpkg-buildpackage $dpkg_flag"; if ( system($prep_debianbuildcmd) ) { - print "Error running \"dpkg-buildpackage -uc -us\" command for kit component prep-$comp->{kitcompname} meta package\n"; + print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component prep-$comp->{kitcompname} meta package\n"; return 1; } } @@ -2482,11 +2498,11 @@ sub build_kitcomp_debian{ } } my $compversion = $comp->{version} . "-" . $comp->{release}; - my $buildstring = "Kit component build package."; - my $debianbuildcmd = "cd $debbuilddir;dch -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage -uc -us"; + my $buildstring = "\'Kit component build package.\'"; + my $debianbuildcmd = "cd $debbuilddir;debchange -v $compversion -b -c debian/changelog $buildstring;dpkg-buildpackage $dpkg_flag"; if ( !$::NON_NATIVE_PKGS->{$comp->{kitcompname}} ) { if ( system($debianbuildcmd) ) { - print "Error running \"dpkg-buildpackage -uc -us\" command for kit component $comp->{kitcompname} meta package\n"; + print "Error running \"dpkg-buildpackage $dpkg_flag\" command for kit component $comp->{kitcompname} meta package\n"; return 1; } my $repodir = $::base_repodir."/".$repo{kitreponame}; @@ -3558,7 +3574,7 @@ sub kit_addpkgs #for debian/ubuntu my $repodir = $tmpdir . "/repos/".$non_native_kitreponame; if ( $debianflag ){ - my $debbuildcmd = "cd $source_dir;dpkg-buildpackage -uc -us"; + my $debbuildcmd = "cd $source_dir;dpkg-buildpackage $dpkg_flag"; if ( system($debbuildcmd) ){ print "error running debian build cmd for kit component $non_native_basename meta package.\n"; return 1; From c3f0760164ff6d8474f66afa2561579b85498725 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 1 Oct 2014 18:02:46 -0400 Subject: [PATCH 42/80] Bug:3832 - test sles OS before checking dhcpd6 file when ipv6 used, fix formatting --- xCAT-server/lib/xcat/plugins/dhcp.pm | 161 ++++++++++++++------------- 1 file changed, 85 insertions(+), 76 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index a4e2f64b8..e5b919447 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1491,93 +1491,102 @@ sub process_request if ( $^O ne 'aix') { - #add the active nics to /etc/sysconfig/dhcpd or /etc/default/dhcp3-server(ubuntu) + #add the active nics to /etc/sysconfig/dhcpd or /etc/default/dhcp3-server(ubuntu) my $dhcpver; - my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 ); + my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 ); foreach $dhcpver ("dhcpd","dhcpd6","dhcp3-server", "isc-dhcp-server") { - if (-e "/etc/sysconfig/$dhcpver") { - if ($dhcpver eq "dhcpd") { + if (-e "/etc/sysconfig/$dhcpver") { + if ($dhcpver eq "dhcpd") { delete($missingfiles{dhcpd}); delete($missingfiles{"dhcp3-server"}); } else { - delete($missingfiles{$dhcpver}); + delete($missingfiles{$dhcpver}); } - open DHCPD_FD, "/etc/sysconfig/$dhcpver"; - my $syscfg_dhcpd = ""; - my $found = 0; - my $dhcpd_key = "DHCPDARGS"; + open DHCPD_FD, "/etc/sysconfig/$dhcpver"; + my $syscfg_dhcpd = ""; + my $found = 0; + my $dhcpd_key = "DHCPDARGS"; + my $os = xCAT::Utils->osver(); + if ($os =~ /sles/i) { + $dhcpd_key = "DHCPD_INTERFACE"; + } + + my $ifarg = "$dhcpd_key=\""; + foreach (keys %activenics) { + if (/!remote!/) { next; } + $ifarg .= " $_"; + } + $ifarg =~ s/^ //; + $ifarg .= "\"\n"; + + while () { + if ($_ =~ m/^$dhcpd_key/) { + $found = 1; + $syscfg_dhcpd .= $ifarg; + } else { + $syscfg_dhcpd .= $_; + } + } + + if ( $found eq 0 ) { + $syscfg_dhcpd .= $ifarg; + } + close DHCPD_FD; + + open DBG_FD, '>', "/etc/sysconfig/$dhcpver"; + print DBG_FD $syscfg_dhcpd; + close DBG_FD; + } elsif (-e "/etc/default/$dhcpver") { #ubuntu + delete($missingfiles{"dhcpd"}); + #dhcpd and dhcpd6 use the same configure file + delete($missingfiles{"dhcpd6"}); + delete($missingfiles{"dhcp3-server"}); + open DHCPD_FD, "/etc/default/$dhcpver"; + my $syscfg_dhcpd = ""; + my $found = 0; + my $dhcpd_key = "INTERFACES"; + my $os = xCAT::Utils->osver(); + + my $ifarg = "$dhcpd_key=\""; + foreach (keys %activenics) { + if (/!remote!/) { next; } + $ifarg .= " $_"; + } + $ifarg =~ s/^ //; + $ifarg .= "\"\n"; + + while () { + if ($_ =~ m/^$dhcpd_key/) { + $found = 1; + $syscfg_dhcpd .= $ifarg; + } else { + $syscfg_dhcpd .= $_; + } + } + + if ( $found eq 0 ) { + $syscfg_dhcpd .= $ifarg; + } + close DHCPD_FD; + + open DBG_FD, '>', "/etc/default/$dhcpver"; + print DBG_FD $syscfg_dhcpd; + close DBG_FD; + } + } + if ($usingipv6) { my $os = xCAT::Utils->osver(); + # sles had dhcpd and dhcpd6 config in the dhcp file if ($os =~ /sles/i) { - $dhcpd_key = "DHCPD_INTERFACE"; - } - - my $ifarg = "$dhcpd_key=\""; - foreach (keys %activenics) { - if (/!remote!/) { next; } - $ifarg .= " $_"; - } - $ifarg =~ s/^ //; - $ifarg .= "\"\n"; - - while () { - if ($_ =~ m/^$dhcpd_key/) { - $found = 1; - $syscfg_dhcpd .= $ifarg; - }else { - $syscfg_dhcpd .= $_; + if ($missingfiles{dhcpd}) { + $callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]}); + } + } else { + if ($missingfiles{dhcpd6}) { + $callback->({error=>["The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"]}); } } - - if ( $found eq 0 ) { - $syscfg_dhcpd .= $ifarg; - } - close DHCPD_FD; - - open DBG_FD, '>', "/etc/sysconfig/$dhcpver"; - print DBG_FD $syscfg_dhcpd; - close DBG_FD; - }elsif (-e "/etc/default/$dhcpver") { #ubuntu - delete($missingfiles{"dhcpd"}); - #dhcpd and dhcpd6 use the same configure file - delete($missingfiles{"dhcpd6"}); - delete($missingfiles{"dhcp3-server"}); - open DHCPD_FD, "/etc/default/$dhcpver"; - my $syscfg_dhcpd = ""; - my $found = 0; - my $dhcpd_key = "INTERFACES"; - my $os = xCAT::Utils->osver(); - - my $ifarg = "$dhcpd_key=\""; - foreach (keys %activenics) { - if (/!remote!/) { next; } - $ifarg .= " $_"; - } - $ifarg =~ s/^ //; - $ifarg .= "\"\n"; - - while () { - if ($_ =~ m/^$dhcpd_key/) { - $found = 1; - $syscfg_dhcpd .= $ifarg; - }else { - $syscfg_dhcpd .= $_; - } - } - - if ( $found eq 0 ) { - $syscfg_dhcpd .= $ifarg; - } - close DHCPD_FD; - - open DBG_FD, '>', "/etc/default/$dhcpver"; - print DBG_FD $syscfg_dhcpd; - close DBG_FD; - } - } - if ($usingipv6 and $missingfiles{dhcpd6}) { - $callback->({error=>["The file /etc/sysconfig/dhcpd6 doesn't exist, check the dhcp server"]}); - } if ($missingfiles{dhcpd}) { $callback->({error=>["The file /etc/sysconfig/dhcpd doesn't exist, check the dhcp server"]}); } From aea40b0226eb36745cef53835c539c101be8f119 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Sat, 4 Oct 2014 23:20:48 -0700 Subject: [PATCH 43/80] fix an issue about hardware discovery process: the sub process can not receive findme request immediately --- xCAT-server/sbin/xcatd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 3ad667574..bb10bdf60 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -936,6 +936,8 @@ unless ($pid_UDP) { my $discoctl; my $udpbroker; socketpair($discoctl,$udpbroker,AF_UNIX,SOCK_STREAM,PF_UNSPEC); + $udpbroker->autoflush(1); + $discoctl->autoflush(1); $pid_disco = xCAT::Utils->xfork; if (!defined $pid_disco) { xCAT::MsgUtils->message("S", "Unable to fork for UDP/TCP"); From 590b18a34c718b55087babca890f08770a2764a9 Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 6 Oct 2014 10:19:57 -0400 Subject: [PATCH 44/80] defect 4277 - allow gpfs_updates script to create gpfs.csh profile that works for both csh and tcsh --- xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_updates | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_updates b/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_updates index 6ab6eaabb..5d8c9fd34 100755 --- a/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_updates +++ b/xCAT-IBMhpc/share/xcat/IBMhpc/gpfs/gpfs_updates @@ -103,7 +103,7 @@ else # assume Linux fi if [ ! -e $gpfsprofile.sh ]; then echo 'export PATH=$PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.sh - echo 'setenv PATH $PATH:/usr/lpp/mmfs/bin' > $gpfsprofile.csh + echo 'setenv PATH ${PATH}:/usr/lpp/mmfs/bin' > $gpfsprofile.csh # Turn off LANG support since we did not install other msg catalogs echo 'export LC_CTYPE=POSIX' >> $gpfsprofile.sh echo 'setenv LC_CTYPE POSIX' >> $gpfsprofile.csh From e9dd282fdf886879de96c0b059eb584c1acc2d28 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 7 Oct 2014 14:05:22 -0400 Subject: [PATCH 45/80] defect 4282 fix debian preinstall script errors --- xCAT-buildkit/share/xcat/kits/debian_template/preinst | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/preinst b/xCAT-buildkit/share/xcat/kits/debian_template/preinst index 6232bd33d..40bdc2df5 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/preinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/preinst @@ -21,6 +21,7 @@ case "$1" in upgrade) if [ -f /tmp/<<>> ]; then + echo "preupgrade processing" <<>> fi ;; From f5296e4107411e561263d57df0c2706da4872da9 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 7 Oct 2014 17:47:53 -0400 Subject: [PATCH 46/80] fix def mapping of kitrepo osbasename attribute --- perl-xCAT/xCAT/Schema.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index acadf67ca..db2bd36c5 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -3633,8 +3633,8 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); tabentry => 'kitrepo.kitname', access_tabentry => 'kitrepo.kitreponame=attr:kitreponame', }, - {attr_name => 'osname', - tabentry => 'kitrepo.osname', + {attr_name => 'osbasename', + tabentry => 'kitrepo.osbasename', access_tabentry => 'kitrepo.kitreponame=attr:kitreponame', }, {attr_name => 'osmajorversion', From cc67df3caafdb1190421fe0b1d8f2fc6ee182e42 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 7 Oct 2014 18:03:47 -0400 Subject: [PATCH 47/80] minor error msg fixes for kit cmds --- xCAT-server/lib/xcat/plugins/kit.pm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 5f01a8db4..a96754747 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1979,20 +1979,24 @@ sub addkitcomp # Read serverrole from osimage. $os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'}); - } elsif ( !$osimagetable or !$osimagetable->{'osname'} ) { + } elsif ( !$osimagetable ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osname' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not exist"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } elsif ( !$osimagetable->{'osname'} ) { + my %rsp; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osname' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; - } elsif ( !$osimagetable->{'osvers'} ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osvers' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osvers' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } elsif ( !$osimagetable->{'osarch'} ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osarch' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osarch' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } else { @@ -3336,20 +3340,24 @@ sub chkkitcomp # Read serverrole from osimage. $os{$osimage}{serverrole} = lc($osimagetable->{'serverrole'}); - } elsif ( !$osimagetable or !$osimagetable->{'osname'} ) { + } elsif ( !$osimagetable ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osname' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not exist"; + xCAT::MsgUtils->message( "E", \%rsp, $callback ); + return 1; + } elsif ( !$osimagetable->{'osname'} ) { + my %rsp; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osname' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; - } elsif ( !$osimagetable->{'osvers'} ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osvers' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osvers' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } elsif ( !$osimagetable->{'osarch'} ) { my %rsp; - push@{ $rsp{data} }, "osimage $osimage does not contains a valid 'osarch' attribute"; + push@{ $rsp{data} }, "osimage $osimage does not contain a valid 'osarch' attribute"; xCAT::MsgUtils->message( "E", \%rsp, $callback ); return 1; } else { From 32d389cbee34639f6a7b1507c0e6751468cf505b Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Tue, 7 Oct 2014 23:19:36 -0700 Subject: [PATCH 48/80] add message for 'mknb' in ubuntu LE --- xCAT-genesis-scripts/debian/postinst | 1 + xCAT-server/lib/xcat/plugins/mknb.pm | 3 +++ 2 files changed, 4 insertions(+) diff --git a/xCAT-genesis-scripts/debian/postinst b/xCAT-genesis-scripts/debian/postinst index f5e28d707..55a4d98bb 100644 --- a/xCAT-genesis-scripts/debian/postinst +++ b/xCAT-genesis-scripts/debian/postinst @@ -20,6 +20,7 @@ set -e case "$1" in configure) + echo "If you are installing/updating xCAT-genesis-base separately, not as part of installing/updating all of xCAT, run 'mknb manually'" touch /etc/xcat/genesis-scripts-updated ;; diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index e4cd41283..4bae8272b 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -53,6 +53,9 @@ sub process_request { if (! $arch) { $callback->({error=>"Need to specify architecture (x86, x86_64 or ppc64)"},{errorcode=>[1]}); return; + } elsif ( $arch eq "ppc64le" or $arch eq "ppc64el" ) { + $callback->({data=>"The arch:$arch is not supported at present, pls use \"ppc64\" instead"}); + return; } unless (-d "$::XCATROOT/share/xcat/netboot/$arch" or -d "$::XCATROOT/share/xcat/netboot/genesis/$arch") { $callback->({error=>"Unable to find directory $::XCATROOT/share/xcat/netboot/$arch or $::XCATROOT/share/xcat/netboot/genesis/$arch",errorcode=>[1]}); From b76e15c4876736d6f1248c670777568d5aa84787 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 8 Oct 2014 08:09:37 -0400 Subject: [PATCH 49/80] minor fix for configib --- xCAT/postscripts/configib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 4717c1339..904dd0da3 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -149,7 +149,7 @@ then fi # remove the nic configuration files which are included in $NIC_IBNICS - for nic in echo "$NIC_IBNICS" | tr "," "\n" + for nic in `echo "$NIC_IBNICS" | tr "," "\n"` do rm -f $dir/ifcfg-$nic 2>&1 1>/dev/null done From 97df5ec9a646591e735863e012135dfbeb567765 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 8 Oct 2014 04:32:48 -0400 Subject: [PATCH 50/80] In ubuntu, rpm can be installed, if rpm is installed,ubuntu will use rpm instead of dpkg,so check dpkg first --- xCAT/postscripts/otherpkgs | 45 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 6d3e771c8..2845b5130 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -396,31 +396,36 @@ hasdpkg=0 supdatecommand="rpm -Uvh --replacepkgs" sremovecommand="rpm -ev" -result=`rpm --version 2>/dev/null` +#In ubuntu, rpm can be installed, if rpm is installed,ubuntu will use rpm +#So dpkg --version should be in front of rpm --version +result=`dpkg --version 2>/dev/null` if [ $? -eq 0 ]; then - hasrpm=1 - result=`rpm -q yum` - if [ $? -eq 0 ]; then - hasyum=1 - else - result=`rpm -q zypper` - if [ "$?" = "0" ]; then - haszypper=1 - fi - fi -else - result=`dpkg --version` + hasdpkg=1 + supdatecommand="dpkg -i" + sremovecommand="dpkg -r" + result=`dpkg -l apt` if [ $? -eq 0 ]; then - hasdpkg=1 - supdatecommand="dpkg -i" - sremovecommand="dpkg -r" - result=`dpkg -l apt` - if [ $? -eq 0 ]; then - hasapt=1 - fi + hasapt=1 + fi +else + result=`rpm --version 2>/dev/null` + if [ $? -eq 0 ]; then + hasrpm=1 + result=`rpm -q yum` + if [ $? -eq 0 ]; then + hasyum=1 + else + result=`rpm -q zypper` + if [ "$?" = "0" ]; then + haszypper=1 + fi + fi fi fi + + + ########### ##start generating the os pkg repositories if ( pmatch "$OSVER" "sles11*" && [ $haszypper -eq 1 ] ); then From ee82fa97b48f447b4dbfc965978b604382e971d0 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Wed, 8 Oct 2014 09:06:52 -0400 Subject: [PATCH 51/80] add fix debian preinstall script errors --- xCAT-buildkit/share/xcat/kits/debian_template/preinst | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-buildkit/share/xcat/kits/debian_template/preinst b/xCAT-buildkit/share/xcat/kits/debian_template/preinst index 40bdc2df5..30b8a5598 100644 --- a/xCAT-buildkit/share/xcat/kits/debian_template/preinst +++ b/xCAT-buildkit/share/xcat/kits/debian_template/preinst @@ -17,6 +17,7 @@ set -e case "$1" in install) <<>> + echo "preinstall processing" ;; upgrade) From e438c2f7667cd015dff6980b98c2905099213c62 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 8 Oct 2014 13:32:24 -0400 Subject: [PATCH 52/80] Add check for Ubuntu on Power7 where iso called powerpc --- xCAT-server/lib/xcat/plugins/debian.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index c6c04fd6a..750b8d840 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -281,7 +281,7 @@ sub copycd { $darch = "ppc64el"; } - elsif ($darch and $darch =~ /ppc/) + elsif ($darch and ($darch =~ /ppc/ or $darch =~ /powerpc/)) { $darch = "ppc64"; } From 1c0f2b5bef5628f809a38e0dcfb08271a3f1eb00 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 8 Oct 2014 13:33:23 -0400 Subject: [PATCH 53/80] clean up formatting of dhpc.pm --- xCAT-server/lib/xcat/plugins/dhcp.pm | 117 +++++++++++++-------------- 1 file changed, 57 insertions(+), 60 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index e5b919447..fc40e2e57 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1208,28 +1208,27 @@ sub process_request # if option is query then call listnode for each node and return if ($opt{q}) - { + { # call listnode for each node requested foreach my $node ( @{$req->{node}} ) { listnode($node,$callback); } - return; + return; } # if current node is a servicenode, make sure that it is also a dhcpserver my $isok=1; if (xCAT::Utils->isServiceNode()) { - $isok=0; - my @hostinfo=xCAT::NetworkUtils->determinehostname(); - my %iphash=(); - foreach(@hostinfo) {$iphash{$_}=1;} - my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver'); - foreach my $s (@sn) - { - if (exists($iphash{$s})) { - $isok=1; - } - } + $isok=0; + my @hostinfo=xCAT::NetworkUtils->determinehostname(); + my %iphash=(); + foreach(@hostinfo) {$iphash{$_}=1;} + my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver'); + foreach my $s (@sn) { + if (exists($iphash{$s})) { + $isok=1; + } + } } if($isok == 0) { #do nothing if it is a service node, but not dhcpserver @@ -1332,39 +1331,35 @@ sub process_request @dhcpconf = (); @dhcp6conf = (); - my $dhcplockfd; - open($dhcplockfd,">","/tmp/xcat/dhcplock"); - flock($dhcplockfd,LOCK_EX); - if ($::XCATSITEVALS{externaldhcpservers}) { #do nothing if remote dhcpservers at this point - } elsif ($opt{n}) - { - if (-e $dhcpconffile) - { - if ($^O eq 'aix') - { - # save NIM aix entries - to be restored later - my $aixconf; - open($aixconf, $dhcpconffile); - if ($aixconf) - { - my $save=0; - while (<$aixconf>) - { - if ($save) { - push @aixcfg, $_; - } + my $dhcplockfd; + open($dhcplockfd,">","/tmp/xcat/dhcplock"); + flock($dhcplockfd,LOCK_EX); + if ($::XCATSITEVALS{externaldhcpservers}) { + # do nothing if remote dhcpservers at this point + } elsif ($opt{n}) { + if (-e $dhcpconffile) { + if ($^O eq 'aix') { + # save NIM aix entries - to be restored later + my $aixconf; + open($aixconf, $dhcpconffile); + if ($aixconf) { + my $save=0; + while (<$aixconf>) { + if ($save) { + push @aixcfg, $_; + } - if ($_ =~ /#Network configuration end\n/) { - $save++; - } - } - close($aixconf); - } - $restartdhcp=1; - @dhcpconf = (); - } + if ($_ =~ /#Network configuration end\n/) { + $save++; + } + } + close($aixconf); + } + $restartdhcp=1; + @dhcpconf = (); + } - my $rsp; + my $rsp; push @{$rsp->{data}}, "Renamed existing dhcp configuration file to $dhcpconffile.xcatbak\n"; xCAT::MsgUtils->message("I", $rsp, $callback); @@ -1400,11 +1395,11 @@ sub process_request @dhcp6conf = (); } } - my $nettab = xCAT::Table->new("networks"); - my @vnets = $nettab->getAllAttribs('net','mgtifname','mask','dynamicrange','nameservers','ddnsdomain', 'domain'); + my $nettab = xCAT::Table->new("networks"); + my @vnets = $nettab->getAllAttribs('net','mgtifname','mask','dynamicrange','nameservers','ddnsdomain', 'domain'); - # get a list of all domains listed in xCAT network defs - # - include the site domain - if any + # get a list of all domains listed in xCAT network defs + # - include the site domain - if any my $nettab = xCAT::Table->new("networks"); my @doms = $nettab->getAllAttribs('domain'); foreach(@doms){ @@ -1416,9 +1411,9 @@ sub process_request # add the site domain if ($site_domain) { - if (!grep(/^$site_domain$/, @alldomains)) { - push (@alldomains, $site_domain); - } + if (!grep(/^$site_domain$/, @alldomains)) { + push (@alldomains, $site_domain); + } } foreach (@vnets) { @@ -1450,18 +1445,19 @@ sub process_request } } - foreach(@vnets){ + foreach(@vnets){ #TODO: v6 relayed networks? - my $n = $_->{net}; - my $if = $_->{mgtifname}; - my $nm = $_->{mask}; + my $n = $_->{net}; + my $if = $_->{mgtifname}; + my $nm = $_->{mask}; if ($if =~ /!remote!/ and $n !~ /:/) { #only take in networks with special interface, but only v4 for now - push @nrn, "$n:$if:$nm"; + push @nrn, "$n:$if:$nm"; } - } + } if ($querynics) - { #Use netstat to determine activenics only when no site ent. - #TODO: IPv6 auto-detect, or just really really insist people define dhcpinterfaces or suffer doom? + { + # Use netstat to determine activenics only when no site ent. + # TODO: IPv6 auto-detect, or just really really insist people define dhcpinterfaces or suffer doom? foreach (@nrn) { my @ent = split /:/; @@ -1496,6 +1492,7 @@ sub process_request my %missingfiles = ( "dhcpd"=>1, "dhcpd6"=>1, "dhcp3-server"=>1 ); foreach $dhcpver ("dhcpd","dhcpd6","dhcp3-server", "isc-dhcp-server") { if (-e "/etc/sysconfig/$dhcpver") { + # for dhcpd, dhcpd6 if ($dhcpver eq "dhcpd") { delete($missingfiles{dhcpd}); delete($missingfiles{"dhcp3-server"}); @@ -1516,7 +1513,7 @@ sub process_request if (/!remote!/) { next; } $ifarg .= " $_"; } - $ifarg =~ s/^ //; + $ifarg = s/\=\" /\=\"/; $ifarg .= "\"\n"; while () { From 5cb4f7a8d9121fd8303ebe39ef9967d637f60d93 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 8 Oct 2014 13:51:48 -0400 Subject: [PATCH 54/80] bug #4081, remove syntax warnings --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 46 ++++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index d211af164..e61152906 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -30,30 +30,30 @@ $Getopt::Long::ignorecase = 0; # Globals # -%::CLIATTRS; # attr=values provided on the command line -%::FILEATTRS; # attr=values provided in an input file -%::FINALATTRS; # final set of attr=values that are used to set +# %::CLIATTRS; # attr=values provided on the command line +#%::FILEATTRS; # attr=values provided in an input file +#%::FINALATTRS; # final set of attr=values that are used to set # the object -%::objfilehash; # hash of objects/types based of "-f" option +#%::objfilehash; # hash of objects/types based of "-f" option # (list in file) -%::WhereHash; # hash of attr=val from "-w" option -@::AttrList; # list of attrs from "-i" option -%::NicsAttrHash; # hash of nics attributes specified with "-i" option +#%::WhereHash; # hash of attr=val from "-w" option +#@::AttrList; # list of attrs from "-i" option +#%::NicsAttrHash; # hash of nics attributes specified with "-i" option # e.g. $::NicsAttrHash{'nicips'} = ("eth0","eth1"); # object type lists -@::clobjtypes; # list of object types derived from the command line. -@::fileobjtypes; # list of object types from input file ("-x" or "-z") +#@::clobjtypes; # list of object types derived from the command line. +#@::fileobjtypes; # list of object types from input file ("-x" or "-z") # object name lists -@::clobjnames; # list of object names derived from the command line -@::fileobjnames; # list of object names from an input file -@::objfilelist; # list of object names from the "-f" option -@::allobjnames; # combined list +#@::clobjnames; # list of object names derived from the command line +#@::fileobjnames; # list of object names from an input file +#@::objfilelist; # list of object names from the "-f" option +#@::allobjnames; # combined list -@::noderange; # list of nodes derived from command line +#@::noderange; # list of nodes derived from command line #------------------------------------------------------------------------------ @@ -951,7 +951,7 @@ sub processArgs } } } - elsif (@::noderange && (@::clobjtypes[0] eq 'node')) + elsif (@::noderange && ($::clobjtypes[0] eq 'node')) { # if there's no object list and the type is node then the @@ -1278,7 +1278,7 @@ sub defmk { # if attr=val on cmd line then could only have one type - $::objtype = @::clobjtypes[0]; + $::objtype = $::clobjtypes[0]; # # set cli attrs for each object definition @@ -1921,7 +1921,7 @@ sub defch { # if attr=val on cmd line then could only have one type - $::objtype = @::clobjtypes[0]; + $::objtype = $::clobjtypes[0]; # # set cli attrs for each object definition @@ -2760,7 +2760,7 @@ sub defls my %objhash; my @objectlist; - @::allobjnames; +# @::allobjnames; my @displayObjList; my $numtypes = 0; @@ -2843,7 +2843,7 @@ sub defls if ($::objectsfrom_opto || $::objectsfrom_nr || $::objectsfrom_args) { - my $type = @::clobjtypes[0]; + my $type = $::clobjtypes[0]; $numtypes = 1; @@ -3748,7 +3748,7 @@ sub defrm # there can only be one type value if ($::objectsfrom_opto || $::objectsfrom_nr || $::objectsfrom_args) { - my $type = @::clobjtypes[0]; + my $type = $::clobjtypes[0]; foreach my $obj (sort @::clobjnames) { @@ -3873,8 +3873,8 @@ sub defrm $nhash{$m} = 'node'; } # Performance: Only call getobjdefs once - my @attrs = ('groups'); - %nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash, 0, \@attrs); + @attrs = ('groups'); + %nodehash = xCAT::DBobjUtils->getobjdefs(\%nhash, 0, \@attrs); if (!(%nodehash)) { my $rsp; @@ -4222,7 +4222,7 @@ sub initialize_variables %::CLIATTRS = (); %::FILEATTRS = (); %::FINALATTRS = (); - %::objfilehash = (); +# %::objfilehash = (); %::WhereHash = (); @::AttrList = (); %::NicsAttrHash = (); From 425dbf90ed93f9e688e6494c39dafacff3033766 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Thu, 9 Oct 2014 03:19:08 -0400 Subject: [PATCH 55/80] wrong complete kit path --- xCAT-buildkit/bin/buildkit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 695eda497..ae6bd3dbd 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1022,7 +1022,7 @@ sub kit_buildtar } } - print "Creating tar file $tarfile.\n"; + print "Creating tar file $::current_dir/$kitfilename.\n"; if ( system("cd $::deploy_dir; cd ..; tar -cjhf $tarfile $kitname/*") ) { print "Error building tarfile $tarfile \n"; From 64c3c7c2730d53647a3d42a34e90887cc9162941 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 9 Oct 2014 13:38:22 -0400 Subject: [PATCH 56/80] missed ~ in =~ in changes from dhcp.pm --- xCAT-server/lib/xcat/plugins/dhcp.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index fc40e2e57..10bedbae8 100755 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1513,7 +1513,7 @@ sub process_request if (/!remote!/) { next; } $ifarg .= " $_"; } - $ifarg = s/\=\" /\=\"/; + $ifarg =~ s/\=\" /\=\"/; $ifarg .= "\"\n"; while () { From ae31875596fee12aad4e60d57795b06be881f134 Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 11 Oct 2013 11:44:21 +0800 Subject: [PATCH 57/80] lsdef -t auditlog may return nothing --- xCAT-test/autotest/testcase/lsdef/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index 9850384fc..c002bdd06 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -151,7 +151,7 @@ cmd:tabprune auditlog -a check:rc==0 cmd:lsdef -t auditlog check:rc==0 -check:output=~auditlog +check:output=~auditlog|Could not find any object end start:lsdef_t_eventlog From 50d51f4e40de84f135b40034135fade5c53d99ad Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 11 Oct 2013 17:31:55 +0800 Subject: [PATCH 58/80] add xfs kernel module and binary for sysclone support on RHEL 7 --- xCAT-genesis-builder/install | 2 +- xCAT-genesis-builder/installkernel | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 36e788e19..2bba77733 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -4,7 +4,7 @@ dracut_install wget openssl tar mstflint ipmitool cpio gzip lsmod ethtool modpro dracut_install netstat # broadcom update requires dracut_install uniq # mellanox update requires dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr -dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 #mkfs.btrfs removed +dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 mkfs.xfs xfs_db #mkfs.btrfs removed dracut_install efibootmgr #dracut_install libvirtd /usr/share/libvirt/cpu_map.xml /usr/bin/qemu-img /usr/libexec/qemu-kvm dracut_install mkswap df brctl vconfig ifenslave ssh-keygen scp clear dhclient lldpad diff --git a/xCAT-genesis-builder/installkernel b/xCAT-genesis-builder/installkernel index 60e5c0a05..074fc1136 100755 --- a/xCAT-genesis-builder/installkernel +++ b/xCAT-genesis-builder/installkernel @@ -1,6 +1,6 @@ #!/bin/bash instmods nfs sunrpc -instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic +instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x bna ixgb ixgbe qlge mptsas mpt2sas mpt3sas ata_piix megaraid_sas virtio_blk ahci ibmaem xhci-hcd sd_mod pmcraid be2net vfat ext3 ext4 btrfs reiserfs usb_storage scsi_wait_scan kvm kvm-intel kvm-amd ipmi_si ipmi_devintf qlcnic xfs instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether instmods mptctl #LSI firmware management requires this instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys From 33213acfae951d06dd8f7f5c36a66873611d3dd2 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 10 Oct 2014 06:14:05 -0400 Subject: [PATCH 59/80] Add --ip to the interface defect 4285 --- xCAT-server/lib/xcat/plugins/configfpc.pm | 54 +++++++++++++++++------ 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index 44b73cd82..ab7fc233e 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -18,7 +18,6 @@ use xCAT::NetworkUtils; use xCAT::MacMap; use Socket; use Net::Ping; -my $interface; ########################################################################## ## Command handler method from tables @@ -65,6 +64,7 @@ sub process_request { my $getopt_success = Getopt::Long::GetOptions( 'help|h|?' => \$::opt_h, 'i|I=s' => \$::opt_I, + 'ip|ip=s' => \$::opt_IP, 'verbose|V' => \$::opt_V, ); @@ -89,7 +89,7 @@ sub process_request { # Option -i for kit component attributes if ( defined($::opt_I) ) { - $interface = $::opt_I; + $::interface = $::opt_I; } my $command = $request->{command}->[0]; @@ -116,9 +116,9 @@ sub configfpc_usage { push @{ $rsp->{data} }, "\nUsage: configfpc - Configure the NeXtScale FPCs.i This command requires the -i option to give specify which network adapter to use to look for the FPCs.\n"; push @{ $rsp->{data} }, - " configfpc -i interface \n "; + " configfpc -i interface [--ip default ip address]\n "; push @{ $rsp->{data} }, - " configfpc [-V|--verbose] -i interface \n "; + " configfpc [-V|--verbose] -i interface [--ip default ip address] \n "; push @{ $rsp->{data} }, " configfpc [-h|--help|-?] \n"; xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); return 0; @@ -129,7 +129,8 @@ sub configfpc_usage { # ########################################################################### # This routine will look for NeXtWcale Fan Power Controllers (FPC) that have -# a default IP address of 192.169.0.100 +# a default IP address of 192.168.0.100 +# It will take in a different default IP address, if you input --ip # # For each FPC found the code will # 1 - ping the default IP address to get the default IP and MAC in the arp table @@ -155,18 +156,40 @@ sub configfpc { my $ipmiuser = 'USERID'; my $ipmipass = 'PASSW0RD'; my $fpcip = '192.168.0.100'; + if ($::opt_IP) { # override with --ip input + $fpcip = $::opt_IP; + } + # Build route, if defaultip is 192.168.0.100, then route is 192.168.0.101/16 + my ($a1,$a2,$a3,$a4)=split(/\./, $fpcip); + my $a4="101"; + my $a5="\/16"; + my $route=join(".", $a1, $a2, $a3,$a4); + my $route = $route . $a5; + + + if($::VERBOSE){ + my $rsp; + push @{ $rsp->{data} }, "Default IP address is $fpcip \n"; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + } + if($::VERBOSE){ + my $rsp; + push @{ $rsp->{data} }, "Default route address is $route \n"; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + } my $defnode = 'deffpc'; # This is the default FPC IP that we are looking for my $foundfpc = 0; - # Setup routing to 182.168.0.100 network + # Setup routing to on the network:w if($::VERBOSE){ my $rsp; - push@{ $rsp->{data} }, "Adding route definition for 192.168.0.101/16 to $::interface interface"; + push@{ $rsp->{data} }, "Running ip addr add dev $::interface $route"; xCAT::MsgUtils->message( "I", $rsp, $callback ); } - my $setroute = `ip addr add dev $::interface 192.168.0.101/16`; + + my $setroute = `ip addr add dev $::interface $route`; # # check for an FPC - this ping will also add the FPC IP and MAC to the ARP table @@ -271,15 +294,14 @@ sub configfpc { # # Cleanup on the way out - Delete route and remove the deffpc node definition # - # Delete routing to 182.168.0.100 network + # Delete routing to from the network if($::VERBOSE){ my $rsp; - push@{ $rsp->{data} }, "Deleting route definition for 192.168.0.101/16 on interface $::interface"; + push@{ $rsp->{data} }, "Running ip addr del dev $::interface $route"; xCAT::MsgUtils->message( "I", $rsp, $callback ); } - my $setroute = `ip addr del dev $::interface 192.168.0.101/16`; + my $setroute = `ip addr del dev $::interface $route`; - # Delete routing to 182.168.0.100 network if($::VERBOSE){ my $rsp; push@{ $rsp->{data} }, "Removing default FPC node definition $defnode"; @@ -427,7 +449,11 @@ sub set_FPC_network_parms { sub get_node { my $callback = shift; - my $fpcip = '192.168.0.100'; + my $fpcip = '192.168.0.100'; # default if not entered on CLI + if ($::opt_IP) { # override with --ip input + $fpcip = $::opt_IP; + } + # get the FPC from the arp table my $arpout = `arp -a | grep $fpcip`; @@ -478,7 +504,7 @@ sub add_node { if($::VERBOSE){ my $rsp; - push@{ $rsp->{data} }, "Creating default FPC node deffpc with IP 192.168.0.100 for later use with rspconfig"; + push@{ $rsp->{data} }, "Creating default FPC node deffpc with IP $fpcip for later use with rspconfig"; xCAT::MsgUtils->message( "I", $rsp, $callback ); } From dd636f81085c4a4a202455f86a1b9a38362bb507 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Fri, 10 Oct 2014 03:14:52 -0700 Subject: [PATCH 60/80] support firmware update for p8LE --- xCAT-genesis-scripts/bin/pseries_platform | 29 ++ xCAT-genesis-scripts/bin/update_flash | 457 ++++++++++++++++++++++ xCAT-genesis-scripts/bin/update_flash_nv | 416 ++++++++++++++++++++ 3 files changed, 902 insertions(+) create mode 100755 xCAT-genesis-scripts/bin/pseries_platform create mode 100755 xCAT-genesis-scripts/bin/update_flash create mode 100755 xCAT-genesis-scripts/bin/update_flash_nv diff --git a/xCAT-genesis-scripts/bin/pseries_platform b/xCAT-genesis-scripts/bin/pseries_platform new file mode 100755 index 000000000..39d0ccfa9 --- /dev/null +++ b/xCAT-genesis-scripts/bin/pseries_platform @@ -0,0 +1,29 @@ +#!/bin/sh + +SOURCE_FILE="pseries_platform" +PLATFORM_FILE=/proc/cpuinfo +export PLATFORM_UNKNOWN=0 +export PLATFORM_POWERKVM_HOST=1 +export PLATFORM_POWERKVM_GUEST=2 +export PLATFORM_PSERIES_LPAR=3 + +export platform_name="Unknown" +export platform=$PLATFORM_UNKNOWN + +if grep -q "PowerNV" $PLATFORM_FILE; then + platform_name="PowerKVM Host" + platform=$PLATFORM_POWERKVM_HOST +elif grep -q "IBM pSeries (emulated by qemu)" $PLATFORM_FILE; then + platform_name="PowerKVM pSeries Guest" + platform=$PLATFORM_POWERKVM_GUEST +elif grep -q "pSeries" $PLATFORM_FILE; then + platform_name="PowerVM pSeries LPAR" + platform=$PLATFORM_PSERIES_LPAR +fi +PARAM=$0 +BASENAME=`basename $0` +echo "basename:$BASENAME, param:$PARAM" + +if [ $SOURCE_FILE = `basename $0` ]; then + echo $platform_name +fi diff --git a/xCAT-genesis-scripts/bin/update_flash b/xCAT-genesis-scripts/bin/update_flash new file mode 100755 index 000000000..5f3b2e5a6 --- /dev/null +++ b/xCAT-genesis-scripts/bin/update_flash @@ -0,0 +1,457 @@ +#!/bin/sh +# Copyright (c) 2003, 2004, 2008 International Business Machines +# Common Public License Version 1.0 (see COPYRIGHT) +# +# Authors: John Rose +# Mike Strosaker + +# Simple script to update flash. The kernel module rtas_flash does +# the real work at reboot time. +# This script has minimal dependencies so it can operate in a rescue +# environment. This is probably overkill since it is easy enough to +# flash without this script. + +#set -x + +# For now firmware can only handle 4k pages. At some point in the +# future they will be able to handle large pages. When that (hopefully) +# happens we will need to use getconf to retrieve the systems page size. +PAGE_SIZE=4096 + +# Error Codes +E_SUCCESS=0 # Success +E_UNSUPPORTED=1 # Flash update is not supported on this system +E_USAGE=3 # Usage error +E_PERM=4 # Permission error +E_IMAGE=5 # Image file error +E_PROC_FS=6 # Proc file either doesn't exist, or behaves unexpectedly +E_MODULE=7 # Error loading module +E_RTAS=8 # RTAS call failed +E_USER=9 # User aborted operation +E_OVERWRITE=10 # Auto overwrite permanent side image +E_WRNTY=15 # Update Access Key Expired + +# Script Constants +PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH +PROCFLASH=/proc/ppc64/rtas/firmware_update +PROCMANAGE=/proc/ppc64/rtas/manage_flash +PROCVALIDATE=/proc/ppc64/rtas/validate_flash +OLDPROCFLASH=/proc/ppc64/rtas/firmware_flash +PSERIES_PLATFORM=$(dirname $0)/pseries_platform + +# firmware_update Status Values +FLASH_AUTH=-9002 # RTAS Not Service Authority Partition +FLASH_NO_OP=-1099 # No operation initiated by user +FLASH_IMG_SHORT=-1005 # Flash image shorter than expected +FLASH_IMG_BAD_LEN=-1004 # Bad length value in flash list block +FLASH_IMG_NULL_DATA=-1003 # Bad data value in flash list block +FLASH_IMG_READY=0 # Firmware img ready for flash on reboot + +# manage_flash Status Values +MANAGE_AUTH=-9002 # RTAS Not Service Authority Partition +MANAGE_ACTIVE_ERR=-9001 # RTAS Cannot Overwrite Active Img +MANAGE_NO_OP=-1099 # No operation initiated by user +MANAGE_PARAM_ERR=-3 # RTAS Parameter Error +MANAGE_HW_ERR=-1 # RTAS Hardware Error +MANAGE_SUCCESS=0 # Operation Successful + +# validate_flash Status Values +VALIDATE_AUTH=-9002 # RTAS Not Service Authority Partition +VALIDATE_INCOMPLETE=-1002 # User copied < VALIDATE_BUF_SIZE +VALIDATE_READY=-1001 # Firmware image ready for validation +VALIDATE_PARAM_ERR=-3 # RTAS Parameter Error +VALIDATE_HW_ERR=-1 # RTAS Hardware Error +VALIDATE_TMP_UPDATE=0 # RPA Section 7.3, Table 63 +VALIDATE_FLASH_AUTH=1 # RPA Section 7.3, Table 63 +VALIDATE_INVALID_IMG=2 # RPA Section 7.3, Table 63 +VALIDATE_CUR_UNKNOWN=3 # RPA Section 7.3, Table 63 +VALIDATE_TMP_COMMIT_DL=4 # RPA Section 7.3, Table 63 +VALIDATE_TMP_COMMIT=5 # RPA Section 7.3, Table 63 +VALIDATE_TMP_UPDATE_DL=6 # RPA Section 7.3, Table 63 +VALIDATE_OUT_OF_WRNTY=7 # RPA Section 7.3, Table 63 + +error() { + local exit_code=$1 + + if [ $# -lt 1 ]; then + echo "error(): usage" >&2 + return $E_USAGE + fi + + shift; + echo update_flash: $* >&2 + exit $exit_code +} + +usage() { + local exit_code; + + if [ "$1" == $E_SUCCESS ]; then + exit_code=$E_SUCCESS + else + exit_code=$E_USAGE + fi + + echo "USAGE: update_flash {-h | -s | -r | -c | [-v|-n] -f }" >&2 + echo " -h Print this message." >&2 + echo " -s Determine if partition has access to" >&2 + echo " perform flash image management." >&2 + echo " -r Reject temporary image." >&2 + echo " -c Commit temporary image." >&2 + echo " -v Validate ONLY with given image file." >&2 + echo " -n Do not overwrite Permanent side" >&2 + echo " image automatically." >&2 + echo " -f Update with given image file. If possible," >&2 + echo " the image is automatically validated prior" >&2 + echo " to update." >&2 + echo "" >&2 + exit $exit_code +} + +query_support() { + local exit_status=$E_UNSUPPORTED + + if [ ! -r "$PROCVALIDATE" ]; then + modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module" + fi + + if [ -e "/proc/device-tree/rtas/ibm,manage-flash-image" ]; then + grep \\"$VALIDATE_AUTH" "$PROCVALIDATE" > /dev/null + if [ $? -ne 0 ]; then + # validate-flash did not return "not authorized" + head --bytes=4k /dev/zero > $PROCVALIDATE 2>/dev/null + grep 1 "$PROCVALIDATE" > /dev/null + if [ $? -ne 0 ]; then + # validate-flash did not return "not authorized" + exit_status=0 + fi + fi + else + if [ -e "/proc/device-tree/rtas/ibm,update-flash-64-and-reboot" ] || [ -e "/proc/device-tree/rtas/udpate-flash-and-reboot" ]; then + exit_status=0 + fi + fi + + if [ $exit_status -ne 0 ]; then + echo update_flash: flash image cannot be managed from this partition + else + echo update_flash: flash image management is supported + fi + + exit $exit_status; +} + +echo_validate_rtas_buf() { + local output="$1" + local cur_t_name=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $2 } ') + local cur_p_name=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $3 } ') + local new_t_name=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $2 } ') + local new_p_name=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $3 } ') + + echo "Projected Flash Update Results:" + echo "Current T Image: $cur_t_name" + echo "Current P Image: $cur_p_name" + echo "New T Image: $new_t_name" + echo "New P Image: $new_p_name" +} + +echo_entitlement_expiry_date() { + local build_date=`cat $PROCVALIDATE | grep "^MG" | tail -n 1 | cut -d " " -f2` + local entl_date=`cat $PROCVALIDATE | grep "^ME" | cut -d " " -f2` + + echo "The selected firmware image cannot be applied." + echo "" + echo -n "The Build Date of the firmware image selected is " + if [ "$build_date" != "" ]; then + echo "$(date --date=$build_date +"%B %d, %Y")." + else + echo "UNKNOWN." + fi + + echo -n "The System's Update Access Key Expiration Date is " + if [ "$entl_date" != "" ]; then + echo "$(date --date=$entl_date +"%B %d, %Y")." + else + echo "UNKNOWN." + fi + echo "" + echo "Please go to http://www.ibm.com/servers/eserver/ess to obtain " + echo "a replacement update access key." +} + +echo_validate_return_status() { + local output="$1" + local rc=$(echo "$output" | head -n 1) + local rtas_buf=$(echo "$output" | tail -n +2) + + [ $# -eq 1 ] || error $E_USAGE "echo_validate_return_status(): usage" + + case "$rc" in + $VALIDATE_PARAM_ERR) + error $E_RTAS "RTAS: validate() Parameter Error";; + $VALIDATE_HW_ERR) + error $E_RTAS "RTAS: validate() Hardware Error";; + $VALIDATE_FLASH_AUTH) + error $E_RTAS "RTAS: validate() Partition does not have authority";; + $VALIDATE_AUTH) + error $E_RTAS "RTAS: validate() Partition does not have authority";; + $VALIDATE_INVALID_IMG) + error $E_RTAS "RTAS: validate() Invalid candidate image for this platform";; + $VALIDATE_TMP_UPDATE) + echo "info: Temporary side will be updated with a newer or" + echo "identical image";; + $VALIDATE_CUR_UNKNOWN) + echo "info: Current fixpack level is unknown";; + $VALIDATE_TMP_COMMIT_DL) + echo "info: Current Temporary image will be committed to" + echo "Permanent side before being replaced with new image, and" + echo "the new image is downlevel from current image";; + $VALIDATE_TMP_COMMIT) + echo "info: Current Temporary side will be committed to" + echo "Permanent side before being replaced with the new image";; + $VALIDATE_TMP_UPDATE_DL) + echo "info: Temporary side will be updated with a downlevel" + echo "image";; + $VALIDATE_OUT_OF_WRNTY) + echo_entitlement_expiry_date + error $E_WRNTY "Please contact your service support structure.";; + *) error $E_RTAS "RTAS: Unknown validate-flash-image Return Status" + esac + + echo + echo_validate_rtas_buf "$rtas_buf" + + # Do not commit T side image to P side + if [ $no_overwrite_opt -eq 1 ]; then + if [ $rc -eq $VALIDATE_TMP_COMMIT_DL ] || [ $rc -eq $VALIDATE_TMP_COMMIT ]; then + echo "" + echo "update_flash: Run without -n option to flash new image" + exit $E_OVERWRITE + fi + fi +} + +validate_flash() { + local img_file=$1 + local output="" + + [ $# -eq 1 ] || error $E_USAGE "validate_flash(): usage" + + [ -r $PROCVALIDATE ] || return $E_PROC_FS + + grep \\"$VALIDATE_AUTH" "$PROCVALIDATE" > /dev/null + if [ $? -eq 0 ]; then # validate-flash returned "not authorized" + return $E_RTAS + fi + + # Copy image file to proc file + cp "$img_file" "$PROCVALIDATE" || error $E_PROC_FS "error copying flash image to rtas_flash validate module" + + # Display appropriate message, exiting if necessary + output="$(cat $PROCVALIDATE)" + echo_validate_return_status "$output" + + return 0 +} + +validate_flash_from_file() { + local img_file=$1 + + [ $# -eq 1 ] || error $E_USAGE "validate_flash_from_file(): usage" + + if [ ! -r "$PROCVALIDATE" ]; then + modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module" + [ -r "$PROCVALIDATE" ] || error $E_PROC_FS "rtas_flash kernel module did not create $PROCVALIDATE" + fi + + if validate_flash $img_file; then + return 0; + else + case "$?" in + $E_PROC_FS) error $E_PROC_FS "validate: $PROCVALIDATE does not exist";; + $E_RTAS) error $E_RTAS "validate: firmware validation not supported on this system";; + esac + fi +} + +echo_update_status() { + local rc="$1" + + [ $# -eq 1 ] || error $E_USAGE "echo_update_status(): usage" + + case "$rc" in + $FLASH_AUTH) + error $E_RTAS "RTAS: Partition does not have authority";; + $FLASH_IMG_SHORT) + error $E_IMAGE "Flash image shorter than expected";; + $FLASH_IMG_BAD_LEN) + error $E_PROC_FS "Bad length value in flash list block";; + $FLASH_IMG_NULL_DATA) + error $E_PROC_FS "Bad data value in flash list block";; + $FLASH_IMG_READY) + echo "Flash image ready...rebooting the system...";; + *) error $E_PROC_FS "RTAS: Unknown update flash status" + esac +} + +update_flash_from_file() { + local img_file=$1 + local output="" + local oldkernel=0 + + [ $# -eq 1 ] || error $E_USAGE "update_flash_from_file(): usage" + + [ -r "$img_file" ] || error $E_IMAGE "cannot read $img_file" + + flashfile=$PROCFLASH + if [ ! -r "$PROCFLASH" ]; then + modprobe rtas_flash + if [ ! -r "$PROCFLASH" ]; then + if [ -r "$OLDPROCFLASH" ]; then + oldkernel=1 + else + error $E_PROC_FS "rtas_flash kernel module did not create $PROCFLASH" + fi + fi + fi + + if [ -r "$PROCVALIDATE" ]; then + validate_flash "$img_file" + fi + + if [ $oldkernel -eq 0 ]; then + dd if="$img_file" of="$PROCFLASH" bs=$PAGE_SIZE 2>/dev/null || error $E_PROC_FS "error copying flash image to rtas_flash kernel module" + + output="$(cat $PROCFLASH)" + echo_update_status "$output" + else + dd if="$img_file" of="$OLDPROCFLASH" bs=PAGE_SIZE 2>/dev/null || error $E_PROC_FS "error copying flash image to rtas_flash kernel module" + cat "$OLDPROCFLASH" + fi + + #XXX + reboot + + return 0; +} + +echo_manage_return_status() { + local is_commit=$1 + local output=$2 + local rc=$(echo $output) + + [ $# -eq 2 ] || error $E_USAGE "echo_manage_return_status(): usage" + + case "$rc" in + $MANAGE_AUTH) + error $E_RTAS "RTAS: manage() Partition does not have authority";; + $MANAGE_ACTIVE_ERR) + error $E_RTAS "RTAS: manage() Cannot Overwrite the Active Firmware Image";; + $MANAGE_PARAM_ERR) + error $E_RTAS "RTAS: manage() Parameter Error";; + $MANAGE_HW_ERR) + error $E_RTAS "RTAS: manage() Hardware Error";; + $MANAGE_SUCCESS) + if [ $is_commit -eq 0 ]; then + echo "success: Rejected temporary firmware image" + else + echo "success: Committed temporary firmware image" + fi + ;; + *) error $E_RTAS "Unknown manage-flash-image Return Status" + esac +} + +manage_flash() { + local is_commit=$1 + local commit_str="1" + local reject_str="0" + local output="" + + [ $# -eq 1 ] || error $E_USAGE "manage_flash(): usage" + + if [ ! -r "$PROCMANAGE" ]; then + modprobe rtas_flash || error $E_MODULE "could not load rtas_flash kernel module" + [ -r "$PROCMANAGE" ] || error $E_PROC_FS "rtas_flash kernel module did not create $PROCMANAGE" + fi + + if [ $is_commit -eq 1 ]; then + echo $commit_str > $PROCMANAGE + else + echo $reject_str > $PROCMANAGE + fi + + output=$(cat $PROCMANAGE) + + echo_manage_return_status $is_commit "$output" + + if echo $output | grep "^success" > /dev/null; then + return 0 + else + return $E_RTAS + fi +} + +file="" +check_opt=0 +commit_opt=0 +reject_opt=0 +validate_opt=0 +no_overwrite_opt=0 +file_opt=0 + +[ -d /proc/device-tree ] || error $E_PROC_FS "iSeries or /proc not mounted" +#XXX +#[ "`whoami`" = "root" ] || error $E_PERM "must be root to execute this command" + +# Check for platform and if PowerNV call update_flash_nv + +# PowerNV update_flash tool +UPDATE_FLASH_NV=$(dirname $0)/update_flash_nv + +. $PSERIES_PLATFORM +case "$platform" in + $PLATFORM_UNKNOWN | $PLATFORM_POWERKVM_GUEST) + echo "update_flash: is not supported on the $platform_name platform" + exit 1;; + $PLATFORM_POWERKVM_HOST) + if [ ! -r "$UPDATE_FLASH_NV" ]; then + error $E_PERM "Couldn't find $UPDATE_FLASH_NV file." + fi + /bin/sh $UPDATE_FLASH_NV $@ + exit $? +esac + +while [ -n "$1" ]; do + arg="$1" + shift + case "$arg" in + -q|-l|-D|-S) error $E_USAGE "the $arg option is not implemented";; + -h) usage $E_SUCCESS;; + -s) check_opt=1;; + -c) commit_opt=1;; + -r) reject_opt=1;; + -v) validate_opt=1;; + -n) no_overwrite_opt=1;; + -f) file_opt=1; file="$1"; shift;; + *) error $E_USAGE "unknown option $arg" + esac +done + +if [ -n "$file" ]; then + if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ] || + [ $check_opt -eq 1 ]; then + usage + elif [ $validate_opt -eq 1 ] && [ $no_overwrite_opt -eq 1 ]; then + usage + elif [ $validate_opt -eq 1 ]; then + validate_flash_from_file $file + else + update_flash_from_file $file + fi +else + [ $check_opt -eq 1 ] && query_support + [ $commit_opt -eq 0 ] && [ $reject_opt -eq 0 ] && usage + [ $commit_opt -eq 1 ] && [ $reject_opt -eq 1 ] && usage + manage_flash $commit_opt +fi diff --git a/xCAT-genesis-scripts/bin/update_flash_nv b/xCAT-genesis-scripts/bin/update_flash_nv new file mode 100755 index 000000000..4bd03a806 --- /dev/null +++ b/xCAT-genesis-scripts/bin/update_flash_nv @@ -0,0 +1,416 @@ +#!/bin/sh +# Copyright (c) 2013 International Business Machines +# Common Public License Version 1.0 (see COPYRIGHT) +# +# Authors: Vasant Hegde +# +# Simple script for code update on "KVM on Power" machines. This +# is a simple wrapper script to pass the image. The Linux kernel +# and FW does the real work during system reboot. +# +# This script has minimal dependencies so it can operate in a +# rescue environment. + +#set -x + +# Error codes +E_SUCCESS=0 # Success +E_UNSUPPORTED=1 # Firmware update is not supported +E_USAGE=3 # Usage error +E_PERM=4 # Permission error +E_IMAGE=5 # Image file error +E_SYS_FS=6 # Firmware update related sysfs file doesn't exist +E_MODULE=7 # Error loading module +E_OPAL=8 # OPAL call failed +E_USER=9 # User aborted operation +E_OVERWRITE=10 # Auto overwrite permanent side image +E_WRNTY=15 # Update Access Key Expired + +# Firmware update related files +SYS_IMAGE_FILE=/sys/firmware/opal/image +SYS_VALIDATE_FLASH=/sys/firmware/opal/validate_flash +SYS_MANAGE_FLASH=/sys/firmware/opal/manage_flash +SYS_UPDATE_FLASH=/sys/firmware/opal/update_flash + +# Code update status values +FLASH_SUCCESS=0 # Success +FLASH_PARAM_ERR=-1 # Parameter error +FLASH_BUSY=-2 # OPAL busy +FLASH_HW_ERR=-6 # Hardware error +FLASH_INTERNAL_ERR=-11 # Internal error +FLASH_NO_OP=-1099 # No operation initiated by user +FLASH_NO_AUTH=-9002 # Inband firmware update is not allowed + +# Validate image status values +FLASH_IMG_READY=-1001 # Image ready for validation +FLASH_IMG_INCOMPLETE=-1002 # User copied < VALIDATE_BUF_SIZE + +# Manage image status values +FLASH_ACTIVE_ERR=-9001 # Cannot overwrite active img + +# Flash image status values +FLASH_IMG_READY=0 # Image ready for flash on reboot +FLASH_INVALID_IMG=-1003 # Flash image shorter than expected +FLASH_IMG_NULL_DATA=-1004 # Bad data +FLASH_IMG_BAD_LEN=-1005 # Bad length + +# Validate image update result tokens +# +# T side will be updated +VALIDATE_TMP_UPDATE=0 +# +# Partition does not have authority +VALIDATE_FLASH_AUTH=1 +# +# Candidate image is not valid for this platform +VALIDATE_INVALID_IMG=2 +# +# Current fixpack level is unknown +VALIDATE_CUR_UNKNOWN=3 +# +# Current T side will be committed to P side before being replace +# with new image, and the new image is downlevel from current image +VALIDATE_TMP_COMMIT_DL=4 +# +# Current T side will be committed to P side before being replaced +# with new image +VALIDATE_TMP_COMMIT=5 +# +# T side will be updated with a downlevel image +VALIDATE_TMP_UPDATE_DL=6 +# +# The candidate image's release date is later than the system's Update +# Access Key Expiration date - service warranty period has expired +VALIDATE_OUT_OF_WRNTY=7 + +error() { + local exit_code=$1 + + if [ $# -lt 1 ]; then + echo "error(): usage." >&2 + return $E_USAGE + fi + + shift; + echo update_flash: $* >&2 + exit $exit_code +} + +usage() { + local exit_code; + + if [ "$1" == $E_SUCCESS ]; then + exit_code=$E_SUCCESS + else + exit_code=$E_USAGE + fi + + echo "USAGE: update_flash {-h | -s | -r | -c | [-v|-n] -f }" >&2 + echo " -h Print this message." >&2 + echo " -s Determine if partition has access to" >&2 + echo " perform flash image management." >&2 + echo " -r Reject temporary image." >&2 + echo " -c Commit temporary image." >&2 + echo " -v Validate the given image file." >&2 + echo " -n Do not overwrite Permanent side" >&2 + echo " image automatically." >&2 + echo " -f Update with given image file. If possible," >&2 + echo " the image is automatically validated prior" >&2 + echo " to update." >&2 + echo "" >&2 + exit $exit_code +} + +# Validate sysfs interface +validate_sysfs_file() { + local file="$1" + if [ -r "$file" ]; then + return $E_SUCCESS + fi + + error $E_SYS_FS "sysfs interface for firmware update does not exists." +} + +# Copy image to sysfs file +copy_candidate_image() { + local img_file=$1 + + [ $# -eq 1 ] || error $E_USAGE "copy_candidate_image(): usage." + + [ -r "$img_file" ] || error $E_IMAGE "Cannot read ${img_file}." + + # Copy candidate image + dd if=$img_file of=$SYS_IMAGE_FILE 2>/dev/null + if [ $? -ne 0 ]; then + echo "update_flash: Error copying firmware image." + error $E_IMAGE "Please retry with valid firmware image." + fi +} + +echo_opal_return_status() { + case "$1" in + $FLASH_PARAM_ERR) + error $E_OPAL "Parameter Error.";; + $FLASH_BUSY) + error $E_OPAL "OPAL Busy.";; + $FLASH_HW_ERR) + error $E_OPAL "Hardware error.";; + $FLASH_INTERNAL_ERR) + error $E_OPAL "OPAL internal error.";; + $FLASH_NO_AUTH) + error $E_PERM "System does not have authority to perform firmware update.";; + $FLASH_IMG_INCOMPLETE) + error $E_IMAGE "Invalid candidate image.";; + $FLASH_ACTIVE_ERR) + error $E_OVERWRITE "Cannot Overwrite the Active Firmware Image.";; + $FLASH_INVALID_IMG) + error $E_IMAGE "Invalid candidate image.";; + $FLASH_IMG_NULL_DATA) + error $E_IMAGE "Bad data value in flash list block.";; + $FLASH_IMG_BAD_LEN) + error $E_IMAGE "Bad length value in flash list block.";; + *) error $E_OPAL "Unknown return status.";; + esac +} + +# Determine if partition has access to perform flash image management +query_flash_support() { + # Validate sysfs interface + validate_sysfs_file $SYS_IMAGE_FILE + + # By default KVM on Power host is allowed to do firmware management + echo "update_flash: Firmware image management is supported." + + exit $E_SUCCESS +} + +echo_validate_buf() { + local output="$1" + local cur_t=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $2 } ') + local cur_p=$(echo "$output" | grep "^MI" | head -n 1 | awk ' { print $3 } ') + local new_t=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $2 } ') + local new_p=$(echo "$output" | grep "^MI" | tail -n 1 | awk ' { print $3 } ') + + echo "Projected Flash Update Results:" + echo "Current T Image: $cur_t" + echo "Current P Image: $cur_p" + echo "New T Image: $new_t" + echo "New P Image: $new_p" +} + +echo_validate_return_status() { + local output="$1" + local rc=$(echo "$output" | head -n 1) + local opal_buf=$(echo "$output" | tail -n +2) + + [ $# -eq 1 ] || error $E_USAGE "echo_validate_return_status(): usage." + + if [ $rc -lt 0 ]; then + echo_opal_return_status $rc + fi + + # Validation result + case "$rc" in + $VALIDATE_TMP_UPDATE) + echo -n "info: Temporary side will be updated with a newer or" + echo " identical image.";; + $VALIDATE_FLASH_AUTH) + error $E_OPAL "System does not have authority.";; + $VALIDATE_INVALID_IMG) + error $E_OPAL "Invalid candidate image for this platform.";; + $VALIDATE_CUR_UNKNOWN) + echo "info: Current fixpack level is unknown.";; + $VALIDATE_TMP_COMMIT_DL) + echo "info: Current Temporary image will be committed to" + echo "Permanent side before being replaced with new image," + echo "and the new image is downlevel from current image.";; + $VALIDATE_TMP_COMMIT) + echo "info: Current Temporary side will be committed to" + echo "Permanent side before being replaced with the new" + echo "image.";; + $VALIDATE_TMP_UPDATE_DL) + echo "info: Temporary side will be updated with a downlevel image.";; + *) error $E_OPAL "Unknown return status." + esac + + echo + echo_validate_buf "$opal_buf" + + # Do not commit T side image to P side + if [ $no_overwrite_opt -eq 1 ]; then + if [ $rc -eq $VALIDATE_TMP_COMMIT_DL ] || + [ $rc -eq $VALIDATE_TMP_COMMIT ]; then + echo "" + echo "update_flash: Run without -n option to flash new image." + exit $E_OVERWRITE + fi + fi +} + +validate_flash() { + local output="" + + # Validate candidate image + echo 1 > $SYS_VALIDATE_FLASH 2>/dev/null + + # Display appropriate message, exiting if necessary + output="$(cat $SYS_VALIDATE_FLASH)" + echo_validate_return_status "$output" +} + +validate_flash_from_file() { + local img_file=$1 + + [ $# -eq 1 ] || error $E_USAGE "validate_flash_from_file(): usage." + + # Validate sysfs interface + validate_sysfs_file $SYS_VALIDATE_FLASH + + # Copy candiadate image + copy_candidate_image $img_file + + # Validate candidate image + validate_flash + + exit $E_SUCCESS +} + +echo_update_return_status() { + local rc="$1" + + [ $# -eq 1 ] || error $E_USAGE "echo_update_return_status(): usage." + + if [ $rc -lt 0 ]; then + echo_opal_return_status $rc + elif [ $rc -eq $FLASH_IMG_READY ]; then + echo + echo "FLASH: Image ready...rebooting the system..." + echo "FLASH: This will take several minutes." + echo "FLASH: Do not power off!" + else + error $E_SYS_FS "Unknown return status." + fi +} + +update_flash_from_file() { + local img_file=$1 + local output="" + + [ $# -eq 1 ] || error $E_USAGE "update_flash_from_file(): usage." + + # Validate sysfs interface + validate_sysfs_file $SYS_UPDATE_FLASH + + # Copy candidate image + copy_candidate_image $img_file + + # Validate candidate image + validate_flash + + # Update image + echo 1 > $SYS_UPDATE_FLASH 2>/dev/null + output="$(cat $SYS_UPDATE_FLASH)" + echo_update_return_status "$output" + + # Reboot system, so that we can flash new image + reboot -f + + exit $E_SUCCESS +} + +echo_manage_return_status() { + local is_commit=$1 + local output=$2 + local rc=$(echo $output) + + [ $# -eq 2 ] || error $E_USAGE "echo_manage_return_status(): usage." + + if [ $rc -lt 0 ]; then + echo_opal_return_status $rc + elif [ $rc -eq $FLASH_SUCCESS ]; then + if [ $is_commit -eq 0 ]; then + echo "Success: Rejected temporary firmware image." + else + echo "Success: Committed temporary firmware image." + fi + else + error $E_OPAL "Unknown return status." + fi +} + +manage_flash() { + local is_commit=$1 + local commit_str="1" + local reject_str="0" + local output="" + + [ $# -eq 1 ] || error $E_USAGE "manage_flash(): usage." + + # Validate sysfs interface + validate_sysfs_file $SYS_MANAGE_FLASH + + # Commit operation + if [ $is_commit -eq 1 ]; then + echo $commit_str > $SYS_MANAGE_FLASH + else + echo $reject_str > $SYS_MANAGE_FLASH + fi + + # Result + output=$(cat $SYS_MANAGE_FLASH) + echo_manage_return_status $is_commit "$output" + + exit $E_SUCCESS +} + +file="" +check_opt=0 +commit_opt=0 +reject_opt=0 +validate_opt=0 +no_overwrite_opt=0 +file_opt=0 + +# Only root user can perform firmware update +[ "`whoami`" == "root" ] || error $E_PERM "Must be root to execute this command." + +# Parse command line options +while [ -n "$1" ]; do + arg="$1" + shift + case "$arg" in + -q|-l|-D|-S) error $E_USAGE "The $arg option is not implemented.";; + -h) usage $E_SUCCESS;; + -s) check_opt=1;; + -c) commit_opt=1;; + -r) reject_opt=1;; + -v) validate_opt=1;; + -n) no_overwrite_opt=1;; + -f) file_opt=1; file="$1"; shift;; + *) error $E_USAGE "Unknown option ${arg}." + esac +done + +if [ -n "$file" ]; then + if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ] || + [ $check_opt -eq 1 ]; then + usage + elif [ $validate_opt -eq 1 ] && [ $no_overwrite_opt -eq 1 ]; then + usage + elif [ $validate_opt -eq 1 ]; then + validate_flash_from_file $file + else + update_flash_from_file $file + fi +else + if [ $check_opt -eq 1 ]; then + if [ $commit_opt -eq 1 ] || [ $reject_opt -eq 1 ]; then + usage + else + query_flash_support + fi + fi + [ $commit_opt -eq 0 ] && [ $reject_opt -eq 0 ] && usage + [ $commit_opt -eq 1 ] && [ $reject_opt -eq 1 ] && usage + manage_flash $commit_opt +fi From 8ff7a04ee39685c98375274975dc42512a5171fc Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 10 Oct 2014 06:38:27 -0400 Subject: [PATCH 61/80] defect 4285 --- xCAT-client/pods/man1/configfpc.1.pod | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/xCAT-client/pods/man1/configfpc.1.pod b/xCAT-client/pods/man1/configfpc.1.pod index 390cbc978..4ece1d8ed 100644 --- a/xCAT-client/pods/man1/configfpc.1.pod +++ b/xCAT-client/pods/man1/configfpc.1.pod @@ -6,13 +6,15 @@ B - discover the Fan Power Controllers (FPCs) and configure the FPC i B B<-i> I +B B<-i> I B<--ip> I + B [B<-V>|B<--verbose>] B [B<-h>|B<--help>|B<-?>] =head1 DESCRIPTION -B will discover and configure all FPCs that are set to the default IP address. +B will discover and configure all FPCs that are set to the default IP address. If not supplied the default ip is 192.168.0.100. The B<-i> B is required to direct B to the xCAT MN interface which is on the same VLAN as the FPCs. @@ -24,7 +26,7 @@ The B command discovers the FPCs and collects the MAC address. The MA This process is repeated until no more FPCs are discovered. -For more information on xCAT support of NeXtScale and configfpc see: +For more information on xCAT support of NeXtScale and configfpc see the following doc: XCAT_NeXtScale_Clusters =head1 OPTIONS @@ -35,6 +37,10 @@ XCAT_NeXtScale_Clusters Use this flag to specify which xCAT MN interface (example: eth4) that is connected to the NeXtScale FPCs. This option is required. +=item B<--ip> I + +Use this flag to override the default ip address of 192.168.0.100 with a new address. + =item B<-V>|B<--verbose> Verbose mode @@ -51,5 +57,11 @@ To discover and configure all NeXtScale Fan Power Controllers (FPCs) connected o B B<-i> I +=item 2 + +To override the default ip address and run in Verbose mode. + +B B<-i> I B<--ip> I<196.68.0.100> B<-V> + =back From 037a8db48174cea018a4df4805f780a4c444707b Mon Sep 17 00:00:00 2001 From: baiyuan Date: Fri, 10 Oct 2014 06:47:03 -0400 Subject: [PATCH 62/80] fix prep pakage name in kit.conf for Ubuntu --- xCAT-buildkit/bin/buildkit | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index ae6bd3dbd..162b71ca4 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -2855,8 +2855,13 @@ sub create_kitconf $::kit_config->{$s}{entries}[$li]->{kitreponame} = $se->{kitreponame}; if ( !$::PREREQUISITE and ($se->{ospkgdeps} || $se->{preinstall} || $se->{preupgrade} || $se->{preuninstall}) ) { - $::kit_config->{$s}{entries}[$li]->{prerequisite} = + if ( $debianflag ){ + $::kit_config->{$s}{entries}[$li]->{prerequisite} = + "prep-" . $se->{basename}; + }else{ + $::kit_config->{$s}{entries}[$li]->{prerequisite} = "prep_" . $se->{basename}; + } } } $li++; From fdfa1fe290115bc37f9b20d0d5982cd377525fa5 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 10 Oct 2014 11:09:04 -0400 Subject: [PATCH 63/80] defect 4283: fix the syntax issues in the hosts.pm and NetworkUtils.pm for the code that support multiple domain and makehosts against nics table --- perl-xCAT/xCAT/NetworkUtils.pm | 17 +- xCAT-server/lib/xcat/plugins/hosts.pm | 560 +++++++++++++------------- 2 files changed, 293 insertions(+), 284 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index 92e278cfe..7d42970ba 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -69,14 +69,14 @@ This program module file, is a set of network utilities used by xCAT commands. #------------------------------------------------------------------------------- sub getNodeDomains() { - my $class = shift; + my $class = shift; my $nodes = shift; my @nodelist = @$nodes; my %nodedomains; # Get the network info for each node - my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist); + my %nethash = xCAT::DBobjUtils->getNetwkInfo(\@nodelist); # get the site domain value my @domains = xCAT::TableUtils->get_site_attribute("domain"); @@ -85,12 +85,13 @@ sub getNodeDomains() # for each node - set hash value to network domain or default # to site domain foreach my $node (@nodelist) { - if ($nethash{$node}{domain}) { - $nodedomains{$node} = $nethash{$node}{domain}; - } else { - $nodedomains{$node} = $sitedomain; - } - } + unless (defined($node)) {next;} + if (defined($nethash{$node}) && $nethash{$node}{domain}) { + $nodedomains{$node} = $nethash{$node}{domain}; + } else { + $nodedomains{$node} = $sitedomain; + } + } return \%nodedomains; } diff --git a/xCAT-server/lib/xcat/plugins/hosts.pm b/xCAT-server/lib/xcat/plugins/hosts.pm index abd762dc8..898e620ed 100755 --- a/xCAT-server/lib/xcat/plugins/hosts.pm +++ b/xCAT-server/lib/xcat/plugins/hosts.pm @@ -54,7 +54,7 @@ sub delnode sub addnode { - my $callback = shift; + my $callback = shift; my $node = shift; my $ip = shift; @@ -65,11 +65,11 @@ sub addnode my $othernames = shift; my $domain = shift; - my $nics = shift; + my $nics = shift; my $idx = 0; my $foundone = 0; - # if this ip was already added then just update the entry + # if this ip was already added then just update the entry while ($idx <= $#hosts) { @@ -82,22 +82,22 @@ sub addnode } else { - # we found a matching entry in the hosts list - if ($nics) { - # we're processing the nics table and we found an - # existing entry for this ip so just add this - # node name as an alias for the existing entry - my ($hip, $hnode, $hdom, $hother)= split(/ /, $hosts[$idx]); - - # at this point "othernames", if any is just a space - # delimited list - so just add the node name to the list - $othernames .= " $node"; - $hosts[$idx] = build_line($callback, $ip, $hnode, $domain, $othernames); - } else { - # otherwise just try to completely update the existing - # entry - $hosts[$idx] = build_line($callback, $ip, $node, $domain, $othernames); - } + # we found a matching entry in the hosts list + if ($nics) { + # we're processing the nics table and we found an + # existing entry for this ip so just add this + # ode name as an alias for the existing entry + my ($hip, $hnode, $hdom, $hother)= split(/ /, $hosts[$idx]); + + # at this point "othernames", if any is just a space + # elimited list - so just add the node name to the list + $othernames .= " $node"; + $hosts[$idx] = build_line($callback, $ip, $hnode, $domain, $othernames); + } else { + # otherwise just try to completely update the existing + # entry + $hosts[$idx] = build_line($callback, $ip, $node, $domain, $othernames); + } } $foundone = 1; } @@ -106,14 +106,14 @@ sub addnode if ($foundone) { return; } my $line = build_line($callback, $ip, $node, $domain, $othernames); - if ($line) { - push @hosts, $line; - } + if ($line) { + push @hosts, $line; + } } sub build_line { - my $callback = shift; + my $callback = shift; my $ip = shift; my $node = shift; my $domain = shift; @@ -121,13 +121,13 @@ sub build_line my @o_names = (); my @n_names = (); - # Trim spaces from the beginning and end from $othernames - $othernames =~ s/^\s+|\s+$//g; - if (defined $othernames) { - # the "hostnames" attribute can be a list delimited by - # either a comma or a space + # Trim spaces from the beginning and end from $othernames + $othernames =~ s/^\s+|\s+$//g; + + # the "hostnames" attribute can be a list delimited by + # either a comma or a space @o_names = split(/,| /, $othernames); } my $longname; @@ -153,26 +153,26 @@ sub build_line } unshift(@o_names, @n_names); - my $shortname=$node; + my $shortname=$node; if ($node =~ m/\.$domain$/i) { $longname = $node; - ($shortname = $node) =~ s/\.$domain$//; + ($shortname = $node) =~ s/\.$domain$//; } elsif ($domain && !$longname) { - $shortname = $node; + $shortname = $node; $longname = "$node.$domain"; } # if shortname contains a dot then we have a bad syntax for name - if ($shortname =~ /\./) { - my $rsp; - push @{$rsp->{data}}, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); - return undef; - } + if ($shortname =~ /\./) { + my $rsp; + push @{$rsp->{data}}, "Invalid short node name \'$shortname\'. The short node name may not contain a dot. The short node name is considered to be anything preceeding the network domain name in the fully qualified node name \'$longname\'.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return undef; + } $othernames = join(' ', @o_names); if ($LONGNAME) { return "$ip $longname $shortname $othernames\n"; } @@ -182,7 +182,7 @@ sub build_line sub addotherinterfaces { - my $callback = shift; + my $callback = shift; my $node = shift; my $otherinterfaces = shift; my $domain = shift; @@ -190,12 +190,12 @@ sub addotherinterfaces my @itf_pairs = split(/,/, $otherinterfaces); foreach (@itf_pairs) { - my ($itf, $ip); - if ($_ =~ /!/) { - ($itf, $ip) = split(/!/, $_); - } else { - ($itf, $ip) = split(/:/, $_); - } + my ($itf, $ip); + if ($_ =~ /!/) { + ($itf, $ip) = split(/!/, $_); + } else { + ($itf, $ip) = split(/:/, $_); + } if ($ip && xCAT::NetworkUtils->isIpaddr($ip)) { if ($itf =~ /^-/) @@ -216,12 +216,12 @@ sub delotherinterfaces my @itf_pairs = split(/,/, $otherinterfaces); foreach (@itf_pairs) { - my ($itf, $ip); - if ($_ =~ /!/) { - ($itf, $ip) = split(/!/, $_); - } else { - ($itf, $ip) = split(/:/, $_); - } + my ($itf, $ip); + if ($_ =~ /!/) { + ($itf, $ip) = split(/!/, $_); + } else { + ($itf, $ip) = split(/:/, $_); + } if ($ip && xCAT::NetworkUtils->isIpaddr($ip)) { if ($itf =~ /^-/) @@ -234,82 +234,80 @@ sub delotherinterfaces } sub add_hosts_content { - my %args = @_; - my $nodelist = $args{nodelist}; - my $callback = $args{callback}; - my $DELNODE = $args{delnode}; - my $domain = $args{domain}; - my $hoststab = xCAT::Table->new('hosts',-create=>0); - my $hostscache; - if ($hoststab) { - $hostscache = - $hoststab->getNodesAttribs($nodelist, - [qw(ip node hostnames otherinterfaces)]); - } - foreach (@{$nodelist}) + my %args = @_; + my $nodelist = $args{nodelist}; + my $callback = $args{callback}; + my $DELNODE = $args{delnode}; + my $domain = $args{domain}; + my $hoststab = xCAT::Table->new('hosts',-create=>0); + my $hostscache; + if ($hoststab) { + $hostscache = $hoststab->getNodesAttribs($nodelist, + [qw(ip node hostnames otherinterfaces)]); + } + foreach (@{$nodelist}) { + my $ref = $hostscache->{$_}->[0]; + my $nodename = $_; + my $ip = $ref->{ip}; + if (not $ip) { + $ip = xCAT::NetworkUtils->getipaddr($nodename); #attempt lookup + } + + my $netn; + ($domain, $netn) = &getIPdomain($ip, $callback); + if (!$domain) { + if ($::sitedomain) { + $domain=$::sitedomain; + } elsif ($::XCATSITEVALS{domain}) { + $domain=$::XCATSITEVALS{domain}; + } else { + my $rsp; + push @{$rsp->{data}}, "No domain can be determined for node \'$nodename\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; + + xCAT::MsgUtils->message("W", $rsp, $callback); + next; + } + } + + if ($DELNODE) + { + delnode $nodename, $ip, $ref->{hostnames}, $domain; + if (defined($ref->{otherinterfaces})) { - - my $ref = $hostscache->{$_}->[0]; - my $nodename = $_; - my $ip = $ref->{ip}; - if (not $ip) { - $ip = xCAT::NetworkUtils->getipaddr($nodename); #attempt lookup - } - - my $netn; - ($domain, $netn) = &getIPdomain($ip, $callback); - if (!$domain) { - if ($::sitedomain) { - $domain=$::sitedomain; - } elsif ($::XCATSITEVALS{domain}) { - $domain=$::XCATSITEVALS{domain}; - } else { - my $rsp; - push @{$rsp->{data}}, "No domain can be determined for node \'$nodename\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; - - xCAT::MsgUtils->message("W", $rsp, $callback); - next; - } - } - - if ($DELNODE) - { - delnode $nodename, $ip, $ref->{hostnames}, $domain; - if (defined($ref->{otherinterfaces})) - { - delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain; - } - } - else - { - if (xCAT::NetworkUtils->isIpaddr($ip)) - { - addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain; - } - else - { - my $rsp; + delotherinterfaces $nodename, $ref->{otherinterfaces}, $domain; + } + } + else + { + if (xCAT::NetworkUtils->isIpaddr($ip)) + { + addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain; + } + else + { + my $rsp; if (!$ip) { push @{$rsp->{data}}, "Ignoring node \'$nodename\', it can not be resolved."; } else { - push @{$rsp->{data}}, "Ignoring node \'$nodename\', its ip address \'$ip\' is not valid."; + push @{$rsp->{data}}, "Ignoring node \'$nodename\', its ip address \'$ip\' is not valid."; } - xCAT::MsgUtils->message("W", $rsp, $callback); - } + xCAT::MsgUtils->message("W", $rsp, $callback); + } + + if (defined($ref->{otherinterfaces})) + { + addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain; + } + } + } #end foreach + if ($args{hostsref}) { + @{$args{hostsref}} = @hosts; + } +} - if (defined($ref->{otherinterfaces})) - { - addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain; - } - } - } #end foreach - if ($args{hostsref}) { - @{$args{hostsref}} = @hosts; - } - } sub process_request { Getopt::Long::Configure("bundling"); @@ -324,7 +322,7 @@ sub process_request my $HELP; my $VERSION; my $REMOVE; - my $DELNODE; + my $DELNODE; my $usagemsg = "Usage: makehosts [-d] [-n] [-l] [-a] [-o] [-m]\n makehosts -h\n makehosts -v"; @@ -390,14 +388,14 @@ sub process_request return; } - # get site domain for backward compatibility - my $sitetab = xCAT::Table->new('site'); - if ($sitetab) { - my $dom = $sitetab->getAttribs({key=>'domain'},'value'); - if ($dom and $dom->{value}) { - $::sitedomain=$dom->{value}; - } - } + # get site domain for backward compatibility + my $sitetab = xCAT::Table->new('site'); + if ($sitetab) { + my $dom = $sitetab->getAttribs({key=>'domain'},'value'); + if ($dom and $dom->{value}) { + $::sitedomain=$dom->{value}; + } + } my $hoststab = xCAT::Table->new('hosts'); my $domain; @@ -431,9 +429,9 @@ sub process_request } - # the contents of the /etc/hosts file is saved in the @hosts array - # the @hosts elements are updated and used to re-create the - # /etc/hosts file at the end by the writeout subroutine. + # the contents of the /etc/hosts file is saved in the @hosts array + # the @hosts elements are updated and used to re-create the + # /etc/hosts file at the end by the writeout subroutine. open($lockh, ">", "/tmp/xcat/hostsfile.lock"); flock($lockh, LOCK_EX); my $rconf; @@ -465,21 +463,21 @@ sub process_request } my $linklocal = xCAT::NetworkUtils->linklocaladdr($mac); - my $netn; + my $netn; ($domain, $netn) = &getIPdomain($linklocal, $callback); - if (!$domain) { - if ($::sitedomain) { - $domain=$::sitedomain; - } elsif ($::XCATSITEVALS{domain}) { - $domain=$::XCATSITEVALS{domain}; - } else { - my $rsp; - push @{$rsp->{data}}, "No domain can be determined for node \'$node\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; - xCAT::MsgUtils->message("W", $rsp, $callback); - next; - } - } + if (!$domain) { + if ($::sitedomain) { + $domain=$::sitedomain; + } elsif ($::XCATSITEVALS{domain}) { + $domain=$::XCATSITEVALS{domain}; + } else { + my $rsp; + push @{$rsp->{data}}, "No domain can be determined for node \'$node\'. The domain of the xCAT node must be provided in an xCAT network definition or the xCAT site definition.\n"; + xCAT::MsgUtils->message("W", $rsp, $callback); + next; + } + } if ($DELNODE) { @@ -493,7 +491,7 @@ sub process_request } else { - add_hosts_content(nodelist=>$req->{node},callback=>$callback,delnode=>$DELNODE,domain=>$domain); + add_hosts_content(nodelist=>$req->{node},callback=>$callback,delnode=>$DELNODE,domain=>$domain); } # end else # do the other node nics - if any @@ -515,14 +513,14 @@ sub process_request push @allnodes, $_->{node}; - my $netn; - ($domain, $netn) = &getIPdomain($_->{ip}); - if (!$domain) { + my $netn; + ($domain, $netn) = &getIPdomain($_->{ip}); + if (!$domain) { $domain=$::sitedomain; } - if (!$domain) { + if (!$domain) { $domain=$::XCATSITEVALS{domain}; - } + } if (xCAT::NetworkUtils->isIpaddr($_->{ip})) { @@ -569,13 +567,13 @@ sub writeout =head3 donics Add the additional network interfaces for a list of nodes as - indicated in the nics table + indicated in the nics table Arguments: - node name + node name Returns: - 0 - ok - 1 - error + 0 - ok + 1 - error Globals: @@ -601,8 +599,8 @@ sub donics foreach my $node (@nodelist) { - my $nich; - my %nicindex; + my $nich; + my %nicindex; # get the nic info my $et = @@ -615,64 +613,64 @@ sub donics ] ); - # only require IP for nic + # only require IP for nic if ( !($et->{nicips}) ) { next; } - # gather nics info - # delimiter could be ":" or "!" - # new $et->{nicips} looks like - # "eth0!11.10.1.1,eth1!60.0.0.5|60.0.0.250..." + # gather nics info + # delimiter could be ":" or "!" + # new $et->{nicips} looks like + # "eth0!11.10.1.1,eth1!60.0.0.5|60.0.0.250..." my @nicandiplist = split(',', $et->{'nicips'}); foreach (@nicandiplist) { - my ($nicname, $nicip); + my ($nicname, $nicip); - # if it contains a "!" then split on "!" - if ($_ =~ /!/) { - ($nicname, $nicip) = split('!', $_); - } else { - ($nicname, $nicip) = split(':', $_); - } + # if it contains a "!" then split on "!" + if ($_ =~ /!/) { + ($nicname, $nicip) = split('!', $_); + } else { + ($nicname, $nicip) = split(':', $_); + } - $nicindex{$nicname}=0; + $nicindex{$nicname}=0; - if (!$nicip) { - next; - } + if (!$nicip) { + next; + } - if ( $nicip =~ /\|/) { - my @ips = split( /\|/, $nicip); - foreach my $ip (@ips) { - $nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $ip; - $nicindex{$nicname}++; - } - } else { - $nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $nicip; - $nicindex{$nicname}++; - } - } + if ( $nicip =~ /\|/) { + my @ips = split( /\|/, $nicip); + foreach my $ip (@ips) { + $nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $ip; + $nicindex{$nicname}++; + } + } else { + $nich->{$nicname}->{nicip}->[$nicindex{$nicname}] = $nicip; + $nicindex{$nicname}++; + } + } my @nicandsufx = split(',', $et->{'nichostnamesuffixes'}); my @nicandprfx = split(',', $et->{'nichostnameprefixes'}); foreach (@nicandsufx) { - my ($nicname, $nicsufx); - if ($_ =~ /!/) { - ($nicname, $nicsufx) = split('!', $_); - } else { - ($nicname, $nicsufx) = split(':', $_); - } + my ($nicname, $nicsufx); + if ($_ =~ /!/) { + ($nicname, $nicsufx) = split('!', $_); + } else { + ($nicname, $nicsufx) = split(':', $_); + } if ( $nicsufx =~ /\|/) { my @sufs = split( /\|/, $nicsufx); - my $index=0; + my $index=0; foreach my $suf (@sufs) { $nich->{$nicname}->{nicsufx}->[$index] = $suf; - $index++; + $index++; } } else { $nich->{$nicname}->{nicsufx}->[0] = $nicsufx; @@ -680,46 +678,49 @@ sub donics } foreach (@nicandprfx) { - my ($nicname, $nicprfx); - if ($_ =~ /!/) { - ($nicname, $nicprfx) = split('!', $_); - } else { - ($nicname, $nicprfx) = split(':', $_); - } + my ($nicname, $nicprfx); + if ($_ =~ /!/) { + ($nicname, $nicprfx) = split('!', $_); + } else { + ($nicname, $nicprfx) = split(':', $_); + } - if ( $nicprfx =~ /\|/) { + if ( defined($nicprfx) && $nicprfx =~ /\|/) { my @prfs = split( /\|/, $nicprfx); - my $index=0; + my $index=0; foreach my $prf (@prfs) { $nich->{$nicname}->{nicprfx}->[$index] = $prf; - $index++; + $index++; } } else { $nich->{$nicname}->{nicprfx}->[0] = $nicprfx; } } - # see if we need to fill in a default suffix - # nich has all the valid nics - ie. that have IPs provided! - foreach my $nic (keys %{$nich}) { - for (my $i = 0; $i < $nicindex{$nic}; $i++ ){ - if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) { - # then we have no suffix at all for this - # so set a default - $nich->{$nic}->{nicsufx}->[$i] = "-$nic"; - } - } - } + # see if we need to fill in a default suffix + # nich has all the valid nics - ie. that have IPs provided! + foreach my $nic (keys %{$nich}) { + unless (defined ($nicindex{$nic})) { + $nicindex{$nic} = 0; + } + for (my $i = 0; $i < $nicindex{$nic}; $i++ ){ + if (!$nich->{$nic}->{nicsufx}->[$i] && !$nich->{$nic}->{nicprfx}->[$i]) { + # then we have no suffix at all for this + # so set a default + $nich->{$nic}->{nicsufx}->[$i] = "-$nic"; + } + } + } my @nicandnetwrk = split(',', $et->{'nicnetworks'}); foreach (@nicandnetwrk) { - my ($nicname, $netwrk); - if ($_ =~ /!/) { - ($nicname, $netwrk) = split('!', $_); - } else { - ($nicname, $netwrk) = split(':', $_); - } + my ($nicname, $netwrk); + if ($_ =~ /!/) { + ($nicname, $netwrk) = split('!', $_); + } else { + ($nicname, $netwrk) = split(':', $_); + } if (!$netwrk) { next; @@ -737,7 +738,10 @@ sub donics } } - my @nicandnicalias = split(',', $et->{'nicaliases'}); + my @nicandnicalias; + if (defined($et->{'nicaliases'})) { + @nicandnicalias = split(',', $et->{'nicaliases'}); + } foreach (@nicandnicalias) { my ($nicname, $aliases); @@ -762,78 +766,82 @@ sub donics } } - # end gather nics info + # end gather nics info - # add or delete nic entries in the hosts file - foreach my $nic (keys %{$nich}) { + # add or delete nic entries in the hosts file + foreach my $nic (keys %{$nich}) { # make sure we have the short hostname my $shorthost; ($shorthost = $node) =~ s/\..*$//; + for (my $i = 0; $i < $nicindex{$nic}; $i++ ){ + my $nicip = ""; + my $nicsuffix = ""; + my $nicprefix = ""; + my $nicnetworks = ""; + my $nicaliases = ""; + + $nicip = $nich->{$nic}->{nicip}->[$i] if (defined ($nich->{$nic}->{nicip}->[$i])); + $nicsuffix = $nich->{$nic}->{nicsufx}->[$i] if (defined($nich->{$nic}->{nicsufx}->[$i])); + $nicprefix = $nich->{$nic}->{nicprfx}->[$i] if (defined($nich->{$nic}->{nicprfx}->[$i])); + $nicnetworks = $nich->{$nic}->{netwrk}->[$i] if (defined($nich->{$nic}->{netwrk}->[$i])); + $nicaliases = $nich->{$nic}->{nicaliases}->[$i] if (defined($nich->{$nic}->{nicaliases}->[$i])); - for (my $i = 0; $i < $nicindex{$nic}; $i++ ){ + if (!$nicip) { + next; + } - my $nicip = $nich->{$nic}->{nicip}->[$i]; - my $nicsuffix = $nich->{$nic}->{nicsufx}->[$i]; - my $nicprefix = $nich->{$nic}->{nicprfx}->[$i]; - my $nicnetworks = $nich->{$nic}->{netwrk}->[$i]; - my $nicaliases = $nich->{$nic}->{nicaliases}->[$i]; + # construct hostname for nic + my $nichostname = "$nicprefix$shorthost$nicsuffix"; - if (!$nicip) { - next; - } + # get domain from network def provided by nic attr + my $nt = $nettab->getAttribs({ netname => "$nicnetworks"}, 'domain'); + # look up the domain as a check or if it's not provided + my ($ndomain, $netn) = &getIPdomain($nicip, $callback); - # construct hostname for nic - my $nichostname = "$nicprefix$shorthost$nicsuffix"; - - # get domain from network def provided by nic attr - my $nt = $nettab->getAttribs({ netname => "$nicnetworks"}, 'domain'); - # look up the domain as a check or if it's not provided - my ($ndomain, $netn) = &getIPdomain($nicip, $callback); - - if ( $nt->{domain} && $ndomain ) { - # if they don't match we may have a problem. - if($nicnetworks ne $netn) { - my $rsp; - push @{$rsp->{data}}, "The xCAT network name listed for + if ( $nt->{domain} && $ndomain ) { + # if they don't match we may have a problem. + if($nicnetworks ne $netn) { + my $rsp; + push @{$rsp->{data}}, "The xCAT network name listed for \'$nichostname\' is \'$nicnetworks\' however the nic IP address \'$nicip\' seems to be in the \'$netn\' network.\nIf there is an error then makes corrections to the database definitions and re-run this command.\n"; - xCAT::MsgUtils->message("W", $rsp, $callback); - } - } + xCAT::MsgUtils->message("W", $rsp, $callback); + } + } - # choose a domain - my $nicdomain; - if ( $ndomain ) { - # use the one based on the ip address - $nicdomain=$ndomain; - } elsif ( $nt->{domain} ) { - # then try the one provided in the nics entry - $nicdomain=$nt->{domain}; - } elsif ( $::sitedomain) { - # try the site domain for backward compatibility - $nicdomain=$::sitedomain; - } elsif ($::XCATSITEVALS{domain}) { - $nicdomain=$::XCATSITEVALS{domain}; - } else { - my $rsp; - push @{$rsp->{data}}, "No domain can be determined for the NIC IP value of \'$nicip\'. The network domains must be provided in an xCAT network definition or the xCAT site definition.\n"; - xCAT::MsgUtils->message("W", $rsp, $callback); - next; - } + # choose a domain + my $nicdomain; + if ( $ndomain ) { + # use the one based on the ip address + $nicdomain=$ndomain; + } elsif ( $nt->{domain} ) { + # then try the one provided in the nics entry + $nicdomain=$nt->{domain}; + } elsif ( $::sitedomain) { + # try the site domain for backward compatibility + $nicdomain=$::sitedomain; + } elsif ($::XCATSITEVALS{domain}) { + $nicdomain=$::XCATSITEVALS{domain}; + } else { + my $rsp; + push @{$rsp->{data}}, "No domain can be determined for the NIC IP value of \'$nicip\'. The network domains must be provided in an xCAT network definition or the xCAT site definition.\n"; + xCAT::MsgUtils->message("W", $rsp, $callback); + next; + } - if ($delnode) - { - delnode $nichostname, $nicip, '', $nicdomain; - } - else - { - addnode $callback, $nichostname, $nicip, $nicaliases, $nicdomain, 1; - } + if ($delnode) + { + delnode $nichostname, $nicip, '', $nicdomain; + } + else + { + addnode $callback, $nichostname, $nicip, $nicaliases, $nicdomain, 1; + } } # end for each index } # end for each nic } # end for each node if ($args{hostsref}) { - @{$args{hostsref}} = @hosts; + @{$args{hostsref}} = @hosts; } $nettab->close; @@ -846,12 +854,12 @@ sub donics =head3 getIPdomain - Find the xCAT network definition match the IP and then return the - domain value from that network def. + Find the xCAT network definition match the IP and then return the + domain value from that network def. Arguments: - node IP - callback + node IP + callback Returns: domain and netname - ok undef - error From 088cb897b2656b8ebfe569938437d5a70effa0ad Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 13 Oct 2014 06:59:19 -0400 Subject: [PATCH 64/80] add the dracut_033 dir for stateless support of centos,SL,ol. It's just a dir link to the rh --- xCAT-server/share/xcat/netboot/SL/dracut_033 | 1 + xCAT-server/share/xcat/netboot/centos/dracut_033 | 1 + xCAT-server/share/xcat/netboot/ol/dracut_033 | 1 + 3 files changed, 3 insertions(+) create mode 120000 xCAT-server/share/xcat/netboot/SL/dracut_033 create mode 120000 xCAT-server/share/xcat/netboot/centos/dracut_033 create mode 120000 xCAT-server/share/xcat/netboot/ol/dracut_033 diff --git a/xCAT-server/share/xcat/netboot/SL/dracut_033 b/xCAT-server/share/xcat/netboot/SL/dracut_033 new file mode 120000 index 000000000..0e9de994a --- /dev/null +++ b/xCAT-server/share/xcat/netboot/SL/dracut_033 @@ -0,0 +1 @@ +../rh/dracut_033 \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/centos/dracut_033 b/xCAT-server/share/xcat/netboot/centos/dracut_033 new file mode 120000 index 000000000..0e9de994a --- /dev/null +++ b/xCAT-server/share/xcat/netboot/centos/dracut_033 @@ -0,0 +1 @@ +../rh/dracut_033 \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/ol/dracut_033 b/xCAT-server/share/xcat/netboot/ol/dracut_033 new file mode 120000 index 000000000..0e9de994a --- /dev/null +++ b/xCAT-server/share/xcat/netboot/ol/dracut_033 @@ -0,0 +1 @@ +../rh/dracut_033 \ No newline at end of file From cde6b88011024ec39727f3ff51ec8c2e1a3cdfcd Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 14 Oct 2013 14:47:21 +0800 Subject: [PATCH 65/80] xCAT-genesis-base: add head, basename, whoami for P8 LE firmware update --- xCAT-genesis-builder/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 2bba77733..cf07a34ec 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -11,7 +11,7 @@ dracut_install mkswap df brctl vconfig ifenslave ssh-keygen scp clear dhclient l dracut_install lldptool /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2 dracut_install poweroff ntpq ntpd hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services dracut_install /sbin/rsyslogd /etc/protocols umount /bin/rpm /usr/lib/rpm/rpmrc -dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/head /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements +dracut_install chmod /lib/libc.so.6 /lib/ld-linux.so.2 /lib/libdl.so.2 /lib/libm.so.6 /sbin/route /sbin/ifconfig /usr/bin/whoami /usr/bin/head /usr/bin/tail /usr/bin/basename /etc/redhat-release ping tr lsusb /usr/share/hwdata/usb.ids #ibm fw wrapper requirements dracut_install dmidecode /usr/lib64/libstdc++.so.6 #uxspi prereqs, but will use dmidecode to improve decision on loading ipmi_si dracut_install dmidecode /usr/lib64/libstdc++.so.5 #broadcom firmware update links against old lib dracut_install /lib/libpthread.so.0 #32 bit lib because UXSPI will not ship a native 64 bit build From 24f771dbe61d4fd358a2d260ac0597bc299bf4e2 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 13 Oct 2014 03:31:06 -0400 Subject: [PATCH 66/80] fix rpm packaging problem with xCAT-genesis-scripts --- xCAT-genesis-scripts/xCAT-genesis-scripts.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index cc6f3f02b..b714e094e 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -90,13 +90,16 @@ touch /etc/xcat/genesis-scripts-updated %{rpminstallroot}/bin/remoteimmsetup %{rpminstallroot}/bin/udpcat.awk %{rpminstallroot}/bin/updateflag.awk +%{rpminstallroot}/bin/pseries_platform +%{rpminstallroot}/bin/update_flash +%{rpminstallroot}/bin/update_flash_nv %{rpminstallroot}/debian/changelog %{rpminstallroot}/debian/compat %{rpminstallroot}/debian/control %{rpminstallroot}/debian/copyright -%{rpminstallroot}/debian/dirs +#%{rpminstallroot}/debian/dirs %{rpminstallroot}/debian/docs -%{rpminstallroot}/debian/install +#%{rpminstallroot}/debian/install %{rpminstallroot}/debian/postinst %{rpminstallroot}/debian/postrm %{rpminstallroot}/debian/preinst From c631a0107d2c5cad07e7ee41c87933eb522e8844 Mon Sep 17 00:00:00 2001 From: lissav Date: Mon, 13 Oct 2014 08:28:55 -0400 Subject: [PATCH 67/80] new fix for 4285 --- xCAT-server/lib/xcat/plugins/configfpc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/configfpc.pm b/xCAT-server/lib/xcat/plugins/configfpc.pm index ab7fc233e..5a5c1623e 100644 --- a/xCAT-server/lib/xcat/plugins/configfpc.pm +++ b/xCAT-server/lib/xcat/plugins/configfpc.pm @@ -161,7 +161,7 @@ sub configfpc { } # Build route, if defaultip is 192.168.0.100, then route is 192.168.0.101/16 my ($a1,$a2,$a3,$a4)=split(/\./, $fpcip); - my $a4="101"; + my $a4 = $a4 +1; my $a5="\/16"; my $route=join(".", $a1, $a2, $a3,$a4); my $route = $route . $a5; From 99e631976580cefb78406b269804f216af4b272c Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 15 Oct 2013 09:51:21 +0800 Subject: [PATCH 68/80] fix for building genesis-base for PCM on MCP --- xCAT-genesis-builder/buildrpm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index a44a773a4..3627d7aa9 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -51,6 +51,8 @@ if [ "$HOSTOS" = "mcp" ]; then sed -i 's/\/etc\/redhat-release/\/etc\/base-release \/etc\/system-release/' $DRACUTMODDIR/install sed -i 's/btrfs//' $DRACUTMODDIR/installkernel + sed -i 's/\/usr\/bin\/basename/\/bin\/basename/' $DRACUTMODDIR/install + # these are needed for sysclone, but are not yet in mcp sed -i 's/ bc//' $DRACUTMODDIR/install sed -i 's/ mkdosfs//' $DRACUTMODDIR/install @@ -58,6 +60,10 @@ if [ "$HOSTOS" = "mcp" ]; then sed -i 's/ kexec//' $DRACUTMODDIR/install sed -i 's/ klogd//' $DRACUTMODDIR/install sed -i 's/ mdadm//' $DRACUTMODDIR/install + sed -i 's/ mkfs\.xfs//' $DRACUTMODDIR/install + sed -i 's/ xfs_db//' $DRACUTMODDIR/install + sed -i 's/ mkreiserfs//' $DRACUTMODDIR/install + sed -i 's/ reiserfstune//' $DRACUTMODDIR/install # These timezone files are not available in the latest mcp build sed -i 's/dracut_install \/usr\/share\/zoneinfo\/posix\/Asia\/Riyadh87//' $DRACUTMODDIR/install From 57c53ba53381861423bfd462a7f206158543502c Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 15 Oct 2013 15:36:23 +0800 Subject: [PATCH 69/80] copycds supports sles12 --- xCAT-server/lib/xcat/plugins/sles.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index a66573dfc..3fb45e46f 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1645,6 +1645,9 @@ sub copycd if (not $darch and m/^BASEARCHS\s+(\S+)/) { $darch = $1; } + if (not $darch and m/^REPOID.*\/(\S+)/) { + $darch = $1; + } } close($dinfo); unless ($darch) @@ -1672,7 +1675,7 @@ sub copycd my $prod = <$mfile>; close($mfile); - if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/) + if ($prod =~ m/SUSE-Linux-Enterprise-Server/ || $prod =~ m/SUSE-Linux-Enterprise-Software-Development-Kit/ || $prod =~ m/SLES/) { if (-f "$mntpath/content") { my $content; @@ -1685,6 +1688,12 @@ sub copycd $detdistname = "sles".$verpair[1]; unless ($distname) { $distname = $detdistname; } } + unless ($distname) { + if (/^DISTRO/) { + $_ =~ /sles:(\d+),/; + $distname = "sles".$1; + } + } } } else { my @parts = split /\s+/, $prod; From 0c51f6e92a87c137a3781466f172dda29ca5f808 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 14 Oct 2014 18:00:39 -0400 Subject: [PATCH 70/80] fix schema def mapping of missing kit and kitcomponent attrs --- perl-xCAT/xCAT/Schema.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index db2bd36c5..e644c375a 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -3617,6 +3617,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); tabentry => 'kit.kitdeployparams', access_tabentry => 'kit.kitname=attr:kitname', }, + {attr_name => 'kitdir', + tabentry => 'kit.kitdir', + access_tabentry => 'kit.kitname=attr:kitname', + }, ); ############################# @@ -3702,6 +3706,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); tabentry => 'kitcomponent.kitpkgdeps', access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', }, + {attr_name => 'prerequisite', + tabentry => 'kitcomponent.prerequisite', + access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', + }, {attr_name => 'driverpacks', tabentry => 'kitcomponent.driverpacks', access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', @@ -3714,6 +3722,10 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs); tabentry => 'kitcomponent.postbootscripts', access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', }, + {attr_name => 'genimage_postinstall', + tabentry => 'kitcomponent.genimage_postinstall', + access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', + }, {attr_name => 'exlist', tabentry => 'kitcomponent.exlist', access_tabentry => 'kitcomponent.kitcompname=attr:kitcompname', From c85c5acdeeff429ac23fa66bd10db0beb8d1cb12 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 14 Oct 2014 18:35:41 -0400 Subject: [PATCH 71/80] defect 4294 - fix rmkitcomp to recognize ubuntu prerequisite prep-kitcomp otherpkgslist entry --- xCAT-server/lib/xcat/plugins/kit.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index a96754747..8516b8a51 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -2897,7 +2897,8 @@ sub rmkitcomp $inlist = 1; } if ( $kitcomps{$kitcomponent}{prerequisite} ) { - if ( $line =~ /^$kitreponame\/prep_$basename$/ ) { + if (( $line =~ /^$kitreponame\/prep_$basename$/ ) || + ( $line =~ /^$kitreponame\/prep-$basename$/ )) { if ( $inlist ) { $num--; foreach ( 1..$num ) { From 2511cebef850571c47ce2ebe09d502ae2eaa9bb9 Mon Sep 17 00:00:00 2001 From: mellor Date: Tue, 14 Oct 2014 20:48:22 -0400 Subject: [PATCH 72/80] defect 4284 - fixed xcatd attempt to write to broken pipe which caused DB processes to not get killed --- xCAT-server/sbin/xcatd | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index bb10bdf60..d8b4a7abd 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -280,6 +280,7 @@ my $socket; $SIG{USR2} = sub { if ($socket) { #do not mess with pid file except when we still have the socket. unlink("/var/run/xcat/installservice.pid"); close($socket); $quit=1; + $udpctl=0; xCAT::MsgUtils->message("S","xcatd install monitor $$ quiescing"); } }; @@ -619,6 +620,7 @@ sub do_udp_service { #This function opens up a UDP port if ($socket) { #only clear out pid file when we still have socket. unlink("/var/run/xcat/udpservice.pid"); close($socket); $quit=1; $socket=0; + $udpctl=0; xCAT::MsgUtils->message("S","xcatd udp service $$ quiescing"); } kill(15,$discopid); @@ -864,7 +866,9 @@ sub ssl_reaper { $numdone--; } } - store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + if ($udpctl) { + store_fd({clientcountchange=>$numdone,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + } $SIG{CHLD} = \&ssl_reaper; } @@ -930,7 +934,7 @@ if (! defined $pid_UDP) { die; } unless ($pid_UDP) { - close($udpctl); + close($udpctl); $udpctl=0; $$progname="xcatd: UDP listener"; my $pid_disco; my $discoctl; @@ -961,7 +965,7 @@ if (! defined $pid_MON) { } unless ($pid_MON) { $$progname="xcatd: install monitor"; - close($udpctl); + close($udpctl); $udpctl=0; do_installm_service; xexit(0); } @@ -1010,6 +1014,7 @@ my $mainpidfile; $SIG{USR2} = sub { if ($listener) { unlink("/var/run/xcat/mainservice.pid"); close($listener); $quit=1; $listener=0; + $udpctl=0; xCAT::MsgUtils->message("S","xcatd main service $$ quiescing"); } }; @@ -1124,7 +1129,7 @@ until ($quit) { } if ($child == 0) { - close($udpctl); + close($udpctl); $udpctl=0; $SIG{TERM} = $SIG{INT} = {}; $SIG{CHLD} = \&generic_reaper; #THROTTLE $listener->close; @@ -1205,7 +1210,9 @@ if ($inet6support) { xexit(0); } $sslclients++; #THROTTLE - store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + if ($udpctl) { + store_fd({clientcountchange=>1,sslclientcount=>$sslclients},$udpctl); #notify udp service of how many clients are active + } $cnnection->close(); } if (open($mainpidfile,"<","/var/run/xcat/mainservice.pid")) { From 3b05fc84b0a144660a2af0291d8fe4aa9124c76a Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 14 Oct 2014 22:50:30 -0400 Subject: [PATCH 73/80] fix for bug 4290: add requires ipmitool-xcat for ppc64 --- xCAT/xCAT.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 713d273bc..7d44b2049 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -65,6 +65,7 @@ Requires: xnba-undi %endif %ifarch ppc ppc64 Requires: xCAT-genesis-scripts-ppc64 +Requires: ipmitool-xcat >= 1.8.9 %endif %if %notpcm From 053225fb26667ec7c917a541a0183d42f27eb35c Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 15 Oct 2014 00:21:48 -0700 Subject: [PATCH 74/80] fix bug 4296 :p8le hw discovery error info about syslog and dmidecode --- xCAT-genesis-scripts/bin/dodiscovery | 9 +++++---- xCAT-genesis-scripts/bin/doxcat | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 3c3929dd8..d1241f82d 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -135,7 +135,8 @@ fi #so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated #so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append #if that other function number does not show up in its own dmi type 41 record -for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do +if [ -f "/usr/sbin/dmidecode" ]; then + for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do obdevs=("${obdevs[@]}" $onboard) if [ ${onboard#*.}=0 ]; then truncslot=${onboard%.*} @@ -145,8 +146,8 @@ for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|gr fi done fi -done - + done +fi #TODO: downed nics, also examine /sys/bus/pci/*/ for more network class devices that might not have driver suppert for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v usb0`; do FIRMDESC="" @@ -155,7 +156,7 @@ for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v PCI_SLOT=`grep PCI_SLOT_NAME /sys/class/net/$dev/device/uevent|awk -F= '{print $2}'` ADDRESS=`ip address show dev $dev|grep "inet "|grep global|awk '{print $2}'` MAC=`ip link show dev $dev|grep ether|awk '{print $2}'| tr /a-f/ /A-F/` - if [ ! -z "$PCI_SLOT" ]; then + if [[ ! -z "$PCI_SLOT" && -f "/usr/sbin/dmidecode" ]]; then SLOTNAME=`dmidecode -t 9|egrep '(Designation|Address)'|grep -B1 $PCI_SLOT|grep Designation|sed -e 's/.*Designation:[ ]*//'` if [ -z "$SLOTNAME" ]; then #check for on board device index=1 diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 7d6203531..b0e5bb7df 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -59,7 +59,7 @@ echo "Done" PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBLIC KEY"` PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` export PUBKEY -/sbin/rsyslogd -c4 +/sbin/rsyslogd -4 mkdir -p /var/lib/lldpad echo 'lldp :' >> /var/lib/lldpad/lldpad.conf echo '{' >> /var/lib/lldpad/lldpad.conf @@ -199,6 +199,13 @@ ntpd -g -x # rv 0 state does not work with the new ntp versions #(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) & (while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) & +IPMI_ERROR=`ipmitool mc info` +IPMI_RC=$? +IPMI_SUPPORT=1 +if [ $IPMI_RC -ne 0 ]; then + IPMI_SUPPORT=0 +fi + if [ -f "/usr/sbin/dmidecode" ]; then if dmidecode|grep IPMI > /dev/null; then modprobe ipmi_si @@ -267,10 +274,14 @@ while :; do cd - elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then /bin/nextdestiny $XCATMASTER:$XCATPORT - ipmitool chassis bootdev pxe + if [ $IPMI_SUPPORT -ne 0 ]; then + ipmitool chassis bootdev pxe + fi reboot -f elif [ "$dest" = "install" -o "$dest" = "netboot" ]; then - ipmitool chassis bootdev pxe + if [ $IPMI_SUPPORT -ne 0 ]; then + ipmitool chassis bootdev pxe + fi reboot -f elif [ "$dest" = sysclone ]; then /bin/dosysclone From 2a494808f72593f4017bde27a86cdc79efcefcc0 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 15 Oct 2014 08:42:35 -0700 Subject: [PATCH 75/80] fix defect #4293 [[FVT]:genimage failed not finding otherpkg repo file --- xCAT-server/share/xcat/netboot/ubuntu/genimage | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 204b3fc86..b4c350292 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -338,9 +338,10 @@ unless ($onlyinitrd) { #add the other package directory to for apt-get install open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list"); - if ($otherpkgsdir_local){ - print $aptconfig "deb file://$otherpkgsdir_local ./\n"; - } + #if ($otherpkgsdir_local){ + # # print $aptconfig "deb file://$otherpkgsdir_local ./\n"; + # print $aptconfig "deb file:///mnt/otherpkgdir/ ./\n"; + #} if ($otherpkgsdir_internet){ print $aptconfig $otherpkgsdir_internet; } @@ -367,6 +368,7 @@ unless ($onlyinitrd) { my %extrapkgnames; if (keys(%extra_hash) > 0) { + open ($aptconfig,">","$rootimg_dir/etc/apt/sources.list.d/genimage.apt.list"); my $index=1; foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { foreach (keys(%{$extra_hash{$pass}})) { @@ -376,11 +378,13 @@ unless ($onlyinitrd) { } if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} + if ($otherpkgsdir_local) { print $aptconfig "deb file:///mnt/otherpkgdir/$_ ./\n"}; $index++; my $pa=$extra_hash{$pass}{$_}; $extrapkgnames{$pass} .= " " . join(' ', @$pa); } } + close($aptconfig); $index--; foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { @@ -403,7 +407,9 @@ unless ($onlyinitrd) { # install extra packages my $aptgetcmd_base = $aptgetcmd; - $aptgetcmd .= " install "; + # to prevent "The following packages cannot be authenticated" error, + # invoke apt-get with "--allow-unauthenticated" option + $aptgetcmd .= " install --allow-unauthenticated "; # append extra pkg names to yum command if ($extrapkgnames{$pass}) { $aptgetcmd .= " $extrapkgnames{$pass} "; From 2f6be4092348aa3422d6411ebbe94165b0b52b14 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 15 Oct 2014 21:24:38 -0700 Subject: [PATCH 76/80] fix defect #4274 default otherpkgdir is /install/post/otherpkgs/ubuntu14.04/ppc64el in ubu --- xCAT-server/share/xcat/netboot/ubuntu/genimage | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index b4c350292..2298b324b 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -373,8 +373,9 @@ unless ($onlyinitrd) { foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) { foreach (keys(%{$extra_hash{$pass}})) { if($_ eq "INCLUDEBAD") { - print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}}); - exit 1; + #print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}}); + xdie "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}}); + # exit 1; } if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;} @@ -423,8 +424,9 @@ unless ($onlyinitrd) { print "$envlist $aptgetcmd\n"; my $rc = system("$envlist $aptgetcmd"); if ($rc) { - print "apt-get invocation failed\n"; - exit 1; + #print "apt-get invocation failed\n"; + #exit 1; + xdie "apt-get invocation failed\n"; } } else { print "No Packages marked for install\n"; @@ -1749,7 +1751,11 @@ sub mount_chroot { #system("mount -o bind /sys $rootimage_dir/sys"); system("mount -o bind $pkgdir $rootimage_dir/mnt/pkgdir"); if ($otherpkgdir){ - system("mount -o bind $otherpkgdir $rootimage_dir/mnt/otherpkgdir"); + if(-d $otherpkgdir){ + system("mount -o bind $otherpkgdir $rootimage_dir/mnt/otherpkgdir"); + }else{ + print "The specified otherpkgdir $otherpkgdir does not exist!\n" + } } } From 5b5ad7d6d76a411d93bf67fe8dc070b46ac6cfe9 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 16 Oct 2014 02:26:27 -0700 Subject: [PATCH 77/80] fix defect #4297 PMR 32466,L6Q,000 autoinst file generated hangs install at running postscripts --- xCAT-server/share/xcat/install/scripts/post.rh.common | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.common b/xCAT-server/share/xcat/install/scripts/post.rh.common index 9ad02fd7a..f7a177061 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.common +++ b/xCAT-server/share/xcat/install/scripts/post.rh.common @@ -13,8 +13,14 @@ if [ -z "$PRINIC" ] then for karg in $(cat /proc/cmdline |sed -e 's/-/:/g' -e 's/ /\n/g'); do if [ "${karg%%=*}" = "BOOTIF" ]; then + MACADDR="${karg#*=}"; + #The BOOTIF in pxelinux will be the MAC address with the hardware type code as a prefix + #such as BOOTIF=01-40-f2-e9-68-de-90 + if [ "${#MACADDR}" == "20" ]; then + MACADDR=${MACADDR:3:21} + fi #export PRINIC=`ifconfig -a|grep -i "hwaddr ${karg#*=01:}"|awk '{print $1}'` - export PRINIC=`ip -o link|grep -i "${karg#*=}"|awk '{print $2}'|sed s/://` + export PRINIC=`ip -o link|grep -i "$MACADDR"|awk '{print $2}'|sed s/://` fi done if [ -z "$PRINIC" ]; then From 5ad09597bd4e4899ce56cd202a5ec61c8c0af2a6 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 16 Oct 2014 03:00:18 -0700 Subject: [PATCH 78/80] replace ifconfig with ip --- xCAT-server/share/xcat/install/scripts/post.ubuntu | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 618ae1aad..aba91af0d 100644 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -12,13 +12,16 @@ if [ -z "$PRINIC" ] then export PRINIC=eth0 elif [[ `echo "$PRINIC" | grep -sqE ^[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+:[A-Fa-f0-9]+$ ;echo $?` == "0" ]]; then - export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + #export PRINIC=`ifconfig -a | grep -i "HWaddr $PRINIC" | awk '{print $1}'` + export PRINIC=`ip -o link|grep -i "$PRINIC" |awk '{print $2}'|sed s/://` fi -IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') +#IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') +IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') if [ -z $IP ] then dhclient eth0 - IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') + #IP=$(ifconfig $PRINIC | grep inet | awk '{print $2}' | awk -F: '{print $2}') + IP=$(ip addr show dev $PRINIC | grep inet | grep -v inet6 | awk '{print $2}' | head -n 1 | awk -F '/' '{print $1}') fi echo "search #TABLE:site:key=domain:value#" >/etc/resolv.conf for i in $(echo #TABLE:site:key=nameservers:value# | tr ',' ' ') From b9577cb9ef96e5b1c4af8cc0510d3d5c65525214 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Fri, 17 Oct 2014 03:22:36 -0400 Subject: [PATCH 79/80] non_native package use this script, update sample using real content --- .../scripts/sample/genimage_post.sh | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/xCAT-buildkit/share/xcat/kits/kit_template/scripts/sample/genimage_post.sh b/xCAT-buildkit/share/xcat/kits/kit_template/scripts/sample/genimage_post.sh index af4636987..98829792d 100644 --- a/xCAT-buildkit/share/xcat/kits/kit_template/scripts/sample/genimage_post.sh +++ b/xCAT-buildkit/share/xcat/kits/kit_template/scripts/sample/genimage_post.sh @@ -1,3 +1,21 @@ +#!/bin/sh -echo "running sample-comp1 genimage_post script" +rpmdir="/opt/xcat/kits/<<>>/<<>>" +if [[ ! -z "$installroot" ]]; then + if [ -n "`ls $installroot$rpmdir/*.deb 2> /dev/null`" ] ; then + dpkg -i --force-all --instdir=$installroot $installroot$rpmdir/*.deb + + elif [ -n "`ls $installroot$rpmdir/*.rpm 2> /dev/null`" ] ; then + rpm --force --root $installroot -Uvh $installroot$rpmdir/*.rpm + fi +else + if [ -n "`ls $rpmdir/*.deb 2> /dev/null`" ] ; then + dpkg -i --force-all $rpmdir/*.deb + + elif [ -n "`ls $rpmdir/*.rpm 2> /dev/null`" ] ; then + rpm --force -Uvh $rpmdir/*.rpm + fi +fi + +exit 0 From 255811ee1f5c13a6f515d8ae2184113141d73f4a Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Sat, 18 Oct 2014 17:13:02 -0700 Subject: [PATCH 80/80] fix bugs that no BOOTIF set for ubuntu diskless --- xCAT-server/lib/xcat/plugins/debian.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 750b8d840..74d7849a5 100755 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1435,7 +1435,7 @@ sub mknetboot #} # append the mac address my $mac; - if( $useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { + if( !$useifname && $machash->{$node}->[0] && $machash->{$node}->[0]->{'mac'}) { # TODO: currently, only "mac" attribute with classic style is used, the "|" delimited string of "macaddress!hostname" format is not used $mac = $machash->{$node}->[0]->{'mac'}; # if ( (index($mac, "|") eq -1) and (index($mac, "!") eq -1) ) { @@ -1449,9 +1449,9 @@ sub mknetboot # } } - if ($useifname && $mac) { - $kcmdline .= "$mac "; - } + #if ($useifname && $mac) { + # $kcmdline .= "$mac "; + #} # add "netdev=" or "BOOTIF=" # which are used for other scenarios @@ -1463,7 +1463,7 @@ sub mknetboot } elsif ( $reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and $reshash->{$node}->[0]->{primarynic} ne "mac") { $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " "; } else { - if ( $useifname && $mac) { + if ( !$useifname && $mac) { $kcmdline .= "BOOTIF=" . $mac . " "; } }