From e4c231b6170f9556509001d0a75940c590464d2a Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 02:12:27 -0400 Subject: [PATCH 001/292] complete lsdef cases --- xCAT-test/autotest/testcase/lsdef/cases0 | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index c002bdd06..dc466dd30 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -209,3 +209,43 @@ check:rc==0 cmd:lsdef testnode1 check:output=~Could not find end + +start:lsdef_template +os:linux +description:check xCAT supported template +cmd:lsdef --template +check:rc==0 +check:output=~hmc\-template \(node\) +check:output=~ppc64le\-template \(node\) +check:output=~ppc64lekvmguest\-template \(node\) +check:output=~switch\-template \(node\) +check:output=~x86_64\-template \(node\) +check:output=~x86_64kvmguest\-template \(node\) +end + +start:lsdef_template_switch_template +os:linux +description:check xCAT supported template for switch template +cmd:lsdef --template switch-template +check:rc==0 +check:output=~Object name\: switch-template +check:output=~groups=switch +check:output=~nodetype=switch +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the switch definition template +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~ip\=OPTIONAL\:the ip address of the switch +check:output=~mac\=OPTIONAL\:the MAC address of the switch +check:output=~switchtype\=OPTIONAL\:The type of switch +end + +start:lsdef_template_with_invalid_name +os:linux +description:lsdef --template with invalid template name +cmd:lsdef --template | grep "test_with_invalid_name" +check:rc==1 +cmd:lsdef --template "test_with_invalid_name" +check:rc==1 +check:output=~Error: Could not find test_with_invalid_name in xCAT templates. +end From e1c5bb103321cb0373d0f130a1298d76386a0204 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 04:58:16 -0400 Subject: [PATCH 002/292] complete mkdef test cases --- xCAT-test/autotest/testcase/mkdef/cases0 | 122 +++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 1419103f2..a0363af14 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -159,4 +159,126 @@ check:output=~not a valid end +start:mkdef_template_switch_template_without_attribute +os:linux +description:create a node with swtich template without any attributes +cmd:result=`lsdef | grep auto_test_node_1`; if [[ $result =~ "auto_test_node_1" ]]; then echo $result; noderm auto_test_node_1; fi +cmd:mkdef -t node -o auto_test_node_1 --template switch-template +check:rc==0 +check:output=~1 object definitions have been created or modified. +cmd:lsdef auto_test_node_1 +check:rc==0 +check:output=~Object name\: auto_test_node_1 +check:output=~groups=switch +check:output=~nodetype=switch +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the switch definition template +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output!=ip\=OPTIONAL\:the ip address of the switch +check:output!=mac\=OPTIONAL\:the MAC address of the switch +check:output!=switchtype\= +cmd:noderm auto_test_node_1 +check:rc==0 +end +start:mkdef_template_cec_template_without_remainder +os:linux +description:create a node with cec template once +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_1 +check:output=~Object name\: auto\_test\_cec\_node\_1 +check:output=~groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test +check:output=~mtm\=test +check:output=~serial\=test +cmd:noderm auto_test_cec_node_1 +check:rc==0 +end + +start:mkdef_template_invalid_template +os:linux +description:create a node with invalid template +cmd:result=`lsdef | grep auto_test_node`; if [[ $result =~ "auto_test_node" ]]; then echo $result; noderm auto_test_node; fi +cmd:result=`lsdef | grep auto_test_invalid_template`; if [[ $result =~ "auto_test_invalid_template" ]]; then echo $result; noderm auto_test_invalid_template; fi +cmd:lsdef --template auto_test_invalid_template +check:rc==1 +check:output=~Error\: Could not find auto\_test\_invalid\_template in xCAT templates +cmd:mkdef -t node -o auto_test_node --template auto_test_invalid_template +check:rc==1 +check:output=~Error\: Could not find the template object named \'auto\_test\_invalid\_template\' of type \'node\' +end + +start:mkdef_node_with_a_node_template +os:linux +description:create a node with a node template, using cec template to create node at beginning +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:result=`lsdef | grep auto_test_cec_node_2`; if [[ $result =~ "auto_test_cec_node_2" ]]; then echo $result; noderm auto_test_cec_node_2; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test groups=test_template +check:rc==0 +check:output=~1 object definitions have been created or modified +check:chdef -t node auto_test_cec_node_1 -o groups=test_template +check:rc==0 +check:output=~created +cmd:mkdef -t node -o auto_test_cec_node_2 --template auto_test_cec_node_1 serial=test2 mtm=test2 hcp=test2 +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_2 +check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~groups\=test\_template +check:output!=groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test2 +check:output=~mtm\=test2 +check:output=~serial\=test2 +cmd:noderm auto_test_cec_node_1 +check:rc==0 +cmd:noderm auto_test_cec_node_2 +check:rc==0 +end + +start:mkdef_template_cec_template_step_by_step +os:linux +description:create a node with cec template step by step +cmd:result=`lsdef | grep auto_test_cec_node_1`; if [[ $result =~ "auto_test_cec_node_1" ]]; then echo $result; noderm auto_test_cec_node_1; fi +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template +check:rc==1 +check:output=~Error\: The attribute \"serial\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test +check:rc==1 +check:output=~Error\: The attribute \"mtm\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test +check:rc==1 +check:output=~Error\: The attribute \"hcp\" must be specified! +cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node_1 +check:output=~Object name\: auto\_test\_cec\_node\_1 +check:output=~groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test +check:output=~mtm\=test +check:output=~serial\=test +cmd:noderm auto_test_cec_node_1 +check:rc==0 +end From 79ad627c441bb68df6188f915121954b0cb5ef59 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 05:10:36 -0400 Subject: [PATCH 003/292] add mkdef new case --- xCAT-test/autotest/testcase/mkdef/cases0 | 33 ++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index a0363af14..99e272667 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -226,8 +226,6 @@ cmd:result=`lsdef | grep auto_test_cec_node_2`; if [[ $result =~ "auto_test_cec cmd:mkdef -t node -o auto_test_cec_node_1 --template cec-template serial=test mtm=test hcp=test groups=test_template check:rc==0 check:output=~1 object definitions have been created or modified -check:chdef -t node auto_test_cec_node_1 -o groups=test_template -check:rc==0 check:output=~created cmd:mkdef -t node -o auto_test_cec_node_2 --template auto_test_cec_node_1 serial=test2 mtm=test2 hcp=test2 check:rc==0 @@ -282,3 +280,34 @@ check:output=~serial\=test cmd:noderm auto_test_cec_node_1 check:rc==0 end + +start:check_mkdef_node_with_template_priority +os:linux +description:create node named cec-template with cec template at beginning, the node is priority high than tempalate to create a new node +cmd:result=`lsdef | grep cec-template`; if [[ $result =~ "cec-template" ]]; then echo $result; noderm cec-template; fi +cmd:result=`lsdef | grep auto_test_cec_node`; if [[ $result =~ "auto_test_cec_node" ]]; then echo $result; noderm auto_test_cec_node; fi +cmd:mkdef -t node -o cec-template --template cec-template serial=test mtm=test hcp=test groups=test_template_priority +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:mkdef -t node -o auto_test_cec_node --template cec-template serial=test2 mtm=test2 hcp=test2 +check:rc==0 +check:output=~1 object definitions have been created or modified +cmd:lsdef auto_test_cec_node +check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~groups\=test\_template\_priority +check:output!=groups\=cec\,all +check:output=~hwtype\=cec +check:output=~mgt\=hmc +check:output=~nodetype\=ppc +check:output=~postbootscripts\=otherpkgs +check:output=~postscripts\=syslog\,remoteshell\,syncfiles +check:output=~usercomment\=the cec definition template +check:output=~hcp\=test2 +check:output=~mtm\=test2 +check:output=~serial\=test2 +cmd:noderm cec-template +check:rc==0 +cmd:noderm auto_test_cec_node +check:rc==0 +end + From acd85daaf3c3cde917093cbc6e2668aa007042f0 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 05:31:07 -0400 Subject: [PATCH 004/292] update failed issues --- xCAT-test/autotest/testcase/mkdef/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 99e272667..83baef541 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -293,7 +293,7 @@ cmd:mkdef -t node -o auto_test_cec_node --template cec-template serial=test2 mtm check:rc==0 check:output=~1 object definitions have been created or modified cmd:lsdef auto_test_cec_node -check:output=~Object name\: auto\_test\_cec\_node\_2 +check:output=~Object name\: auto\_test\_cec\_node check:output=~groups\=test\_template\_priority check:output!=groups\=cec\,all check:output=~hwtype\=cec From f635ae9fccd9076d2dba3ba91e48eb27ff4561c2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 4 Jul 2016 23:41:40 -0400 Subject: [PATCH 005/292] complete chdef mkdef cases --- xCAT-test/autotest/testcase/chdef/cases0 | 17 +++++++++++++++++ xCAT-test/autotest/testcase/rmdef/cases0 | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/xCAT-test/autotest/testcase/chdef/cases0 b/xCAT-test/autotest/testcase/chdef/cases0 index f3ad24b73..26db07053 100644 --- a/xCAT-test/autotest/testcase/chdef/cases0 +++ b/xCAT-test/autotest/testcase/chdef/cases0 @@ -222,3 +222,20 @@ cmd:chdef -t wrongtype -o testnode groups=all,aix check:rc!=0 check:output=~not a valid end + + +start:chdef_template +os:linux +description:try to change a template, a new node is created according to chdef. +cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi +cmd:chdef -t node -o switch-template groups=test +check:output=~1 object definitions have been created or modified +check:output=~New object definitions \'switch-template\' have been created +check:rc==0 +cmd:lsdef switch-template +check:output=~Object name\: switch\-template +check:output=~groups\=test +check:rc==0 +cmd:noderm switch-template +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/rmdef/cases0 b/xCAT-test/autotest/testcase/rmdef/cases0 index 8a6b9f51c..50bbe14e9 100644 --- a/xCAT-test/autotest/testcase/rmdef/cases0 +++ b/xCAT-test/autotest/testcase/rmdef/cases0 @@ -128,3 +128,13 @@ cmd:rmdef -t wrongtype -o testnode check:rc!=0 check:output=~not a valid end + +start:rmdef_template +os:linux +description:try to delete a template, then error messages appear +cmd:result=`lsdef | grep switch-template`; if [[ $result =~ "switch-template" ]]; then echo $result; noderm switch-template; fi +cmd:rmdef switch-template +check:rc==1 +check:output=~Error\: Could not find an object named \'switch-template\' of type \'node\' +check:output=~No objects have been removed from the xCAT database. +end From 2742a29bcfb609511db0199b33374099b9a96ebe Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 2 Sep 2016 12:08:38 +0000 Subject: [PATCH 006/292] [xCAT-client]xdshbak: make `-q` match manpage --- xCAT-client/bin/xdshbak | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index 66bc59ff3..a4d6769ed 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -110,8 +110,7 @@ while () # $num_lines++; if (!($quiet)) { - if ($::opt_x) { $num_lines % 100 == 0 && print STDOUT "."; } - else { $num_lines % 1000 == 0 && print STDOUT "."; } + $num_lines % 1000 == 0 && print STDOUT "."; } if (/: /) { @@ -170,7 +169,7 @@ while () # The hostnames are sorted alphabetically # -$num_lines > 999 && print STDOUT "\n"; +!($quiet) && $num_lines > 999 && print STDOUT "\n"; if ($compress) { if ($long_ln eq $prev_ln) @@ -204,7 +203,7 @@ sub d_syntax "-c : compresses the output by listing unique output only once.\n"; my $usage3 = "-h : help \n"; my $usage4 = -"-x : omit extra header output for each node. Can not be used with -c. \n"; + "-x : omit extra header output for each node. Can not be used with -c. \n"; my $usage5 = "-q : quiet mode.\n"; my $usage = $usage1 .= $usage2 .= $usage3 .= $usage4 .= $usage5; xCAT::MsgUtils->message("I", $usage); @@ -302,10 +301,10 @@ sub print_tree xCAT::MsgUtils->message("I", "HOSTS:"); print -"-------------------------------------------------------------------------\n"; + "-------------------------------------------------------------------------\n"; &display_wc; print -"-------------------------------------------------------------------------------\n"; + "-------------------------------------------------------------------------------\n"; print $str{$index}; } } From 7b6b421b17d30fd718e940755213917a5689a7e1 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 2 Sep 2016 12:16:01 +0000 Subject: [PATCH 007/292] [xCAT-client]xdshbak: make `-x` match manpage --- xCAT-client/bin/xdshbak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index a4d6769ed..48b612527 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -236,7 +236,9 @@ sub print_list if (!$::opt_x) { ($num_hosts >= 1) && print "\n"; } $num_hosts++; - if ($::opt_x) { print "$hostname: $ls{$hostname}"; } + if ($::opt_x) { + map { print "$hostname: $_\n" } split(/\n/, $ls{$hostname}); + } else { From 7fcfc0700b4ee70a6e24a41e10884d88ee10381d Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Fri, 2 Sep 2016 12:19:41 +0000 Subject: [PATCH 008/292] [xCAT-client]xdshbak: make header match manpage --- xCAT-client/bin/xdshbak | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index 48b612527..c200a185c 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -243,7 +243,7 @@ sub print_list { #$hn_string = `$SPMSG DSH $MSGCAT INFO510 'HOST: %1\$s\n' $hostname`; - xCAT::MsgUtils->message("I", "HOST:$hostname\n"); + xCAT::MsgUtils->message("I", "HOST:$hostname"); printf '%.' . (6 + length($hostname)) . "s\n", '---------------------------------------------------------------'; @@ -300,10 +300,9 @@ sub print_tree @wc = sort(@wc); #system "$SPMSG DSH $MSGCAT INFO511 'HOSTS '"; - xCAT::MsgUtils->message("I", "HOSTS:"); - - print - "-------------------------------------------------------------------------\n"; + xCAT::MsgUtils->message("I", + "HOSTS -------------------------------------------------------------------------" + ); &display_wc; print "-------------------------------------------------------------------------------\n"; From ccd0ff64f5f779df5a33a6aa56b52b4005dbfb10 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Mon, 10 Oct 2016 15:12:57 +0000 Subject: [PATCH 009/292] [xCAT-client]xdshbak: Use `version` sorting on hostnames --- xCAT-client/bin/xdshbak | 7 +++++-- xCAT-client/debian/control | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index c200a185c..7084614bb 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -10,6 +10,9 @@ use xCAT::MsgUtils; use xCAT::DSHCLI; use locale; use Getopt::Std; + +eval "use Sort::Versions qw/versioncmp/; 1;" or *versioncmp = sub ($$) { ($a,$b)= @_ ; return $a cmp $b }; + ##################################################################### # # # Module: xdshbak # @@ -231,7 +234,7 @@ sub print_list local (@lines, $numhosts, $hn_string, $l_string); - foreach $hostname (sort @hs) + foreach $hostname (sort { versioncmp($a, $b) } @hs) { if (!$::opt_x) { ($num_hosts >= 1) && print "\n"; } $num_hosts++; @@ -297,7 +300,7 @@ sub print_tree ($num_hosts >= 1) && print "\n"; $num_hosts++; @wc = split(/:/, $hdr{$index}); - @wc = sort(@wc); + @wc = sort { versioncmp($a, $b) } @wc; #system "$SPMSG DSH $MSGCAT INFO511 'HOSTS '"; xCAT::MsgUtils->message("I", diff --git a/xCAT-client/debian/control b/xCAT-client/debian/control index 321fc1b19..032f70438 100644 --- a/xCAT-client/debian/control +++ b/xCAT-client/debian/control @@ -8,5 +8,6 @@ Standards-Version: 3.7.2 Package: xcat-client Architecture: all Depends: ${perl:Depends}, nmap, perl-xcat +Recommends: libsort-versions-perl Description: Core executables and data of the xCAT management project xCAT-client provides the fundamental xCAT commands (chtab, chnode, rpower, etc) helpful in administrating systems at scale, with particular attention paid to large HPC clusters. From c6f7861fb1da01f77e1ba9c7cf35b45618ec9d95 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Mon, 10 Oct 2016 15:21:26 +0000 Subject: [PATCH 010/292] [xCAT-client]xdshbak: Add bare output sub-option `-b` for `-x` --- xCAT-client/bin/xdshbak | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index 7084614bb..fd343f30f 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -24,6 +24,7 @@ eval "use Sort::Versions qw/versioncmp/; 1;" or *versioncmp = sub ($$) { ($a,$b # output from multiple nodes preceded by the hostname # # # # Inputs: # +# -b : bare output, don't prepend hostname per line. only with -x # # -c : list distinct output only once # # -h : usage # # -x : omit extra header output for each node. # @@ -53,7 +54,7 @@ $::dsh_command = 'xdshbak'; # # Process the command line... # -if (!getopts('cxhq')) +if (!getopts('bcxhq')) { # Gather options; if errors &d_syntax; exit(-1); @@ -71,6 +72,11 @@ if ($::opt_c && $::opt_x) exit(-1); } # these 2 options are mutually exclusive +if ($::opt_b && !($::opt_x)) { + &d_syntax; + exit(-1); +} # -b only makes sense with -x + if ($::opt_c) { $compress++; @@ -201,14 +207,15 @@ else sub d_syntax { - my $usage1 = "Usage: xdshbak [-c | -x | -h | -q] \n"; - my $usage2 = - "-c : compresses the output by listing unique output only once.\n"; - my $usage3 = "-h : help \n"; - my $usage4 = - "-x : omit extra header output for each node. Can not be used with -c. \n"; - my $usage5 = "-q : quiet mode.\n"; - my $usage = $usage1 .= $usage2 .= $usage3 .= $usage4 .= $usage5; + # Duplicates POD - pod2usage ? + my @usage; + push @usage, "Usage: xdshbak [-c | -x [-b] | -h | -q]"; + push @usage, " -b : bare output, don't prepend hostname per line. only with -x"; + push @usage, " -c : compresses the output by listing unique output only once."; + push @usage, " -h : help"; + push @usage, " -x : omit extra header output for each node. Can not be used with -c."; + push @usage, " -q : quiet mode."; + my $usage = join "\n", @usage; xCAT::MsgUtils->message("I", $usage); } @@ -240,7 +247,13 @@ sub print_list $num_hosts++; if ($::opt_x) { - map { print "$hostname: $_\n" } split(/\n/, $ls{$hostname}); + if ($::opt_b) { + # Bare output + print $ls{$hostname}; + } else { + # No header. hostname prepended on every line + map { print "$hostname: $_\n" } split(/\n/, $ls{$hostname}); + } } else { From a91bf8e258f1f32b0aeb4245352c1603bb71f4d7 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Thu, 5 Nov 2015 11:36:05 +0000 Subject: [PATCH 011/292] [xCAT-client]xdshbak: Add `-b` option to manpage --- xCAT-client/pods/man1/xdshbak.1.pod | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xCAT-client/pods/man1/xdshbak.1.pod b/xCAT-client/pods/man1/xdshbak.1.pod index 61262572e..fed91b77d 100644 --- a/xCAT-client/pods/man1/xdshbak.1.pod +++ b/xCAT-client/pods/man1/xdshbak.1.pod @@ -4,7 +4,7 @@ B - Formats the output of the B command. =head1 B -B [B<-c> | B<-x> | B<-h> | B<-q>] +B [B<-c> | B<-x> [ B<-b> ] | B<-h> | B<-q>] =head1 DESCRIPTION @@ -62,6 +62,9 @@ the output by hostname for easier viewing: . . +If the B<-b> flag is specified in addition to B<-x>, the hostname at the beginning +of each line is stripped. + =head2 Standard Error When the B filter is used and standard error messages are generated, @@ -72,6 +75,11 @@ output messages. This is true with and without the B<-c> flag. =over 6 +=item B<-b> + +Strip the host prefix from the beginning of the lines. This only +works with the B<-x> option. + =item B<-c> If the output from multiple nodes is identical it will be collapsed From 701477eaafcfcbcc1d5e9ac43ec18463f1281eb6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 17 Oct 2016 16:09:27 -0400 Subject: [PATCH 012/292] Add RHEV KVM documentation --- .../{powerKVM.rst => hypervisorKVM.rst} | 82 +++++++++++++++---- .../ppc64le/virtual_machines/index.rst | 2 +- 2 files changed, 69 insertions(+), 15 deletions(-) rename docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/{powerKVM.rst => hypervisorKVM.rst} (53%) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst similarity index 53% rename from docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst rename to docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 239b69b08..35b572fcc 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/powerKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -1,20 +1,21 @@ -Setup PowerKVM Hypervisor -========================= +Setup Hypervisor +================ -Provision Hypervisor with PowerKVM ----------------------------------- +Provision Hypervisor +-------------------- -Please follow the :ref:`Diskful Installation ` to provision kvm hypervisor with PowerKVM, several customization steps should be taken into consideration. +Follow the :ref:`Diskful Installation ` to provision kvm hypervisor for PowerKVM or RHEV. -To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso** for example here: -#. Obtain a PowerKVM iso and create PowerKVM osimages with it: :: +* **[PowerKVM]** + + Obtain a PowerKVM iso and create PowerKVM osimages with it: :: copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso - The following PowerKVM osimage will be created on success :: + The following PowerKVM osimage will be created :: # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute Object name: pkvm3.1-ppc64le-install-compute @@ -29,9 +30,52 @@ To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1. provmethod=install template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl +* **[RHEV]** + + At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. + + * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. + + * Run ``createrepo .`` in the */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. + + * Create new osimage definition based on an existing RH7 osimage definition :: + + mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute --template rhels7.3-ppc64le-install-compute + * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: + + chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create a new file */opt/xcat/share/xcat/install/rh/other.pkglist* to list required packages :: + + libvirt + qemu-kvm-rhev + qemu-kvm-tools-rhev + virt-manager-common + virt-install + + * Modify ``otherpkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + + * The RHEV osimage should look similar to: :: + + Object name: rhels7.3-ppc64le-RHEV4-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.3-ppc64le + osname=Linux + osvers=rhels7.3 + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + pkgdir=/install/rhels7.3/ppc64le + pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + #. Customize the hypervisor node definition to create network bridge - xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Please specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: + xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: @@ -65,16 +109,16 @@ To demonstrate the brief steps on hypervisor provision, take **ibm-powerkvm-3.1. chmod 755 /install/postscripts/mountvms chdef kvmhost1 -p postscripts=mountvms -#. Provision the hypervisor node with the PowerKVM osimage :: +#. Provision the hypervisor node with the osimage :: - nodeset kvmhost1 osimage=pkvm3.1-ppc64le-install-compute + nodeset kvmhost1 osimage= rpower kvmhost1 boot Create network bridge on hypervisor ------------------------------------ -To launch VMs, a network bridge must be created on the PowerKVM hypervisors. +To launch VMs, a network bridge must be created on the KVM hypervisor. If the hypervisor is provisioned successfully according to the steps described above, a network bridge will be created and attached to a physical interface. This can be checked by running ``brctl show`` on the hypervisor to show the network bridge information, please make sure a network bridge has been created and configured according to the parameters passed to postscript "xHRM" :: @@ -83,10 +127,20 @@ If the hypervisor is provisioned successfully according to the steps described a br0 8000.000000000000 no eth0 -If the network bridge is not created or configured successfully, please run "xHRM" with **updatenode** on managememt node to create it manually::: +If the network bridge is not created or configured successfully, run "xHRM" with **updatenode** on managememt node to create it manually::: updatenode kvmhost1 -P "xHRM bridgeprereq eth0:br0" - + +Start libvirtd service +---------------------- + +Verify **libvirtd** service is running: :: + + systemctl status libvirtd + +If service is not running, it can be started with: :: + + systemctl start libvirtd .. [1] Every standard libvirt installation provides NAT based connectivity to virtual machines out of the box using the "virtual bridge" interfaces (virbr0, virbr1, etc) Those will be created by default. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst index 0bd559648..d134a2464 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst @@ -32,6 +32,6 @@ This section introduces the steps of management node preparation, KVM hypervisor :maxdepth: 2 kvmMN.rst - powerKVM.rst + hypervisorKVM.rst manage_vms.rst FAQ.rst From 2a2d13054db2dcc6aa7faf641bf2429637b5cb72 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Oct 2016 14:10:39 -0400 Subject: [PATCH 013/292] Review suggestions implemented --- .../virtual_machines/RHEVHypervisor.rst | 48 +++++++++++ .../virtual_machines/hypervisorKVM.rst | 83 +++---------------- .../ppc64le/virtual_machines/index.rst | 2 +- .../virtual_machines/pKVMHypervisor.rst | 20 +++++ 4 files changed, 80 insertions(+), 73 deletions(-) create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst create mode 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst new file mode 100644 index 000000000..9274d7018 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -0,0 +1,48 @@ + + At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. + + * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to ``/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA`` + + * Create a yum repository for the downloaded RPMs :: + + createrepo /install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create new osimage definition based on an existing RHEL7 osimage definition :: + + mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute \ + --template rhels7.3-ppc64le-install-compute + + * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: + + chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + + * Create a new file ``/opt/xcat/share/xcat/install/rh/other.pkglist`` to list required packages :: + + libvirt + qemu-kvm-rhev + qemu-kvm-tools-rhev + virt-manager-common + virt-install + + * Modify ``otherpkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + + * The RHEV osimage should look similar to: :: + + Object name: rhels7.3-ppc64le-RHEV4-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=rhels7.3-ppc64le + osname=Linux + osvers=rhels7.3 + otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA + otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + pkgdir=/install/rhels7.3/ppc64le + pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 35b572fcc..1f0873241 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -1,93 +1,32 @@ -Setup Hypervisor -================ - +Install and Configure Hypervisor +================================ Provision Hypervisor -------------------- - -Follow the :ref:`Diskful Installation ` to provision kvm hypervisor for PowerKVM or RHEV. - - * **[PowerKVM]** - Obtain a PowerKVM iso and create PowerKVM osimages with it: :: - - copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso - - The following PowerKVM osimage will be created :: - - # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute - Object name: pkvm3.1-ppc64le-install-compute - imagetype=linux - osarch=ppc64le - osdistroname=pkvm3.1-ppc64le - osname=Linux - osvers=pkvm3.1 - otherpkgdir=/install/post/otherpkgs/pkvm3.1/ppc64le - pkgdir=/install/pkvm3.1/ppc64le - profile=compute - provmethod=install - template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl + .. include:: pKVMHypervisor.rst * **[RHEV]** - At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. - - * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. - - * Run ``createrepo .`` in the */install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA* directory. - - * Create new osimage definition based on an existing RH7 osimage definition :: - - mkdef -t osimage -o rhels7.3-ppc64le-RHEV4-install-compute --template rhels7.3-ppc64le-install-compute - * Modify ``otherpkgdir`` attribute to point to the package directory with downloaded RPMs :: - - chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - - * Create a new file */opt/xcat/share/xcat/install/rh/other.pkglist* to list required packages :: - - libvirt - qemu-kvm-rhev - qemu-kvm-tools-rhev - virt-manager-common - virt-install - - * Modify ``otherpkglist`` attribute to point to the file from the step above :: - - chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist - - * The RHEV osimage should look similar to: :: - - Object name: rhels7.3-ppc64le-RHEV4-install-compute - imagetype=linux - osarch=ppc64le - osdistroname=rhels7.3-ppc64le - osname=Linux - osvers=rhels7.3 - otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist - pkgdir=/install/rhels7.3/ppc64le - pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist - profile=compute - provmethod=install - template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + .. include:: RHEVHypervisor.rst #. Customize the hypervisor node definition to create network bridge - xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. Here is some examples on this: + xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. For example: - To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: + * To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq" - To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: + * To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" - To create a bridge named 'br0' against the network device 'eth0' :: + * To create a bridge named 'br0' against the network device 'eth0' :: - chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" + chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" **Note**: The network bridge name you use should not be the virtual bridges created by libvirt installation [1]_. diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst index d134a2464..a13f1e1c6 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/index.rst @@ -26,7 +26,7 @@ The xCAT based KVM solution offers users the ability to: * install copy on write instances of virtual machines * clone virtual machines -This section introduces the steps of management node preparation, KVM hypervisor setup and virtual machine management, and presents some typical problems and solutions on xCAT kvm support. +This section introduces the steps of management node preparation, hypervisor setup and virtual machine management, and presents some typical problems and solutions on xCAT kvm support. .. toctree:: :maxdepth: 2 diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst new file mode 100644 index 000000000..e75d9f5e3 --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/pKVMHypervisor.rst @@ -0,0 +1,20 @@ + + Obtain a PowerKVM ISO and create PowerKVM osimages with it: :: + + copycds ibm-powerkvm-3.1.0.0-39.0-ppc64le-gold-201511041419.iso + + The following PowerKVM osimage will be created :: + + # lsdef -t osimage -o pkvm3.1-ppc64le-install-compute + Object name: pkvm3.1-ppc64le-install-compute + imagetype=linux + osarch=ppc64le + osdistroname=pkvm3.1-ppc64le + osname=Linux + osvers=pkvm3.1 + otherpkgdir=/install/post/otherpkgs/pkvm3.1/ppc64le + pkgdir=/install/pkvm3.1/ppc64le + profile=compute + provmethod=install + template=/opt/xcat/share/xcat/install/pkvm/compute.pkvm3.ppc64le.tmpl + From 4648ef53db6c7ab22e3700c45aa57b34cf3b3c5e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 19 Oct 2016 04:47:50 -0400 Subject: [PATCH 014/292] add new check rootimgdir warning message case --- xCAT-test/autotest/testcase/mkdef/cases0 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xCAT-test/autotest/testcase/mkdef/cases0 b/xCAT-test/autotest/testcase/mkdef/cases0 index 83baef541..9595e6e22 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases0 +++ b/xCAT-test/autotest/testcase/mkdef/cases0 @@ -311,3 +311,16 @@ cmd:noderm auto_test_cec_node check:rc==0 end +start:mkdef_template_diskless_osimage_rootimgdir +os:linux +description:check rootimgdir warning message after make new osimage with mkdef --template +cmd:mkdef -t osimage -o test-osimage_with_template --template __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +output=~1 object definitions have been created or modified +cmd:xcatprobe osimagecheck +check:output=~Identical root image directory +check:output=~test-osimage +check:output=~__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +cmd:rmdef -t osimage -o test-osimage_with_template +check:rc==0 +end From 761a8f8373ef660163351603b7f9af0d06ae8d6d Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 20 Oct 2016 13:31:13 -0400 Subject: [PATCH 015/292] upport kitcomponent can be add to higher version of OS --- xCAT-server/lib/xcat/plugins/kit.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 6e135ba8c..ba1db981f 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1844,7 +1844,7 @@ sub validate_os { return 1; } - if ($kitcomp->{osminorversion} and ($osimage->{minorversion} ne $kitcomp->{osminorversion})) { + if ($kitcomp->{osminorversion} and ($osimage->{minorversion} lt $kitcomp->{osminorversion})) { # my %rsp; # push@{ $rsp{data} }, "osimage $os is not compatible with kit component $kitcomp->{kitcompname} with attribute minorversion"; @@ -2149,7 +2149,7 @@ sub addkitcomp return 1; } - if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} ne $kitcomps{$kitcomp}{osminorversion})) { + if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} lt $kitcomps{$kitcomp}{osminorversion})) { my %rsp; push @{ $rsp{data} }, "osimage $osimage is not compatible with kit component $kitcomp with attribute minorversion"; xCAT::MsgUtils->message("E", \%rsp, $callback); @@ -3606,7 +3606,7 @@ sub chkkitcomp return 1; } - if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} ne $kitcomps{$kitcomp}{osminorversion})) { + if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} lt $kitcomps{$kitcomp}{osminorversion})) { my %rsp; push @{ $rsp{data} }, "kit component $kitcomp is not compatible with osimage $osimage with attribute minorversion"; xCAT::MsgUtils->message("E", \%rsp, $callback); @@ -5080,7 +5080,7 @@ sub get_compat_kitreponames { if (defined($kitrepo->{osmajorversion}) && $kitrepo->{osmajorversion} ne $osdistro->{majorversion}) { next; } - if (defined($kitrepo->{osminorversion}) && $kitrepo->{osminorversion} ne $osdistro->{minorversion}) { + if (defined($kitrepo->{osminorversion}) && $osdistro->{minorversion} lt $kitrepo->{osminorversion} ) { next; } if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch} && $kitrepo->{osarch} ne 'noarch') { From 359063aa61734816276593314c07c3da5045426b Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 24 Oct 2016 14:22:21 +0800 Subject: [PATCH 016/292] Add testcase test-sigint-genimage.sh --- xCAT-test/autotest/testcase/signal/cases0 | 4 + .../testcase/signal/test-sigint-genimage.sh | 167 ++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 xCAT-test/autotest/testcase/signal/cases0 create mode 100755 xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh diff --git a/xCAT-test/autotest/testcase/signal/cases0 b/xCAT-test/autotest/testcase/signal/cases0 new file mode 100644 index 000000000..efd959a5e --- /dev/null +++ b/xCAT-test/autotest/testcase/signal/cases0 @@ -0,0 +1,4 @@ +start:genimage_sigint +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/signal/test-sigint-genimage.sh +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh b/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh new file mode 100755 index 000000000..3464fcbfa --- /dev/null +++ b/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh @@ -0,0 +1,167 @@ +#!/bin/bash + +# Author: GONG Jie +# Create: 2016-10-17 +# Update: 2016-10-21 +# Version: 1.3.0 + +# +# warn_if_bad Put out warning message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Incoming $1 is returned unless it is 0 +# +function warn_if_bad() +{ + local -i rc="$1" + local script="${0##*/}" + + # Ignore if no problems + [ "${rc}" -eq "0" ] && return 0 + + # Broken + shift + echo "${script}: $@" >&2 + return "${rc}" +} + +# +# exit_if_bad Put out error message(s) if $1 has bad RC. +# +# $1 0 (pass) or non-zero (fail). +# $2+ Remaining arguments printed only if the $1 is non-zero. +# +# Exits with 1 unless $1 is 0 +# +function exit_if_bad() +{ + warn_if_bad "$@" || exit 1 + return 0 +} + +# +# check_root_or_break +# +# Breaks the script if not running as root. +# +# If this returns 1, the invoker MUST abort the script. +# +# returns 0 if running as root +# returns 1 if not (and breaks the script) +# +function check_root_or_exit() +{ + [ "${UID}" -eq "0" ] + exit_if_bad "$?" "Must be run by UID=0. Actual UID=${UID}." + return 0 +} + +# +# check_executes Check for executable(s) +# +# Returns 0 if true. +# Returns 1 if not. +# +function check_executes() +{ + local cmd + local all_ok="yes" + for cmd in "$@" + do + if ! type "${cmd}" &>/dev/null + then + echo "Command \"${cmd}\" not found" >&2 + all_ok="no" + fi + done + [ "${all_ok}" = "yes" ] +} + +# +# check_exec_or_exit Check for required executables. +# +# Exits (not returns) if commands listed on command line do not exist. +# +# Returns 0 if true. +# Exits with 1 if not. +# +function check_exec_or_exit() +{ + check_executes "$@" + exit_if_bad "$?" "Above listed required command(s) not found" + return 0 +} + +# +# internal_setup Script setup +# +# Returns 0 on success. +# Exits (not returns) with 1 on failure. +# +function internal_setup() +{ + # Trap exit for internal_cleanup function. + trap "internal_cleanup" 0 + + umask 0077 + + check_exec_or_exit cat cpio find grep tail tee touch xargs +} + +# +# internal_cleanup Script cleanup (reached via trap 0) +# +# Destory any temporarily facility created by internal_setup. +# +function internal_cleanup() +{ + custom_cleanup +} + +function custom_cleanup() +{ + rm -rf "/install/netboot/testing0000" +} + + +PATH="/opt/xcat/bin:/opt/xcat/sbin:/bin:/sbin:/usr/bin:/usr/sbin" + +OSIMAGE="$(lsdef -t osimage | grep -- -netboot-compute | head -n 1)" +[ -n "${OSIMAGE}" ] +exit_if_bad "$?" "Diskless osimage not found" + +lsdef -t osimage "${OSIMAGE}" -z | sed -e 's/^.*:$/compute_9999z/' + +# The new osimage name is compute_9999z +OSIMAGE="compute_9999z" + +lsdef -t osimage "${OSIMAGE}" +exit_if_bad "$?" "Diskless osimage ${OSIMAGE} not created" + +chdef -t osimage "${OSIMAGE}" "rootimgdir=/install/netboot/testing0000/${OSIMAGE}" +exit_if_bad "$?" "Command chdef failed" + +genimage "${OSIMAGE}" & +CHILD="$!" + +sleep 1 + +kill -0 "${CHILD}" +exit_if_bad "$?" "Process not found" + +kill -SIGINT "${CHILD}" +exit_if_bad "$?" "Send SIGINT failed" + +sleep 2 + +ps axo comm | grep genimage +[ "$?" -ne "0" ] +exit_if_bad "$?" "Still running 000" + +ps axo pgrp | grep "${CHILD}" +[ "$?" -ne "0" ] +exit_if_bad "$?" "Still running 001" + +exit 0 From 8745b0cd7ee744a981664c43bb6d37c701c54141 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 25 Oct 2016 15:43:20 +0800 Subject: [PATCH 017/292] update after Jun Xia's comments --- xCAT-test/autotest/testcase/lsdef/cases0 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/lsdef/cases0 b/xCAT-test/autotest/testcase/lsdef/cases0 index dc466dd30..55e846e11 100644 --- a/xCAT-test/autotest/testcase/lsdef/cases0 +++ b/xCAT-test/autotest/testcase/lsdef/cases0 @@ -243,8 +243,7 @@ end start:lsdef_template_with_invalid_name os:linux description:lsdef --template with invalid template name -cmd:lsdef --template | grep "test_with_invalid_name" -check:rc==1 +cmd:result=`lsdef | grep test_with_invalid_name`; if [[ $result =~ "test_with_invalid_name" ]]; then noderm test_with_invalid_name; fi cmd:lsdef --template "test_with_invalid_name" check:rc==1 check:output=~Error: Could not find test_with_invalid_name in xCAT templates. From cc9ac639de993b06af29debc74b3a9bcf355bb7c Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 25 Oct 2016 05:11:02 -0400 Subject: [PATCH 018/292] complete --- xCAT-test/autotest/testcase/updatenode/cases0 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/testcase/updatenode/cases0 b/xCAT-test/autotest/testcase/updatenode/cases0 index 91f783957..9d8f7b6bb 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases0 +++ b/xCAT-test/autotest/testcase/updatenode/cases0 @@ -454,3 +454,23 @@ check:output=~postscripts has completed check:output=~Software Maintenance has completed end +start:updatenode_P_syslog_V_xcatdebugmode_is_one +description:xcatdebugmode value is one, there should be execution outputs. +cmd:chtab key=xcatdebugmode site.value=1 +check:rc==0 +cmd:updatenode $$CN -P syslog -V +check:output=~$$CN: ++ +cmd:chtab key=xcatdebugmode site.value=0 +check:rc==0 +end + +start:updatenode_P_syslog_V_xcatdebugmode_is_two +description:xcatdebugmode value is two, there should be execution outputs. +cmd:chtab key=xcatdebugmode site.value=2 +check:rc==0 +cmd:updatenode $$CN -P syslog -V +check:output=~$$CN: ++ +cmd:chtab key=xcatdebugmode site.value=0 +check:rc==0 +end + From af0a9ab241f29791c0b9c23d206fbe37f9f7773a Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 26 Oct 2016 16:17:58 +0800 Subject: [PATCH 019/292] Fix the lacking of osimage defining in test case test-sigint-genimage.sh --- xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh b/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh index 3464fcbfa..53fff28b1 100755 --- a/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh +++ b/xCAT-test/autotest/testcase/signal/test-sigint-genimage.sh @@ -132,7 +132,7 @@ OSIMAGE="$(lsdef -t osimage | grep -- -netboot-compute | head -n 1)" [ -n "${OSIMAGE}" ] exit_if_bad "$?" "Diskless osimage not found" -lsdef -t osimage "${OSIMAGE}" -z | sed -e 's/^.*:$/compute_9999z/' +lsdef -t osimage "${OSIMAGE}" -z | sed -e 's/^.*:$/compute_9999z/' | mkdef -z # The new osimage name is compute_9999z OSIMAGE="compute_9999z" From e0fe3bf9d6cca475b2c66740f42fb87f1b197ed1 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 27 Oct 2016 05:27:06 -0400 Subject: [PATCH 020/292] completed_all --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 + 16 files changed, 16 insertions(+) diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 67ccc3c22..15676669e 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -203,6 +203,7 @@ nodeset_shell nodeset_cmdline nodeset_runimg nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index 3ab8926a8..bfbec794d 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -206,6 +206,7 @@ nodeset_cmdline nodeset_runimg redhat_migration1 redhat_migration2 +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index 7d731ecc9..e5ff83cf1 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -203,6 +203,7 @@ nodeset_check_warninginfo nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index 2a5935deb..0528fa834 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -297,6 +297,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index 24f9bb87e..27578b5ea 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -204,6 +204,7 @@ switchdiscover_range_z_V nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_statelite_installation_flat SN_setup_case reg_linux_diskfull_installation_hierarchy diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index 0b0b36ea0..f858555ad 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -209,6 +209,7 @@ nodeset_check_warninginfo nodeset_shell nodeset_cmdline nodeset_runimg +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat reg_linux_statelite_installation_flat SN_setup_case diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index d0dab7145..d0992c014 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -261,6 +261,7 @@ makentp_V makentp makentp_a nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index c4548264d..c4dbf5754 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -213,6 +213,7 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat packimage_m_cpio_c_gzip packimage_m_cpio_c_xz diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 8c1f9d50f..469a3527c 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -216,6 +216,7 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles sles_migration1 sles_migration2 reg_linux_statelite_installation_flat diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index 2ef6a799d..225f6cdad 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -213,6 +213,7 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles sles_migration1 sles_migration2 reg_linux_diskless_installation_flat diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index e4c01d5b3..00303edbc 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -252,3 +252,4 @@ xcatd_restart run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 0b405b1ae..5348d0ae6 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -269,3 +269,4 @@ rmdocker_command rmdocker_f_command lsdocker_h_command lsdocker_l_command +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index bc050eb58..02ba1c12f 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -252,3 +252,4 @@ xcatd_restart_systemd run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_ubuntu diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index cb7c8a4ce..aa69d806c 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -261,3 +261,4 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo +xcatconfig_u_check_xcatsslversion_ubuntu From e3f1ad04c7db346dac6133d7ac139a4eb9af6bc7 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 27 Oct 2016 05:32:18 -0400 Subject: [PATCH 021/292] add ubuntu migration test cases --- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 2 ++ xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 2 ++ xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 3 +++ xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 2 ++ 4 files changed, 9 insertions(+) diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 00303edbc..89789aa69 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -253,3 +253,5 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_ubuntu +ubuntule_migration1_p8le +ubuntule_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 5348d0ae6..1f2ce26ba 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -270,3 +270,5 @@ rmdocker_f_command lsdocker_h_command lsdocker_l_command xcatconfig_u_check_xcatsslversion_ubuntu +ubuntux_migration1_vm +ubuntux_migration2_vm diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 02ba1c12f..17244fa12 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -253,3 +253,6 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_ubuntu +ubuntule_migration1_p8le +ubuntule_migration2_p8le + diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index aa69d806c..2b2b1d6e4 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -262,3 +262,5 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_ubuntu +ubuntux_migration1_vm +ubuntux_migration2_vm From 97f6fc8083e21fd52facbb6abf2e7521d9b8b0a2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 31 Oct 2016 04:45:18 -0400 Subject: [PATCH 022/292] update xcattest completed --- xCAT-test/xcattest | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 7e35a5149..2155e04a6 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -17,7 +17,8 @@ use lib "$::XCATROOT/lib/perl"; my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $needhelp = 0; my $configinfo = undef; -my $configfile = "$rootdir/default.conf"; +#my $configfile = "$rootdir/default.conf"; +my $configfile = undef; my $casedir = "$rootdir/testcase"; my $bundledir = "$rootdir/bundle"; my $resultdir = "$rootdir/result"; @@ -768,7 +769,6 @@ sub loadcase if ($needshow) { if (@cases) { - log_this("Test cases:"); foreach my $case (@cases) { log_this("$case->{name}"); } @@ -1063,9 +1063,10 @@ sub usage log_this(" xcattest [-f configure file] [-t cases list]"); log_this(" xcattest [-f configure file] [-c cmds list]"); log_this("Show xcat test cases, bundle files, commands lists:"); - log_this(" xcattest [-f configure file] [-b case bundle files] [-l]"); - log_this(" xcattest [-f configure file] [-t cases list] [-l]"); - log_this(" xcattest [-f configure file] [-c cmds list] [-l]"); + log_this(" xcattest [-b case bundle files] [-l]"); + log_this(" xcattest [-t cases list] [-l]"); + log_this(" xcattest [-c cmds list] [-l]"); + log_this("Show all bundle files, all commands:"); log_this(" xcattest [-s command|bundle]"); log_this(""); return; @@ -1111,7 +1112,7 @@ sub listbundlefiles } close(FILE); if (!$skip){ - $bundlefilesinfo{$bundlefile} = "No description, add \"description: details\" in this bundle file"; + $bundlefilesinfo{$bundlefile} = "No description, add with \"description: details\" in bundle file"; } } &listformatbundleinfo(%bundlefilesinfo); @@ -1132,8 +1133,9 @@ sub listformatbundleinfo my $finallen = ($screenwidth > $desiredwidth ? $desiredwidth : $screenwidth); print "bundle files and descriptions:\n"; - - foreach my $filename (keys %bundlefilesinfo) { + + foreach my $filename (sort { $a cmp $b } keys %bundlefilesinfo ) { + # foreach my $filename (keys %bundlefilesinfo) { my @desc = split(" ", $bundlefilesinfo{$filename}); my $str = ""; my @formatdesc = (); @@ -1242,8 +1244,13 @@ sub checkoptions if (!defined($bundlelist) && !defined($caselist) && !defined($cmdlist) && !defined($showbundlesorcommands)) { log_this("Error: please define options correctly, see below usage information:"); return 1; + }elsif ((defined($bundlelist) || defined($caselist) || defined($cmdlist)) && (! $needshow) && !defined($configinfo)) { + #config file must be defined if the using -c,-b,-t to run test cases + log_this("Error: To run test cases, please define the config file with -f option"); + log_this(" To show test cases, please use the -l option"); + return 1; }elsif (defined($showbundlesorcommands) && (defined($bundlelist) || defined($caselist) || defined($cmdlist))) { - # -s can't be used together with -c,-b,-t + #-s can't be used together with -c,-b,-t log_this("Error: -b,-c or -t can't be used together with -s"); return 1; }elsif (defined($showbundlesorcommands) && $needshow) { @@ -1251,7 +1258,7 @@ sub checkoptions return 1; } - #check the L option, it only should be bundle or command + #check the -s option, the value should be bundle or command if (defined($showbundlesorcommands)) { if (($showbundlesorcommands ne "bundle") && ($showbundlesorcommands ne "command")) { log_this("Error: please use \"bundle\" or \"command\" as the \-s value"); @@ -1262,10 +1269,11 @@ sub checkoptions } $showcommandslist= 1; } + #get and check config file and System label #this System label means only the [System] variable will be loaded - if ($configinfo) { - if ($configinfo =~ /(.*):(.*)/) { + if (defined($configinfo)) { + if ($configinfo =~ /(.*):(.*)/) { $configfile = $1; $initallabel = $2; if ($initallabel ne $loadsysteminfo) { @@ -1275,11 +1283,10 @@ sub checkoptions }else { $configfile = $configinfo; } - } - - if (!(-e $configfile)) { - log_this("Error: Can't open config file: $configfile"); - return 1; + if (!(-e $configfile)) { + log_this("Error: Can't open config file: $configfile"); + return 1; + } } #check bundle files @@ -1288,12 +1295,12 @@ sub checkoptions foreach my $bundle (@bundles){ if ("$bundledir/$bundle" !~ /\.bundle$/) { log_this("Error: please input the .bundle file"); - log_this("Use 'xcattest -s bundle' to list out available bundles"); + log_this("Use 'xcattest -s bundle' to list all bundle files"); return 1; } if (!(-e "$bundledir/$bundle")) { log_this("Error: Can't open bundle file: $bundle"); - log_this("Use 'xcattest -b bundle' to list out available bundles"); + log_this("Use 'xcattest -s bundle' to list all bundle files"); return 1; } } From 444d223c88e668316c755dd38a72a744272c6a81 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 31 Oct 2016 10:10:08 -0400 Subject: [PATCH 023/292] Fix permissions on loadmlxeth script loadmlxeth was not executable, resulting in a broken udev rule for mellanox booting systems. --- xCAT-genesis-scripts/sbin/loadmlxeth | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 xCAT-genesis-scripts/sbin/loadmlxeth diff --git a/xCAT-genesis-scripts/sbin/loadmlxeth b/xCAT-genesis-scripts/sbin/loadmlxeth old mode 100644 new mode 100755 From 58fa0e86123220acf9216f14d11d53fa7f6ae581 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 20:52:23 -0400 Subject: [PATCH 024/292] - Added the :noboot option into the dhcpinterfaces keyword - cleaned up the text in the site table keyword and descriptions to prevent horizontal scrolling on RTD. --- perl-xCAT/xCAT/Schema.pm | 263 ++++++++++++++++++++------------------- 1 file changed, 132 insertions(+), 131 deletions(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 056437d7c..296ee634a 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -937,18 +937,18 @@ passed as argument rather than by table value', # Do not put description text past column 88, so it displays well in a 100 char wide window. # ----------------------------------------------------------------------------------|---------- - key => "Attribute Name: Description\n\n" . - " ------------\n" . - "AIX ATTRIBUTES\n" . - " ------------\n" . -" nimprime : The name of NIM server, if not set default is the AIX MN. - If Linux MN, then must be set for support of mixed cluster (TBD).\n\n" . + key => "Attribute Name: Description\n\n" . +" ------------\n" . +"AIX ATTRIBUTES\n" . +" ------------\n" . +" nimprime : The name of NIM server, if not set default is the AIX MN.\n" . +" If Linux MN, then must be set for support of mixed cluster (TBD).\n\n" . " useSSHonAIX: (yes/1 or no/0). Default is yes. The support for rsh/rcp is deprecated.\n" . " useNFSv4onAIX: (yes/1 or no/0). If yes, NFSv4 will be used with NIM. If no,\n" . - " NFSv3 will be used with NIM. Default is no.\n\n" . - " -----------------\n" . - "DATABASE ATTRIBUTES\n" . - " -----------------\n" . +" NFSv3 will be used with NIM. Default is no.\n\n" . +" -----------------\n" . +"DATABASE ATTRIBUTES\n" . +" -----------------\n" . " auditnosyslog: If set to 1, then commands will only be written to the auditlog table.\n" . " This attribute set to 1 and auditskipcmds=ALL means no logging of commands.\n" . " Default is to write to both the auditlog table and syslog.\n" . @@ -967,21 +967,26 @@ passed as argument rather than by table value', " excludenodes: A set of comma separated nodes and/or groups that would automatically\n" . " be subtracted from any noderange, it can be used for excluding some\n" . " failed nodes for any xCAT commands. See the 'noderange' manpage for\n" . - " details on supported formats.\n\n" . +" details on supported formats.\n\n" . " nodestatus: If set to 'n', the nodelist.status column will not be updated during\n" . -" the node deployment, node discovery and power operations. The default is to update.\n\n" . +" the node deployment, node discovery and power operations. The default\n" . +" is to update.\n\n" . " skiptables: Comma separated list of tables to be skipped by dumpxCATdb\n\n" . -" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog.\n\n" . - " -------------\n" . - "DHCP ATTRIBUTES\n" . - " -------------\n" . -" dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same\n" . -" for all nodes, use a simple comma-separated list of NICs. To\n" . -" specify different NICs for different nodes:\n" . - " xcatmn|eth1,eth2;service|bond0.\n" . -" In this example xcatmn is the name of the xCAT MN, and DHCP there\n" . -" should listen on eth1 and eth2. On all of the nodes in group\n" . -" 'service' DHCP should listen on the bond0 nic.\n\n" . +" skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not \n" . +" be logged in syslog.\n\n" . +" -------------\n" . +"DHCP ATTRIBUTES\n" . +" -------------\n" . +" dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same for all\n" . +" nodes, use a comma-separated list of the NICs. To specify different NICs\n" . +" for different nodes, use the format: \"xcatmn|eth1,eth2;service|bond0\", \n" . +" where xcatmn is the name of the management node, DHCP should listen on \n" . +" the eth1 and eth2 interfaces. All the nodes in group 'service' should \n" . +" listen on the 'bond0' interface.\n\n" . +" To disable the genesis kernel from being sent to specific interfaces, a\n" . +" ':noboot' option can be appended to the interface name. For example,\n" . +" if the management node has two interfaces, eth1 and eth2, disable\n" . +" genesis from being sent to eth1 using: \"eth1:noboot,eth2\".\n\n" . " dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd.\n\n" . " dhcplease: The lease time for the dhcp client. The default value is 43200.\n\n" . " disjointdhcps: If set to '1', the .leases file on a service node only contains\n" . @@ -993,78 +998,77 @@ passed as argument rather than by table value', " If set to 'static', the network configuration will be configured \n" . " in static mode based on the node and network definition on MN.\n" . " If set to 'dhcp', the network will be configured with dhcp protocol.\n" . - " The default is 'dhcp'.\n\n" . - " ------------\n" . - "DNS ATTRIBUTES\n" . - " ------------\n" . -" dnshandler: Name of plugin that handles DNS setup for makedns.\n" . - " domain: The DNS domain name used for the cluster.\n\n" . -" forwarders: The DNS servers at your site that can provide names outside of the\n" . -" cluster. The makedns command will configure the DNS on the management\n" . -" node to forward requests it does not know to these servers.\n" . -" Note that the DNS servers on the service nodes will ignore this value\n" . -" and always be configured to forward requests to the management node.\n\n" . +" The default is 'dhcp'.\n\n" . +" ------------\n" . +"DNS ATTRIBUTES\n" . +" ------------\n" . +" dnshandler: Name of plugin that handles DNS setup for makedns.\n\n" . +" domain: The DNS domain name used for the cluster.\n\n" . +" forwarders: The DNS servers at your site that can provide names outside of the cluster.\n" . +" The makedns command will configure the DNS on the management node to foward\n" . +" requests it does not know to these servers. Note that the DNS servers on the\n" . +" service nodes will ignore this value and always be configured to forward \n" . +" to the management node.\n\n" . " master: The hostname of the xCAT management node, as known by the nodes.\n\n" . -" nameservers: A comma delimited list of DNS servers that each node in the cluster\n" . -" should use. This value will end up in the nameserver settings of the\n" . +" nameservers: A comma delimited list of DNS servers that each node in the cluster should\n" . +" use. This value will end up in the nameserver settings of the\n" . " /etc/resolv.conf on each node. It is common (but not required) to set\n" . " this attribute value to the IP addr of the xCAT management node, if\n" . " you have set up the DNS on the management node by running makedns.\n" . " In a hierarchical cluster, you can also set this attribute to\n" . " \"\" to mean the DNS server for each node should be the\n" . " node that is managing it (either its service node or the management\n" . - " node).\n\n" . +" node).\n\n" . " externaldns: To specify that external dns is used. If externaldns is set to any value\n" . " then, makedns command will not start the local nameserver on xCAT MN. \n" . - " Default is to start the local nameserver.\n\n" . +" Default is to start the local nameserver.\n\n" . " dnsupdaters: The value are \',\' separated string which will be added to the zone config\n" . " section. This is an interface for user to add configuration entries to\n" . - " the zone sections in named.conf.\n\n" . -" dnsinterfaces: The network interfaces DNS server should listen on. If it is the same\n" . -" for all nodes, use a simple comma-separated list of NICs. To\n" . -" specify different NICs for different nodes:\n" . - " xcatmn|eth1,eth2;service|bond0.\n" . -" In this example xcatmn is the name of the xCAT MN, and DNS there\n" . -" should listen on eth1 and eth2. On all of the nodes in group\n" . -" 'service' DNS should listen on the bond0 nic.\n" . -" NOTE: if using this attribute to block certain interfaces, make sure\n" . -" the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to\n" . -" use this ip to communicate with the local NDS server on MN.\n\n" . - " -------------------------\n" . - "HARDWARE CONTROL ATTRIBUTES\n" . - " -------------------------\n" . +" the zone sections in named.conf.\n\n" . +" dnsinterfaces: The network interfaces DNS should listen on. If it is the same for all\n" . +" nodes, use a simple comma-separated list of NICs. To specify different \n" . +" NICs for different nodes, use the format: \"xcatmn|eth1,eth2;service|bond0\", \n" . +" where xcatmn is the name of the management node, and DNS should listen on\n" . +" the eth1 and eth2 interfaces. All the nods in group 'service' should \n" . +" listen on the 'bond0' interface.\n\n" . +" NOTE: If using this attribute to block certain interfaces, make sure\n" . +" the IP maps to your hostname of xCAT MN is not blocked since xCAT needs\n" . +" to use this IP to communicate with the local NDS server on MN.\n\n" . +" -------------------------\n" . +"HARDWARE CONTROL ATTRIBUTES\n" . +" -------------------------\n" . " blademaxp: The maximum number of concurrent processes for blade hardware control.\n\n" . " ea_primary_hmc: The hostname of the HMC that the Integrated Switch Network\n" . " Management Event Analysis should send hardware serviceable\n" . " events to for processing and potentially sending to IBM.\n\n" . " ea_backup_hmc: The hostname of the HMC that the Integrated Switch Network\n" . " Management Event Analysis should send hardware serviceable\n" . - " events to if the primary HMC is down.\n\n" . +" events to if the primary HMC is down.\n\n" . " enableASMI: (yes/1 or no/0). If yes, ASMI method will be used after fsp-api. If no,\n" . " when fsp-api is used, ASMI method will not be used. Default is no.\n\n" . " fsptimeout: The timeout, in milliseconds, to use when communicating with FSPs.\n\n" . " hwctrldispatch: Whether or not to send hw control operations to the service\n" . " node of the target nodes. Default is 'y'.(At present, this attribute\n" . - " is only used for IBM Flex System)\n\n" . +" is only used for IBM Flex System)\n\n" . " ipmidispatch: Whether or not to send ipmi hw control operations to the service\n" . " node of the target compute nodes. Default is 'y'.\n\n" . " ipmimaxp: The max # of processes for ipmi hw ctrl. The default is 64. Currently,\n" . - " this is only used for HP hw control.\n\n" . +" this is only used for HP hw control.\n\n" . " ipmiretries: The # of retries to use when communicating with BMCs. Default is 3.\n\n" . " ipmisdrcache: If set to 'no', then the xCAT IPMI support will not cache locally\n" . " the target node's SDR cache to improve performance.\n\n" . " ipmitimeout: The timeout to use when communicating with BMCs. Default is 2.\n" . - " This attribute is currently not used.\n\n" . +" This attribute is currently not used.\n\n" . " maxssh: The max # of SSH connections at any one time to the hw ctrl point for PPC\n" . " This parameter doesn't take effect on the rpower command.\n" . " It takes effects on other PPC hardware control command\n" . " getmacs/rnetboot/rbootseq and so on. Default is 8.\n\n" . -" syspowerinterval: For system p CECs, this is the number of seconds the rpower\n" . -" command will wait between performing the action for each CEC.\n" . -" For system x IPMI servers, this is the number of seconds the\n" . -" rpower command will wait between powering on \n" . -" nodes at a time. This value is used to control the power on speed\n" . - " in large clusters. Default is 0.\n\n" . +" syspowerinterval: For SystemP CECs, this is the number of seconds the rpower command\n" . +" will wait between performing the action for each CEC. For SystemX\n" . +" IPMI servers, this is the number of seconds the rpower command will\n" . +" wait between powering on nodes at a time. This\n" . +" value is used to control the power on speed in large clusters. \n" . +" Default is 0.\n\n" . " syspowermaxnodes: The number of servers to power on at one time before waiting\n" . " 'syspowerinterval' seconds to continue on to the next set of\n" . " nodes. If the noderange given to rpower includes nodes served\n" . @@ -1081,18 +1085,18 @@ passed as argument rather than by table value', " processes for PPC hardware control commands. Default is 64.\n\n" . " ppcretry: The max # of PPC hw connection attempts to HMC before failing.\n" . " It only takes effect on the hardware control commands through HMC. \n" . - " Default is 3.\n\n" . +" Default is 3.\n\n" . " ppctimeout: The timeout, in milliseconds, to use when communicating with PPC hw\n" . " through HMC. It only takes effect on the hardware control commands\n" . - " through HMC. Default is 0.\n\n" . +" through HMC. Default is 0.\n\n" . " snmpc: The snmp community string that xcat should use when communicating with the\n" . - " switches.\n\n" . - " ---------------------------\n" . - "INSTALL/DEPLOYMENT ATTRIBUTES\n" . - " ---------------------------\n" . +" switches.\n\n" . +" ---------------------------\n" . +"INSTALL/DEPLOYMENT ATTRIBUTES\n" . +" ---------------------------\n" . " cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n" . " directory on the stateless and statelite nodes after the\n" . - " postscripts are run. Default is no.\n\n" . +" postscripts are run. Default is no.\n\n" . " db2installloc: The location which the service nodes should mount for\n" . " the db2 code to install. Format is hostname:/path. If hostname is\n" . " omitted, it defaults to the management node. Default is /mntdb2.\n\n" . @@ -1100,18 +1104,18 @@ passed as argument rather than by table value', " defserialport: The default serial port - currently only used by mknb.\n\n" . " defserialspeed: The default serial speed - currently only used by mknb.\n\n" . " genmacprefix: When generating mac addresses automatically, use this manufacturing\n" . - " prefix (e.g. 00:11:aa)\n\n" . +" prefix (e.g. 00:11:aa)\n\n" . " genpasswords: Automatically generate random passwords for BMCs when configuring\n" . - " them.\n\n" . +" them.\n\n" . " installdir: The local directory name used to hold the node deployment packages.\n\n" . " installloc: The location from which the service nodes should mount the \n" . " deployment packages in the format hostname:/path. If hostname is\n" . " omitted, it defaults to the management node. The path must\n" . - " match the path in the installdir attribute.\n\n" . +" match the path in the installdir attribute.\n\n" . " iscsidir: The path to put the iscsi disks in on the mgmt node.\n\n" . " mnroutenames: The name of the routes to be setup on the management node.\n" . " It is a comma separated list of route names that are defined in the\n" . - " routes table.\n\n" . +" routes table.\n\n" . " runbootscripts: If set to 'yes' the scripts listed in the postbootscripts\n" . " attribute in the osimage and postscripts tables will be run during\n" . " each reboot of stateful (diskful) nodes. This attribute has no\n" . @@ -1127,44 +1131,43 @@ passed as argument rather than by table value', " sharedtftp: Set to 0 or no, xCAT should not assume the directory\n" . " in tftpdir is mounted on all on Service Nodes. Default is 1/yes.\n" . " If value is set to a hostname, the directory in tftpdir\n" . - " will be mounted from that hostname on the SN\n\n" . -" sharedinstall: Indicates if a shared file system will be used for installation\n" . -" resources. Possible values are: 'no', 'sns', or 'all'. 'no' \n" . -" means a shared file system is not being used. 'sns' means a\n" . -" shared filesystem is being used across all service nodes.\n" . -" 'all' means that the management as well as the service nodes\n" . -" are all using a common shared filesystem. The default is 'no'.\n" . +" will be mounted from that hostname on the SN\n\n" . +" sharedinstall: Indicates if a shared file system will be used for installation\n" . +" resources. Possible values are: 'no', 'sns', or 'all'. 'no' \n" . +" means a shared file system is not being used. 'sns' means a\n" . +" shared filesystem is being used across all service nodes.\n" . +" 'all' means that the management as well as the service nodes\n" . +" are all using a common shared filesystem. The default is 'no'.\n\n" . " xcatconfdir: Where xCAT config data is (default /etc/xcat).\n\n" . " xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques\n" . " to help user debug problems while using xCAT, especially on OS provision,\n" . " such as collecting logs of the whole installation process and accessing\n" . " the installing system via ssh, etc. These techniques will be enabled\n" . " according to different xCAT debug levels specified by 'xcatdebugmode',\n" . - " currently supported values:\n" . - " '0': disable debug mode\n" . - " '1': enable basic debug mode\n" . - " '2': enable expert debug mode\n" . +" currently supported values:\n" . +" '0': disable debug mode\n" . +" '1': enable basic debug mode\n" . +" '2': enable expert debug mode\n" . " For the details on 'basic debug mode' and 'expert debug mode',\n" . - " refer to xCAT documentation.\n\n" . - " --------------------\n" . - "REMOTESHELL ATTRIBUTES\n" . - " --------------------\n" . -" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n" . +" refer to xCAT documentation.\n\n" . +" --------------------\n" . +"REMOTESHELL ATTRIBUTES\n" . +" --------------------\n" . +" nodesyncfiledir: The directory on the node, where xdcp will rsync the files\n\n" . " SNsyncfiledir: The directory on the Service Node, where xdcp will rsync the files\n" . " from the MN that will eventually be rsync'd to the compute nodes.\n\n" . -" sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless root \n" . -" ssh during install, or xdsh -K. Default is ALLGROUPS.\n" . -" Set to NOGROUPS,if you do not wish to enabled any group of compute nodes.\n" . -" Service Nodes are not affected by this attribute\n" . - " they are always setup with\n" . -" passwordless root access to nodes and other SN.\n" . +" sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless\n" . +" root ssh to the nodes during install or running 'xdsh -K'. The default\n" . +" is ALLGROUPS. Set to NOGROUPS to disable.\n\n" . +" Service Nodes are not affected by this attribute as they are always\n" . +" configured with passwordless root access.\n" . " If using the zone table, this attribute in not used.\n\n" . - " -----------------\n" . - "SERVICES ATTRIBUTES\n" . - " -----------------\n" . +" -----------------\n" . +"SERVICES ATTRIBUTES\n" . +" -----------------\n" . " consoleondemand: When set to 'yes', conserver connects and creates the console\n" . -" output only when the user opens the console. Default is no on\n" . - " Linux, yes on AIX.\n\n" . +" output only when the user opens the console. Default is 'no' on\n" . +" Linux, 'yes' on AIX.\n\n" . " httpport: The port number that the booting/installing nodes should contact the\n" . " http server on the MN/SN on. It is your responsibility to configure\n" . " the http server to listen on that port - xCAT will not do that.\n\n" . @@ -1174,7 +1177,7 @@ passed as argument rather than by table value', " For example, if the network response time is too slow, nmap may not\n" . " give stable output. You can increase the timeout value by specifying \n" . " '--min-rtt-timeout 1s'. xCAT will append the options defined here to \n" . - " the nmap command.\n\n" . +" the nmap command.\n\n" . " ntpservers: A comma delimited list of NTP servers for the service node and\n" . " the compute node to sync with. The keyword means that\n" . " the node's NTP server is the node that is managing it\n" . @@ -1182,45 +1185,43 @@ passed as argument rather than by table value', " extntpservers: A comma delimited list of external NTP servers for the xCAT\n" . " management node to sync with. If it is empty, the NTP server\n" . " will use the management node's own hardware clock to calculate\n" . - " the system date and time\n\n" . -" svloglocal: if set to 1, syslog on the service node will not get forwarded to the\n" . - " mgmt node.\n\n" . - " timezone: (e.g. America/New_York)\n\n" . - " tftpdir: tftp directory path. Default is /tftpboot\n\n" . +" the system date and time\n\n" . +" svloglocal: If set to 1, syslog on the service node will not get forwarded to the\n" . +" management node.\n\n" . +" timezone: (e.g. America/New_York)\n\n" . +" tftpdir: The tftp directory path. Default is /tftpboot\n\n" . " tftpflags: The flags that used to start tftpd. Default is \'-v -l -s /tftpboot \n" . " -m /etc/tftpmapfile4xcat.conf\' if tftplfags is not set\n\n" . " useNmapfromMN: When set to yes, nodestat command should obtain the node status\n" . " using nmap (if available) from the management node instead of the\n" . " service node. This will improve the performance in a flat network.\n\n" . -" vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically\n" . -" bring up vsftpd. (You must manually install vsftpd before this.\n" . -" This setting does not apply to the service node. For sn\n" . -" you need to set servicenode.ftpserver=1 if you want xcatd to\n" . - " bring up vsftpd.\n\n" . -"FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts \n" . -" entries generated by 'makehosts' will put the FQDN before the PQDN(Partially \n" . -" Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n" . -"hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be\n" . -" included hierarchically. Attribute values for all the node's groups\n" . -" will be applied to the node in the groups' order except the repeat one.\n\n" . - " -----------------------\n" . - "VIRTUALIZATION ATTRIBUTES\n" . - " -----------------------\n" . -" usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the\n" . - " virtual network bridge up correctly.\n" . +" vsftp: Default is 'n'. If set to 'y', xcatd on the management node will automatically\n" . +" start vsftpd. (vsftpd must be installed by the admin). This setting does not\n" . +" apply to service nodes. For service nodes, set servicenode.ftpserver=1.\n\n" . +" FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts \n" . +" entries generated by 'makehosts' will put the FQDN before the PQDN(Partially \n" . +" Qualified Domain Name). Otherwise, the original behavior will be performed.\n\n" . +" hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be\n" . +" included hierarchically. Attribute values for all the node's groups\n" . +" will be applied to the node in the groups' order except the repeat one.\n\n" . +" -----------------------\n" . +"VIRTUALIZATION ATTRIBUTES\n" . +" -----------------------\n" . +" usexhrm: Have xCAT execute the xHRM script when booting up KVM guests to configure\n" . +" the virtual network bridge.\n\n" . " vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove\n" . " and add hypervisors while trying to perform operations. If users\n" . " or tasks outside of xCAT perform the joining this assures xCAT\n" . - " will not interfere.\n\n" . +" will not interfere.\n\n" . " vmwarereconfigonpower: When set to no, the VMWare plugin will make no effort to\n" . " push vm.cpus/vm.memory updates from xCAT to VMWare.\n\n" . " persistkvmguests: Keep the kvm definition on the kvm hypervisor when you power off\n" . " the kvm guest node. This is useful for you to manually change the \n" . " kvm xml definition file in virsh for debugging. Set anything means\n" . - " enable.\n\n" . - " --------------------\n" . - "XCAT DAEMON ATTRIBUTES\n" . - " --------------------\n" . +" enable.\n\n" . +" --------------------\n" . +"XCAT DAEMON ATTRIBUTES\n" . +" --------------------\n" . " useflowcontrol: (yes/1 or no/0). If yes, the postscript processing on each node\n" . " contacts xcatd on the MN/SN using a lightweight UDP packet to wait\n" . " until xcatd is ready to handle the requests associated with\n" . @@ -1228,9 +1229,9 @@ passed as argument rather than by table value', " locking out admin interactive use. This value works with the\n" . " xcatmaxconnections and xcatmaxbatch attributes. Is not supported on AIX.\n" . " If the value is no, nodes sleep for a random time before contacting\n" . - " xcatd, and retry. The default is no.\n" . - " See the following document for details:\n" . - " Hints_and_Tips_for_Large_Scale_Clusters\n\n" . +" xcatd, and retry. The default is no.\n" . +" See the following document for details:\n" . +" Hints_and_Tips_for_Large_Scale_Clusters\n\n" . " xcatmaxconnections: Number of concurrent xCAT protocol requests before requests\n" . " begin queueing. This applies to both client command requests\n" . " and node requests, e.g. to get postscripts. Default is 64.\n\n" . @@ -1240,7 +1241,7 @@ passed as argument rather than by table value', " xcatiport: The port used by xcatd to receive install status updates from nodes.\n\n" . " xcatlport: The port used by xcatd command log writer process to collect command output.\n\n" . " xcatsslversion: The ssl version by xcatd. Default is SSLv3.\n\n" . - " xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n", +" xcatsslciphers: The ssl cipher by xcatd. Default is 3DES.\n\n", value => 'The value of the attribute specified in the "key" column.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", From f2eeaa37eb3b8d1d1b1eca01f39d6cbdf7e4053a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 31 Oct 2016 22:10:43 -0400 Subject: [PATCH 025/292] Better message wording (#2048) --- xCAT-probe/subcmds/osimagecheck | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/osimagecheck b/xCAT-probe/subcmds/osimagecheck index ea3c51611..071a6d3ef 100755 --- a/xCAT-probe/subcmds/osimagecheck +++ b/xCAT-probe/subcmds/osimagecheck @@ -167,7 +167,9 @@ sub check_for_valid_osimage_attributes { if (($template_file =~ /compute.tmpl/) || ($template_file =~ /service.tmpl/)) { if ($template_file !~ /ubuntu/) { # Skip Ubintu osimages, currently ok to have service.tmpl and compute.tmpl for them - probe_utils->send_msg("$output", "w", "$osimage_name contains depricated 'template' value \n $template_file"); + probe_utils->send_msg("$output", "w", "Default 'template' value is being used by $osimage_name \n". + " If this image was generated by 'copycds -n ', make sure the specified\n". + " follows xCAT naming convention (for example 'rhels7.2')"); } } } From 331d7868fa5553d30daba3ec4be93279de7d6f84 Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 1 Nov 2016 10:14:54 +0800 Subject: [PATCH 026/292] Set value to '' if value within composite primary keys not defined (#2045) As history reasons, null value is always set within the composite primary keys, this patch is just a work aroud for the issue encountered on postgres. Correct fix is to report error to the client side, but too much error handler is missing in xcat code close-issue: #2037 close-issue: #2007 --- perl-xCAT/xCAT/Table.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index c45f1db6e..a97fbf7c0 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -1722,6 +1722,16 @@ sub setAttribs @bind = (); $cols = ""; my %newpairs; + # NOTE(chenglch): Just work around, set the default value to '' due to + # null value can not be allowed in composite primary keys in standard + # SQL rules. + my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; + my @pkeys = @{$descr->{keys}}; + for my $p (@pkeys) { + if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { + $elems->{$p}= ''; + } + } #first, merge the two structures to a single hash foreach (keys %keypairs) From 4e89b7545473c552a54d2c62ae46c8a7b342e627 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Tue, 1 Nov 2016 10:15:51 +0800 Subject: [PATCH 027/292] auto recognize rhhpc iso on copycds (#2034) --- xCAT-server/lib/xcat/plugins/anaconda.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 01fd184e9..a2a37be24 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2257,6 +2257,17 @@ sub copycd # my @rhel_version = split / /, $desc; $distname = "rhels" . $rhel_version[4]; + open($dinfo, $mntpath . "/.treeinfo"); + while (<$dinfo>) { + chomp($_); + s/\s+$//; #remove trailing spaces + next if /^\s*$/; #-- skip empty lines + if ($_ =~ /variant = ComputeNode/) { + $distname = "rhelhpc" . $rhel_version[4]; + last; + } + } + close($dinfo); } else { From 9dc963578c5bca0830651d53b72e41a52244121c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 22:23:16 -0400 Subject: [PATCH 028/292] Add the autogenerated man pages --- .../references/man1/packimage.1.rst | 2 +- .../admin-guides/references/man5/site.5.rst | 142 +++++++++--------- 2 files changed, 74 insertions(+), 70 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index 5be66f428..f7f1ff332 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -33,7 +33,7 @@ DESCRIPTION Packs the stateless image from the chroot file system into a file to be sent to the node for a diskless boot. -Note: For an osimage that is deployed on a cluster, running packimage will overwrite the existing rootimage file and be unavailable to the compute nodes while the command executes. +Note: For an osimage that is deployed on a cluster, running packimage will overwrite the existing rootimage file and be unavailable to the compute nodes while packimage is running. ********** diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 0b547c409..bfdd13269 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -82,22 +82,28 @@ site Attributes: details on supported formats. nodestatus: If set to 'n', the nodelist.status column will not be updated during - the node deployment, node discovery and power operations. The default is to update. + the node deployment, node discovery and power operations. The default + is to update. skiptables: Comma separated list of tables to be skipped by dumpxCATdb - skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not be logged in syslog. + skipvalidatelog: If set to 1, then getcredentials and getpostscripts calls will not + be logged in syslog. ------------- DHCP ATTRIBUTES ------------- - dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same - for all nodes, use a simple comma-separated list of NICs. To - specify different NICs for different nodes: - xcatmn|eth1,eth2;service|bond0. - In this example xcatmn is the name of the xCAT MN, and DHCP there - should listen on eth1 and eth2. On all of the nodes in group - 'service' DHCP should listen on the bond0 nic. + dhcpinterfaces: The network interfaces DHCP should listen on. If it is the same for all + nodes, use a comma-separated list of the NICs. To specify different NICs + for different nodes, use the format: "xcatmn|eth1,eth2;service|bond0", + where xcatmn is the name of the management node, DHCP should listen on + the eth1 and eth2 interfaces. All the nodes in group 'service' should + listen on the 'bond0' interface. + + To disable the genesis kernel from being sent to specific interfaces, a + ':noboot' option can be appended to the interface name. For example, + if the management node has two interfaces, eth1 and eth2, disable + genesis from being sent to eth1 using: "eth1:noboot,eth2". dhcpsetup: If set to 'n', it will skip the dhcp setup process in the nodeset cmd. @@ -120,18 +126,19 @@ site Attributes: DNS ATTRIBUTES ------------ dnshandler: Name of plugin that handles DNS setup for makedns. + domain: The DNS domain name used for the cluster. - forwarders: The DNS servers at your site that can provide names outside of the - cluster. The makedns command will configure the DNS on the management - node to forward requests it does not know to these servers. - Note that the DNS servers on the service nodes will ignore this value - and always be configured to forward requests to the management node. + forwarders: The DNS servers at your site that can provide names outside of the cluster. + The makedns command will configure the DNS on the management node to foward + requests it does not know to these servers. Note that the DNS servers on the + service nodes will ignore this value and always be configured to forward + to the management node. master: The hostname of the xCAT management node, as known by the nodes. - nameservers: A comma delimited list of DNS servers that each node in the cluster - should use. This value will end up in the nameserver settings of the + nameservers: A comma delimited list of DNS servers that each node in the cluster should + use. This value will end up in the nameserver settings of the /etc/resolv.conf on each node. It is common (but not required) to set this attribute value to the IP addr of the xCAT management node, if you have set up the DNS on the management node by running makedns. @@ -148,16 +155,16 @@ site Attributes: section. This is an interface for user to add configuration entries to the zone sections in named.conf. - dnsinterfaces: The network interfaces DNS server should listen on. If it is the same - for all nodes, use a simple comma-separated list of NICs. To - specify different NICs for different nodes: - xcatmn|eth1,eth2;service|bond0. - In this example xcatmn is the name of the xCAT MN, and DNS there - should listen on eth1 and eth2. On all of the nodes in group - 'service' DNS should listen on the bond0 nic. - NOTE: if using this attribute to block certain interfaces, make sure - the ip maps to your hostname of xCAT MN is not blocked since xCAT needs to - use this ip to communicate with the local NDS server on MN. + dnsinterfaces: The network interfaces DNS should listen on. If it is the same for all + nodes, use a simple comma-separated list of NICs. To specify different + NICs for different nodes, use the format: "xcatmn|eth1,eth2;service|bond0", + where xcatmn is the name of the management node, and DNS should listen on + the eth1 and eth2 interfaces. All the nods in group 'service' should + listen on the 'bond0' interface. + + NOTE: If using this attribute to block certain interfaces, make sure + the IP maps to your hostname of xCAT MN is not blocked since xCAT needs + to use this IP to communicate with the local NDS server on MN. ------------------------- HARDWARE CONTROL ATTRIBUTES @@ -200,12 +207,12 @@ site Attributes: It takes effects on other PPC hardware control command getmacs/rnetboot/rbootseq and so on. Default is 8. - syspowerinterval: For system p CECs, this is the number of seconds the rpower - command will wait between performing the action for each CEC. - For system x IPMI servers, this is the number of seconds the - rpower command will wait between powering on - nodes at a time. This value is used to control the power on speed - in large clusters. Default is 0. + syspowerinterval: For SystemP CECs, this is the number of seconds the rpower command + will wait between performing the action for each CEC. For SystemX + IPMI servers, this is the number of seconds the rpower command will + wait between powering on nodes at a time. This + value is used to control the power on speed in large clusters. + Default is 0. syspowermaxnodes: The number of servers to power on at one time before waiting 'syspowerinterval' seconds to continue on to the next set of @@ -291,12 +298,13 @@ site Attributes: If value is set to a hostname, the directory in tftpdir will be mounted from that hostname on the SN - sharedinstall: Indicates if a shared file system will be used for installation - resources. Possible values are: 'no', 'sns', or 'all'. 'no' - means a shared file system is not being used. 'sns' means a - shared filesystem is being used across all service nodes. - 'all' means that the management as well as the service nodes - are all using a common shared filesystem. The default is 'no'. + sharedinstall: Indicates if a shared file system will be used for installation + resources. Possible values are: 'no', 'sns', or 'all'. 'no' + means a shared file system is not being used. 'sns' means a + shared filesystem is being used across all service nodes. + 'all' means that the management as well as the service nodes + are all using a common shared filesystem. The default is 'no'. + xcatconfdir: Where xCAT config data is (default /etc/xcat). xcatdebugmode: the xCAT debug level. xCAT provides a batch of techniques @@ -315,23 +323,24 @@ site Attributes: REMOTESHELL ATTRIBUTES -------------------- nodesyncfiledir: The directory on the node, where xdcp will rsync the files + SNsyncfiledir: The directory on the Service Node, where xdcp will rsync the files from the MN that will eventually be rsync'd to the compute nodes. - sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless root - ssh during install, or xdsh -K. Default is ALLGROUPS. - Set to NOGROUPS,if you do not wish to enabled any group of compute nodes. - Service Nodes are not affected by this attribute - they are always setup with - passwordless root access to nodes and other SN. + sshbetweennodes: Comma separated list of groups of compute nodes to enable passwordless + root ssh to the nodes during install or running 'xdsh -K'. The default + is ALLGROUPS. Set to NOGROUPS to disable. + + Service Nodes are not affected by this attribute as they are always + configured with passwordless root access. If using the zone table, this attribute in not used. ----------------- SERVICES ATTRIBUTES ----------------- consoleondemand: When set to 'yes', conserver connects and creates the console - output only when the user opens the console. Default is no on - Linux, yes on AIX. + output only when the user opens the console. Default is 'no' on + Linux, 'yes' on AIX. httpport: The port number that the booting/installing nodes should contact the http server on the MN/SN on. It is your responsibility to configure @@ -355,12 +364,12 @@ site Attributes: will use the management node's own hardware clock to calculate the system date and time - svloglocal: if set to 1, syslog on the service node will not get forwarded to the - mgmt node. + svloglocal: If set to 1, syslog on the service node will not get forwarded to the + management node. timezone: (e.g. America/New_York) - tftpdir: tftp directory path. Default is /tftpboot + tftpdir: The tftp directory path. Default is /tftpboot tftpflags: The flags that used to start tftpd. Default is '-v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf' if tftplfags is not set @@ -369,29 +378,24 @@ site Attributes: using nmap (if available) from the management node instead of the service node. This will improve the performance in a flat network. - vsftp: Default is 'n'. If set to 'y', the xcatd on the mn will automatically - bring up vsftpd. (You must manually install vsftpd before this. - This setting does not apply to the service node. For sn - you need to set servicenode.ftpserver=1 if you want xcatd to - bring up vsftpd. - - - FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts - entries generated by 'makehosts' will put the FQDN before the PQDN(Partially - Qualified Domain Name). Otherwise, the original behavior will be performed. - - hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be - included hierarchically. Attribute values for all the node's groups - will be applied to the node in the groups' order except the repeat one. - - - .. code-block:: perl - + vsftp: Default is 'n'. If set to 'y', xcatd on the management node will automatically + start vsftpd. (vsftpd must be installed by the admin). This setting does not + apply to service nodes. For service nodes, set servicenode.ftpserver=1. + + FQDNfirst: Fully Qualified Domain Name first. If set to 1/yes/enable, the /etc/hosts + entries generated by 'makehosts' will put the FQDN before the PQDN(Partially + Qualified Domain Name). Otherwise, the original behavior will be performed. + + hierarchicalattrs: Table attributes(e.g. postscripts, postbootscripts) that will be + included hierarchically. Attribute values for all the node's groups + will be applied to the node in the groups' order except the repeat one. + ----------------------- VIRTUALIZATION ATTRIBUTES ----------------------- - usexhrm: Have xCAT run its xHRM script when booting up KVM guests to set the - virtual network bridge up correctly. + usexhrm: Have xCAT execute the xHRM script when booting up KVM guests to configure + the virtual network bridge. + vcenterautojoin: When set to no, the VMWare plugin will not attempt to auto remove and add hypervisors while trying to perform operations. If users or tasks outside of xCAT perform the joining this assures xCAT From 5abb24af167654210c8d6973d4b859689862c1c6 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 31 Oct 2016 22:23:28 -0400 Subject: [PATCH 029/292] Add some text describing the noboot option to disable the genesis kernel from being sent over a interface --- .../ppc64le/configure/networks.rst | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index 1c7f6b28d..c7124b018 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -12,15 +12,19 @@ Set attributes in the ``networks`` table #. To define additional networks, use one of the following options: - * Use ``mkdef`` to create/update an entry into ``networks`` table. (**Recommended**) + * (**Recommended**) Use ``mkdef`` to create/update an entry into ``networks`` table. To create a network entry for 192.168.X.X/16 with a gateway of 192.168.1.254: :: mkdef -t network -o net1 net=192.168.0.0 mask=255.255.0.0 gateway=192.168.1.254 - * Use the ``tabedit`` command to modify the networks table directly in an editor: ``tabedit networks`` + * Use the ``tabedit`` command to modify the networks table directly in an editor: :: - * Use the ``makenetworks`` command to automatically generate a entry in the ``networks`` table + tabedit networks + + * Use the ``makenetworks`` command to automatically generate a entry in the ``networks`` table: :: + + makenetworks #. Verify the network statements @@ -33,13 +37,23 @@ Initialize DHCP services #. Configure DHCP to listen on different network interfaces (**Optional**) - xCAT allows specifying different network intercaces thateDHCP can listen on for different nodes or node groups. If this is not needed, go to the next step. To set dhcpinterfaces :: + The ``dhcpinterfaces`` keyword allows users to specify or limit the DHCP to listen over certain network interfaces. - chdef -t site dhcpinterfaces='xcatmn|eth1,eth2;service|bond0' + If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` with: :: + chdef -t site dhcpinterfaces="eth1,eth3" + + To set "eth1" and "eth3" on the management node, and "bond0" on all the nodes in the "service" nodegroup, set ``dhcpinterfaces`` with: :: + + chdef -t site dhcpinterfaces="xcatmn|eth1,eth3;service|bond0" + + [**noboot**]: For the IBM OpenPower S822LC for HPC ("Minsky") nodes, the BMC and "eth0" on the compute side shares the same physical ethernet port. However, it is recommended to allow the BMC to be dedicated and to use "eth1" for the compute node. When an open range is configured on the two networks, the xCAT Genesis Kernel will be sent to the BMC interface and will cause problems with discovery. In this scenario, if "eth1" is the BMC network and "eth3" is the compute network, disabled genesis by setting ``:noboot`` in ``dhcpinterfaces`` with: :: + + chdef -t site dhcpinterfaces="eth1:noboot,eth3" + + For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. - #. Create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: makedhcp -n From c3dfe43b72a105e9078574143631a8e105995d26 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 31 Oct 2016 23:30:33 -0400 Subject: [PATCH 030/292] update docoment and man page --- .../references/man1/xcattest.1.rst | 30 +++++++++++----- xCAT-test/pods/man1/xcattest.1.pod | 34 +++++++++++++------ 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst index e09fd2e9e..e3b56aff0 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -21,11 +21,21 @@ SYNOPSIS \ **xcattest**\ [\ **-?|-h**\ ] -\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-b**\ \ *case bundle list*\ ] [\ **-l**\ ] +\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-b**\ \ *case bundle list*\ ] \ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-t**\ \ *case list*\ ] -\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-c**\ \ *cmd list*\ ] [\ **-l**\ ] +\ **xcattest**\ [\ **-f**\ \ *configure file*\ ] [\ **-c**\ \ *cmd list*\ ] + +\ **xcattest**\ [\ **-b**\ \ *case bundle list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-t**\ \ *case list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-c**\ \ *cmd list*\ ] [\ **-l**\ ] + +\ **xcattest**\ [\ **-s**\ \ *command*\ ] + +\ **xcattest**\ [\ **-s**\ \ *bundle*\ ] *********** @@ -52,7 +62,7 @@ OPTIONS \ **-f**\ \ *configure file*\ - Specifies the configuration file, if not specified, the default configure file is /opt/xcat/share/xcat/tools/autotest/default.conf. +Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template @@ -79,7 +89,9 @@ OPTIONS Display the test cases names specified by the flag -b, -t or -c. +\ **-s**\ + Display the bundle files and command with value: bundle or command. ************ RETURN VALUE @@ -136,33 +148,33 @@ EXAMPLES .. code-block:: perl - xcattest -c /tmp/config -c rpower + xcattest -f /tmp/config -c rpower 2. - To run customized bundle: + To run customized bundle with /tmp/config file: .. code-block:: perl - xcattest -l > /tmp/custom.bundle + xcattest -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle - xcattest -b custom.bundle + xcattest -f /tmp/config -b custom.bundle 3. - To run specified test cases. + To run specified test cases with /tmp/config: .. code-block:: perl - xcattest -t lsdef_t_o_l_z + xcattest -f /tmp/config -t lsdef_t_o_l_z diff --git a/xCAT-test/pods/man1/xcattest.1.pod b/xCAT-test/pods/man1/xcattest.1.pod index 773326908..5dba9d902 100644 --- a/xCAT-test/pods/man1/xcattest.1.pod +++ b/xCAT-test/pods/man1/xcattest.1.pod @@ -6,11 +6,21 @@ B - Run automated xCAT test cases. B [B<-?|-h>] -B [B<-f> I] [B<-b> I] [B<-l>] +B [B<-f> I] [B<-b> I] B [B<-f> I] [B<-t> I] -B [B<-f> I] [B<-c> I] [B<-l>] +B [B<-f> I] [B<-c> I] + +B [B<-b> I] [B<-l>] + +B [B<-t> I] [B<-l>] + +B [B<-c> I] [B<-l>] + +B [B<-s> B] + +B [B<-s> B] =head1 DESCRIPTION @@ -28,11 +38,11 @@ Display usage message. =item B<-f> I -Specifies the configuration file, if not specified, the default configure file is /opt/xcat/share/xcat/tools/autotest/default.conf. +Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template =item B<-b> I -Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. +Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. The bundle files should be listed in: /opt/xcat/share/xcat/tools/autotest/bundle. =item B<-t> I @@ -46,6 +56,10 @@ Comma separated list of commands which will be tested, i.e., all the test cases Display the test cases names specified by the flag -b, -t or -c. +=item B<-s> + +Display the bundle files and command with value: bundle or command. + =back =head1 RETURN VALUE @@ -86,21 +100,21 @@ B: Each test case can have more than one I sections and each I s To run all test cases related command rpower: - xcattest -c /tmp/config -c rpower + xcattest -f /tmp/config -c rpower =item 2. -To run customized bundle: +To run customized bundle with /tmp/config file: - xcattest -l > /tmp/custom.bundle + xcattest -c lsdef -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle - xcattest -b custom.bundle + xcattest -f /tmp/config -b custom.bundle =item 3. -To run specified test cases. +To run specified test cases with /tmp/config file: - xcattest -t lsdef_t_o_l_z + xcattest -f /tmp/config -t lsdef_t_o_l_z =item 4. From 6c8e7befd08be1f439764d9d8fdd81a02ee2c84b Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 30 Oct 2016 22:17:00 -0400 Subject: [PATCH 031/292] fix issue 2051, update noderange check --- xCAT-probe/subcmds/discovery | 34 +++++++++++++++++++++++----------- xCAT-probe/subcmds/osdeploy | 2 +- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 28f71bb7c..73876fd1f 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -170,14 +170,14 @@ sub check_pre_defined_node { @cmdoutput = `lsdef $noderange 2>&1`; foreach (@cmdoutput) { - if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) { + if ($_ =~ /^Error: Could not find an object named '(.+)' of type .+/i) { $currentnode = $1; push @errornodes, $currentnode; $rst = 1; } elsif ($_ =~ /^\s*Object name: (\w+)/i) { $currentnode = $1; $monitor_nodes{$1} = 0; - } elsif ($_ =~ /^\s+(\w+)\s*=\s*(\w+)/) { + } elsif ($_ =~ /^\s+(\w+)\s*=\s*(.*)/) { $nodecheckrst{$currentnode}{$1} = $2; } } @@ -284,15 +284,24 @@ sub check_pre_defined_node { } my %switch_node = (); - my @switchoutput = `tabdump switch`; - foreach my $switch_line (@switchoutput) { - next if ($switch_line =~ /#node,switch,port,vlan,interface,comments,disable/); - chomp ($switch_line); - $switch_line =~ s/"//g; - my @split_switch = split(",", $switch_line); - if (($split_switch[1] ne "") and ($split_switch[2] ne "")) { - my $switchport = "$split_switch[1]*$split_switch[2]"; - push @{ $switch_node{$switchport} }, $split_switch[0]; + my @switchoutput = `lsdef -t node -i switch,switchport -c 2>&1`; + my $node_s; + my $node_p; + my $switch; + my $port; + foreach (@switchoutput) { + chomp($_); + $_ =~ s/^\s+|\s+$//g; + if ($_ =~ /(\S+):\s+switch=(.*)/i) { + $node_s = $1; + $switch = $2; + } elsif ($_ =~ /(\S+):\s+switchport=(.*)/i) { + $node_p = $1; + $port = $2; + } + if (($node_s eq $node_p) and $switch and $port) { + my $switchport = "$switch*$port"; + push @{ $switch_node{$switchport} }, $node_s; } } @@ -1283,6 +1292,9 @@ sub handle_http_msg { if ($log_ref->{msg} =~ /GET\s+(.+)\s+HTTP.+/ or $log_ref->{msg} =~ /HEAD\s+(.+)\s+HTTP.+/) { my $file = $1; my $record = "Via HTTP $ip get $file"; + if ($file =~ /\/install\//i) { + return; + } probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index ff8e927f6..63231b5e2 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -253,7 +253,7 @@ sub check_noderange { foreach (@cmdoutput) { chomp($_); $_ =~ s/^\s+|\s+$//g; - if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) { + if ($_ =~ /^Error: Could not find an object named '(.+)' of type .+/i) { $rst = 1; push @$error_ref, "Node $1 without node definition"; } elsif ($_ =~ /(\S+):\s+mac=(.*)/i) { From e72fb85ea7b01e0e5697cb15d067fad80376afb7 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 1 Nov 2016 09:47:51 -0400 Subject: [PATCH 032/292] Made some changes based on review comments - Reformatted the DHCP section - Created a section for noboot so that we can link this in our Release Notes --- .../ppc64le/configure/networks.rst | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index c7124b018..b199866d2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -12,7 +12,7 @@ Set attributes in the ``networks`` table #. To define additional networks, use one of the following options: - * (**Recommended**) Use ``mkdef`` to create/update an entry into ``networks`` table. + * [**Recommended**] Use ``mkdef`` to create/update an entry into ``networks`` table. To create a network entry for 192.168.X.X/16 with a gateway of 192.168.1.254: :: @@ -35,26 +35,33 @@ Set attributes in the ``networks`` table Initialize DHCP services ------------------------ -#. Configure DHCP to listen on different network interfaces (**Optional**) +Configure DHCP to listen on different network interfaces [**Optional**] - The ``dhcpinterfaces`` keyword allows users to specify or limit the DHCP to listen over certain network interfaces. + The default behavior of xCAT is to configure DHCP to listen on all interfaces defined in the ``networks`` table. - If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` with: :: + The ``dhcpinterfaces`` keyword in the ``site`` table allows administrators to limit the interfaces that DHCP will listen over. If the management node has 4 interfaces, (eth0, eth1, eth2, and eth3), and you want DHCP to listen only on "eth1" and "eth3", set ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1,eth3" - To set "eth1" and "eth3" on the management node, and "bond0" on all the nodes in the "service" nodegroup, set ``dhcpinterfaces`` with: :: + To set "eth1" and "eth3" on the management node and "bond0" on all nodes in the nodegroup="service", set ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="xcatmn|eth1,eth3;service|bond0" - [**noboot**]: For the IBM OpenPower S822LC for HPC ("Minsky") nodes, the BMC and "eth0" on the compute side shares the same physical ethernet port. However, it is recommended to allow the BMC to be dedicated and to use "eth1" for the compute node. When an open range is configured on the two networks, the xCAT Genesis Kernel will be sent to the BMC interface and will cause problems with discovery. In this scenario, if "eth1" is the BMC network and "eth3" is the compute network, disabled genesis by setting ``:noboot`` in ``dhcpinterfaces`` with: :: +**noboot** +`````````` + For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-size integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1:noboot,eth3" - - For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. + # run the mknb command to remove the genesis + # configuration file for the specified network + mknb ppc64 -#. Create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: + +For more information, see ``dhcpinterfaces`` keyword in the :doc:`site ` table. + + +After making any DHCP changes, create a new DHCP configuration file with the networks defined using the ``makedhcp`` command. :: makedhcp -n From a49db1c4ffb92025169660028115f3899138d1c1 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Wed, 2 Nov 2016 10:45:26 +0800 Subject: [PATCH 033/292] fix nodediscoverls output limits serial length (#2032) --- xCAT-server/lib/xcat/plugins/seqdiscovery.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index fc668a0af..3bc482215 100755 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -909,7 +909,7 @@ Usage: } else { $ent->{'node'} = 'undef' unless ($ent->{'node'}); $ent->{'method'} = 'undef' unless ($ent->{'method'}); - push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-13s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 12)); + push @discoverednodes, sprintf(" %-40s%-20s%-15s%-10s%-20s", $ent->{'uuid'}, $ent->{'node'}, $ent->{'method'}, $ent->{'mtm'}, substr($ent->{'serial'}, 0, 19)); } } From 15e2a17a8be4c761edd7c916ef0ea4194d5fe2bc Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 2 Nov 2016 01:03:07 -0400 Subject: [PATCH 034/292] move rsyslogd restart code from dhclient-script to doxcat --- xCAT-genesis-builder/dhclient-script | 20 -------------- xCAT-genesis-scripts/bin/doxcat | 40 +++++++++++++++------------- 2 files changed, 22 insertions(+), 38 deletions(-) diff --git a/xCAT-genesis-builder/dhclient-script b/xCAT-genesis-builder/dhclient-script index 25291afe7..fcf51c9ac 100755 --- a/xCAT-genesis-builder/dhclient-script +++ b/xCAT-genesis-builder/dhclient-script @@ -36,26 +36,6 @@ elif [ $reason = "BOUND" ]; then for gw in $new_routers; do ip route add default via $gw done - # Up to this point we were logging to the local /var/log/xcat.genesis - # file. But now we know the xCAT MN, so replace logging to the local - # file with logging to the xCAT MN - if [ ! -z "$new_log_servers" ]; then - head -n -1 /etc/rsyslog.conf > /etc/rsyslog.conf.new - cp /etc/rsyslog.conf.new /etc/rsyslog.conf - fi - for ls in $new_log_servers; do - echo "*.* @$ls" >> /etc/rsyslog.conf - done - kill `cat /var/run/syslogd.pid` - sleep 3 - RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` - if [ $RSYSLOGD_VERSION -ge 8 ]; then - # Newer versions of rsyslogd do not support -c flag anymore - /sbin/rsyslogd - else - /sbin/rsyslogd -c4 - fi - if [ ! -z "$new_tcode" -a -r "/usr/share/zoneinfo/posix/$new_tcode" ]; then cp "/usr/share/zoneinfo/posix/$new_tcode" /etc/localtime diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 794e57534..9c052b313 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -169,6 +169,10 @@ export XCATMASTER logger -s -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT" +head -n -1 /etc/rsyslog.conf > /etc/rsyslog.conf.new +cp /etc/rsyslog.conf.new /etc/rsyslog.conf +echo "*.* @$XCATMASTER" >> /etc/rsyslog.conf + if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then # doing static ip # the device was determined above from the bootif mac, and put in bootnic @@ -253,21 +257,6 @@ else fi fi -count_f=0 -while [ $count_f -le 8 ]; do - rsyslogd_ps=`ps -ef | grep 'rsyslogd' | grep -v 'grep'` - if [ "$rsyslogd_ps" ]; then - break - else - ((count_f++)) - sleep 0.5 - fi -done - -if [ $count_f -gt 8 ]; then - echo "rsyslogd maybe off" -fi - openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" @@ -282,9 +271,19 @@ fi # rv 0 state does not work with the new ntp versions while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do + echo `ntpq -c 'rv 0 offset` sleep 1 done +kill `cat /var/run/syslogd.pid` +sleep 3 +RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` +if [ $RSYSLOGD_VERSION -ge 8 ]; then + /sbin/rsyslogd +else + /sbin/rsyslogd -c4 +fi + HOST_ARCH=`uname -m` if echo $HOST_ARCH | grep "ppc64"; then modprobe ipmi_powernv @@ -331,6 +330,7 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' + touch /tmp/xcatgenesisdiscovery elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -391,16 +391,20 @@ while :; do destiny='' dest='' elif [ "$dest" = standby ]; then - destiny='' - dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + if [ -e "/tmp/xcatgenesisdiscovery" ]; then + logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" + else + logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + fi fi delay=$((delay-1)) sleep 1 done + destiny='' + dest='' echo "Retrying "; elif [ "$dest" = shutdown ]; then logger -s -t $log_label -p local4.info "Poweroff..." From 15eeb3b2d50af3b9190890153e539baf04cefd3d Mon Sep 17 00:00:00 2001 From: chenglch Date: Wed, 2 Nov 2016 15:20:08 +0800 Subject: [PATCH 035/292] Skit auditlog and eventlog table as auto increment key is uesd (#2066) Close-issue: #2065 --- perl-xCAT/xCAT/Table.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index a97fbf7c0..67b1b2b8f 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -1724,12 +1724,15 @@ sub setAttribs my %newpairs; # NOTE(chenglch): Just work around, set the default value to '' due to # null value can not be allowed in composite primary keys in standard - # SQL rules. - my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; - my @pkeys = @{$descr->{keys}}; - for my $p (@pkeys) { - if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { - $elems->{$p}= ''; + # SQL rules. As auto increment key is uesd by 'eventlog' and 'auditlog' + # table, just skip these tables. + if ($self->{tabname} ne "eventlog" && $self->{tabname} ne "auditlog") { + my $descr = $xCAT::Schema::tabspec{ $self->{tabname} }; + my @pkeys = @{$descr->{keys}}; + for my $p (@pkeys) { + if(!defined($elems->{$p}) && !defined($pKeypairs->{$p})) { + $elems->{$p}= ''; + } } } From 181c1a706c07531df5eec264158e254bd3f0e8c9 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 04:18:51 -0400 Subject: [PATCH 036/292] New template of probe command dispatch in hierarchy environment --- xCAT-probe/lib/perl/hierarchy.pm | 267 +++++++++++++++++++++++ xCAT-probe/subcmds/code_template | 350 +++++++------------------------ 2 files changed, 346 insertions(+), 271 deletions(-) create mode 100644 xCAT-probe/lib/perl/hierarchy.pm diff --git a/xCAT-probe/lib/perl/hierarchy.pm b/xCAT-probe/lib/perl/hierarchy.pm new file mode 100644 index 000000000..94594d6d2 --- /dev/null +++ b/xCAT-probe/lib/perl/hierarchy.pm @@ -0,0 +1,267 @@ +package hierarchy; + +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html + +BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } +use lib "$::XCATROOT/probe/lib/perl"; +use probe_utils; +use xCAT::ServiceNodeUtils; + +use strict; +use Data::Dumper; +use IO::Select; +use File::Basename; +use POSIX ":sys_wait_h"; + +sub new { + my $self = {}; + my $class = shift; + + $self->{program_name} = basename("$0"); + + my %dispatchcmd; + $self->{dispatchcmd} = \%dispatchcmd; + + my @subjobpids = (); + my @subjobfds = (); + my %subjobstates; + my %fdnodemap; + $self->{subjobpids} = \@subjobpids; + $self->{subjobfds} = \@subjobfds; + $self->{subjobstates} = \%subjobstates; + $self->{allsubjobdone} = 0; + $self->{fdnodemap} = \%fdnodemap; + $self->{select} = new IO::Select; + + bless($self, ref($class) || $class); + return $self; +} + +sub calculate_dispatch_cmd { + my $self = shift; + my $noderange = shift; + my $argv_ref = shift; + my $error_ref = shift; + + @{$error_ref} = (); + + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + if ($noderange) { + my @nodes = probe_utils->parse_node_range($noderange); + + #if there is error in noderange + if ($?) { + my $error = join(" ", @nodes); + if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { + push @{$error_ref}, "There are invaild nodes ($1) in command line attribute node range"; + } else { + push @{$error_ref}, "There is error in command line attribute node range, please using nodels to check"; + } + return 1; + } else { + + #calculate the mapping between SN and the nodes which belong to it. + chomp foreach (@nodes); + my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); + + my %newsnnodemap; + my $rst = 0; + foreach my $sn (keys %$snnodemap) { + if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN + push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); + } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN + if (grep(/^$1$/, @snlist)) { + push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); + } else { + push @{$error_ref}, "The value $1 of 'servicenode' isn't a service node"; + $rst = 1; + } + } else { # the nodes don't belong to any SN will be handled by MN + push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); + } + } + + return 1 if ($rst); + + #print Dumper \%newsnnodemap; + #generate new command for each SN, replace noderange + foreach my $sn (keys %newsnnodemap) { + my $nodes = join(",", @{ $newsnnodemap{$sn} }); + for (my $i = 0 ; $i <= @$argv_ref ; $i++) { + if ($argv_ref->[$i] eq "-n") { + $argv_ref->[ $i + 1 ] = $nodes; + last; + } + } + my $args = join(" ", @$argv_ref); + $self->{dispatchcmd}->{$sn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + } + } + } else { + + #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN + if (@snlist) { + my $args = join(" ", @$argv_ref); + my $sns = join(",", @snlist); + $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1" if (!$?); + $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + } + } + + return 0; +} + +sub dispatch_cmd { + my $self = shift; + my $noderange = shift; + my $argv_ref = shift; + my $error_ref = shift; + + @$error_ref = (); + my $rst = 0; + + $rst = $self->calculate_dispatch_cmd($noderange, $argv_ref, $error_ref); + return $rst if ($rst); + + foreach my $target_server (keys %{ $self->{dispatchcmd} }) { + my $subjobcmd = undef; + if ($target_server eq "mn") { + $subjobcmd = $self->{dispatchcmd}->{$target_server}; + } else { + $subjobcmd = "xdsh $target_server -s \"$self->{dispatchcmd}->{$target_server}\" 2>&1"; + } + + #print "$subjobcmd\n"; + + my $subjobfd; + my $subjobpid; + if (!($subjobpid = open($subjobfd, "$subjobcmd |"))) { + push @{$error_ref}, "Fork process to dispatch cmd $subjobcmd to $target_server failed: $!"; + $rst = 1; + last; + } + push(@{ $self->{subjobpids} }, $subjobpid); + push(@{ $self->{subjobfds} }, $subjobfd); + $self->{fdnodemap}->{$subjobfd} = $target_server; + } + + if (@{ $self->{subjobpids} }) + { + $self->{select}->add(\*$_) foreach (@{ $self->{subjobfds} }); + $| = 1; + + foreach (@{ $self->{subjobfds} }) { + $self->{subjobstates}->{$_} = 0; + } + } + + return $rst; +} + +sub read_reply { + my $self = shift; + my $reply_cache_ref = shift; + + %$reply_cache_ref = (); + + my @hdls; + while (!$self->{allsubjobdone} && !%$reply_cache_ref) { + if (@hdls = $self->{select}->can_read(0)) { + foreach my $hdl (@hdls) { + foreach my $fd (@{ $self->{subjobfds} }) { + if (!$self->{subjobstates}->{$_} && $hdl == \*$fd) { + if (eof($fd)) { + $self->{subjobstates}->{$fd} = 1; + } else { + my $line; + chomp($line = <$fd>); + + #print ">>>$line\n"; + $line = "mn:$line" if ($self->{fdnodemap}->{$fd} eq "mn"); + push @{ $reply_cache_ref->{ $self->{fdnodemap}->{$fd} } }, $line; + } + } + } + } + } + sleep 0.1; + + #check if all sub job have done + $self->{allsubjobdone} = 1; + $self->{allsubjobdone} &= $self->{subjobstates}->{$_} foreach (keys %{ $self->{subjobstates} }); + } + + if (%$reply_cache_ref) { + return 1; + } else { + return 0; + } +} + +sub destory { + my $self = shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + close($_) foreach (@{ $self->{subjobfds} }); + + my %runningpid; + $runningpid{$_} = 1 foreach (@{ $self->{subjobpids} }); + my $existrunningpid = 0; + $existrunningpid = 1 if (%runningpid); + + my $try = 0; + while ($existrunningpid) { + + #send terminal signal to all running process at same time + #try INT 5 up to 5 times + if ($try < 5) { + foreach my $pid (keys %runningpid) { + kill 'INT', $pid if ($runningpid{$pid}); + } + + #try TERM 5 up to 5 times + } elsif ($try < 10) { + foreach my $pid (keys %runningpid) { + kill 'TERM', $pid if ($runningpid{$pid}); + } + + #try KILL 1 time + } else { + foreach my $pid (keys %runningpid) { + kill 'KILL', $pid if ($runningpid{$pid}); + } + } + ++$try; + + sleep 1; + + #To check how many process exit, set the flag of exited process to 0 + foreach my $pid (keys %runningpid) { + $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); + } + + #To check if there are processes still running, if there are, try kill again in next loop + $existrunningpid = 0; + $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); + + #just try 10 times, if still can't kill some process, give up + if ($try > 10) { + my $leftpid; + foreach my $pid (keys %runningpid) { + $leftpid .= "$pid " if ($runningpid{$pid}); + } + push @{$error_ref}, "Can't stop process $leftpid, please handle manually."; + $rst = 1; + last; + } + } + return $rst; +} + + + + +1; diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index a681e9649..91d7b7ff4 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -1,41 +1,21 @@ #!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html -#-------------------------------------------------------- -#This is a template for developing a probe sub_command. -#This template mainly implement the sub_comamd dispatch in hierarchical structure -#Developer only need to focus on main probe job (by implement do_main_job function) and friendly output (by implement summary_all_jobs_output function) for user -#This template can also be used in flat structure. but if developer think it's too heavy in flat, it's fine to develop sub command directly. -#But in hierarchical structure, we strongly recommand using this template. -#The main dispatch policy are: -#1. if there isn't noderange input from commmand line. if there are service nodes defined in current MN, -# we dispatch exact same command input from STDIN to all SNs and current MN. if there isn't service nodes defined, -# just hanld command input from STDIN in current MN -#2. If there is noderange input from command line by opion "-n", we will dispatch the command input from STDIN to SN which can hanle these ndoes -# For example, if we got command from STDIN like "probecommand -n test[1-15] -V" and test[1-5] 's SN is SN1, test[6-10]'s SN is SN2 -# The dispatch result will be: -# For MN run: probecommand -n test[11-15] -V -# For SN1 run: probecommand -n test[1-5] -V -# For SN2 run: probecommand -n test[6-10] -V -#3. All the return message from SNs and MN will be saved in hash %summaryoutput, develper can use it while implement summary_all_jobs_output function -#-------------------------------------------------------- - - BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; use probe_utils; -use xCAT::ServiceNodeUtils; +use hierarchy; use File::Basename; -use Getopt::Long qw(:config no_ignore_case); -use IO::Select; use Data::Dumper; +use Getopt::Long qw(:config no_ignore_case); -my $program_name = basename("$0"); #current sub_command name -my $help = 0; #command line attribute '-h', get usage information -my $test = 0; #command line attribute '-T' -my $verbose = 0; #command line attribute '-V' -my $noderange; #command line attribute '-n' + +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' +my $hierarchy = 0; +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT my $is_sn = 0; #flag current server is SN my $rst = 0; #the exit code of current command @@ -47,22 +27,19 @@ my $terminal = 0; #means get INT signal from STDIN # $summaryoutput{SN1} = @SN1_output_history my %summaryoutput; -#a map of SNs and command which will be dispatched to current SN -# one example: -# $dispatchcmd{SN1} = "probecommand -n test[1-5] -V" -# $dispatchcmd{SN2} = "probecommand -n test[6-10] -V" -my %dispatchcmd; +my $is_sn; +$is_sn = 1 if (-e "/etc/xCATSN"); -#save command line attributes from STDIN -my @tmpargv; - -#-------------------------------- +#------------------------------------- +# Usage +#------------------------------------- # below are some options rules used by default # -h : Get usage information of current sub command # -V : Output more information for debug # -T : To verify if $program_name can work, reserve option for probe framework, dosen't use by customer # -n : In xCAT probe, -n is uesd to specify node range uniformly -#-------------------------------- +#------------------------------------- +my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: $program_name -h $program_name [-V] @@ -78,23 +55,19 @@ Options: #------------------------------------ # Please implement the main checking job of current command in do_main_job function -# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. -# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT # Recommand to use probe_utils->send_msg() to handle message you plan to print out # A simple example has been written in funciton. #------------------------------------ sub do_main_job { - my $outputtarget = shift; - $outputtarget = "stdout" if (!$outputtarget); my $rst = 0; - probe_utils->send_msg($outputtarget, "o", "I reveive node range is $noderange"); + probe_utils->send_msg("$output", "o", "I reveive node range is $noderange"); #<#DO YOUR OWN CHECKING JOB1#> - probe_utils->send_msg($outputtarget, "o", "first checking point"); + probe_utils->send_msg("$output", "o", "first checking point"); #<#DO YOUR OWN CHECKING JOB2#> - probe_utils->send_msg($outputtarget, "f", "second checking point"); + probe_utils->send_msg("$output", "f", "second checking point"); return $rst; } @@ -112,94 +85,27 @@ sub summary_all_jobs_output { #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED probe_utils->send_msg("$output", "d", "======================do summary====================="); + + #print "summaryoutput:\n"; + #print Dumper \%summaryoutput; + foreach my $sn (keys %summaryoutput) { probe_utils->send_msg("$output", "d", "[$sn]"); foreach my $log (@{ $summaryoutput{$sn} }) { - probe_utils->send_msg("$output", "d", "$log"); + probe_utils->send_msg("$output", "d", "\t$log"); } } return $rst; } #------------------------------------- -# Each probe sub command is supposed to support hierarchical. -# This funtion is used to calclulate which SN should be dispatched which command +# main process #------------------------------------- -sub calculate_dispatch_cmd { - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - if ($noderange) { - my @nodes = `nodels $noderange 2>&1`; - - #if there is error in noderange - if ($?) { - my $error = join(" ", @nodes); - if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { - probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); - } else { - probe_utils->send_msg("$output", "f", "There is error in command line attribute node range, please using nodels to check"); - } - return 1; - } else { - - #calculate the mapping between SN and the nodes which belong to it. - chomp foreach (@nodes); - my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); - - #print Dumper $snnodemap; - my %newsnnodemap; - foreach my $sn (keys %$snnodemap) { - if (grep(/^$sn$/, @snlist)) { # the node just belong to one SN - push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); - } elsif ($sn =~ /(\w+),.+/) { # the node belong to more than one SN, count it into first SN - if(grep(/^$1$/, @snlist)){ - push(@{ $newsnnodemap{$1} }, @{ $snnodemap->{$sn} }); - }else{ - probe_utils->send_msg("$output", "f", "The value $1 of 'servicenode' isn't a service node"); - } - } else { # the nodes don't belong to any SN will be handled by MN - push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); - } - } - - #print Dumper \%newsnnodemap; - #generate new command for each SN, replace noderange - foreach my $sn (keys %newsnnodemap) { - my $nodes = join(",", @{ $newsnnodemap{$sn} }); - if ($sn eq "mn") { - $noderange = $nodes; - } else { - for (my $i = 0 ; $i <= $#tmpargv ; $i++) { - if ($tmpargv[$i] eq "-n") { - $tmpargv[ $i + 1 ] = $nodes; - last; - } - } - my $args = join(" ", @tmpargv); - $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; - } - } - } - } else { - - #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN - if (@snlist) { - my $args = join(" ", @tmpargv); - my $sns = join(",", @snlist); - $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); - } - } - return 0; -} - - - -#------------------------------------- -# main process start -#------------------------------------- -@tmpargv = @ARGV; +my @tmpargv = @ARGV; if ( !GetOptions("--help|h" => \$help, "T" => \$test, + "H" => \$hierarchy, "n=s" => \$noderange, "V" => \$verbose)) { @@ -227,177 +133,77 @@ $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; }; -#-------------------------------------------- -# To confirm what current node is, MN or SN -#-------------------------------------------- -$is_sn = 1 if (-e "/etc/xCATSN"); - -#if this node is SN, just run job, not to do dispatch -if ($is_sn) { +#if it is called by hierarchy template, just run job, not to do dispatch +if ($hierarchy || $is_sn) { $rst = do_main_job(); exit $rst; } -#-------------------------------------------- -# calculate which command should be dispatched to which SN -#-------------------------------------------- -$rst = calculate_dispatch_cmd(); +my $hierarchy_instance = hierarchy->new(); -#print Dumper \%dispatchcmd; -#print "nodes left to mn : $noderange\n"; -#print "========================\n"; -exit $rst if ($rst); - -#-------------------------------------------- -# dispatch job to MN and SN -#-------------------------------------------- -my $mnjobpid = 0; -my @snsjobpids = (); -my @snsjobfds = (); -my $pipe_parent_read; -my $pipe_child_write; -pipe $pipe_parent_read, $pipe_child_write; -{ - #handle job in MN - $mnjobpid = fork(); - if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); - $rst = 1; - last; - } elsif ($mnjobpid == 0) { - $SIG{TERM} = $SIG{INT} = sub { - exit 1; - }; - - close $pipe_parent_read; - $rst = do_main_job($pipe_child_write); - exit $rst; +#-------starting to dispatch_cmd-------- +my @error; +$rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); +if ($rst) { + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error) { + probe_utils->send_msg("$output", "", "$_"); } - $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; - close $pipe_child_write; - - #handle job dispatch to SN - foreach my $sn (keys %dispatchcmd) { - my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; - - #print "$sn = $snjobcmd\n"; - my $snjobfd; - my $snjobpid; - if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); - next; - } - push(@snsjobpids, $snjobpid); - push(@snsjobfds, $snjobfd); + if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); } + exit $rst; +} - my $select = new IO::Select; - $select->add(\*$pipe_parent_read) if ($pipe_parent_read); - $select->add(\*$_) foreach (@snsjobfds); - $| = 1; +#----------start to read reply------- +my %reply_cache; +while ($hierarchy_instance->read_reply(\%reply_cache)) { + foreach my $servers (keys %reply_cache) { #Dispatch_cmd may use SN range to dispatch cms to SNs at one time + my @server_array = split(",", $servers); + foreach my $server (@server_array) { + foreach (@{ $reply_cache{$servers} }) { + my $msg = ""; + my $logmsg = ""; - my $line; - my %pipeisnonull; - $pipeisnonull{mn} = 1; - $pipeisnonull{$_} = 1 foreach (@snsjobfds); - my $onepipeisnonull = 1; - while ($onepipeisnonull) { - if (@hdls = $select->can_read(0)) { - foreach $hdl (@hdls) { - if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { - if (eof($pipe_parent_read)) { - $pipeisnonull{mn} = 0; - } else { - chomp($line = <$pipe_parent_read>); - print "$line\n"; - push @{ $summaryoutput{mn} }, $line; + #For cases like below: + #c910f02c04p04: [ok] :All xCAT deamons are running + if ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/) { + if ("$1" eq "$server") { + $logmsg = "$2: $3"; + $msg = "$2:<$server>: $3"; } + + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + } elsif ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/) { + if ("$1" eq "$server") { + $logmsg = "$2"; + $msg = "<$server>: $2"; + } + + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. } else { - foreach my $fd (@snsjobfds) { - if ($pipeisnonull{$fd} && $hdl == \*$fd) { - if (eof($fd)) { - $pipeisnonull{$fd} = 0; - } else { - chomp($line = <$fd>); - if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { - push @{ $summaryoutput{$2} }, $line; - #if need to print to STDIN in real time, can make below line available - #print "[failed] :$2: $line\n"; - } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { - push @{ $summaryoutput{$1} }, $2; - #if need to print to STDIN in real time, can make below lines available - #$line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); - #print "$line\n"; - } - } - } + if (length($reply_cache{$servers}->[$_])) { + $logmsg = $reply_cache{$servers}->[$_]; + $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } + probe_utils->send_msg("$output", "", "$msg") if (length($msg)); + push @{ $summaryoutput{$server} }, $logmsg if (length($logmsg)); } - $onepipeisnonull = 0; - $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); - } - last if ($terminal); - sleep 1; - } -} -close($pipe_child_write) if ($pipe_child_write); -close($pipe_parent_read) if ($pipe_parent_read); -close($_) foreach (@snsjobfds); - -#start to clear up all sub processes -my %runningpid; -$runningpid{$mnjobpid} = 1 if ($mnjobpid); -$runningpid{$_} = 1 foreach (@snsjobpids); -my $existrunningpid = 0; -$existrunningpid = 1 if (%runningpid); - -my $trytime = 0; -while ($existrunningpid) { - - #send terminal signal to all running process at same time - #try INT 5 up to 5 times - if ($try < 5) { - foreach my $pid (keys %runningpid) { - kill 'INT', $pid if ($runningpid{$pid}); - } - - #try TERM 5 up to 5 times - } elsif ($try < 10) { - foreach my $pid (keys %runningpid) { - kill 'TERM', $pid if ($runningpid{$pid}); - } - - #try KILL 1 time - } else { - foreach my $pid (keys %runningpid) { - kill 'KILL', $pid if ($runningpid{$pid}); } } - ++$try; - - sleep 1; - - #To check how many process exit, set the flag of exited process to 0 - foreach my $pid (keys %runningpid) { - $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); - } - - #To check if there are processes still running, if there are, try kill again in next loop - $existrunningpid = 0; - $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); - - #just try 10 times, if still can't kill some process, give up - if ($try > 10) { - my $leftpid; - foreach my $pid (keys %runningpid) { - $leftpid .= "$pid " if ($runningpid{$pid}); - } - print "Can't stop process $leftpid, please handle manually.\n"; + if ($terminal) { last; } } +#----------hierarchy_instance->destory----------- +if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); +} + #------------------------------------- # summary all jobs output to display #------------------------------------- @@ -408,3 +214,5 @@ exit $rst; + + From a819f670bcb31561316a87fc09f03e5b26852a74 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 2 Nov 2016 04:46:53 -0400 Subject: [PATCH 037/292] add replay function for discovery --- xCAT-probe/subcmds/discovery | 66 +++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 73876fd1f..a798bd8d0 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -78,7 +78,7 @@ if ( "m=s" => \$discovery_type, "n=s" => \$noderange, "t=s" => \$maxwaittime, -# "r=s" => \$rollforward_time_of_replay, + "r=s" => \$rollforward_time_of_replay, "i=s" => \$nics)) #option i is a reservation option, dosen't show up in usage now { probe_utils->send_msg("stdout", "f", "Invalid parameter for $program_name"); @@ -424,7 +424,7 @@ sub do_pre_check { probe_utils->send_msg("stdout", "d", "$_") foreach (@errors); } } else { - $msg = "Attribute 'master' in 'site' table is configured well"; + $msg = "Attribute 'master' in 'site' table is configured"; my $masteripinsite = `tabdump site | awk -F',' '/^"master",/ { gsub(/"/, "", \$2) ; print \$2 }'`; chomp($masteripinsite); if ($masteripinsite eq "") { @@ -694,7 +694,7 @@ sub check_genesis_file { sub dhcp_dynamic_range_check { my $nets = shift; my $rst = 0; - my $msg = "DHCP dynamic range is configured well"; + my $msg = "DHCP dynamic range is configured"; my $dhcpconfig; if (-e "/etc/dhcp/dhcpd.conf") { @@ -756,12 +756,18 @@ sub dhcp_dynamic_range_check { $tftpdir = "/tftpboot"; } + my @errors = (); my %node_ip; if ($noderange) { %node_ip = get_node_ip(); + foreach my $node (keys %node_ip) { + if ($node_ip{$node}{"error"}) { + push @errors, $node_ip{$node}{"error"}; + $rst = 1; + } + } } - my @errors = (); foreach my $net (@$nets) { if (!exists($subnet_hash{$net})) { push @errors, "The net $net is not matched."; @@ -772,11 +778,12 @@ sub dhcp_dynamic_range_check { if ($subnet_hash{$net} ne "unknown") { if (%node_ip) { foreach my $node (keys %node_ip) { + next if ($node_ip{$node}{"error"}); foreach my $dr (@{ $subnet_hash{$net} }) { my @dr_ip = split(/-/, $dr); - if (compare_ip_value($dr_ip[0], $node_ip{$node}) and compare_ip_value($node_ip{$node}, $dr_ip[1])) { - push @errors, "$node ip $node_ip{$node} is conflicting with dynamic range."; + if (compare_ip_value($dr_ip[0], $node_ip{$node}{"ip"}) and compare_ip_value($node_ip{$node}{"ip"}, $dr_ip[1])) { + push @errors, "$node ip $node_ip{$node}{\"ip\"} is conflicting with dynamic range."; $rst = 1; next; } @@ -817,33 +824,28 @@ sub dhcp_dynamic_range_check { sub get_node_ip { my $ip_net; my @node_info = `lsdef $noderange -i ip -c 2>&1`; - my %nodeip; - my %nodecheckrst; + my %nodeipcheck = (); foreach (@node_info) { chomp($_); $_ =~ s/^\s+|\s+$//g; - if ($_ =~ /^Error: Could not find an object named '(\w+)' .+/i) { - $nodecheckrst{$1}{"error"} = "Could not find node definition"; - $rst = 1; - } elsif ($_ =~ /^(\w+): ip=(.*)/i) { - $nodeip{$1} = $2; + if ($_ =~ /^Error: Could not find an object named '(.+)' of type .+/i) { + $nodeipcheck{$1}{"error"} = "Could not find node definition"; + } elsif ($_ =~ /^(.+): ip=(.*)/i) { + $nodeipcheck{$1}{"ip"} = $2; } } - foreach my $node (keys %nodeip) { + foreach my $node (keys %nodeipcheck) { $ip_net = xCAT::NetworkUtils->getipaddr($node); - if ($nodeip{$node} and ($nodeip{$node} ne $ip_net)) { - probe_utils->send_msg("stdout", "d", "IP $nodeip{$node} definition for $node is not correct") if ($verbose); + if ($nodeipcheck{$node}{"ip"} and $ip_net and ($nodeipcheck{$node}{"ip"} ne $ip_net)) { + $nodeipcheck{$node}{"error"} = "IP $nodeipcheck{$node}{\"ip\"} definition for $node is not correct"; + $nodeipcheck{$node}{"ip"} = $ip_net; } - $nodeip{$node} = $ip_net; + $nodeipcheck{$node}{"error"} = "IP for $node is not on any network this server attached, please run 'makehosts' and 'makedns -n'." unless (xCAT::NetworkUtils->nodeonmynet($node)); } - foreach my $node (keys %nodecheckrst) { - probe_utils->send_msg("stdout", "d", "$node : $nodecheckrst{$node}{error}") if (exists($nodecheckrst{$node}{error})); - } - - return %nodeip; + return %nodeipcheck; } sub compare_ip_value { @@ -1174,17 +1176,17 @@ sub handle_dhcp_msg { my $nic = $2; if ($3 =~ /no free leases/) { - probe_utils->send_msg("stdout", "d", "[$mac] Receive DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } - my $record = "Receive DHCPDISCOVER from $mac via $nic"; + my $record = "Received DHCPDISCOVER from $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /DHCPOFFER\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/i) { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send DHCPOFFER on $ip back to $mac via $nic"; + my $record = "Sent DHCPOFFER on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1192,7 +1194,7 @@ sub handle_dhcp_msg { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Receive DHCPREQUEST from $mac for $ip via $nic"; + my $record = "Received DHCPREQUEST from $mac for $ip via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1200,7 +1202,7 @@ sub handle_dhcp_msg { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send DHCPACK on $ip back to $mac via $nic"; + my $record = "Sent DHCPACK on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1211,17 +1213,17 @@ sub handle_dhcp_msg { my $mac = $1; my $nic = $2; if ($3 =~ /no dynamic leases/) { - probe_utils->send_msg("stdout", "d", "Receive DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } - my $record = "Receive BOOTREQUEST from $mac via $nic"; + my $record = "Received BOOTREQUEST from $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; my $mac = $2; my $nic = $3; - my $record = "Send BOOTREPLY on $ip back to $mac via $nic"; + my $record = "Sent BOOTREPLY on $ip back to $mac via $nic"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1520,7 +1522,7 @@ sub conclusion_report { } } elsif ($node_state_ref->{$identify}{type} eq "mac") { foreach (@{ $node_state_ref->{$identify}{statehistory} }) { - $stop_stage = $_ if ($stop_stage < $_); + $stop_stage = $_ if ($stop_stage < $_); } if ($stop_stage != $::STATE_DISCOVER_COMPLETED) { $failed_mac{$identify}{stop_point} = $stop_stage; @@ -1532,7 +1534,7 @@ sub conclusion_report { my $success_node_num = @success_node; my $failed_node_num = @failed_node; my $failed_nodes = join(",", @failed_node); - probe_utils->send_msg("stdout", "", "Discover $success_node_num node(s) successfully, $failed_node_num node(s) failed."); + probe_utils->send_msg("stdout", "", "Discovered $success_node_num node(s) successfully, $failed_node_num node(s) failed."); probe_utils->send_msg("stdout", "", "Unmatched node(s):"); probe_utils->send_msg("stdout", "", "$failed_nodes"); From 6e891d066d03b8420c243b035e1fbc6f90e25bac Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 05:19:50 -0400 Subject: [PATCH 038/292] Refine probe tool 'xcatmn' --- xCAT-probe/subcmds/xcatmn | 1619 ++++++++++++++++++------------------- 1 file changed, 777 insertions(+), 842 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 6890bfc8f..f09e111b9 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -5,45 +5,43 @@ BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/o use lib "$::XCATROOT/probe/lib/perl"; use probe_utils; +use hierarchy; use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use File::Basename; -use Getopt::Long qw(:config no_ignore_case); -use IO::Select; use Data::Dumper; +use Getopt::Long qw(:config no_ignore_case); -my $program_name = basename("$0"); #current sub_command name my $help = 0; #command line attribute '-h', get usage information my $test = 0; #command line attribute '-T' +my $hierarchy = 0; my $verbose = 0; #command line attribute '-V' my $noderange; #command line attribute '-n' -my $installnic; my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT -my $is_sn = 0; #flag current server is SN my $rst = 0; #the exit code of current command my $terminal = 0; #means get INT signal from STDIN -my %summaryoutput; #save all output from commands running on SNs and MN +my $installnic; -#a map of SNs and command which will be dispatched to current SN -# $dispatchcmd{snname} = "command" -my %dispatchcmd; +#save all output from commands running on SNs and MN +# one example: +# $summaryoutput{mn} = @mn_output_history +# $summaryoutput{SN1} = @SN1_output_history +my %summaryoutput; -#save command line attributes from STDIN -my @tmpargv; +my $is_sn; +$is_sn = 1 if (-e "/etc/xCATSN"); -#-------------------------------- -# below are some options rules used by default -# -h : Get usage information of current sub command -# -V : Output more information for debug -# -T : To verify if $program_name can work, reserved option for probe framework, not for use by customer -# -n : In xCAT probe, -n is used to specify node range uniformly -#-------------------------------- + +#------------------------------------- +# Usage +#------------------------------------- +my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: $program_name -h - $program_name [-i ] [-V] + $program_name -i [-V] Description: - After xcat installation, use this command to check if xcat has been installed correctly and is ready for use. + After xCAT installation, use this command to check if xCAT has been installed correctly and is ready for use. For hierarchical cluster, only the provision network on the same network as the management node is supported. If in the different network, ignore the results. Options: @@ -52,626 +50,142 @@ Options: -i : Required. Specify the network interface name of provision network on management node "; - -sub returncmdoutput { - my $rst = shift; - chomp($rst); - my $outputtarget = shift; - my @lines = split("[\n\r]", $rst); - foreach my $line (@lines) { - probe_utils->send_msg("$outputtarget", "d", "$line"); - } -} - -#------------------------------------- -# TWO FUNCTIONS MUST BE IMPLEMENTED BY EACH SUB COMMAND -# They are do_main_job and summary_all_jobs_output -#------------------------------------- - -#------------------------------------ -# Please implement the main checking job of current command in do_main_job function -# If $outputtarget has input value, that means do_main_job is running on MN, so every message needed to print on STDOUT should be written into pipe $outputtarget. -# If $outputtarget has no value, that means do_main_job is running on SN, all message just need to print on STDOUT -# Recommand to use probe_utils->send_msg() to handle message you plan to print out -#------------------------------------ sub do_main_job { - my $outputtarget = shift; - $outputtarget = "stdout" if (!$outputtarget); my $rst = 0; + my @error = (); + my $checkpoint; + my $rc = 0; + my $installnicip; - my $msg; - my $serverip; + #check if all xcat deamons are running + $checkpoint = "All xCAT deamons are running"; + $rst = check_all_xcat_deamons(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); - $msg = "Sub process 'xcatd: SSL listener' is running"; - my $xcatdproc = `ps aux|grep -v grep|grep xcatd`; - chomp($xcatdproc); - if ($xcatdproc =~ /xcatd: SSL listener/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; + #check if xcatd can receive request + $checkpoint = "xcatd can receive command request"; + $rst = check_xcatd_receive_request(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check 'site' table configuratiions + my %sitetable; + $checkpoint = "'site' table is configured correctly"; + $rst = check_site_table(\%sitetable,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check network configuratiions + $checkpoint = "Provision network is configured correctly"; + $rst = check_network(\%sitetable,\$installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + return $rst if($rst); + + #check 'passwd' table configuratiions + $checkpoint = "'passwd' table is configured correctly"; + $rst = check_passwd_table(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check important directory + $checkpoint = "Important directory is configured correctly"; + $rst = check_directory(\%sitetable,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check if SElinux is disabled + $checkpoint = "SELinux is disabled on current server"; + $rst = check_selinux(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check http service + $checkpoint = "HTTP service works well"; + $rst = check_http_service($installnicip, \@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check tftp service + $checkpoint = "TFTP service works well"; + $rst = check_tftp_service($installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check DNS service + $checkpoint = "DNS service works well"; + $rst = check_dns_service(\%sitetable, $installnicip,\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #check DHCP service + $checkpoint = "DHCP service works well"; + $rst = check_dhcp_service($installnicip, \@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + + #Below are the 'warning` level check points + + #check if firewall is close + $checkpoint = "Firewall is closed on current server"; + $rst = check_firewall(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + #check disk space + $checkpoint = "The disk space is enough for xCAT to work"; + $rst = check_disk(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + + #some sepecific check points in MN + if(! $is_sn){ + #check if server ip is a static ip in MN + $checkpoint = "The IP of master is a static IP address"; + $rst = check_server_ip_static($installnicip,\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; + + #check if dhcpd.leases is less than 100M + $checkpoint = "The dhcpd.leases file is less than 100M"; + $rst = check_dhcp_leases(\@error); + print_check_result($checkpoint, "w", $rst, \@error); + $rc |= $rst; } - $msg = "Sub process 'xcatd: DB Access' is running"; - if ($xcatdproc =~ /xcatd: DB Access/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: UDP listener' is running"; - if ($xcatdproc =~ /xcatd: UDP listener/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: install monitor' is running"; - if ($xcatdproc =~ /xcatd: install monitor/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: Discovery worker' is running"; - if ($xcatdproc =~ /xcatd: Discovery worker/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "Sub process 'xcatd: Command log writer' is running"; - if ($xcatdproc =~ /xcatd: Command log writer/) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "w", "Sub process 'xcatd: Command log writer' isn't running"); - } - return 1 if ($rst); - - my $xcatdport = `lsdef -t site -i xcatdport -c | awk -F'=' '{print \$2}'`; - chomp($xcatdport); - probe_utils->send_msg($outputtarget, "d", "The port used by the xcatd daemon for client/server communication is $xcatdport") if ($verbose); - $msg = "xcatd is listening on port $xcatdport"; - my $cmdoutput = `netstat -ant|grep LISTEN|grep $xcatdport`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $xcatiport = `lsdef -t site -i xcatiport -c | awk -F'=' '{print \$2}'`; - chomp($xcatiport); - probe_utils->send_msg($outputtarget, "d", "The port used by xcatd to receive install status updates from nodes is $xcatiport") if ($verbose); - $msg = "xcatd is listening on port $xcatiport"; - $cmdoutput = `netstat -antp | grep -i xcatd|grep LISTEN|grep $xcatiport`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - return 1 if ($rst); - - $msg = "'lsxcatd -a' works"; - $cmdoutput = `lsxcatd -a 2>&1`; - $rst = $?; - returncmdoutput($cmdoutput, $outputtarget) if ($verbose); - if ($rst) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return $rst; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $masteripinsite = `lsdef -t site -i master -c | awk -F'=' '{print \$2}'`; - chomp($masteripinsite); - probe_utils->send_msg($outputtarget, "d", "The value of 'master' in 'site' table is $masteripinsite") if ($verbose); - probe_utils->send_msg($outputtarget, "f", "There isn't 'master' definition in 'site' table") if ($masteripinsite eq ""); - - $msg = "The value of 'master' in 'site' table is an IP address"; - if (probe_utils->is_ip_addr("$masteripinsite")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return 1; - } - - if (!$is_sn) { - - # on MN, check the validity of installnic and get ip address of the NIC - $msg = "NIC $installnic exists on current server"; - my $nics = `ip addr show $installnic >/dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is NIC named $installnic on current server"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - $msg = "Get IP address of NIC $installnic"; - $serverip = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; - chomp($serverip); - if (!defined($serverip) || ($serverip eq "")) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Use 'ip addr show' to check if there is IP assigned to $installnic"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "d", "The IP of NIC $installnic is $serverip") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - if ($serverip) { - $msg = "The IP $serverip of $installnic equals the value of 'master' in 'site' table"; - if ($serverip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - $msg = "IP $serverip of NIC $installnic is a static IP on current server"; - if (probe_utils->is_static_ip("$serverip", "$installnic")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "w", "IP $serverip of $installnic is not a static IP on current server"); - } - } else { - - # on SN, get ip address by compare 'master' attribute in 'site' table - # choose the one in the same network with 'master' - my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; - - foreach (@ipoutput) { - if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { - if (xCAT::NetworkUtils::isInSameSubnet($masteripinsite, $1, $2, 1)) { - $serverip = $1; - } - } - } - - $msg = "Get IP address that on the same network as master $masteripinsite"; - if (!defined($serverip) || ($serverip eq "")) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - return 1; - } else { - probe_utils->send_msg($outputtarget, "d", "The IP is $serverip") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - $msg = "$serverip belongs to one of networks defined in 'networks' table"; - my $networks = `tabdump networks|grep -v "^#"`; - $networks =~ s/\"//g; - my $netcnt = `echo "$networks"|wc -l`; - my $hit = 0; - for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { - my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; - chomp($line); - if ($line =~ /(.+) (.+) (.+)/) { - if (!$is_sn) { - $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip) && ("$3" eq "$installnic")); - } else { - $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $serverip)); - } - } - } - if ($hit) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "There is domain definition in 'site' table"; - my $domain = `lsdef -t site -i domain -c | awk -F'=' '{print \$2}'`; - chomp($domain); - if ($domain) { - probe_utils->send_msg($outputtarget, "d", "The value of 'domain' in 'site' table is $domain") if ($verbose); - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - $msg = "There is a configuration in 'passwd' table for 'system' for node provisioning"; - my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; - chomp($passwd); - my ($username, $pw) = split(" ", $passwd); - if ($username eq "" || $pw eq "") { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Define username and password for 'system' in 'passwd' table"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - my $installdir = `lsdef -t site -i installdir -c | awk -F'=' '{print \$2}'`; - chomp($installdir); - probe_utils->send_msg($outputtarget, "d", "The 'install' directory is set to $installdir in 'site' table on current server") if ($verbose); - my $tftpdir = `lsdef -t site -i tftpdir -c | awk -F'=' '{print \$2}'`; - chomp($tftpdir); - probe_utils->send_msg($outputtarget, "d", "The 'tftp' directory is set to $tftpdir in 'site' table on current server") if ($verbose); - - $msg = "There is $installdir directory on current server"; - if (-e "$installdir/postscripts/") { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - if ($is_sn) { - my $mountoutput = `mount | grep '$installdir'`; - chomp($mountoutput); - - my $mountip; - if ($mountoutput =~ /(.+):$installdir on $installdir /) { - my $mountsource = $1; - if (xCAT::NetworkUtils->isIpaddr($mountsource)) { - $mountip = $mountsource; - } else { - $mountip = xCAT::NetworkUtils->getipaddr($mountsource); - } - } - - $msg = "installdir $installdir is mounted from the management node"; - if ($mountip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - $msg = "There is $tftpdir directory on current server"; - if (-e "$tftpdir") { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - - if ($is_sn) { - my $mountoutput = `mount | grep '$tftpdir'`; - chomp($mountoutput); - - my $mountip; - if ($mountoutput =~ /(.+):$tftpdir on $tftpdir /) { - my $mountsource = $1; - if (xCAT::NetworkUtils->isIpaddr($mountsource)) { - $mountip = $mountsource; - } else { - $mountip = xCAT::NetworkUtils->getipaddr($mountsource); - } - } - - $msg = "tftpdir $tftpdir is mounted from the management node"; - if ($mountip eq $masteripinsite) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - #check the free space of specific directory - #if "/var" is mounted on standalone disk, more than 1G free space is expected - #if "/tmp" is mounted on standalone disk, more than 1G free space is expected - #if installdir is mounted on standalone disk, more than 10G free space is expected. - #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. - my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); - foreach my $dir (@dir_expectedspace_list){ - next if($dir->[0] eq "/" && $dir->[1] == 0); - my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); - if($checkrst == 2){ - $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; - }elsif($checkrst == 1){ - probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); - }elsif($checkrst == 0){ - probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); - } - - } - - $msg = "SELinux is disabled on current server"; - if (probe_utils->is_selinux_enable()) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - $msg = "Firewall is closed on current server"; - if (probe_utils->is_firewall_open()) { - probe_utils->send_msg($outputtarget, "w", "Firewall is configured on current server"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - - `which wget > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'wget' tool isn't installed, skip checking HTTP service. Install 'wget' then try again"); - } else { - $msg = "HTTP service is ready on $serverip"; - if (probe_utils->is_http_ready("$serverip")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - - my $nodename = `hostname -s`; - chomp($nodename); - - # For sn, 'setuptftp' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie TFTP service, will not check it - my $checktftp = 1; - if ($is_sn) { - $checktftp = `lsdef $nodename -i setuptftp -c | awk -F'=' '{print \$2}'`; - chomp($checktftp); - unless ($checktftp) { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide TFTP service"); - } - } - if ($checktftp) { - `which tftp > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'tftp' tool isn't installed, skip checking tftp service. Install 'tftp' then try again"); - } else { - $msg = "TFTP service is ready on $serverip"; - if (probe_utils->is_tftp_ready("$serverip")) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } - } - } - - # For sn, 'setupdns' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie DNS service, will not check it - my $checkdns = 1; - if ($is_sn) { - $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; - chomp($checkdns); - unless ($checkdns) { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DNS service"); - } - } - - if ($checkdns) { - `which nslookup > /dev/null 2>&1`; - if ($?) { - probe_utils->send_msg($outputtarget, "w", "'nslookup' tool isn't installed, skip checking DNS service. Install 'nslookup' then try again"); - } else { - $msg = "DNS server is ready on $serverip"; - probe_utils->send_msg($outputtarget, "d", "Domain used to check DNS is $domain") if ($verbose); - - my $rc = 0; - if (!$is_sn) { - - # if this is a hierarchical cluster, nslookup one of sn to check DNS service - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - my $sntmp = shift(@snlist); - if ($sntmp) { - my $sninfo = `cat /etc/hosts | grep $sntmp`; - if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { - my $snip = "$1.$2.$3.$4"; - if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$domain")) { - probe_utils->send_msg("$outputtarget", "d", "nslookup $sntmp $snip failed") if($verbose); - $rc = 1; - } - } - } else { - - # if there is no sn, nslookup mnip - my $nslkp = `nslookup $serverip $serverip 2>&1`; - chomp($nslkp); - my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); - if (!$tmp) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip $serverip failed") if($verbose); - $rc = 1; - } - } - if ($rc) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } else { - - # on sn, nslookup it's ip to check DNS service - if (!probe_utils->is_dns_ready("$serverip", "$masteripinsite", "$nodename", "$domain")) { - probe_utils->send_msg($outputtarget, "d", "nslookup $serverip failed"); - probe_utils->send_msg($outputtarget, "f", "$msg"); - } - else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - } - } - - # For sn, 'setupdhcp' attribute could be set to '0' or '1'. - # if '0', sn does not need to provie DHCP service, will not check it - my $checkdhcp = 1; - my $rc = 0; - if ($is_sn) { - $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; - chomp($checkdhcp); - if ($checkdhcp) { - - # on sn, just check dhcpd service whether running - $msg = "DHCP service is ready on $serverip"; - my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; - if ($dhcpoutput) { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } else { - probe_utils->send_msg($outputtarget, "f", "$msg"); - } - } else { - probe_utils->send_msg($outputtarget, "d", "SN $nodename is not set to provide DHCP service"); - } - } else { - my $leasefile = ""; - if (-e "/var/lib/dhcpd/dhcpd.leases") { - $leasefile = "/var/lib/dhcpd/dhcpd.leases"; - } elsif (-e "/var/lib/dhcp/db/dhcpd.leases") { - $leasefile = "/var/lib/dhcp/db/dhcpd.leases"; - } elsif (-e "/var/lib/dhcp/dhcpd.leases") { - $leasefile = "/var/lib/dhcp/dhcpd.leases"; - } - - $msg = "The size of $leasefile is less than 100M"; - my $filesizetmp = `du -sb $leasefile`; - if ($?) { - returncmdoutput($filesizetmp) if ($verbose); - probe_utils->send_msg($outputtarget, "f", "$msg"); - $rst = 1; - } else { - chomp($filesizetmp); - my ($size, $file) = split(" ", $filesizetmp); - probe_utils->send_msg($outputtarget, "d", "The size of $leasefile is $size byte") if ($verbose); - if ($size > 104857600) { - probe_utils->send_msg($outputtarget, "w", "The size of $leasefile is more than 100M"); - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - my $rc = 0; - my $msg = "DHCP service is ready on $serverip"; - - { #very important brace to create a block - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - my $sntmp = shift(@snlist); - if ($sntmp) { - my $tmp = `makedhcp -q $sntmp`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp -q $sntmp failed") if ($verbose); - $rc = 1; - last; - } - chomp($tmp); - my $snip = xCAT::NetworkUtils->getipaddr($sntmp); - my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; - chomp ($snmac); - my $tmpmac; - if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { - $tmpmac = $1; - if ($tmpmac !~ $snmac) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - } - } else { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - } - } else { - - my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "Node simulation by 'chdef' has failed") if ($verbose); - $rc = 1; - last; - } else { - probe_utils->send_msg($outputtarget, "d", "Simulate a node xcatmntest to do dhcp test") if ($verbose); - } - - `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; - - open HOSTFILE, ">> /etc/hosts"; - print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; - close HOSTFILE; - - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); - $tmp = `makedhcp xcatmntest 2>&1`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp xcatmntest failed") if ($verbose); - $rc = 1; - `rmdef xcatmntest`; - last; - } - - probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp -q xcatmntest'") if ($verbose); - $tmp = `makedhcp -q xcatmntest`; - if ($?) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "makedhcp -q xcatmntest failed") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; - } - chomp($tmp); - if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { - returncmdoutput($tmp, $outputtarget) if ($verbose); - probe_utils->send_msg($outputtarget, "d", "DHCP server reply is wrong") if ($verbose); - $rc = 1; - `makedhcp -d xcatmntest && rmdef xcatmntest`; - last; - } - - probe_utils->send_msg($outputtarget, "d", "Start clearing simulation information for dhcp test") if ($verbose); - $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; - returncmdoutput($tmp, $outputtarget) if ($verbose); - - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; - } - } - if ($rc) { - probe_utils->send_msg($outputtarget, "f", "$msg"); - probe_utils->send_msg($outputtarget, "d", "Run 'makedhcp -n' if it has not been ran before."); - $rst = 1; - } else { - probe_utils->send_msg($outputtarget, "o", "$msg"); - } - } - - - return $rst; + return $rc; } -#------------------------------------- -# When this command return from all SNs and MN, you need to generate a summary -# All history outpout from SNs and MN are saved in globle hash %summaryoutput. -# $summaryoutput{mn} = @mnhistory -# $summaryoutput{snname1} = @snname1history; -# The entry in each histroy array isn't categorized, the message coming early is arranged before the one coming later. -# A simple example of how to dump %summaryoutput has been written in function -#------------------------------------- sub summary_all_jobs_output { + my $rst = 0; if ($terminal) { return 0; } - print "\n======================do summary=====================\n"; + + #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED + probe_utils->send_msg("$output", "d", "======================do summary====================="); + #print "summaryoutput:\n"; + #print Dumper \%summaryoutput; my @summary; push @summary, "[ok]:[MN]: Check on MN PASS."; + my $ok_section = 0; foreach my $line (@{ $summaryoutput{mn} }) { if ($line =~ /(\[failed\]\s*):\s*(.*)/) { - push @summary, "$1:\t$2"; + push @summary, "$1: $2"; $summary[0] = "[failed]:[MN]: Check on MN FAILED."; + $ok_section = 0; } elsif ($line =~ /(\[warning\]\s*):\s*(.*)/) { - push @summary, "$1:\t$2"; + push @summary, "$1: $2"; + $ok_section = 0; + } elsif($line =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + push @summary, "$1: $2"; + } elsif($line =~ /(\[ok\]\s*):\s*(.*)/) { + $ok_section=1; } + } my %summary_sn = (); @@ -679,17 +193,25 @@ sub summary_all_jobs_output { next if ($node eq "mn"); ${ $summary_sn{$node}{"rst"} } = 1; push @{ $summary_sn{$node}{"details"} }, "[ok]:[SN:$node]: Check on SN $node PASS."; + $ok_section = 0; foreach my $log (@{ $summaryoutput{$node} }) { if ($log =~ /(\[failed\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; ${ $summary_sn{$node}{"rst"} } = 0; $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; + $ok_section = 0; } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "$1:\t$2"; + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; + $ok_section = 0; + } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + push @{ $summary_sn{$node}{"details"} }, "$1: $2"; + } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/){ + $ok_section = 1; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { - push @{ $summary_sn{$node}{"details"} }, "[failed]:\t$log"; + push @{ $summary_sn{$node}{"details"} }, "[failed]: $log"; ${ $summary_sn{$node}{"rst"} } = 0; $summary_sn{$node}{"details"}[0] = "[failed]:[SN:$node]: Check on SN $node FAILED."; + $ok_section = 0; } } } @@ -720,9 +242,587 @@ sub summary_all_jobs_output { } } } + + return $rst; +} + +sub print_check_result{ + my $msg = shift; + my $error_level = shift; + my $check_return_code = shift; + my $error_msg_ref = shift; + + if($check_return_code == 1){ + probe_utils->send_msg("$output", "$error_level", $msg); + probe_utils->send_msg("$output", "d", "$_") foreach (@$error_msg_ref); + }elsif($check_return_code ==2){ + return; + }else{ + probe_utils->send_msg("$output", "o", $msg); + } } +sub check_all_xcat_deamons{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + my @deamon_list = ("SSL listener", + "DB Access", + "UDP listener", + "install monitor", + "Discovery worker", + "Command log writer"); + + my $output = `ps aux|grep -v grep|grep xcatd`; + foreach my $deamon (@deamon_list){ + if($output !~ /$deamon/){ + push @$error_ref, "Deamon '$deamon' isn't running"; + $rst = 1; + } + } + + return $rst; +} + +sub check_xcatd_receive_request{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + #check important port + my @port_list = ("xcatdport", "xcatiport"); + foreach my $port_attr (@port_list){ + my $port = `lsdef -t site -i $port_attr -c| awk -F'=' '{print \$2}'`; + chomp($port); + if($port){ + my $cmdoutput = `netstat -ant|grep LISTEN|grep $port`; + if($?){ + push @$error_ref, "Attribute '$port_attr' in site table is set to $port, but xcatd isn't listening on $port"; + $rst=1; + } + }else{ + push @$error_ref, "Attribute '$port_attr' isn't set in 'site' table"; + $rst = 1; + } + } + return $rst if($rst); + + #send one command to test if xcatd can receive request + my $cmdoutput = `lsxcatd -a 2>&1`; + if($?){ + my @lines = split("[\n\r]", $cmdoutput); + push @$error_ref, $_ foreach (@lines); + $rst=1; + } + + return $rst; +} + +sub check_site_table{ + my $sitetable_ref=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + my @attr_list = ("master", "domain", "installdir", "tftpdir"); + foreach my $attr (@attr_list){ + my $value; + $value = `lsdef -t site -i $attr -c | awk -F'=' '{print \$2}'`; + chomp($value); + if($value eq ""){ + push @$error_ref, "There isn't '$attr' definition in 'site' table"; + $rst=1; + }else{ + if (($attr eq "master") and (! probe_utils->is_ip_addr("$value"))) { + push @$error_ref, "The value of 'master' in 'site' table isn't an IP addres"; + $rst=1; + } + $sitetable_ref->{$attr} = $value; + } + } + + return $rst; +} + +sub check_passwd_table{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; + chomp($passwd); + my ($username, $pw) = split(" ", $passwd); + if ($username eq "" || $pw eq "") { + push @$error_ref, "There isn't username or password for 'system' in 'passwd' table"; + $rst = 1; + } + + return $rst; +} + +sub check_network{ + my $sitetable_ref=shift; + my $serverip_ref = shift; #output arguments + my $error_ref = shift; #output arguments + + my $rst = 0; + @$error_ref = (); + + if($is_sn){ + # on SN, get ip address by compare 'master' attribute in 'site' table + # choose the one in the same network with 'master' + my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; + foreach (@ipoutput) { + if ($_ =~ /inet\s+(.+)\/(.+)\s+brd\s+(.+)\s+scope global/i) { + if (xCAT::NetworkUtils::isInSameSubnet($sitetable_ref->{master}, $1, $2, 1)) { + $$serverip_ref = $1; + } + } + } + if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { + push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; + $rst = 1; + } + }else{ # on MN + my $nics = `ip addr show $installnic >/dev/null 2>&1`; + if ($?) { + push @$error_ref, "There isn't NIC '$installnic' in current server"; + $rst = 1; + } else { + $$serverip_ref = `ip addr show $installnic | awk -F" " '/inet / {print \$2}'|awk -F"/" '{print \$1}'`; + chomp($$serverip_ref); + if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { + push @$error_ref, "There isn't IP address assigned to NIC $installnic"; + $rst =1; + }else{ + if ($$serverip_ref ne $sitetable_ref->{master}) { + push @$error_ref, "The IP $$serverip_ref of $installnic doesn't equal the value of 'master' in 'site' table"; + $rst = 1; + } + } + } + } + + my $networks = `tabdump networks|grep -v "^#"`; + $networks =~ s/\"//g; + my $netcnt = `echo "$networks"|wc -l`; + my $hit = 0; + for (my $i = 1 ; $i < $netcnt + 1 ; $i++) { + my $line = `echo "$networks" |sed -n ${i}p |awk -F"," '{print \$2,\$3,\$4}'`; + chomp($line); + if ($line =~ /(.+) (.+) (.+)/) { + if ($is_sn) { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $$serverip_ref)); + } else { + $hit = 1 if (probe_utils->is_ip_belong_to_net("$1", "$2", $$serverip_ref) && ("$3" eq "$installnic")); + } + } + } + if (! $hit) { + push @$error_ref, "IP $$serverip_ref of $installnic doesn't belong to any network defined in 'networks' table"; + $rst = 1; + } + return $rst; +} + +sub check_server_ip_static{ + my $serverip=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + if (! probe_utils->is_static_ip("$serverip", "$installnic")) { + push @$error_ref, "The value '$serverip' of 'master' in 'site' table isn't a static ip"; + $rst=1; + } + return $rst; +} + + +sub check_directory{ + my $sitetable_ref=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my @dir_list = ("installdir", "tftpdir"); + foreach my $dir (@dir_list){ + if($sitetable_ref->{$dir} eq ""){ + push @$error_ref, "There isn't '$dir' definition in 'site' table"; + $rst = 1; + }else{ + if (! -e "$sitetable_ref->{$dir}") { + push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server"; + $rst = 1; + }else{ + if ($is_sn) { + my $mountoutput = `mount | grep '$sitetable_ref->{$dir}'`; + chomp($mountoutput); + + my $mountip; + if ($mountoutput =~ /(.+):$sitetable_ref->{$dir} on $sitetable_ref->{$dir} /) { + my $mountsource = $1; + if (xCAT::NetworkUtils->isIpaddr($mountsource)) { + $mountip = $mountsource; + } else { + $mountip = xCAT::NetworkUtils->getipaddr($mountsource); + } + } + + if ($mountip ne $sitetable_ref->{master}) { + push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node"; + $rst = 1; + } + } + } + } + } + + return $rst; +} + + +sub check_disk{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + #check the free space of specific directory + #if "/var" is mounted on standalone disk, more than 1G free space is expected + #if "/tmp" is mounted on standalone disk, more than 1G free space is expected + #if installdir is mounted on standalone disk, more than 10G free space is expected. + #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. + my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); + foreach my $dir (@dir_expectedspace_list){ + next if($dir->[0] eq "/" && $dir->[1] == 0); + my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); + if($checkrst == 2){ + $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; +# }elsif($checkrst == 1){ +# probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); + }elsif($checkrst == 0){ +# probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); + push @$error_ref, "The free space of '$dir->[0]' is less than $dir->[1] G"; + $rst = 1; + } + + } + + return $rst; +} + +sub check_selinux{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + if (probe_utils->is_selinux_enable()) { + push @$error_ref, "SELinux is enabled on current server"; + $rst = 1; + } + + return $rst; +} + +sub check_firewall { + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + if (probe_utils->is_firewall_open()) { + push @$error_ref, "Firewall is configured on current server"; + $rst =1; + } + + return $rst; +} + +sub check_http_service{ + my $serverip=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + `which wget > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; + $rst = 1; + } else { + if (! probe_utils->is_http_ready("$serverip")) { + push @$error_ref, "HTTP service isn't ready on $serverip"; + $rst = 1; + } + } + + return $rst; +} + + +sub check_tftp_service{ + my $serverip = shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $nodename = `hostname -s`; + chomp($nodename); + + # For sn, 'setuptftp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie TFTP service, will not check it + my $checktftp = 1; + if ($is_sn) { + $checktftp = `lsdef $nodename -i setuptftp -c | awk -F'=' '{print \$2}' `; + chomp($checktftp); + } + if ($checktftp) { + `which tftp > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "TFTP check need 'tftp' tool, please install 'tftp' tool and try again"; + $rst = 1; + } else { + $msg = "TFTP service is ready on $serverip"; + if (! probe_utils->is_tftp_ready("$serverip")) { + push @$error_ref, "TFTP service isn't ready on $serverip"; + $rst = 1; + } + } + }else{ + $rst = 2; + } + + return $rst; +} + +sub check_dns_service{ + my $sitetable_ref=shift; + my $serverip=shift; + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + my $nodename = `hostname -s`; + chomp($nodename); + + # For sn, 'setupdns' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DNS service, will not check it + my $checkdns = 1; + if ($is_sn) { + $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; + chomp($checkdns); + } + + if ($checkdns) { + `which nslookup > /dev/null 2>&1`; + if ($?) { + push @$error_ref, "DNS check need 'nslookup' tool, please install 'nslookup' tool and try again"; + $rst = 1; + } else { + if ($is_sn) { + # on sn, nslookup it's ip to check DNS service + if (!probe_utils->is_dns_ready("$serverip", "$sitetable_ref->{master}", "$nodename", "$sitetable_ref->{domain}")) { + push @$error_ref, "DNS service isn't ready on $serverip"; + $rst = 1; + } + }else{ + my $rc=0; + # if this is a hierarchical cluster, nslookup one of sn to check DNS service + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $sninfo = `cat /etc/hosts | grep $sntmp`; + if ($sninfo =~ /(\d+).(\d+).(\d+).(\d+)/) { + my $snip = "$1.$2.$3.$4"; + if (!probe_utils->is_dns_ready("$snip", "$serverip", "$sntmp", "$sitetable_ref->{domain}")) { + $rc = 1; + } + } + } else { + + # if there is no sn, nslookup mnip + my $nslkp = `nslookup $serverip $serverip 2>&1`; + chomp($nslkp); + my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); + if (!$tmp) { + $rc = 1; + } + } + if ($rc) { + push @$error_ref, "DNS service isn't ready on $serverip"; + $rst = 1; + } + } + } + }esle{ + $rst =2; + } + + return $rst; +} + + +sub check_dhcp_service{ + my $serverip=shift; + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + + # For sn, 'setupdhcp' attribute could be set to '0' or '1'. + # if '0', sn does not need to provie DHCP service, will not check it + if ($is_sn) { + my $nodename = `hostname -s`; + chomp($nodename); + my $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; + chomp($checkdhcp); + if ($checkdhcp) { + # on sn, just check dhcpd service whether running + my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; + if (! $dhcpoutput) { + push @$error_ref, "There isn't 'dhcpd' deamon in current server"; + $rst = 1; + } + } else { + $rst = 2; + } + } else { + my $rc = 0; + { #very important brace to create a block + my @snlist = xCAT::ServiceNodeUtils->getAllSN(); + my $sntmp = shift(@snlist); + if ($sntmp) { + my $tmp = `makedhcp -q $sntmp`; + if ($?) { + push @$error_ref, "makedhcp -q $sntmp failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + last; + } + chomp($tmp); + my $snip = xCAT::NetworkUtils->getipaddr($sntmp); + my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; + chomp ($snmac); + my $tmpmac; + if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { + $tmpmac = $1; + if ($tmpmac !~ $snmac) { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + } + } else { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + } + } else { + + my $tmp = `chdef xcatmntest groups=all ip=$serverip mac=aa:aa:aa:aa:aa:aa`; + if ($?) { + push @$error_ref, "Node simulation by 'chdef' has failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + last; + } else { + push @$error_ref, "Simulate a node xcatmntest to do dhcp test" if ($verbose); + } + + `cp /etc/hosts /etc/hosts.bak.probe > /dev/null 2>&1`; + + open HOSTFILE, ">> /etc/hosts"; + print HOSTFILE "$serverip xcatmntest xcatmntest.$domain"; + close HOSTFILE; + + probe_utils->send_msg($outputtarget, "d", "To do 'makedhcp xcatmntest'") if ($verbose); + $tmp = `makedhcp xcatmntest 2>&1`; + if ($?) { + push @$error_ref, "makedhcp xcatmntest failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `rmdef xcatmntest`; + last; + } + + $tmp = `makedhcp -q xcatmntest`; + if ($?) { + push @$error_ref, "makedhcp -q xcatmntest failed"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + chomp($tmp); + if ($tmp !~ /xcatmntest: ip-address = $serverip, hardware-address = aa:aa:aa:aa:aa:aa/) { + push @$error_ref, "DHCP server reply is wrong"; + returncmdoutput($tmp, $error_ref) if ($verbose); + $rc = 1; + `makedhcp -d xcatmntest && rmdef xcatmntest`; + last; + } + + push @$error_ref, "Start clearing simulation information for dhcp test" if ($verbose); + $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; + returncmdoutput($tmp, $error_ref) if ($verbose); + + `rm /etc/hosts`; + `mv /etc/hosts.bak.probe /etc/hosts`; + } + } + if ($rc) { + push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; + $rst = 1; + } + } + + return $rst; +} + +sub check_dhcp_leases{ + my $error_ref = shift; + + my $rst = 0; + @$error_ref = (); + + my $leasefile = ""; + if (-e "/var/lib/dhcpd/dhcpd.leases") { + $leasefile = "/var/lib/dhcpd/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/db/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/db/dhcpd.leases"; + } elsif (-e "/var/lib/dhcp/dhcpd.leases") { + $leasefile = "/var/lib/dhcp/dhcpd.leases"; + } + + my $filesizetmp = `du -sb $leasefile`; + if ($?) { + push @$error_ref, "Got the size of '$leasefile' failed"; + returncmdoutput($filesizetmp, $error_ref) if ($verbose); + $rst = 1; + } else { + chomp($filesizetmp); + my ($size, $file) = split(" ", $filesizetmp); + if ($size > 104857600) { + my $size_m = $size / 1048576; + push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; + $rst =1; + } + } + return $rst; +} + +sub returncmdoutput { + my $rst = shift; + my $error_ref = shift; + + chomp($rst); + my @lines = split("[\n\r]", $rst); + foreach my $line (@lines) { + push @$error_ref, $line; + } +} #------------------------------------- # Clean up test environment # ------------------------------------- @@ -736,90 +836,14 @@ sub cleanup { `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; } } - #------------------------------------- -# Each probe sub command is supposed to support hierarchical. -# This funtion is used to caclulate which SN should be dispatched which command +# main process #------------------------------------- -sub caclulate_dispatch_cmd { - my @snlist = xCAT::ServiceNodeUtils->getAllSN(); - if ($noderange) { - my @nodes = `nodels $noderange 2>&1`; - if ($?) { - my $error = join(" ", @nodes); - if ($error =~ /Error: Invalid nodes and\/or groups in noderange: (.+)/) { - probe_utils->send_msg("$output", "f", "There are invaild nodes ($1) in command line attribute node range"); - } else { - probe_utils->send_msg("$output", "f", "There is an error in command line attribute node range, use 'nodels' to check"); - } - return 1; - } else { - chomp foreach (@nodes); - my $snnodemap = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN"); - my %newsnnodemap; - foreach my $sn (keys %$snnodemap) { - if (grep(/^$sn$/, @snlist)) { - push(@{ $newsnnodemap{$sn} }, @{ $snnodemap->{$sn} }); - } else { - push(@{ $newsnnodemap{mn} }, @{ $snnodemap->{$sn} }); - } - } - - foreach my $sn (keys %newsnnodemap) { - my $nodes = join(",", @{ $newsnnodemap{$sn} }); - if ($sn eq "mn") { - $noderange = $nodes; - } else { - for (my $i = 0 ; $i <= $#tmpargv ; $i++) { - if ($tmpargv[$i] eq "-n") { - $tmpargv[ $i + 1 ] = $nodes; - last; - } - } - my $args = join(" ", @tmpargv); - $dispatchcmd{$sn} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1"; - } - } - } - } else { - if (@snlist) { - my $args = join(" ", @tmpargv); - if ($args =~ /\-V/) { - $args = "-V"; - } else { - $args = " "; - } - my $sns = join(",", @snlist); - $dispatchcmd{$sns} = "$::XCATROOT/probe/subcmds/$program_name $args 2>&1" if (!$?); - } - } - return 0; -} - -#------------------------------------ -# print sn's msg after all msg received -#------------------------------------ -sub send_sn_msg { - foreach $node (keys %summaryoutput) { - next if ($node eq "mn"); - foreach my $line (@{ $summaryoutput{$node} }) { - if ($line =~ /^(\[\w+\]\s*):\s*(.*)/) { - print "$1:[SN:$node]: $2\n"; - } else { - print "[failed] :[SN:$node]: $line\n"; - } - } - } -} - -#------------------------------------- -# main process start -#------------------------------------- -@tmpargv = @ARGV; +my @tmpargv = @ARGV; if ( !GetOptions("--help|h" => \$help, "T" => \$test, - "n=s" => \$noderange, + "H" => \$hierarchy, "V" => \$verbose, "i=s" => \$installnic)) { @@ -842,166 +866,75 @@ if ($test) { exit 0; } +#Handle the interrupt signal from STDIN $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; cleanup(); }; -#-------------------------------------------- -# To confirm what current node is, MN or SN -#-------------------------------------------- -$is_sn = 1 if (-e "/etc/xCATSN"); - -if ($is_sn) { +#if it is called by hierarchy template, just run job, not to do dispatch +if ($hierarchy || $is_sn) { $rst = do_main_job(); exit $rst; } -if (!defined($installnic)) { - probe_utils->send_msg("$output", "f", "Option -i is required"); - probe_utils->send_msg("$output", "d", "$::USAGE"); - exit 1; +my @error; +my $hierarchy_instance = hierarchy->new(); +$rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); +if($rst){ + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error){ + probe_utils->send_msg("$output", "", "$_"); + } + if($hierarchy_instance->destory(\@error)){ + probe_utils->send_msg("$output", "", "$_") foreach(@error); + } + exit $rst; } -#-------------------------------------------- -# Each probe tool is supposed to support hierarchical. -#-------------------------------------------- -$rst = caclulate_dispatch_cmd(); - -#print Dumper \%dispatchcmd; -#print "node left to mn : $noderange\n"; -exit $rst if ($rst); - -#-------------------------------------------- -# dispatch job to MN and SN -#-------------------------------------------- -my $mnjobpid = 0; -my @snsjobpids = (); -my @snsjobfds = (); -my $pipe_parent_read; -my $pipe_child_write; -pipe $pipe_parent_read, $pipe_child_write; -{ - #handle job in MN - $mnjobpid = fork(); - if (!defined($mnjobpid)) { - probe_utils->send_msg("$output", "f", "fork process to handle MN job failed: $!"); - $rst = 1; - last; - } elsif ($mnjobpid == 0) { - $SIG{TERM} = $SIG{INT} = sub { - exit 1; - }; - - close $pipe_parent_read; - $rst = do_main_job($pipe_child_write); - exit $rst; - } - $SIG{CHLD} = sub { waitpid($mnjobpid, WNOHANG) }; - close $pipe_child_write; - - #handle job dispatch to SN - foreach my $sn (keys %dispatchcmd) { - my $snjobcmd = "xdsh $sn -s \"$dispatchcmd{$sn}\" 2>&1"; - my $snjobfd; - my $snjobpid; - if (!($snjobpid = open($snjobfd, "$snjobcmd |"))) { - probe_utils->send_msg("$output", "f", "fork process to dispatch cmd $snjobcmd to $sn failed: $!"); - next; - } - push(@snsjobpids, $snjobpid); - push(@snsjobfds, $snjobfd); - } - - my $select = new IO::Select; - $select->add(\*$pipe_parent_read) if ($pipe_parent_read); - $select->add(\*$_) foreach (@snsjobfds); - $| = 1; - - my $line; - my %pipeisnonull; - $pipeisnonull{mn} = 1; - $pipeisnonull{$_} = 1 foreach (@snsjobfds); - my $onepipeisnonull = 1; - while ($onepipeisnonull) { - if (@hdls = $select->can_read(0)) { - foreach $hdl (@hdls) { - if ($pipeisnonull{mn} && $hdl == \*$pipe_parent_read) { - if (eof($pipe_parent_read)) { - $pipeisnonull{mn} = 0; - } else { - chomp($line = <$pipe_parent_read>); - if ($line =~ /(\[\w+\]\s*):\s*(.*)/) { - print "$1:[MN]: $2\n"; - } - push @{ $summaryoutput{mn} }, $line; +my %reply_cache; +while($hierarchy_instance->read_reply(\%reply_cache)){ + foreach my $servers (keys %reply_cache){ #Dispatch_cmd may use SN range to dispatch cms to SNs at one time + my @server_array = split(",", $servers); + foreach my $server (@server_array){ + foreach (@{$reply_cache{$servers}}){ + my $msg = ""; + my $logmsg=""; + + #For cases like below: + #c910f02c04p04: [ok] :All xCAT deamons are running + if($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/){ + if("$1" eq "$server"){ + $logmsg = "$2: $3"; + $msg = "$2:<$server>: $3"; } - } else { - foreach my $fd (@snsjobfds) { - if ($pipeisnonull{$fd} && $hdl == \*$fd) { - if (eof($fd)) { - $pipeisnonull{$fd} = 0; - } else { - chomp($line = <$fd>); - if ($line =~ /(Error:)\s+(\w+)\s+(.+)/i) { - push @{ $summaryoutput{$2} }, $line; - } elsif ($line =~ /^(\w+)\s*:\s(.*)/) { - push @{ $summaryoutput{$1} }, $2; - $line = "$2:$1: $3" if ($line =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/); - } - } - } + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + }elsif($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/){ + if("$1" eq "$server"){ + $logmsg = "$2"; + $msg = "<$server>: $2"; + } + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. + }else{ + if(length($reply_cache{$servers}->[$_])){ + $logmsg = $reply_cache{$servers}->[$_]; + $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } + probe_utils->send_msg("$output", "", "$msg") if(length($msg)); + push @{$summaryoutput{$server}},$logmsg if(length($logmsg)); } - $onepipeisnonull = 0; - $onepipeisnonull |= $pipeisnonull{$_} foreach (keys %pipeisnonull); } - last if ($terminal); - sleep 1; } - send_sn_msg(); + if($terminal){ + last; + } } -close($pipe_child_write) if ($pipe_child_write); -close($pipe_parent_read) if ($pipe_parent_read); -close($_) foreach (@snsjobfds); -my %runningpid; -$runningpid{$mnjobpid} = 1 if ($mnjobpid); -$runningpid{$_} = 1 foreach (@snsjobpids); -my $existrunningpid = 0; -$existrunningpid = 1 if (%runningpid); - -my $trytime = 0; -while ($existrunningpid) { - - #try INT 5 up to 5 times - if ($try < 5) { - foreach my $pid (keys %runningpid) { - kill 'INT', $pid if ($runningpid{$pid}); - } - - #try TERM 5 up to 5 times - } elsif ($try < 10) { - foreach my $pid (keys %runningpid) { - kill 'TERM', $pid if ($runningpid{$pid}); - } - - #try KILL 1 time - } else { - foreach my $pid (keys %runningpid) { - kill 'KILL', $pid if ($runningpid{$pid}); - } - } - ++$try; - - sleep 1; - foreach my $pid (keys %runningpid) { - $runningpid{$pid} = 0 if (waitpid($pid, WNOHANG)); - } - $existrunningpid = 0; - $existrunningpid |= $runningpid{$_} foreach (keys %runningpid); - last if ($try > 10); +if($hierarchy_instance->destory(\@error)){ + probe_utils->send_msg("$output", "", "$_") foreach(@error); } #------------------------------------- @@ -1014,3 +947,5 @@ exit $rst; + + From 6fab40277e7c5428db54a111044dd0dbbea83598 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 2 Nov 2016 14:53:59 -0400 Subject: [PATCH 039/292] Suggested review changes --- .../virtual_machines/RHEVHypervisor.rst | 18 ++++++++++++++---- .../ppc64le/virtual_machines/hypervisorKVM.rst | 14 +++++++------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index 9274d7018..e8ae9fabf 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -17,7 +17,17 @@ chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - * Create a new file ``/opt/xcat/share/xcat/install/rh/other.pkglist`` to list required packages :: + * Create a new file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: + + #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglis# + bridge-utils + + * Modify ``pkglist`` attribute to point to the file from the step above :: + + chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ + pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist + + * Create a new file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: libvirt qemu-kvm-rhev @@ -28,7 +38,7 @@ * Modify ``otherpkglist`` attribute to point to the file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist * The RHEV osimage should look similar to: :: @@ -39,9 +49,9 @@ osname=Linux osvers=rhels7.3 otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - otherpkglist=/opt/xcat/share/xcat/install/rh/other.pkglist + otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist pkgdir=/install/rhels7.3/ppc64le - pkglist=/install/custom/install/rh/compute.rhels7.ppc64le.pkglist + pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist profile=compute provmethod=install template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index 1f0873241..add5069d2 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -16,19 +16,19 @@ Provision Hypervisor xCAT ships a postscript **xHRM** to create a network bridge on kvm host during installation/netbooting. Specify the **xHRM** with appropriate parameters in **postscripts** attibute. For example: - * To create a bridge with default name 'default' against the installation network device which was specified by **installnic** attribute :: - - chdef kvmhost1 -p postscripts="xHRM bridgeprereq" - - * To create a bridge named 'br0' against the installation network device which was specified by **installnic** attribute(recommended) :: + * To create a bridge named 'br0' against the installation network device specified by **installnic**: :: chdef kvmhost1 -p postscripts="xHRM bridgeprereq br0" - * To create a bridge named 'br0' against the network device 'eth0' :: + * To create a bridge with default name 'default' against the installation network device specified by **installnic**: :: + + chdef kvmhost1 -p postscripts="xHRM bridgeprereq" + + * To create a bridge named 'br0' against the network device 'eth0': :: chdef kvmhost1 -p postscripts="xHRM bridgeprereq eth0:br0" - **Note**: The network bridge name you use should not be the virtual bridges created by libvirt installation [1]_. + **Note**: The network bridge name you use should not be the virtual bridges (vbrX) created by libvirt installation [1]_. #. Customize the hypervisor node definition to mount the shared kvm storage directory on management node **(optional)** From 990e611b28429476086c27039f34a38449bc023c Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 2 Nov 2016 15:33:46 -0400 Subject: [PATCH 040/292] Update networks.rst Fix spelling error on noboot section --- .../admin-guides/manage_clusters/ppc64le/configure/networks.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst index b199866d2..3bacd82b5 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/networks.rst @@ -49,7 +49,7 @@ Configure DHCP to listen on different network interfaces [**Optional**] **noboot** `````````` - For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-size integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: + For the *IBM OpenPOWER S822LC for HPC ("Minsky")* nodes, the BMC and compute "eth0" share the left-side integrated ethernet port and compute "eth1" is the right-side integrated ethernet port. For these servers, it is recommended to use two physical cables allowing the BMC port to be dedicated and "eth1" used by the OS. When an open range is configured on the two networks, the xCAT Genesis kernel will be sent to the BMC interface and causes problems during hardware discovery. To support this scenario, on the xCAT management node, if "eth1" is connected to the BMC network and "eth3" is connected to the compute network, disable genesis boot for the BMC network by setting ``:noboot`` in ``dhcpinterfaces`` using: :: chdef -t site dhcpinterfaces="eth1:noboot,eth3" From c619538333047b807326e5da274ae6d019fb15e2 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 2 Nov 2016 16:55:05 -0400 Subject: [PATCH 041/292] Handle invalid options for makentp command --- xCAT-server/lib/xcat/plugins/makentp.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index d8801b431..f2e784751 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -110,6 +110,7 @@ sub parse_args { # Responds with usage statement local *usage = sub { my $usage_string = xCAT::Usage->getUsage($cmd); + send_msg($request, 0, " $usage_string"); return ([ $_[0], $usage_string ]); }; @@ -124,6 +125,7 @@ sub parse_args { @ARGV = @$args; $Getopt::Long::ignorecase = 0; Getopt::Long::Configure("bundling"); + Getopt::Long::Configure("no_pass_through"); # Process command-line flags if (!GetOptions(\%opt, @@ -288,7 +290,7 @@ sub process_request { } if ($verbose) { - send_msg(\%request, 0, " ...changing the ntpp configuration file /etc/ntp.conf.\n ntp servers are: $ntp_servers"); + send_msg(\%request, 0, " ...changing the ntp configuration file /etc/ntp.conf.\n ntp servers are: $ntp_servers"); } # create ntp server config file From 42ec75fd250a6718c17f31fe22782f6364d4b56b Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 3 Nov 2016 10:24:00 +0800 Subject: [PATCH 042/292] update xcattest after review --- xCAT-test/xcattest | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 2155e04a6..541fad827 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -17,7 +17,6 @@ use lib "$::XCATROOT/lib/perl"; my $rootdir = "$::XCATROOT/share/xcat/tools/autotest"; my $needhelp = 0; my $configinfo = undef; -#my $configfile = "$rootdir/default.conf"; my $configfile = undef; my $casedir = "$rootdir/testcase"; my $bundledir = "$rootdir/bundle"; @@ -1135,7 +1134,6 @@ sub listformatbundleinfo print "bundle files and descriptions:\n"; foreach my $filename (sort { $a cmp $b } keys %bundlefilesinfo ) { - # foreach my $filename (keys %bundlefilesinfo) { my @desc = split(" ", $bundlefilesinfo{$filename}); my $str = ""; my @formatdesc = (); From a892d52457a1cd8517655379d41453edd05c7d70 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 2 Nov 2016 22:45:28 -0400 Subject: [PATCH 043/292] updated all existed cases, passed on rhels and ubuntu both --- xCAT-test/autotest/testcase/xcatconfig/case0 | 44 ++++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index ef0776219..44013c2d4 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -1,11 +1,14 @@ start:xcatconfig_null description:xcatconfig with no argument +os:Linux cmd:xcatconfig -check:output=~Usage +check:output=~No parameters were supplied on the xcatconfig command. Run xcatconfig -h +check:rc!=0 end start:xcatconfig_f description:To force regeneration of keys and credentials and reinitialize the site table +os:Linux cmd:xcatconfig -f check:rc==0 end @@ -13,6 +16,7 @@ end start:xcatconfig_k description:To regenerate root's ssh keys +os:Linux cmd:cp -rf /root/.ssh /root/.sshbak cmd:xcatconfig -k check:rc==0 @@ -25,22 +29,42 @@ cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys cmd:mv -f /root/.sshbak /root/.ssh end +start:xcatconfig_k_c +description:To regenerate root's ssh keys +os:Linux +cmd:cp -rf /root/.ssh /root/.sshbak +cmd:xcatconfig -k -c +check:rc==0 +check:output=~(Generated /root/.ssh/id_rsa.pub) +check:output=~Created xCAT certificate +check:output=~Signature ok +check:output!=Fail +cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub +check:rc!=0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +cmd:mv -f /root/.sshbak /root/.ssh +end -start:xcatconfig_d +start:xcatconfig_d_V description:This option will reinitialize the basic xCAT database table setup -cmd:dumpxCATdb -p /tmp +os:Linux +cmd:dumpxCATdb -p /tmp/xcatconfig check:rc==0 -cmd:xcatconfig -d +cmd:xcatconfig -d -V check:rc==0 -check:output=~(Updated cluster site definition) -cmd:restorexCATdb -p /tmp +check:output=~Updated cluster site definition +check:output=~Created postscripts definition +cmd:restorexCATdb -p /tmp/xcatconfig check:rc==0 -cmd:rm -rf /tmp/*.csv +cmd:rm -rf /tmp/xcatconfig/*.csv end start:xcatconfig_s description:To regenerate node host ssh keys +os:Linux cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak check:rc==0 cmd:xcatconfig -s @@ -53,6 +77,7 @@ end start:xcatconfig_s_c description:To regenerate node host ssh keys and credentials +os:Linux cmd:cp -rf /root/.xcat /root/.xcatbak check:rc==0 cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak @@ -61,7 +86,6 @@ cmd:xcatconfig -s -c check:rc==0 check:output=~Created xCAT certificate check:output=~Signature ok -check:output=~OK check:output!~Fail cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 @@ -71,6 +95,7 @@ end start:xcatconfig_h description:xcatconfig -h and --help +os:Linux cmd:xcatconfig -h check:output=~Usage cmd:xcatconfig --help @@ -80,6 +105,7 @@ end start:xcatconfig_v description:xcatconfig -v and --version +os:Linux cmd:xcatconfig -v check:output=~version|Version cmd:xcatconfig --version @@ -87,6 +113,7 @@ check:output=~version|Version end start:xcatconfig_u_check_xcatsslversion_rhels_sles +os:rhels,sles description:after xcatconfig -u the site.xcatsslversion will not be changed cmd:lsdef -t site -i xcatsslversion -c | grep '=TLSv1$' check:rc==0 @@ -105,6 +132,7 @@ end start:xcatconfig_u_check_xcatsslversion_ubuntu description:after xcatconfig -u the site.xcatsslversion will not be changed +os:ubuntu cmd:lsdef -t site -i xcatsslversion -c | grep '=TLSv1$' check:rc==0 cmd:chtab key=xcatsslversion site.value=TLSv1_2 From 31a68a5835a0bb10271711e8e66c158bcc8ccfe4 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 2 Nov 2016 22:59:07 -0400 Subject: [PATCH 044/292] Modified depending on comments and add comments --- xCAT-probe/lib/perl/hierarchy.pm | 7 ++++--- xCAT-probe/subcmds/code_template | 34 +++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/xCAT-probe/lib/perl/hierarchy.pm b/xCAT-probe/lib/perl/hierarchy.pm index 94594d6d2..3c1add40d 100644 --- a/xCAT-probe/lib/perl/hierarchy.pm +++ b/xCAT-probe/lib/perl/hierarchy.pm @@ -100,11 +100,12 @@ sub calculate_dispatch_cmd { } else { #there isn't noderange input from STDIN, dispatch command to all SN if there are SN defined in MN + #if there isn't SN defined in MN, just dispatch command to MN itself + my $args = join(" ", @$argv_ref); + $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; if (@snlist) { - my $args = join(" ", @$argv_ref); my $sns = join(",", @snlist); - $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1" if (!$?); - $self->{dispatchcmd}->{mn} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; + $self->{dispatchcmd}->{$sns} = "$::XCATROOT/probe/subcmds/$self->{program_name} $args -H 2>&1"; } } diff --git a/xCAT-probe/subcmds/code_template b/xCAT-probe/subcmds/code_template index 91d7b7ff4..ed9ffdd46 100755 --- a/xCAT-probe/subcmds/code_template +++ b/xCAT-probe/subcmds/code_template @@ -1,6 +1,26 @@ #!/usr/bin/perl # IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#-------------------------------------------------------- +#This is a template for developing a new probe sub_command. Especially in hierarchical environment. +#This template mainly implement the sub_comamd dispatch in hierarchical structure and basic framework of a new sub_comamd. +#Developer only need to focus on main probe job (by implement do_main_job function) and friendly output (by implement summary_all_jobs_output function) for user. +#This template can also be used in flat structure. but if developer think it's too heavy in flat, it's fine to develop sub command directly. +#But in hierarchical structure, we strongly recommand using this template. +# +#The main dispatch policy are: +#1. if there isn't noderange input from commmand line and there are service nodes defined in current MN, +# dispatch exact same command input from STDIN to all SNs and current MN. if there isn't service nodes defined, +# just hanld command input from STDIN in current MN +#2. If there is noderange input from command line by opion "-n", we will dispatch the command input from STDIN to SN which can hanle these ndoes +# For example, if we got command from STDIN like "probecommand -n test[1-15] -V" and test[1-5] 's SN is SN1, test[6-10]'s SN is SN2 +# The dispatch result will be: +# For MN run: probecommand -n test[11-15] -V +# For SN1 run: probecommand -n test[1-5] -V +# For SN2 run: probecommand -n test[6-10] -V +#3. All the return message from SNs and MN will be saved in hash %summaryoutput, develper can use it when implement summary_all_jobs_output function +#-------------------------------------------------------- + BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } use lib "$::XCATROOT/probe/lib/perl"; @@ -54,20 +74,20 @@ Options: "; #------------------------------------ -# Please implement the main checking job of current command in do_main_job function -# Recommand to use probe_utils->send_msg() to handle message you plan to print out +# Please implement the main job of current command in do_main_job function +# Recommand to use probe_utils->send_msg() to handle message you plan to print out to STDOUT # A simple example has been written in funciton. #------------------------------------ sub do_main_job { my $rst = 0; - probe_utils->send_msg("$output", "o", "I reveive node range is $noderange"); + probe_utils->send_msg("$output", "o", "Received node range: $noderange"); - #<#DO YOUR OWN CHECKING JOB1#> - probe_utils->send_msg("$output", "o", "first checking point"); + #<#DO YOUR OWN JOB1#> + probe_utils->send_msg("$output", "o", "Do the first job"); - #<#DO YOUR OWN CHECKING JOB2#> - probe_utils->send_msg("$output", "f", "second checking point"); + #<#DO YOUR OWN JOB2#> + probe_utils->send_msg("$output", "f", "Do the second job"); return $rst; } From 1ebdb5d96c3acb16a20821b694f551466913e986 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 26 Oct 2016 20:54:39 +0800 Subject: [PATCH 045/292] add lock in rh/genimage to avoid multiple genimage processes on same rootimg directory;add guard code before umount/remove mount points under rootimg directory --- perl-xCAT/xCAT/Utils.pm | 50 ++++++++++++++++++++-- xCAT-server/lib/xcat/plugins/packimage.pm | 13 +++++- xCAT-server/lib/xcat/plugins/rmimage.pm | 43 ++++++++++++++----- xCAT-server/share/xcat/netboot/rh/genimage | 40 ++++++++++++++--- 4 files changed, 125 insertions(+), 21 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index d158858f2..d28ea58ae 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -32,6 +32,7 @@ else { use IPC::Open3; use IO::Select; use xCAT::GlobalDef; +use Digest::MD5 qw(md5_hex); eval { require xCAT::RemoteShellExp; }; @@ -2394,19 +2395,21 @@ sub acquire_lock { use Fcntl ":flock"; my $tlock; $tlock->{path} = "/var/lock/xcat/" . $lock_name; - open($tlock->{fd}, ">", $tlock->{path}) or return undef; + sysopen($tlock->{fd}, $tlock->{path}, POSIX::O_CREAT | POSIX::O_WRONLY) or return undef; unless ($tlock->{fd}) { return undef; } - if ($nonblock_mode) { flock($tlock->{fd}, LOCK_EX | LOCK_NB) or return undef; } else { flock($tlock->{fd}, LOCK_EX) or return undef; } - print { $tlock->{fd} } $$; + + truncate $tlock->{fd},0; + syswrite $tlock->{fd} ,$$; $tlock->{fd}->autoflush(1); return $tlock; } + #--------------------- =head3 release_lock @@ -4781,4 +4784,45 @@ sub get_nmapversion { return $nmap_version; } + +#-------------------------------------------------------------------------------- + +=head3 acquire_lock_imageop + acquire lock for the image related operations on specific rootimg dir + the image related operation includes genimage,packimage,rmimage... + Arguments: + $rootimg_dir: the full path of osimage rootimage dir + lock mode: 0-block, 1-non-block + Returns: + a list with format (, or ) + + the : 0 on success, 1 on fail + the : available on fail + the : available on success +=cut + +#-------------------------------------------------------------------------------- + +sub acquire_lock_imageop { + my $self=shift; + my $rootimg_dir=shift; + my $NON_BLOCK=shift; + + $NON_BLOCK=1 unless(defined $NON_BLOCK); + my $mylockfile=Cwd::realpath($rootimg_dir); + my $mymd5=md5_hex($mylockfile); + $mylockfile=~s/\//./g; + $mylockfile=$mylockfile.".".$mymd5; + + my $lock = xCAT::Utils->acquire_lock("$mylockfile", $NON_BLOCK); + unless ($lock){ + my $pidfd; + open($pidfd,"<","/var/run/lock/xcat/$mylockfile"); + my $pid=<$pidfd>; + close($pidfd); + return (1, "failed to acquire lock, seems there is another genimage/packimage/rmimage process $pid running on root image dir \"$rootimg_dir\""); + } + return (0,$lock); +} + 1; diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index d5ab79c76..929f2d578 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -37,6 +37,8 @@ use File::Path; use xCAT::Utils; use xCAT::TableUtils; use xCAT::SvrUtils; +use Digest::MD5 qw(md5_hex); + Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -97,7 +99,8 @@ sub process_request { my $provmethod; my $help; my $version; - + my $lock; + GetOptions( "profile|p=s" => \$profile, "arch|a=s" => \$arch, @@ -199,6 +202,14 @@ sub process_request { } $rootimg_dir = "$destdir/rootimg"; + + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop($rootimg_dir); + if($retcode){ + $callback->({ error => ["$lock"], errorcode => [1]}); + return 1; + } + my $distname = $osver; until (-r "$::XCATROOT/share/xcat/netboot/$distname/" or not $distname) { chop($distname); diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index 586fa785c..ad35bd605 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -10,9 +10,11 @@ BEGIN use lib "$::XCATROOT/lib/perl"; use Getopt::Long; use File::Path; +use Cwd qw(realpath); use xCAT::Utils; use xCAT::TableUtils; use xCAT::DBobjUtils; +use Digest::MD5 qw(md5_hex); Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -41,7 +43,8 @@ sub process_request { my $xcatdef; my $imagename; my $imagedir; - + my $lock; + if (!xCAT::Utils->isLinux()) { $callback->({ error => ["The rmimage command is only supported on Linux."], errorcode => [1] }); return; @@ -175,8 +178,17 @@ sub process_request { $callback->({ error => ["Image directory $imagedir does not exist"], errorcode => [1] }); return; } + - # Doing this extra check now because we now have a method and arch from either the node or the image name. + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop("$imagedir/rootimg"); + if($retcode){ + $callback->({ error => ["$lock"], errorcode => [1]}); + return 1; + } + + + # Doing this extra check now because we now have a method and arch from either the node or the image namee if (($method eq "sysclone") && ($arch ne "s390x")) { # Only supporting removing sysclone images for s390x at this time. @@ -184,17 +196,28 @@ sub process_request { return; } - my @filestoremove = ("$imagedir/rootimg.gz", "$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); + my @filestoremove = ("$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); + my @rootimgtars=glob "$imagedir/rootimg.{tar,cpio}.{xz,gz}"; + push @filestoremove,@rootimgtars; + #unmount all the mount points under rootimg directory + #to avoid removing the directory/files on management node by mistake + $realimagedir=realpath("$imagedir/rootimg"); + my @mntptlist; + my $FILEHD=undef; + open($FILEHD,"<","/proc/mounts"); + while(<$FILEHD>){ + my @arr=split / /; + push @mntptlist,$arr[1] if(substr($arr[1],0,length($realimagedir)) eq $realimagedir); + } + close($FILEHD); + foreach my $mntpt (@mntptlist){ + system("umount -l $mntpt >/dev/null 2>&1") + } - #some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk - `umount -l $imagedir/rootimg/proc 2>&1 1>/dev/null`; - - # also umount the rootimg/sys - `umount -l $imagedir/rootimg/sys 2>&1 1>/dev/null`; # umount the rootimg/dev - my $devmount = `cat /proc/mounts |grep "$imagedir/rootimg/dev"`; - if ($devmount) { + my $devmount = system("findmnt $imagedir/rootimg/dev/ >/dev/null 2>&1"); + if (!$devmount) { xCAT::Utils->runcmd("umount -l $imagedir/rootimg/dev"); if ($?) { $callback->({ error => ["$imagedir/rootimg/dev mount on /dev, and can't umount. remove $imagename will lead to unpredictable result, please umount manualy before try again"], errorcode => [1] }); diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index ea50b4a6c..72c45871a 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -19,6 +19,8 @@ use File::Temp qw/mkdtemp/; use FindBin; use lib "$FindBin::Bin/../imgutils"; use imgutils; +use xCAT::Utils; +use Digest::MD5 qw(md5_hex); #use strict; Getopt::Long::Configure("bundling"); @@ -66,6 +68,8 @@ my $tempfile; my $prompt; my $ignorekernelchk; my $noupdate; +my $lock; + sub xdie { @@ -112,17 +116,30 @@ sub mount_chroot { sub umount_chroot { my $rootimage_dir = shift; - if ($rootimage_dir eq "") { + + $rootimage_dir=realpath($rootimage_dir); + if ($rootimage_dir eq "/") { print "\n\n\n\nWARNING: /proc and /sys may still be mounted in the rootimgdir\n\n\n\n"; return 1; } - + + #unmount all the mount points under rootimg directory + #to avoid removing the direcoty/files on managemment node by mistake + my @mntptlist; + my $FILEHD=undef; + open($FILEHD,"<","/proc/mounts"); + while(<$FILEHD>){ + my @arr=split / /; + push @mntptlist,$arr[1] if(substr($arr[1],0,length($rootimage_dir)) eq $rootimage_dir); + } + close($FILEHD); + foreach my $mntpt (@mntptlist){ + system("umount -l $mntpt >/dev/null 2>&1") + } + if (majversion($osver) > 6) { - system("umount -l $rootimage_dir/proc"); - system("umount -l $rootimage_dir/sys"); - - #system("umount -l $rootimage_dir/dev"); - system("rm -rf $rootimage_dir/dev/*"); + #only remove the /dev in rootimg directory if it is not a mount point + system("findmnt $rootimage_dir/dev/ >/dev/null 2>&1 || rm -rf $rootimage_dir/dev/*"); } } @@ -194,6 +211,7 @@ $srcdir_otherpkgs = "$installroot/post/otherpkgs/$osver/$arch" unless ($srcdir_o $destdir = "$installroot/netboot/$osver/$arch/$profile" unless ($destdir); $updates{'rootimgdir'} = $destdir if ($tempfile); + $rootimg_dir = "$destdir/rootimg"; $kerneldir = "$installroot/kernels" unless ($kerneldir); # the default directory for 3rd-party kernel is "$installroot/kernels"; @@ -348,6 +366,14 @@ unless ($onlyinitrd) { exit 1; } + my $retcode; + ($retcode,$lock)=xCAT::Utils->acquire_lock_imageop($rootimg_dir); + if($retcode){ + print "$lock"; + exit 1; + } + + mount_chroot($rootimg_dir); my %pkg_hash = imgutils::get_package_names($pkglist); From 472f94bb2241e760854fabd9042ffc3a00afb5db Mon Sep 17 00:00:00 2001 From: neo954 Date: Thu, 3 Nov 2016 02:39:07 -0500 Subject: [PATCH 046/292] [go-xcat] Fix GitHub issue #1998 (#2059) * [go-xcat] Fix GitHub issue #1998, print out friendly error messages when no xcat paackages installed on updating * [go-xcat] GitHub pull request #2059, change error message base on the comment of @whowutwut --- xCAT-server/share/xcat/tools/go-xcat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 6e82a6929..fc2449872 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.9 +# Version 1.0.10 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -1188,6 +1188,9 @@ function update_xcat() [[ "${ver}" = "(not installed)" ]] && unset "install_list[${i}]" done < <(check_package_version "${install_list[@]}") + [[ "${#install_list[@]}" -gt "0" ]] + warn_if_bad "$?" "xCAT is not installed." + exit_if_bad "$?" "In order to install xCAT, please rerun with \`${0##*/} install'." install_packages "$@" "${install_list[@]}" } From 42814db0bcaf965d525b1b5aa75a190f15796e63 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 03:33:02 -0400 Subject: [PATCH 047/292] modified xcatprobe discovery usage --- xCAT-probe/subcmds/discovery | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index a798bd8d0..5a4a1cd82 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -39,12 +39,15 @@ my $program_name = basename("$0"); $::USAGE = "Usage: $program_name -h $program_name -n -m [-t ] [-V] [--noprecheck] + $program_name -n -m -r [-V] [--noprecheck] Description: - Probe the discovery process, including pre-check for required configuration and realtime monitor of discovery process. - If all pre-check items pass, $program_name will go to monitor directly, otherwise $program_name will exit. - In order to do realtime monitor, $program_name probe must be run along with the node discovery procedure. Trigger this command before triggering node discovery procedure. - Currently, this command does not support hierarchy. + Probe the discovery process, including pre-check for required configuration, 'Realtime monitor' and 'Replay history' of discovery process. + If all pre-check items failed, $program_name will exit. + Realtime monitor: This is a default. This tool with monitor discovery state of the node. Trigger 'Realtime monitor' before rebooting target node to do discovery. + Replay history: Used after discovery is finished to probe the previously completed discovery. + + [NOTE] Currently, hierarchial structure is not supported. Options: -h : Get usage information of $program_name. @@ -53,6 +56,9 @@ Options: -n : The range of predefined nodes, must be used with option -m. --noprecheck : skip pre-checking discovery to validate correct configuration. -t : The maximum time to wait when doing monitor, unit is minutes. default is 60. + -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) + Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). + If unit is not specified, hour will be used by default. "; #---------------------------------------------- From 606ac46dd08991dda05ad55535c977c2291c8887 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 3 Nov 2016 14:58:08 +0800 Subject: [PATCH 048/292] Use sleep subroutine instead of exec(sleep) exec function call will take over all the process, lead to no chance to continue the work within the script, this patch use sleep function call from perl library instead. Close-issue: #1801 --- xCAT-server/share/xcat/cons/ipmi | 98 +++++++++++++++++--------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/xCAT-server/share/xcat/cons/ipmi b/xCAT-server/share/xcat/cons/ipmi index 620a72e01..48d22d406 100755 --- a/xCAT-server/share/xcat/cons/ipmi +++ b/xCAT-server/share/xcat/cons/ipmi @@ -1,50 +1,52 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html use Fcntl qw(:DEFAULT :flock); - -sub get_lock { - unless (flock(LOCKHANDLE, LOCK_EX | LOCK_NB)) { - $| = 1; - print "Acquiring startup lock..."; - flock(LOCKHANDLE, LOCK_EX) or die "Fatal Error securing startup lock"; - print "done\n"; - } - truncate(LOCKHANDLE, 0); - print LOCKHANDLE $$ . "\n"; -} - -sub release_lock { - truncate(LOCKHANDLE, 0); - flock(LOCKHANDLE, LOCK_UN); -} - -BEGIN -{ - use Time::HiRes qw(sleep); - use File::Path; - use Fcntl qw(:DEFAULT :flock); - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; - umask 0077; - mkpath("/tmp/xcat/"); - unless (sysopen(LOCKHANDLE, "/tmp/xcat/consolelock", O_WRONLY | O_CREAT)) { - print "Unable to open lock file"; - exec("sleep 15"); - exit 0; - } - get_lock(); - - #my $sleepint=int(rand(10)); - #print "Opening console in ".(2+(0.5*$sleepint))." seconds...\n"; - #sleep $sleepint; +use Time::HiRes qw(sleep); +use File::Path; +BEGIN { + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } my $sleepint = int(rand(10)); #Stagger start to avoid overwhelming conserver/xCATd -$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; -use lib "$::XCATROOT/lib/perl"; -require xCAT::Client; +my ($lockfd, $bmc); my $username = 'USERID'; my $password = 'PASSW0RD'; my $node = $ARGV[0]; -my $bmc; + +use constant CONSOLE_LOCK_FILE => "/tmp/xcat/consolelock"; +use constant CONSOLE_LOCK_DIR => "/tmp/xcat"; + +sub acquire_lock { + umask 0077; + mkpath(CONSOLE_LOCK_DIR); + print "Acquiring startup lock..."; + unless (sysopen($lockfd, CONSOLE_LOCK_FILE, O_WRONLY | O_CREAT)) { + print "Unable to open file ".CONSOLE_LOCK_FILE."\n"; + sleep(15); + exit 1; + } + unless (flock($lockfd, LOCK_EX)) { + print "Unable to lock file ".CONSOLE_LOCK_FILE."\n"; + close($lockfd); + sleep(15); + exit 1; + } + print "done\n"; + unless (syswrite($lockfd, $$, length($$))) { + print "Unable to write file ".CONSOLE_LOCK_FILE."\n"; + close($lockfd); + sleep(15); + exit 1; + } +} + +sub release_lock { + flock($lockfd, LOCK_UN); + close($lockfd); +} + + +use lib "$::XCATROOT/lib/perl"; +require xCAT::Client; sub getans { my $rsp = shift; @@ -63,16 +65,22 @@ my $cmdref = { arg => ["text"], noderange => [ $ARGV[0] ] }; +acquire_lock(); +# avoid of congestion +sleep(0.1); +release_lock(); xCAT::Client::submit_request($cmdref, \&getans); + until (($username or $password) and $bmc) { - release_lock(); #Let other clients have a go + #Let other clients have a go $sleepint = 10 + int(rand(20)); print "Console not ready, retrying in $sleepint seconds (Ctrl-e,c,o to skip delay) \n"; - exec("sleep $sleepint"); - get_lock(); + sleep ($sleepint); + acquire_lock(); + sleep(0.1); + release_lock(); xCAT::Client::submit_request($cmdref, \&getans); } -release_lock(); my ($user, $pass); if ($username) { @@ -124,9 +132,7 @@ if ($rc) { #some shoddy vendors ignore the IPMI 2.0 requirement to support IPMI while ($rc != 0) { $sleepint = 10 + int(rand(20)); print "Failure to reach IPMI device, retrying in $sleepint seconds (Hit Ctrl-E,c,o to skip)\n"; - exec("sleep $sleepint"); - - #sleep $sleepint; + sleep ($sleepint); @mcinfo = `$ipmitool -I lanplus $user $pass -H $bmc mc info`; #| grep 'Manufacturer ID : 343' > /dev/null 2>&1"; $rc = $?; if ($rc) { #repeat workaround for shoddy vendors From 672f1e8bd58f096a8072986a89573e997c762807 Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 04:21:57 -0400 Subject: [PATCH 049/292] modified depending on comments --- xCAT-genesis-scripts/bin/doxcat | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 9c052b313..fa78b4677 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -271,14 +271,19 @@ fi # rv 0 state does not work with the new ntp versions while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do - echo `ntpq -c 'rv 0 offset` sleep 1 done -kill `cat /var/run/syslogd.pid` -sleep 3 -RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` -if [ $RSYSLOGD_VERSION -ge 8 ]; then +read -r RSYSLOG_PID /dev/null +kill "$RSYSLOG_PID" 2>/dev/null +while kill -0 "$RSYSLOG_PID" 2>/dev/null +do + sleep 0.5 +done +unset RSYSLOG_PID + +RSYSLOGD_VERSION=`rsyslogd -v | awk '/rsyslogd/ { split($2, a, "."); print a[1]; }'` +if [ "$RSYSLOGD_VERSION" -ge 8 ]; then /sbin/rsyslogd else /sbin/rsyslogd -c4 @@ -330,7 +335,8 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' - touch /tmp/xcatgenesisdiscovery + DISCOVERYDONE=1 + export DISCOVERYDONE elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -394,7 +400,7 @@ while :; do delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - if [ -e "/tmp/xcatgenesisdiscovery" ]; then + if [ $DISCOVERYDONE == 1 ]; then logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" else logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" From b34a916cafaeff39221a04ee83b68e28adc46860 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 3 Nov 2016 09:22:52 -0400 Subject: [PATCH 050/292] Review updates --- .../ppc64le/virtual_machines/RHEVHypervisor.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index e8ae9fabf..5ad65df54 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -17,17 +17,17 @@ chdef -t osimage rhels7.3-ppc64le-RHEV4-install-compute \ otherpkgdir=/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA - * Create a new file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: + * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: - #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglis# + #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist# bridge-utils - * Modify ``pkglist`` attribute to point to the file from the step above :: + * Modify ``pkglist`` attribute to point to the package list file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ pkglist=/install/custom/rhels7.3/ppc64le/rhelv4.pkglist - * Create a new file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: + * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: libvirt qemu-kvm-rhev @@ -35,7 +35,7 @@ virt-manager-common virt-install - * Modify ``otherpkglist`` attribute to point to the file from the step above :: + * Modify ``otherpkglist`` attribute to point to the package list file from the step above :: chdef -t osimage rhels7.3-snap3-ppc64le-RHEV4-install-compute \ otherpkglist=/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist From 21b77c86df0be6b5b55779ecc97e970e8117caba Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 3 Nov 2016 21:01:52 -0400 Subject: [PATCH 051/292] modified depending on comments --- xCAT-genesis-scripts/bin/doxcat | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index fa78b4677..e03df7a83 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -335,8 +335,8 @@ while :; do /bin/getcert $XCATMASTER:$XCATPORT destiny='' dest='' - DISCOVERYDONE=1 - export DISCOVERYDONE + XCAT_DISCOVERY_WAS_DONE=1 + export XCAT_DISCOVERY_WAS_DONE elif [ "$dest" = shell ]; then logger -s -t $log_label -p local4.info "Dropping to debug shell(exit to run next destiny)..." destiny='' @@ -400,7 +400,7 @@ while :; do delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do if [ $((delay%10)) == 0 ]; then - if [ $DISCOVERYDONE == 1 ]; then + if [ "$XCAT_DISCOVERY_WAS_DONE" == 1 ]; then logger -s -t $log_label -p local4.info "Received request=$dest, will call xCAT back in $delay seconds. Discovery is complete, run nodeset on this node to provision an Operating System" else logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" @@ -409,8 +409,8 @@ while :; do delay=$((delay-1)) sleep 1 done - destiny='' - dest='' + destiny='' + dest='' echo "Retrying "; elif [ "$dest" = shutdown ]; then logger -s -t $log_label -p local4.info "Poweroff..." From fc15887f848eab5bfbee1f3f0255b81689b73abf Mon Sep 17 00:00:00 2001 From: thiell Date: Thu, 3 Nov 2016 21:43:55 -0700 Subject: [PATCH 052/292] postscripts: add --showduplicates to yum list (#2056) "yum list" alone does NOT check the older packages available in the yum repo. If we want to install a specific package version, the --showduplicates option is required. As an example, with this patch, we can now add a specific kernel package to otherpkgs.pkglist that is older that the one available in the distro. --- xCAT/postscripts/otherpkgs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 27c934d8d..b54c5e23f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -715,7 +715,7 @@ while [ $op_index -le $OTHERPKGS_INDEX ]; do fi if [ $hasyum -eq 1 ]; then #use yum - result=`yum list $fn 2>&1` + result=`yum --showduplicates list $fn 2>&1` if [ $? -eq 0 ]; then rc=0 array_set_element repo_path $index $path From ea5ffdc0bc7e9bc4175a9863d719ef59efbb3041 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 4 Nov 2016 12:47:21 +0800 Subject: [PATCH 053/292] update dhcpd conf file when upgrade xcat (#2067) --- xCAT-server/sbin/xcatconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index e960e1640..840df68c5 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1464,6 +1464,13 @@ sub initDB xCAT::MsgUtils->message('E', "Could not add default value for site.xcatsslversion."); } } + + # Set dhcpd.conf be updated when update xcat + my $cmds = "XCATBYPASS=Y $::XCATROOT/sbin/makedhcp -n 2>/dev/null"; + xCAT::Utils->runcmd("$cmds", -1); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message('E', "Could not create a new dhcp configuration file."); + } } # remove xcatserver,xcatclient From c51cb98c75e6d0027c7b6212e8cee10071b60ff6 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Fri, 4 Nov 2016 13:22:52 +0800 Subject: [PATCH 054/292] quote date command in string (#2076) --- xCAT/postscripts/xcatinstallpost | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 32a51016e..21309a79d 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -43,7 +43,7 @@ while true; do if [ $RETRY -eq 90 ];then #timeout, complain and exit - msgutil_r "$MASTER_IP" "err" `date`" xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log" + msgutil_r "$MASTER_IP" "err" "`date`: xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log" exit 1 fi From 2751a075b6e2310b18294285438c6e2d02f56796 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 4 Nov 2016 02:32:48 -0400 Subject: [PATCH 055/292] fix bug#1528 and modify code depending on comments --- xCAT-probe/subcmds/xcatmn | 461 +++++++++++++++++++------------------- 1 file changed, 235 insertions(+), 226 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index f09e111b9..9fb7c68c4 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -9,14 +9,15 @@ use hierarchy; use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use File::Basename; +use File::Copy; use Data::Dumper; use Getopt::Long qw(:config no_ignore_case); -my $help = 0; #command line attribute '-h', get usage information -my $test = 0; #command line attribute '-T' +my $help = 0; #command line attribute '-h', get usage information +my $test = 0; #command line attribute '-T' my $hierarchy = 0; -my $verbose = 0; #command line attribute '-V' -my $noderange; #command line attribute '-n' +my $verbose = 0; #command line attribute '-V' +my $noderange; #command line attribute '-n' my $output = "stdout"; #used by probe_utils->send_msg("$output", "o", "xxxxxxxxxx"); print output to STDOUT my $rst = 0; #the exit code of current command my $terminal = 0; #means get INT signal from STDIN @@ -33,7 +34,7 @@ $is_sn = 1 if (-e "/etc/xCATSN"); #------------------------------------- -# Usage +# Usage #------------------------------------- my $program_name = basename("$0"); #current sub_command name $::USAGE = "Usage: @@ -51,7 +52,7 @@ Options: "; sub do_main_job { - my $rst = 0; + my $rst = 0; my @error = (); my $checkpoint; my $rc = 0; @@ -59,97 +60,98 @@ sub do_main_job { #check if all xcat deamons are running $checkpoint = "All xCAT deamons are running"; - $rst = check_all_xcat_deamons(\@error); + $rst = check_all_xcat_deamons(\@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); - #check if xcatd can receive request + #check if xcatd can receive request $checkpoint = "xcatd can receive command request"; - $rst = check_xcatd_receive_request(\@error); + $rst = check_xcatd_receive_request(\@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check 'site' table configuratiions my %sitetable; $checkpoint = "'site' table is configured correctly"; - $rst = check_site_table(\%sitetable,\@error); + $rst = check_site_table(\%sitetable, \@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check network configuratiions $checkpoint = "Provision network is configured correctly"; - $rst = check_network(\%sitetable,\$installnicip,\@error); + $rst = check_network(\%sitetable, \$installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); - return $rst if($rst); + return $rst if ($rst); #check 'passwd' table configuratiions $checkpoint = "'passwd' table is configured correctly"; - $rst = check_passwd_table(\@error); + $rst = check_passwd_table(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check important directory $checkpoint = "Important directory is configured correctly"; - $rst = check_directory(\%sitetable,\@error); + $rst = check_directory(\%sitetable, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; - #check if SElinux is disabled + #check if SElinux is disabled $checkpoint = "SELinux is disabled on current server"; - $rst = check_selinux(\@error); + $rst = check_selinux(\@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check http service $checkpoint = "HTTP service works well"; - $rst = check_http_service($installnicip, \@error); + $rst = check_http_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check tftp service $checkpoint = "TFTP service works well"; - $rst = check_tftp_service($installnicip,\@error); + $rst = check_tftp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DNS service $checkpoint = "DNS service works well"; - $rst = check_dns_service(\%sitetable, $installnicip,\@error); + $rst = check_dns_service(\%sitetable, $installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #check DHCP service $checkpoint = "DHCP service works well"; - $rst = check_dhcp_service($installnicip, \@error); + $rst = check_dhcp_service($installnicip, \@error); print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; #Below are the 'warning` level check points - #check if firewall is close + #check if firewall is close $checkpoint = "Firewall is closed on current server"; - $rst = check_firewall(\@error); + $rst = check_firewall(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; #check disk space - $checkpoint = "The disk space is enough for xCAT to work"; - $rst = check_disk(\@error); + $checkpoint = "The disk space is enough for xCAT to work"; + $rst = check_disk(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; - + #some sepecific check points in MN - if(! $is_sn){ + if (!$is_sn) { + #check if server ip is a static ip in MN $checkpoint = "The IP of master is a static IP address"; - $rst = check_server_ip_static($installnicip,\@error); + $rst = check_server_ip_static($installnicip, \@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; #check if dhcpd.leases is less than 100M $checkpoint = "The dhcpd.leases file is less than 100M"; - $rst = check_dhcp_leases(\@error); + $rst = check_dhcp_leases(\@error); print_check_result($checkpoint, "w", $rst, \@error); $rc |= $rst; } @@ -166,6 +168,7 @@ sub summary_all_jobs_output { #DO SUMMARY DEPENDING ON YOUR SUB_COMMAND NEED probe_utils->send_msg("$output", "d", "======================do summary====================="); + #print "summaryoutput:\n"; #print Dumper \%summaryoutput; @@ -180,12 +183,12 @@ sub summary_all_jobs_output { } elsif ($line =~ /(\[warning\]\s*):\s*(.*)/) { push @summary, "$1: $2"; $ok_section = 0; - } elsif($line =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + } elsif ($line =~ /(\[debug\]\s*):\s*(.*)/ && !$ok_section) { push @summary, "$1: $2"; - } elsif($line =~ /(\[ok\]\s*):\s*(.*)/) { - $ok_section=1; + } elsif ($line =~ /(\[ok\]\s*):\s*(.*)/) { + $ok_section = 1; } - + } my %summary_sn = (); @@ -203,9 +206,9 @@ sub summary_all_jobs_output { } elsif ($log =~ /(\[warning\]\s*):\s*(.*)/) { push @{ $summary_sn{$node}{"details"} }, "$1: $2"; $ok_section = 0; - } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && ! $ok_section) { + } elsif ($log =~ /(\[debug\]\s*):\s*(.*)/ && !$ok_section) { push @{ $summary_sn{$node}{"details"} }, "$1: $2"; - } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/){ + } elsif ($log =~ /(\[ok\]\s*):\s*(.*)/) { $ok_section = 1; } elsif ($log !~ /^(\[\w+\]\s*):\s*(.*)/) { push @{ $summary_sn{$node}{"details"} }, "[failed]: $log"; @@ -242,115 +245,115 @@ sub summary_all_jobs_output { } } } - + return $rst; } -sub print_check_result{ - my $msg = shift; - my $error_level = shift; +sub print_check_result { + my $msg = shift; + my $error_level = shift; my $check_return_code = shift; - my $error_msg_ref = shift; + my $error_msg_ref = shift; - if($check_return_code == 1){ + if ($check_return_code == 1) { probe_utils->send_msg("$output", "$error_level", $msg); probe_utils->send_msg("$output", "d", "$_") foreach (@$error_msg_ref); - }elsif($check_return_code ==2){ + } elsif ($check_return_code == 2) { return; - }else{ - probe_utils->send_msg("$output", "o", $msg); + } else { + probe_utils->send_msg("$output", "o", $msg); } } -sub check_all_xcat_deamons{ +sub check_all_xcat_deamons { my $error_ref = shift; my $rst = 0; @$error_ref = (); - my @deamon_list = ("SSL listener", - "DB Access", - "UDP listener", - "install monitor", - "Discovery worker", - "Command log writer"); + my @deamon_list = ("SSL listener", + "DB Access", + "UDP listener", + "install monitor", + "Discovery worker", + "Command log writer"); my $output = `ps aux|grep -v grep|grep xcatd`; - foreach my $deamon (@deamon_list){ - if($output !~ /$deamon/){ - push @$error_ref, "Deamon '$deamon' isn't running"; - $rst = 1; + foreach my $deamon (@deamon_list) { + if ($output !~ /$deamon/) { + push @$error_ref, "Deamon '$deamon' isn't running"; + $rst = 1; } } - + return $rst; } -sub check_xcatd_receive_request{ +sub check_xcatd_receive_request { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); #check important port my @port_list = ("xcatdport", "xcatiport"); - foreach my $port_attr (@port_list){ + foreach my $port_attr (@port_list) { my $port = `lsdef -t site -i $port_attr -c| awk -F'=' '{print \$2}'`; - chomp($port); - if($port){ + chomp($port); + if ($port) { my $cmdoutput = `netstat -ant|grep LISTEN|grep $port`; - if($?){ + if ($?) { push @$error_ref, "Attribute '$port_attr' in site table is set to $port, but xcatd isn't listening on $port"; - $rst=1; + $rst = 1; } - }else{ + } else { push @$error_ref, "Attribute '$port_attr' isn't set in 'site' table"; $rst = 1; } } - return $rst if($rst); + return $rst if ($rst); #send one command to test if xcatd can receive request my $cmdoutput = `lsxcatd -a 2>&1`; - if($?){ - my @lines = split("[\n\r]", $cmdoutput); - push @$error_ref, $_ foreach (@lines); - $rst=1; + if ($?) { + my @lines = split("[\n\r]", $cmdoutput); + push @$error_ref, $_ foreach (@lines); + $rst = 1; } - + return $rst; } -sub check_site_table{ - my $sitetable_ref=shift; - my $error_ref = shift; +sub check_site_table { + my $sitetable_ref = shift; + my $error_ref = shift; my $rst = 0; @$error_ref = (); my @attr_list = ("master", "domain", "installdir", "tftpdir"); - foreach my $attr (@attr_list){ + foreach my $attr (@attr_list) { my $value; $value = `lsdef -t site -i $attr -c | awk -F'=' '{print \$2}'`; chomp($value); - if($value eq ""){ + if ($value eq "") { push @$error_ref, "There isn't '$attr' definition in 'site' table"; - $rst=1; - }else{ - if (($attr eq "master") and (! probe_utils->is_ip_addr("$value"))) { + $rst = 1; + } else { + if (($attr eq "master") and (!probe_utils->is_ip_addr("$value"))) { push @$error_ref, "The value of 'master' in 'site' table isn't an IP addres"; - $rst=1; + $rst = 1; } $sitetable_ref->{$attr} = $value; } } - + return $rst; } -sub check_passwd_table{ +sub check_passwd_table { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); - + my $passwd = `tabdump passwd |awk -F',' '/system/ { gsub(/"/, "", \$2); gsub(/"/, "", \$3); print \$2,\$3 }'`; chomp($passwd); my ($username, $pw) = split(" ", $passwd); @@ -362,15 +365,16 @@ sub check_passwd_table{ return $rst; } -sub check_network{ - my $sitetable_ref=shift; - my $serverip_ref = shift; #output arguments - my $error_ref = shift; #output arguments +sub check_network { + my $sitetable_ref = shift; + my $serverip_ref = shift; #output arguments + my $error_ref = shift; #output arguments my $rst = 0; @$error_ref = (); - - if($is_sn){ + + if ($is_sn) { + # on SN, get ip address by compare 'master' attribute in 'site' table # choose the one in the same network with 'master' my @ipoutput = `ip addr show | grep inet | grep -v inet6 2>&1`; @@ -382,10 +386,10 @@ sub check_network{ } } if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { - push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; + push @$error_ref, "There isn't IP in current server has the same network as master '$sitetable_ref->{master}'"; $rst = 1; } - }else{ # on MN + } else { # on MN my $nics = `ip addr show $installnic >/dev/null 2>&1`; if ($?) { push @$error_ref, "There isn't NIC '$installnic' in current server"; @@ -395,8 +399,8 @@ sub check_network{ chomp($$serverip_ref); if (!defined($$serverip_ref) || ($$serverip_ref eq "")) { push @$error_ref, "There isn't IP address assigned to NIC $installnic"; - $rst =1; - }else{ + $rst = 1; + } else { if ($$serverip_ref ne $sitetable_ref->{master}) { push @$error_ref, "The IP $$serverip_ref of $installnic doesn't equal the value of 'master' in 'site' table"; $rst = 1; @@ -404,7 +408,7 @@ sub check_network{ } } } - + my $networks = `tabdump networks|grep -v "^#"`; $networks =~ s/\"//g; my $netcnt = `echo "$networks"|wc -l`; @@ -420,48 +424,48 @@ sub check_network{ } } } - if (! $hit) { + if (!$hit) { push @$error_ref, "IP $$serverip_ref of $installnic doesn't belong to any network defined in 'networks' table"; $rst = 1; } return $rst; } -sub check_server_ip_static{ - my $serverip=shift; +sub check_server_ip_static { + my $serverip = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); - if (! probe_utils->is_static_ip("$serverip", "$installnic")) { + if (!probe_utils->is_static_ip("$serverip", "$installnic")) { push @$error_ref, "The value '$serverip' of 'master' in 'site' table isn't a static ip"; - $rst=1; - } - return $rst; -} + $rst = 1; + } + return $rst; +} -sub check_directory{ - my $sitetable_ref=shift; - my $error_ref = shift; - my $rst = 0; +sub check_directory { + my $sitetable_ref = shift; + my $error_ref = shift; + my $rst = 0; @$error_ref = (); my @dir_list = ("installdir", "tftpdir"); - foreach my $dir (@dir_list){ - if($sitetable_ref->{$dir} eq ""){ - push @$error_ref, "There isn't '$dir' definition in 'site' table"; + foreach my $dir (@dir_list) { + if ($sitetable_ref->{$dir} eq "") { + push @$error_ref, "There isn't '$dir' definition in 'site' table"; $rst = 1; - }else{ - if (! -e "$sitetable_ref->{$dir}") { + } else { + if (!-e "$sitetable_ref->{$dir}") { push @$error_ref, "There isn't '$sitetable_ref->{$dir}' directory on current server"; $rst = 1; - }else{ + } else { if ($is_sn) { my $mountoutput = `mount | grep '$sitetable_ref->{$dir}'`; chomp($mountoutput); - + my $mountip; if ($mountoutput =~ /(.+):$sitetable_ref->{$dir} on $sitetable_ref->{$dir} /) { my $mountsource = $1; @@ -471,53 +475,58 @@ sub check_directory{ $mountip = xCAT::NetworkUtils->getipaddr($mountsource); } } - + if ($mountip ne $sitetable_ref->{master}) { push @$error_ref, "$dir '$sitetable_ref->{$dir}' isn't mounted from the management node"; $rst = 1; } } } - } + } } return $rst; } -sub check_disk{ +sub check_disk { my $error_ref = shift; my $rst = 0; @$error_ref = (); - #check the free space of specific directory - #if "/var" is mounted on standalone disk, more than 1G free space is expected - #if "/tmp" is mounted on standalone disk, more than 1G free space is expected - #if installdir is mounted on standalone disk, more than 10G free space is expected. - #if any one of above three directories hasn't standalone disk, "/" directory should cover its space requirement. - my @dir_expectedspace_list = (["/var", "1"], ["/tmp", "1"], ["$installdir", "10"], ["/" , "0"]); - foreach my $dir (@dir_expectedspace_list){ - next if($dir->[0] eq "/" && $dir->[1] == 0); - my $checkrst = probe_utils->is_dir_has_enough_space($dir->[0], $dir->[1]); - if($checkrst == 2){ - $dir_expectedspace_list[$#dir_expectedspace_list][1] += $dir->[1]; -# }elsif($checkrst == 1){ -# probe_utils->send_msg($outputtarget, "o", "The free space of '$dir->[0]' directory is more than $dir->[1] G"); - }elsif($checkrst == 0){ -# probe_utils->send_msg($outputtarget, "w", "The free space of '$dir->[0]' is less than $dir->[1] G"); - push @$error_ref, "The free space of '$dir->[0]' is less than $dir->[1] G"; - $rst = 1; - } + my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); + my %mountpointinfo; + foreach my $dir (keys %dir_expectedspace_list) { + my $output = `df -k $dir|tail -n 1`; + chomp($output); + my @splitoutput = split(" ", $output); + $mountpointinfo{ $splitoutput[5] }{available} = $splitoutput[3]; + $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir} * 1048576; + push @{ $mountpointinfo{ $splitoutput[5] }{mount} }, $dir; + } + my $msg = ""; + foreach $mountpoint (keys %mountpointinfo) { + if ($mountpointinfo{$mountpoint}{need} > $mountpointinfo{$mountpoint}{available}) { + foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { + $msg .= "'$_' needs $dir_expectedspace_list{$_} G, "; + } + my $size_g = $mountpointinfo{$mountpoint}{available} / 1048576; + $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $size_g G, it isn't enough."; + $rst = 1; + } + } + if ($rst) { + push @$error_ref, "$msg"; } return $rst; } -sub check_selinux{ +sub check_selinux { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); if (probe_utils->is_selinux_enable()) { @@ -530,21 +539,21 @@ sub check_selinux{ sub check_firewall { my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); if (probe_utils->is_firewall_open()) { push @$error_ref, "Firewall is configured on current server"; - $rst =1; + $rst = 1; } return $rst; } -sub check_http_service{ - my $serverip=shift; +sub check_http_service { + my $serverip = shift; my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); `which wget > /dev/null 2>&1`; @@ -552,8 +561,8 @@ sub check_http_service{ push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; $rst = 1; } else { - if (! probe_utils->is_http_ready("$serverip")) { - push @$error_ref, "HTTP service isn't ready on $serverip"; + if (!probe_utils->is_http_ready("$serverip")) { + push @$error_ref, "HTTP service isn't ready on $serverip"; $rst = 1; } } @@ -562,10 +571,10 @@ sub check_http_service{ } -sub check_tftp_service{ - my $serverip = shift; +sub check_tftp_service { + my $serverip = shift; my $error_ref = shift; - my $rst = 0; + my $rst = 0; @$error_ref = (); my $nodename = `hostname -s`; @@ -585,23 +594,23 @@ sub check_tftp_service{ $rst = 1; } else { $msg = "TFTP service is ready on $serverip"; - if (! probe_utils->is_tftp_ready("$serverip")) { + if (!probe_utils->is_tftp_ready("$serverip")) { push @$error_ref, "TFTP service isn't ready on $serverip"; $rst = 1; } } - }else{ + } else { $rst = 2; } return $rst; } -sub check_dns_service{ - my $sitetable_ref=shift; - my $serverip=shift; - my $error_ref = shift; - my $rst = 0; +sub check_dns_service { + my $sitetable_ref = shift; + my $serverip = shift; + my $error_ref = shift; + my $rst = 0; @$error_ref = (); my $nodename = `hostname -s`; @@ -614,7 +623,7 @@ sub check_dns_service{ $checkdns = `lsdef $nodename -i setupnameserver -c | awk -F'=' '{print \$2}'`; chomp($checkdns); } - + if ($checkdns) { `which nslookup > /dev/null 2>&1`; if ($?) { @@ -622,13 +631,15 @@ sub check_dns_service{ $rst = 1; } else { if ($is_sn) { + # on sn, nslookup it's ip to check DNS service if (!probe_utils->is_dns_ready("$serverip", "$sitetable_ref->{master}", "$nodename", "$sitetable_ref->{domain}")) { push @$error_ref, "DNS service isn't ready on $serverip"; $rst = 1; } - }else{ - my $rc=0; + } else { + my $rc = 0; + # if this is a hierarchical cluster, nslookup one of sn to check DNS service my @snlist = xCAT::ServiceNodeUtils->getAllSN(); my $sntmp = shift(@snlist); @@ -645,7 +656,7 @@ sub check_dns_service{ # if there is no sn, nslookup mnip my $nslkp = `nslookup $serverip $serverip 2>&1`; chomp($nslkp); - my $tmp = grep {$_ =~ "Server:[\t\s]*$serverip"} split (/\n/, $nslkp); + my $tmp = grep { $_ =~ "Server:[\t\s]*$serverip" } split(/\n/, $nslkp); if (!$tmp) { $rc = 1; } @@ -656,23 +667,23 @@ sub check_dns_service{ } } } - }esle{ - $rst =2; - } - + } esle { + $rst = 2; + } + return $rst; } -sub check_dhcp_service{ - my $serverip=shift; +sub check_dhcp_service { + my $serverip = shift; my $error_ref = shift; my $rst = 0; @$error_ref = (); - # For sn, 'setupdhcp' attribute could be set to '0' or '1'. + # For sn, 'setupdhcp' attribute could be set to '0' or '1'. # if '0', sn does not need to provie DHCP service, will not check it if ($is_sn) { my $nodename = `hostname -s`; @@ -680,18 +691,19 @@ sub check_dhcp_service{ my $checkdhcp = `lsdef $nodename -i setupdhcp -c | awk -F'=' '{print \$2}'`; chomp($checkdhcp); if ($checkdhcp) { + # on sn, just check dhcpd service whether running my $dhcpoutput = `ps aux | grep dhcpd |grep -v grep`; - if (! $dhcpoutput) { - push @$error_ref, "There isn't 'dhcpd' deamon in current server"; + if (!$dhcpoutput) { + push @$error_ref, "There isn't 'dhcpd' deamon in current server"; $rst = 1; } } else { $rst = 2; } } else { - my $rc = 0; - { #very important brace to create a block + my $rc = 0; + { #very important brace to create a block my @snlist = xCAT::ServiceNodeUtils->getAllSN(); my $sntmp = shift(@snlist); if ($sntmp) { @@ -705,7 +717,7 @@ sub check_dhcp_service{ chomp($tmp); my $snip = xCAT::NetworkUtils->getipaddr($sntmp); my $snmac = `lsdef $sntmp -i mac -c | awk -F'=' '{print \$2}'`; - chomp ($snmac); + chomp($snmac); my $tmpmac; if ($tmp =~ /$sntmp: ip-address = $snip, hardware-address = (.+)/) { $tmpmac = $1; @@ -749,7 +761,7 @@ sub check_dhcp_service{ $tmp = `makedhcp -q xcatmntest`; if ($?) { - push @$error_ref, "makedhcp -q xcatmntest failed"; + push @$error_ref, "makedhcp -q xcatmntest failed"; returncmdoutput($tmp, $error_ref) if ($verbose); $rc = 1; `makedhcp -d xcatmntest && rmdef xcatmntest`; @@ -768,12 +780,12 @@ sub check_dhcp_service{ $tmp = `makedhcp -d xcatmntest && rmdef xcatmntest`; returncmdoutput($tmp, $error_ref) if ($verbose); - `rm /etc/hosts`; - `mv /etc/hosts.bak.probe /etc/hosts`; + unlink "/etc/hosts"; + move("/etc/hosts.bak.probe", "/etc/hosts"); } } if ($rc) { - push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; + push @$error_ref, "Run 'makedhcp -n' if it has not been ran before."; $rst = 1; } } @@ -781,7 +793,7 @@ sub check_dhcp_service{ return $rst; } -sub check_dhcp_leases{ +sub check_dhcp_leases { my $error_ref = shift; my $rst = 0; @@ -796,25 +808,18 @@ sub check_dhcp_leases{ $leasefile = "/var/lib/dhcp/dhcpd.leases"; } - my $filesizetmp = `du -sb $leasefile`; - if ($?) { - push @$error_ref, "Got the size of '$leasefile' failed"; - returncmdoutput($filesizetmp, $error_ref) if ($verbose); + my @fileinfo = stat("$leasefile"); + if ($fileinfo[7] > 104857600) { + my $size_m = $fileinfo[7] / 1048576; + push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; $rst = 1; - } else { - chomp($filesizetmp); - my ($size, $file) = split(" ", $filesizetmp); - if ($size > 104857600) { - my $size_m = $size / 1048576; - push @$error_ref, "The size of $leasefile is $size_m M, more than 100M"; - $rst =1; - } } + return $rst; } sub returncmdoutput { - my $rst = shift; + my $rst = shift; my $error_ref = shift; chomp($rst); @@ -823,6 +828,7 @@ sub returncmdoutput { push @$error_ref, $line; } } + #------------------------------------- # Clean up test environment # ------------------------------------- @@ -832,10 +838,11 @@ sub cleanup { `makedhcp -d xcatmntest && rmdef xcatmntest > /dev/null 2>&1`; } if (-e "/etc/hosts.bak.probe") { - `rm /etc/hosts > /dev/null 2>&1`; - `mv /etc/hosts.bak.probe /etc/hosts > /dev/null 2>&1`; + unlink "/etc/hosts"; + move("/etc/hosts.bak.probe", "/etc/hosts"); } } + #------------------------------------- # main process #------------------------------------- @@ -881,60 +888,62 @@ if ($hierarchy || $is_sn) { my @error; my $hierarchy_instance = hierarchy->new(); $rst = $hierarchy_instance->dispatch_cmd($noderange, \@tmpargv, \@error); -if($rst){ - probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); - foreach (@error){ - probe_utils->send_msg("$output", "", "$_"); - } - if($hierarchy_instance->destory(\@error)){ - probe_utils->send_msg("$output", "", "$_") foreach(@error); - } - exit $rst; +if ($rst) { + probe_utils->send_msg("$output", "f", "Calculate dispatch command failed"); + foreach (@error) { + probe_utils->send_msg("$output", "", "$_"); + } + if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); + } + exit $rst; } my %reply_cache; -while($hierarchy_instance->read_reply(\%reply_cache)){ - foreach my $servers (keys %reply_cache){ #Dispatch_cmd may use SN range to dispatch cms to SNs at one time +while ($hierarchy_instance->read_reply(\%reply_cache)) { + foreach my $servers (keys %reply_cache) { #Dispatch_cmd may use SN range to dispatch cms to SNs at one time my @server_array = split(",", $servers); - foreach my $server (@server_array){ - foreach (@{$reply_cache{$servers}}){ - my $msg = ""; - my $logmsg=""; - - #For cases like below: + foreach my $server (@server_array) { + foreach (@{ $reply_cache{$servers} }) { + my $msg = ""; + my $logmsg = ""; + + #For cases like below: #c910f02c04p04: [ok] :All xCAT deamons are running - if($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/){ - if("$1" eq "$server"){ + if ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(\[\w+\]\s*):\s*(.*)/) { + if ("$1" eq "$server") { $logmsg = "$2: $3"; - $msg = "$2:<$server>: $3"; + $msg = "$2:<$server>: $3"; } - #For cases like below: - #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! - }elsif($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/){ - if("$1" eq "$server"){ + + #For cases like below: + #c910f02c04p05: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! + } elsif ($reply_cache{$servers}->[$_] =~ /^(\w+)\s*:\s*(.*)/) { + if ("$1" eq "$server") { $logmsg = "$2"; - $msg = "<$server>: $2"; + $msg = "<$server>: $2"; } - #For cases like below: - #Unable to open socket connection to xcatd daemon on localhost:3001. - }else{ - if(length($reply_cache{$servers}->[$_])){ + + #For cases like below: + #Unable to open socket connection to xcatd daemon on localhost:3001. + } else { + if (length($reply_cache{$servers}->[$_])) { $logmsg = $reply_cache{$servers}->[$_]; $msg = "[failed] :[$server]: $reply_cache{$servers}->[$_]"; } } - probe_utils->send_msg("$output", "", "$msg") if(length($msg)); - push @{$summaryoutput{$server}},$logmsg if(length($logmsg)); + probe_utils->send_msg("$output", "", "$msg") if (length($msg)); + push @{ $summaryoutput{$server} }, $logmsg if (length($logmsg)); } } } - if($terminal){ - last; + if ($terminal) { + last; } } -if($hierarchy_instance->destory(\@error)){ - probe_utils->send_msg("$output", "", "$_") foreach(@error); +if ($hierarchy_instance->destory(\@error)) { + probe_utils->send_msg("$output", "", "$_") foreach (@error); } #------------------------------------- From 0a0615139c60100c7ffc4e973f76ce66e59367f8 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 4 Nov 2016 03:19:38 -0400 Subject: [PATCH 056/292] modify depending on comments --- xCAT-probe/subcmds/xcatmn | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 9fb7c68c4..e30f54650 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -498,11 +498,11 @@ sub check_disk { my %dir_expectedspace_list = ("/var" => 1, "/tmp" => 1, "/install" => 10); my %mountpointinfo; foreach my $dir (keys %dir_expectedspace_list) { - my $output = `df -k $dir|tail -n 1`; + my $output = `df --block-size=1G $dir|tail -n 1`; chomp($output); my @splitoutput = split(" ", $output); $mountpointinfo{ $splitoutput[5] }{available} = $splitoutput[3]; - $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir} * 1048576; + $mountpointinfo{ $splitoutput[5] }{need} += $dir_expectedspace_list{$dir}; push @{ $mountpointinfo{ $splitoutput[5] }{mount} }, $dir; } @@ -512,8 +512,7 @@ sub check_disk { foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { $msg .= "'$_' needs $dir_expectedspace_list{$_} G, "; } - my $size_g = $mountpointinfo{$mountpoint}{available} / 1048576; - $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $size_g G, it isn't enough."; + $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $mountpointinfo{$mountpoint}{available} G, it isn't enough."; $rst = 1; } } From 66bc88169f1e2bcf0f3eb41067b704e6d7dc43cc Mon Sep 17 00:00:00 2001 From: XuWei Date: Fri, 4 Nov 2016 03:51:48 -0400 Subject: [PATCH 057/292] delete extra functions in probe_utils --- xCAT-probe/lib/perl/probe_utils.pm | 107 ----------------------------- 1 file changed, 107 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index e99845562..db96fdc24 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -354,32 +354,6 @@ sub is_dns_ready { #------------------------------------------ -=head3 - Description: - Convert host name to ip address - Arguments: - hostname: The hostname need to convert - Returns: - ip: The ip address -=cut - -#------------------------------------------ -sub get_ip_from_hostname { - my $hostname = shift; - $hostname = shift if (($hostname) && ($hostname =~ /probe_utils/)); - my $ip = ""; - - my @output = `ping -c 1 $hostname 2>&1`; - if (!$?) { - if ($output[0] =~ /^PING.+\s+\((\d+\.\d+\.\d+\.\d+)\).+/) { - $ip = $1; - } - } - return $ip; -} - -#------------------------------------------ - =head3 Description: Calculate network address from ip and netmask @@ -409,45 +383,6 @@ sub get_network { #------------------------------------------ -=head3 - Description: - Convert ip to hostname - Arguments: - ip: The ip need to convert - Returns: - hostname: hostname or "" -=cut - -#------------------------------------------ -sub get_hostname_from_ip { - my $ip = shift; - $ip = shift if (($ip) && ($ip =~ /probe_utils/)); - my $dns_server = shift; - my $hostname = ""; - my $output = ""; - - `which nslookup > /dev/null 2>&1`; - if (!$?) { - $output = `nslookup $ip $dns_server 2>&1`; - if (!$?) { - chomp($output); - my $rc = $hostname = `echo "$output"|awk -F" " '/name =/ {print \$4}'|awk -F"." '{print \$1}'`; - chomp($hostname); - return $hostname if (!$rc); - } - } - if (($hostname eq "") && (-e "/etc/hosts")) { - $output = `cat /etc/hosts 2>&1 |grep $ip`; - if (!$?) { - my @splitoutput = split(" ", $output); - $hostname = $splitoutput[1]; - } - } - return $hostname; -} - -#------------------------------------------ - =head3 Description: Check if the free space of specific directory is more than expected value @@ -482,48 +417,6 @@ sub is_dir_has_enough_space{ return 2; } -#------------------------------------------ - -=head3 - Description: - Convert input time format to the number of non-leap seconds since whatever time the system considers to be the epoch - the format of input time are two kinds - one like "Aug 15 02:43:31", another likes "15/Aug/2016:01:10:24" - Arguments: - timestr: the time format need to be converted - yday: the year of current time. - Returns: - the number of non-leap seconds since whatever time the system considers to be the epoch -=cut - -#------------------------------------------ -sub convert_to_epoch_seconds { - my $timestr=shift; - $timestr = shift if (($timestr) && ($timestr =~ /probe_utils/)); - my $yday=shift; - my $ref_seconds=shift; - my $mday; - my $dday; - my $h; - my $m; - my $s; - my $epoch_seconds=-1; - my %monthsmap = ("Jan"=>0,"Feb"=>1,"Mar"=>2,"Apr"=>3,"May"=>4,"Jun"=>5,"Jul"=>6,"Aug"=>7,"Sep"=>8,"Oct"=>9,"Nov"=>10,"Dec"=>11); - - if($timestr =~/(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)/){ - ($mday,$dday,$h,$m,$s)=($1,$2,$3,$4,$5); - $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); - if($epoch_seconds>$ref_seconds){ - $yday-=1; - $epoch_seconds = timelocal($s,$m,$h,$dday,$monthsmap{$mday},$yday); - } - }elsif($timestr =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/){ - $epoch_seconds = timelocal($6,$5,$4,$1,$monthsmap{$2},($3-1900)); - } - return $epoch_seconds; -} - - #------------------------------------------ =head3 From 8663283e3ed21cbadbaefe03eea2bd539f2dfe56 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Fri, 4 Nov 2016 04:55:07 -0400 Subject: [PATCH 058/292] complete all cases --- xCAT-test/autotest/testcase/xcatconfig/case0 | 334 ++++++++++++++----- 1 file changed, 245 insertions(+), 89 deletions(-) diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 44013c2d4..1b86b2c05 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -6,93 +6,6 @@ check:output=~No parameters were supplied on the xcatconfig command. Run xcatcon check:rc!=0 end -start:xcatconfig_f -description:To force regeneration of keys and credentials and reinitialize the site table -os:Linux -cmd:xcatconfig -f -check:rc==0 -end - - -start:xcatconfig_k -description:To regenerate root's ssh keys -os:Linux -cmd:cp -rf /root/.ssh /root/.sshbak -cmd:xcatconfig -k -check:rc==0 -check:output=~(Generated /root/.ssh/id_rsa.pub) -cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub -check:rc!=0 -cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys -check:rc==0 -cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys -cmd:mv -f /root/.sshbak /root/.ssh -end - -start:xcatconfig_k_c -description:To regenerate root's ssh keys -os:Linux -cmd:cp -rf /root/.ssh /root/.sshbak -cmd:xcatconfig -k -c -check:rc==0 -check:output=~(Generated /root/.ssh/id_rsa.pub) -check:output=~Created xCAT certificate -check:output=~Signature ok -check:output!=Fail -cmd:diff /root/.ssh/id_rsa.pub /root/.sshbak/id_rsa.pub -check:rc!=0 -cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys -check:rc==0 -cmd:cp -rf /root/.sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys -cmd:mv -f /root/.sshbak /root/.ssh -end - -start:xcatconfig_d_V -description:This option will reinitialize the basic xCAT database table setup -os:Linux -cmd:dumpxCATdb -p /tmp/xcatconfig -check:rc==0 -cmd:xcatconfig -d -V -check:rc==0 -check:output=~Updated cluster site definition -check:output=~Created postscripts definition -cmd:restorexCATdb -p /tmp/xcatconfig -check:rc==0 -cmd:rm -rf /tmp/xcatconfig/*.csv -end - - -start:xcatconfig_s -description:To regenerate node host ssh keys -os:Linux -cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak -check:rc==0 -cmd:xcatconfig -s -check:rc==0 -check:output=~(Generating new node hostkeys) -cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub -check:rc!=0 -cmd:rm -rf /etc/xcat/hostkeysbak -end - -start:xcatconfig_s_c -description:To regenerate node host ssh keys and credentials -os:Linux -cmd:cp -rf /root/.xcat /root/.xcatbak -check:rc==0 -cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak -check:rc==0 -cmd:xcatconfig -s -c -check:rc==0 -check:output=~Created xCAT certificate -check:output=~Signature ok -check:output!~Fail -cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub -check:rc!=0 -cmd:rm -rf /etc/xcat/hostkeysbak -cmd:rm -rf /root/.xcatbak -end - start:xcatconfig_h description:xcatconfig -h and --help os:Linux @@ -102,16 +15,259 @@ cmd:xcatconfig --help check:output=~Usage end - start:xcatconfig_v description:xcatconfig -v and --version os:Linux -cmd:xcatconfig -v +cmd:xcatconfig -v check:output=~version|Version cmd:xcatconfig --version check:output=~version|Version end +start:xcatconfig_k +description:To regenerate root's ssh keys +os:Linux +#step1:backup /root/.ssh +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#step2: run command +cmd:xcatconfig -k +check:rc==0 +check:output=~Generated /root/.ssh/id_rsa.pub +#step3: To make sure /root/.ssh/id_rsa.pub is regenerated +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc!=0 +#make sure the /install/postscripts/_ssh/authorized_keys is rewrite +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#step4. restore test environment +cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +check:rc==0 +end + + +start:xcatconfig_k_c +description:To regenerate root's ssh keys and cretials +os:Linux +#step1:backup /root/.ssh +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#step2:run command and check the output +cmd:xcatconfig -k -c +check:rc==0 +check:output=~Generated /root/.ssh/id_rsa.pub +check:output=~Created xCAT certificate +check:output=~Signature ok +check:output!=(Fail|fail|Error|error) +#step3:To make sure /root/.ssh/id_rsa.pub is regenerated +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc!=0 +#make sure the /install/postscripts/_ssh/authorized_keys is rewrite +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#step4:restore test environment +cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +check:rc==0 +end + + + +start:xcatconfig_s +description:To regenerate node host ssh keys +os:Linux +#step1:backup: /etc/xcat/hostkeys /install/postscripts/hostkeys +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -s +check:rc==0 +check:output=~Generating new node hostkeys +check:output=~Generating SSH2 RSA Key +#step3:Make sure /etc/xcat/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step4:Make sure /install/postscripts/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step5:restore test environment +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +check:rc==0 +end + +start:xcatconfig_s_c +description:To regenerate node host ssh keys and credentials +os:Linux +#step1:backup: /etc/xcat/hostkeys /install/postscripts/hostkeys +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -s -c +check:rc==0 +check:output=~Created xCAT certificate +check:output=~Generating new node hostkeys +check:output=~Generating SSH2 RSA Key +check:output=~Signature ok +check:output!=(Fail|fail|Error|error) +#step3:Make sure /etc/xcat/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step4:Make sure /install/postscripts/hostkeys/ssh_host_rsa_key.pub is regenerated +cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#step5:restore test environment +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +check:rc==0 +end + + +step1:dumpxCATdb -p /tmp/xcatconfigtest +step2:change existed site.maxssh value:chtab key=maxssh site.value=888 +step3:add a new key with value: chtab key=testxcatconfigoptiond site.value=test +step4:xcatconfig -d -V +check:rc==0 +check:output=~Updated cluster site definition +step5:check the existed key value is inited to be default value: lsdef -t site -i maxssh | grep "=8$" +step6:check the added key and value is still the same:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +step7:restorexCATdb -p /tmp/xcatconfigtest +step8:rm -rf /tmp/xcatconfigtest + +start:xcatconfig_d_V +description:This -d option will reinitialize the basic xCAT database table setup +os:Linux +#step1:backup database and prepare test data +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +#change existed key's value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +#add new key and value +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2:run command and check messages +cmd:xcatconfig -d -V +check:rc==0 +check:output=~Updated cluster site definition +#step3:Make sure existed key's value is reinited +cmd:lsdef -t site -i maxssh | grep "=8$" +check:rc==0 +#make sure the added key and value are existed and not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +#step4:restore test environment +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest +end + + + +start:xcatconfig_i +os:Linux +description:Initial the xCAT installation in Management Node, only node host key regenerated, xcatd restart; xCAT credentials, database and the ssh key are not changed +#step1:backup test environment and prepare test data +#backup test environment, including database, /root/.ssh/, /etc/xcat/hostkey/, install/postscripts/hostkeys +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#prepare data:change existed site.maxssh, and add new key with value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2: run command and check output +cmd:xcatconfig -i +check:rc==0 +check:output!=Created xCAT certificate +check:output!=(Fail|fail|Error|error) +#step3: check the test result +#xCATd is running +cmd:service xcatd status +check:rc==0 +check:output=~(active \(running\)|service is running) +#node ssh key are regenerated +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc!=0 +#/root/.ssh are still the same, not changed +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc==0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#keys in site table are not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +cmd:lsdef -t site -i maxssh | grep "=888$" +check:rc==0 +#step4.restore test environment +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +check:rc==0 +end + + +start:xcatconfig_u +os:Linux +description:Update xCAT in Management Node, xcatd restart; database, xCAT credentials, node ssh key and root ssh key are not changed +#step1:backup test environment and prepare test data +#backup test environment, including database, /root/.ssh/, /etc/xcat/hostkey/, install/postscripts/hostkeys +cmd:dumpxCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:cp -rf /etc/xcat/hostkeys /etc/xcat/hostkeysbak +check:rc==0 +cmd:cp -rf /install/postscripts/hostkeys /install/postscripts/hostkeysbak +check:rc==0 +cmd:cp -rf /root/.ssh /root/sshbak +check:rc==0 +#prepare data:change existed site.maxssh, and add new key with value +cmd:chtab key=maxssh site.value=888 +check:rc==0 +cmd:chtab key=testxcatconfigoptiond site.value=test +check:rc==0 +#step2: run command and check output +cmd:xcatconfig -u +check:rc==0 +check:output!=Created xCAT certificate +check:output!=(Fail|fail|Error|error) +#step3: check the test result +#xCATd is running +cmd:service xcatd status +check:rc==0 +check:output=~(active \(running\)|service is running) +#node ssh key not changed +cmd:diff /etc/xcat/hostkeys/ssh_host_rsa_key.pub /etc/xcat/hostkeysbak/ssh_host_rsa_key.pub +check:rc==0 +#/root/.ssh are still the same, not changed +cmd:diff /root/.ssh/id_rsa.pub /root/sshbak/id_rsa.pub +check:rc==0 +cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys +check:rc==0 +#keys in site table are not changed +cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +check:rc==0 +cmd:lsdef -t site -i maxssh | grep "=888$" +check:rc==0 +#step4.restore test environment +cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +check:rc==0 +end + start:xcatconfig_u_check_xcatsslversion_rhels_sles os:rhels,sles description:after xcatconfig -u the site.xcatsslversion will not be changed From 6450ef2ab6c290389f650f304b5951bd2659d2a6 Mon Sep 17 00:00:00 2001 From: tingtli Date: Sat, 5 Nov 2016 16:58:21 +0800 Subject: [PATCH 059/292] update to add more debug information before rmvm is executed (#2086) --- .../get_install_disk/fresh_install_disk | 1 + .../Diskless_installation_flat_p8_le | 2 ++ .../testcase/installation/SN_setup_case | 2 +- .../reg_linux_SN_installation_hierarchy | 2 ++ .../reg_linux_diskfull_installation_flat | 2 ++ .../ubuntu_diskless_installation_vm | 2 ++ .../ubuntu_full_installation_vm_docker | 2 ++ .../testcase/migration/.redhat_migration.swp | Bin 0 -> 16384 bytes .../testcase/migration/redhat_migration | 4 ++++ .../autotest/testcase/migration/sles_migration | 4 ++++ 10 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 xCAT-test/autotest/testcase/migration/.redhat_migration.swp diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk index 888e8fece..b79bab100 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk @@ -4,6 +4,7 @@ description:check fresh install disk, usded for x86 multi disk only, and not che cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata |grep -i $$CN; fi cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 07052ec7e..c298b2319 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -3,6 +3,8 @@ os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc==0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 2b32fc850..87db2d52d 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -9,7 +9,7 @@ cmd:chtab key=nameservers site.value="" check:rc==0 #cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p && mkvm $$SN -s 20G; fi;fi #Add for debug rmvm issue -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata |grep -i $$SN; fi +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi check:rc==0 cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 20G; fi;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index a5ec315bc..56f0d2c20 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -3,6 +3,8 @@ os:Linux cmd:chtab key=nameservers site.value="" check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi +check:rc==0 cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rmvm $$SN -f -p && mkvm $$SN -s 40G; fi cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 242c77ea3..48b56899f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,6 +5,8 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 7ae29b85a..5ada5a6ca 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -3,6 +3,8 @@ os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc=0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index cca833817..c1c077691 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -2,6 +2,8 @@ start:Full_installation_flat_docker os:Linux cmd:copycds $$ISO check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/migration/.redhat_migration.swp b/xCAT-test/autotest/testcase/migration/.redhat_migration.swp new file mode 100644 index 0000000000000000000000000000000000000000..89bebd163186eb8143ce40adb6f1d997edc02df0 GIT binary patch literal 16384 zcmeHNO>7)V6|Tf_He}<;5)c9j(90ysCf@Y)j1w8~FoBR*Sxbq7Z0`!O8#y)IH8YL- zPt`qkyo!JmLfk-t8=N@7fdfJauE4H99MG;Y;*`60$+6s4;8u#fYpRk^Z5+ z9G(a}@cNRcUKH9=xC5SUjtUMl$lNy!7zU;=FsI9!t%YlJzJB4{2VR&`#}pX`3GHFkl!k3>XFs1MgJ^;*`y>uZ((kJpa|rug7pzVE@fOdAXNg9bC)z|C5)W%dfvJ z?&tr_#V}wPFbo(53GHFkl!k3>XFs1BQVoz<|rOQo=U=m-+xeW&`&BXa5Ae z4fFs3e4Me`Pk|o*&jX)kZ0<+E*MY|XUh~gE+T0zW4b%agA~^FG;E%xXfG+~8zztvl zK%FzF^Yp&~)O-3W@DboC#!mkW_#W^rKmxGi^amMx->bmSf%gNmjGg*B@CN|0PeJ#o zOTbCSp86~B7VtXo6X4rG0`!5;0gJ#1#!mhN_!aOo;Hv=6Je*tt8jQ`tu36YM3;nau zKZ|1$vzHk=@lW8-z#G78!1n<>ML7ZaCmsMF2F@@x^EUt-&cKG5?*QKb)&bZ#gMQDP zX6*Qzz;A%>0^bBsejMe;z?bsLv0r2^Ir!Td2xn_aI-O3FIf1+M$V~=x@#3vjs_za1 za(ux<3Pj3Xp7ORTvUX`0#YT50E9c=lL!+j~@sF4gR%}BW< z>r0Qedo(g+zJbC<_mzdphU50DgD3AuG4!gomW+eMNG)nad{hW5w98=_dSSmR&=MiHJx7o_Ammb#@^qL?iUEZych+uh ztlVF1ZN9j?wvHcFGW{fzW^EUerjC>(8cJxkMe5kGjC!6g8m{)#VPUy9#<=en!^;a{ zz3-D6U6p!OY(~DTY#hbKlNny)X6WNt?`&|6bw|mWC+pUzmz8XkhWMBi5Ej2y1kIOb$@NS(uV5hx0gR(**Z_Jh5x&+cyV=d3btGic`YszG@isI61GJ0$r&ls z7vt(>_hol!^i?qwRKm}17j3)9>cZ9eKqmpR{A}iUjG-*zddYxU?=;&x0}LfPPY=fwJT8gPerKl84cislb~yC?hi!5rN_+u3TFv(5 z%lx_Lu3Tw*J$i{QaLW?+d7O#(*$WWxJ&ziEf@Do8Yj&_8a zBrtWWTdF$;-I!|hOH^g`p3x85q)C%W$p(T!ZR&Xw-kw5(p5m=3H}c+EdGzCqXMl;P z2)ezzo4H2!Gjl#N?lx8^g9x!W;S4q7z|4#l%rOD)i_R3?@7gFQigz71fufc5`x7K6 zQ+3e5(a6-vlGVbnIf_7X$ksAC4U8M4{@xkPW9-B#6w@6EUdzKdOwnQ!5oz zhCG0)Dya-%^nSKv;$WdZCA7i3T2os)MF>tG=c8PssLGQKJa%+ivz!oYXGxtbtoUN0 zOP7d(tx;h@3(Y&FJh2x`%G*b`>_L%)Qr>lk0b*-MuO&Mj#V$eNrW*Qs&!Rkgp_~{l zs08m!E=qO7+zqO2hl0Yx5PENw!d{X&Jo}sW(zyIzuR8;tq(bTn&XB{IorwB=)a5?KTq4+DE@64@g$O$@Bm`>D>w_|1uqau&tJdO7kL#t$gY+$y z?f>U~i2eN8(*FM(_WRh|p2gnw>|Nlq0QS^1?0aj!2YwCw7{H#j_B8-|;~Mtgwa)<8 z0PNFi&j65Fs~x;^HFpdHh5^HXVZbn87%&VN1`Gp+0mFb{;7Ktc!r}>B@rZbG8@lfy zPw92z5#P0_y*VCgtBZPvH2FZgDA!Lr#-x{CQx)dD%eP8Hq)$ literal 0 HcmV?d00001 diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index a0495ec39..30882049f 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -5,6 +5,8 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 @@ -114,6 +116,8 @@ stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index a8cc0c51d..91fec010c 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -5,6 +5,8 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 @@ -116,6 +118,8 @@ description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 +cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 From 092cf75d8b0c6c51b6f3f99e407245b506f26433 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Mon, 7 Nov 2016 12:11:48 +0800 Subject: [PATCH 060/292] Add more test cases for command updatenode --- xCAT-test/autotest/testcase/updatenode/cases1 | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 xCAT-test/autotest/testcase/updatenode/cases1 diff --git a/xCAT-test/autotest/testcase/updatenode/cases1 b/xCAT-test/autotest/testcase/updatenode/cases1 new file mode 100644 index 000000000..fac86011b --- /dev/null +++ b/xCAT-test/autotest/testcase/updatenode/cases1 @@ -0,0 +1,36 @@ +start:updatenode_scripts +cmd:mkdir -p /install/postscripts +check:rc==0 +cmd:echo "#!/bin/bash" >/install/postscripts/blah +cmd:echo "echo FOO BAR BAZ QUX" >>/install/postscripts/blah +cmd:chmod 0755 /install/postscripts/blah +check:rc==0 +cmd:updatenode $$CN -P blah >/tmp/updatenode.blah.out +check:rc==0 +cmd:grep 'FOO BAR BAZ QUX' /tmp/updatenode.blah.out +check:rc==0 +check:rc==0 +cmd:rm -f /install/postscripts/blah /tmp/updatenode.blah.out +check:rc==0 +end + +start:updatenode_scripts_timeout +cmd:mkdir -p /install/postscripts +check:rc==0 +cmd:echo "#!/bin/bash" >/install/postscripts/blah +cmd:echo "echo FOO BAR BAZ QUX" >>/install/postscripts/blah +cmd:echo "sleep 20" >>/install/postscripts/blah +cmd:echo "echo XYZZY ZZZ" >>/install/postscripts/blah +cmd:chmod 0755 /install/postscripts/blah +check:rc==0 +cmd:updatenode $$CN -P blah -t 5 >/tmp/updatenode.blah.out 2>/tmp/updatenode.blah.err +check:rc==0 +cmd:grep 'FOO BAR BAZ QUX' /tmp/updatenode.blah.out +check:rc==0 +cmd:grep 'XYZZY ZZZ' /tmp/updatenode.blah.out +check:rc==1 +cmd:grep 'SIGINT' /tmp/updatenode.blah.err +check:rc==0 +cmd:rm -f /install/postscripts/blah /tmp/updatenode.blah.out /tmp/updatenode.blah.err +check:rc==0 +end From 6f735b0e8d2eb90b5377da7baa5e2b855f7a798a Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 31 Oct 2016 09:21:15 -0400 Subject: [PATCH 061/292] fix issue linux orderly shutdown not noticed by xcat. #1939;replace xcatpostinit1 sysvinit service with xcatpostinit1.service systemd service unit as the hook to run PS&PBS and report status for redhat;report node status on system command --- .../share/xcat/install/scripts/post.xcat | 101 +++++++++++------- xCAT-server/share/xcat/netboot/rh/genimage | 18 +++- xCAT/postscripts/xcatpostinit | 1 + xCAT/postscripts/xcatpostinit1 | 1 + xCAT/postscripts/xcatpostinit1.install | 38 +++++++ xCAT/postscripts/xcatpostinit1.netboot | 71 ++++++++++++ xCAT/postscripts/xcatpostinit1.service | 12 +++ 7 files changed, 200 insertions(+), 42 deletions(-) create mode 100755 xCAT/postscripts/xcatpostinit1.install create mode 100755 xCAT/postscripts/xcatpostinit1.netboot create mode 100644 xCAT/postscripts/xcatpostinit1.service diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index ea5976449..6197c36df 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -34,6 +34,8 @@ fi EOF ) >/tmp/updateflag +chmod 0755 /tmp/updateflag + cd /tmp RAND=$(perl -e 'print int(rand(50)). "\n"') if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then @@ -266,50 +268,69 @@ else fi -#create the post init -cat >/etc/init.d/xcatpostinit1 << 'EOF' -#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1# -EOF -chmod 755 /etc/init.d/xcatpostinit1 - -if [ ! -x /etc/init.d/xcatpostinit1 ]; then - if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then - msgutil_r "$MASTER_IP" "debug" "failed to generate /etc/init.d/xcatpostinit1" "/var/log/xcat/xcat.log" - fi -else - if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then - msgutil_r "$MASTER_IP" "debug" "/etc/init.d/xcatpostinit1 generated" "/var/log/xcat/xcat.log" - fi -fi - export OSVER=#TABLE:nodetype:THISNODE:os# - -if [[ $OSVER == ubuntu* ]]; then - ln -s /etc/init.d/xcatpostinit1 /etc/rc2.d/S84xcatpostinit1 -else - ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc3.d/S84xcatpostinit1 - ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc4.d/S84xcatpostinit1 - ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc5.d/S84xcatpostinit1 +#create the post init service as a hook to run PS and PBS, as well as status updating +hassystemd=0 +systemctl --version 2>/dev/null +if [ $? -eq 0 ]; then + hassystemd=1 fi -if [[ $OSVER == ubuntu* ]]; then - update-rc.d xcatpostinit1 defaults +if [ $hassystemd -eq 1 ] ; then + cat >/etc/systemd/system/xcatpostinit1.service <<'EOF' +#INCLUDE:/install/postscripts/xcatpostinit1.service# +EOF + msgutil_r "$MASTER_IP" "debug" "/etc/systemd/system/xcatpostinit1.service generated" "/var/log/xcat/xcat.log" + + ln -s /etc/systemd/system/xcatpostinit1.service /etc/systemd/system/multi-user.target.wants/xcatpostinit1.service + msgutil_r "$MASTER_IP" "debug" "xcatpostinit1.service enabled" "/var/log/xcat/xcat.log" + + cat >/opt/xcat/xcatpostinit1 << 'EOF' +#INCLUDE:/install/postscripts/xcatpostinit1.install# +EOF + chmod 755 /opt/xcat/xcatpostinit1 else - if [[ $OSVER == sles* ]]; then - if [[ $OSVER == sles10* ]]; then - /sbin/insserv xcatpostinit1 - else - /sbin/insserv -p /etc/init.d xcatpostinit1 + cat >/etc/init.d/xcatpostinit1 << 'EOF' +#INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatpostinit1.install# +EOF + chmod 755 /etc/init.d/xcatpostinit1 + + if [ ! -x /etc/init.d/xcatpostinit1 ]; then + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "failed to generate /etc/init.d/xcatpostinit1" "/var/log/xcat/xcat.log" + fi + else + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "/etc/init.d/xcatpostinit1 generated" "/var/log/xcat/xcat.log" fi fi - #chkconfig --add xcatpostinit1 - chkconfig xcatpostinit1 on - if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then - msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 enabled" "/var/log/xcat/xcat.log" + + if [[ $OSVER == ubuntu* ]]; then + ln -s /etc/init.d/xcatpostinit1 /etc/rc2.d/S84xcatpostinit1 + else + ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc3.d/S84xcatpostinit1 + ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc4.d/S84xcatpostinit1 + ln -s /etc/init.d/xcatpostinit1 /etc/rc.d/rc5.d/S84xcatpostinit1 + fi + + if [[ $OSVER == ubuntu* ]]; then + update-rc.d xcatpostinit1 defaults + else + if [[ $OSVER == sles* ]]; then + if [[ $OSVER == sles10* ]]; then + /sbin/insserv xcatpostinit1 + else + /sbin/insserv -p /etc/init.d xcatpostinit1 + fi + fi + #chkconfig --add xcatpostinit1 + chkconfig xcatpostinit1 on + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 enabled" "/var/log/xcat/xcat.log" + fi fi fi - #create the xcatinstallpost mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' @@ -327,12 +348,13 @@ if [[ $OSVER == ubuntu* ]]; then msgutil_r "$MASTER_IP" "debug" "update-rc.d -f xcatpostinit1 remove" "/var/log/xcat/xcat.log" fi else - if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + if [ "$RUNBOOTSCRIPTS" != "'yes'" ] && [ "$NODESTATUS" = "'n'" ]; then chkconfig xcatpostinit1 off + if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then + msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 disabled" "/var/log/xcat/xcat.log" + fi fi - if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then - msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 disabled" "/var/log/xcat/xcat.log" - fi + fi EOF @@ -373,6 +395,7 @@ chmod 755 /xcatpost/mypostscript export ARCH=#TABLE:nodetype:THISNODE:arch# export CONSOLEPORT=#TABLEBLANKOKAY:nodehm:THISNODE:serialport# + if [[ $OSVER != ubuntu* ]]; then addsiteyum fi diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index ea50b4a6c..2bfc3ffc4 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1988,9 +1988,21 @@ sub generic_post { #This function is meant to leave the image in a state approxi system("cd $rootimg_dir/etc/rc3.d; ln -sf ../init.d/gettyset S60gettyset"); } - copy("$installroot/postscripts/xcatpostinit", "$rootimg_dir/etc/init.d/xcatpostinit"); - chmod(0755, "$rootimg_dir/etc/init.d/xcatpostinit"); - system("cd $rootimg_dir/etc/rc3.d; ln -sf ../init.d/xcatpostinit S61xcatpostinit"); + if(-e "$rootimg_dir/usr/lib/systemd/"){ + #if systemd is the service management framework for the diskless image + #enable the xcatpostinit1.service + copy("/install/postscripts/xcatpostinit1.netboot","$rootimg_dir/opt/xcat/xcatpostinit1"); + chmod(0755,"$rootimg_dir/opt/xcat/xcatpostinit1"); + copy("/install/postscripts/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/xcatpostinit1.service"); + symlink("$rootimg_dir/etc/systemd/system/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/multi-user.targ +et.wants/xcatpostinit1.service") ; + }else{ + #for traditional sysvinit + copy("$installroot/postscripts/xcatpostinit1.netboot", "$rootimg_dir/etc/init.d/xcatpostinit"); + chmod(0755, "$rootimg_dir/etc/init.d/xcatpostinit"); + system("cd $rootimg_dir/etc/rc3.d; ln -sf ../init.d/xcatpostinit S61xcatpostinit"); + } + } } diff --git a/xCAT/postscripts/xcatpostinit b/xCAT/postscripts/xcatpostinit index 116a2df6b..2085cd5ef 100755 --- a/xCAT/postscripts/xcatpostinit +++ b/xCAT/postscripts/xcatpostinit @@ -1,5 +1,6 @@ #!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# this script is deprecated,please use xcatpostinit1.netboot instead # chkconfig: 345 84 59 # description: service node postboot script hack # processname: xcatpostinit diff --git a/xCAT/postscripts/xcatpostinit1 b/xCAT/postscripts/xcatpostinit1 index c3ebb21a6..e4966b677 100755 --- a/xCAT/postscripts/xcatpostinit1 +++ b/xCAT/postscripts/xcatpostinit1 @@ -1,5 +1,6 @@ #!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# This script is deprecated, please use xcatpostinit1.install instead # chkconfig: 345 84 59 # description: service node postboot script hack # processname: xcatpostinit diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install new file mode 100755 index 000000000..ac3e5cd73 --- /dev/null +++ b/xCAT/postscripts/xcatpostinit1.install @@ -0,0 +1,38 @@ +#!/bin/sh +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# chkconfig: 345 84 59 +# description: the hook for systemd service unit to run PB and report node status on diskful node +# processname: xcatpostinit1 + +# Source function library. +if [ -x /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +fi + +[ -f /opt/xcat/xcatinfo ] && XCATSERVER=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2 2>/dev/null` +[ -f /xcatpost/mypostscript ] && NODESTATUS=`grep 'NODESTATUS=' /xcatpost/mypostscript |awk -F = '{print $2}' 2>/dev/null` +[ -f /xcatpost/mypostscript ] && RUNBOOTSCRIPT=`grep 'RUNBOOTSCRIPT=' /xcatpost/mypostscript |awk -F = '{print $2}' 2>/dev/null` + +case $1 in +stop) + [ "$NODESTATUS" != "n" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" + ;; +start) + # check for the REBOOT specified in xcatinfo to run post boot scripts on reboot + if [ -f /opt/xcat/xcatinfo ]; then + REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2` + fi + # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 + if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost -a "$RUNBOOTSCRIPT" = "1"]; then + /opt/xcat/xcatdsklspost 6 + elif [ "$REBOOT" = "TRUE" -a "NODESTATUS" != "n" ]; then + /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" + else + # run /opt/xcat/xcatinstallpost + if [ -r /opt/xcat/xcatinstallpost ]; then + /opt/xcat/xcatinstallpost + fi + fi + + ;; +esac diff --git a/xCAT/postscripts/xcatpostinit1.netboot b/xCAT/postscripts/xcatpostinit1.netboot new file mode 100755 index 000000000..eae32c188 --- /dev/null +++ b/xCAT/postscripts/xcatpostinit1.netboot @@ -0,0 +1,71 @@ +#!/bin/sh +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# chkconfig: 345 84 59 +# description: the hook in systemd service unit to run PB or report node status on diskless & statelite node +# processname: xcatpostinit1 + +### BEGIN INIT INFO +# Provides: xcatpostinit +# Default-Start: 3 4 5 +# Default-stop: 0 1 2 6 +# Required-Start: gettyset +# Required-Stop: +# Short-Description: xCATpost +# Description: xCAT post boot script +### END INIT INFO + +# Source function library. +if [ -x /etc/rc.d/init.d/functions ]; then + . /etc/rc.d/init.d/functions +fi + +XCATSERVER=$(grep --only-matching "\" /proc/cmdline |cut -d= -f2 |cut -d: -f1 2>/dev/null) + +logger -t xcat -p local4.info "$0: action is $1" +case $1 in +restart) + $0 stop + $0 start + ;; +status) + echo -n "xcatpostinit runs only at boot, runs additional post scripts" + logger -t xcat -p local4.info "xcatpostinit runs only at boot, runs additional post scripts" + ;; +stop) + echo -n "nothing to stop " + logger -t xcat -p local4.info "nothing to stop" + grep nonodestatus /proc/cmdline 2>/dev/null || [ -n "$XCATSERVER" ] && /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus powering-off" + ;; +start) + # Node is stateless by default + STATELITE=0 + + # Node is statelite if /proc/cmdline have flag `STATEMNT=' + STATELITE_FLAG="STATEMNT=" + + # Script to direct further actions + SCRIPT="/opt/xcat/xcatdsklspost" + + # Usefull information passed as kernel arguments + if [ -f "/proc/cmdline" ]; then + if grep --quiet --no-messages "$STATELITE_FLAG" "/proc/cmdline"; then + STATELITE=1 + fi + fi + + # Test for script existance + if ! [ -x "$SCRIPT" ]; then + msg "can't locate executable $SCRIPT" + exit -1 + fi + + # Run $SCRIPT according to node type + if [ $STATELITE -ne 0 ]; then + logger -t xcat -p local4.info "Call $SCRIPT for statelite mode" + "$SCRIPT" 4 + else + logger -t xcat -p local4.info "Call $SCRIPT for stateless mode" + "$SCRIPT" + fi + ;; +esac diff --git a/xCAT/postscripts/xcatpostinit1.service b/xCAT/postscripts/xcatpostinit1.service new file mode 100644 index 000000000..502a85e1d --- /dev/null +++ b/xCAT/postscripts/xcatpostinit1.service @@ -0,0 +1,12 @@ +[Unit] +Description=xcat service on compute node, the framework to run postbootscript and update node status +After=network.target rsyslog.service + +[Service] +Type=oneshot +ExecStart=/opt/xcat/xcatpostinit1 start +ExecStop=/opt/xcat/xcatpostinit1 stop +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target From 74dca9c43eb29a13610ee967e4565a192503f3a3 Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 7 Nov 2016 02:43:09 -0500 Subject: [PATCH 062/292] fix issue 1650, help to resolve errors --- perl-xCAT/xCAT/MacMap.pm | 4 +++- xCAT-probe/subcmds/switch-macmap | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index 077c4d21b..aab0e63ab 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -343,7 +343,9 @@ sub dump_mac_info { } elsif (defined($self->{macinfo}->{$switch}->{ErrorStr})) { $ret{$switch}->{ErrorStr} = $self->{macinfo}->{$switch}->{ErrorStr}; - + if ($ret{$switch}->{ErrorStr} =~ /Unknown user name/) { + $ret{$switch}->{ErrorStr} = "Unknown snmp user name"; + } # To show the error message that the username/password related error is for SNMP only if ($ret{$switch}->{ErrorStr} =~ /username|password/i) { $ret{$switch}->{ErrorStr} .= " through SNMP"; diff --git a/xCAT-probe/subcmds/switch-macmap b/xCAT-probe/subcmds/switch-macmap index fbbb0cc6e..3a52ca5df 100755 --- a/xCAT-probe/subcmds/switch-macmap +++ b/xCAT-probe/subcmds/switch-macmap @@ -94,7 +94,7 @@ if (-f $error_file) { my $fd; open($fd, "<", "$normal_file"); my @fails = (); - +my @error_nodes = (); # There is 2 kinds of error message: # 1. Error: The nodetype is not 'switch' for nodes: switch1 # Error: No switch configuration info find for switch-10-5-23-1 @@ -104,6 +104,8 @@ foreach (<$fd>) { if (/Error:/) { if (/^(\S*):\s*Error:\s*(.*)/) { push @fails, "$1 - $2"; + } elsif (/^Error:\s*The nodetype is not 'switch' for nodes: (.+)/) { + push @error_nodes, "$1"; } elsif (/^Error:\s*(.*)/) { push @fails, $1; } else { @@ -124,6 +126,10 @@ if (-f $normal_file) { if (-f $error_file) { unlink($error_file); } +if (@error_nodes) { + my $error_node = join(",", @error_nodes); + probe_utils->send_msg("$output", "d", "[$error_node] : Error, switch-macmap can only be run against xCAT objects that have 'nodetype=switch'"); +} foreach (@fails) { probe_utils->send_msg("$output", "f", "$_"); } From 1446ee33d749872d89def726f00d0d7690bc4264 Mon Sep 17 00:00:00 2001 From: penguhyang Date: Mon, 7 Nov 2016 15:53:40 +0800 Subject: [PATCH 063/292] fix utilities required for statelite missing from sles initrd (#2093) --- xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite | 2 +- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite index 1fc3f2222..49e2fb3f1 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite @@ -457,7 +457,7 @@ ProcessType () { # before mount, need to check whether it exists or not STRPATH="${TMPFS}${2}" STRLEN=${#STRPATH} - CHAREND=`echo ${STRPATH} | /bin/cut -c${STRLEN}` + CHAREND=`echo ${STRPATH} | /usr/bin/cut -c${STRLEN}` if [ "${CHAREND}" = "/" ]; then # it is one directory if [ ! -d ${STRPATH} ]; then diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 01884a946..c8edb667d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1791,7 +1791,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/cut", "usr/bin/rm", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "bin/tar") { getlibs($_); push @filestoadd, $_; } From b86bb493e3683d1d28efbf4a181e2656662f453e Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 7 Nov 2016 03:29:59 -0500 Subject: [PATCH 064/292] completed --- xCAT-test/autotest/linux.conf.template | 2 ++ .../{ubuntule_migration1_p8le => ubuntu_migration1_p8le} | 4 ++-- .../migration/{ubuntux_migration1_vm => ubuntu_migration1_vm} | 4 ++-- .../{ubuntule_migration2_p8le => ubuntu_migration2_p8le} | 4 ++-- .../migration/{ubuntux_migration2_vm => ubuntu_migration2_vm} | 4 ++-- 5 files changed, 10 insertions(+), 8 deletions(-) rename xCAT-test/autotest/testcase/migration/{ubuntule_migration1_p8le => ubuntu_migration1_p8le} (95%) rename xCAT-test/autotest/testcase/migration/{ubuntux_migration1_vm => ubuntu_migration1_vm} (95%) rename xCAT-test/autotest/testcase/migration/{ubuntule_migration2_p8le => ubuntu_migration2_p8le} (95%) rename xCAT-test/autotest/testcase/migration/{ubuntux_migration2_vm => ubuntu_migration2_vm} (95%) diff --git a/xCAT-test/autotest/linux.conf.template b/xCAT-test/autotest/linux.conf.template index a6482e6a2..ecb158ad5 100644 --- a/xCAT-test/autotest/linux.conf.template +++ b/xCAT-test/autotest/linux.conf.template @@ -72,6 +72,8 @@ UBUNTU_MIGRATION1_CORE=https://xcat.org/files/xcat/xcat-core/2.10.x_Ubuntu/xcat- UBUNTU_MIGRATION2_CORE=https://xcat.org/files/xcat/xcat-core/2.11.x_Ubuntu/xcat-core/xcat-core-2.11.1-ubuntu.tar.bz2 UBUNTU_MIGRATION1_DEP=https://xcat.org/files/xcat/xcat-dep/2.x_Ubuntu/xcat-dep-ubuntu-20151012.tar.bz UBUNTU_MIGRATION2_DEP=https://xcat.org/files/xcat/xcat-dep/2.x_Ubuntu/xcat-dep-ubuntu-2.11.1.tar.bz2 +UBUNTU_MIGRATION1_VERSION=2.10 +UBUNTU_MIGRATION2_VERSION=2.11.1 MIGRATION1_CORE=http://xcat.org/files/xcat/xcat-core/2.10.x_Linux/xcat-core/xcat-core-2.10.tar.bz2 MIGRATION2_CORE=http://xcat.org/files/xcat/xcat-core/2.11.x_Linux/xcat-core/xcat-core-2.11.1-linux.tar.bz2 MIGRATION1_DEP=http://xcat.org/files/xcat/xcat-dep/2.x_Linux/xcat-dep-2.10.tar.bz2 diff --git a/xCAT-test/autotest/testcase/migration/ubuntule_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le similarity index 95% rename from xCAT-test/autotest/testcase/migration/ubuntule_migration1_p8le rename to xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index 5fbfce149..99fb91d37 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntule_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -1,6 +1,6 @@ start:ubuntu_migration1_p8le os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$UBUNTU_MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file cmd:copycds $$ISO check:rc==0 @@ -76,7 +76,7 @@ cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 -cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$MIGRATION1_VERSION" +cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$UBUNTU_MIGRATION1_VERSION" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntux_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm similarity index 95% rename from xCAT-test/autotest/testcase/migration/ubuntux_migration1_vm rename to xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 38e3d3f09..dfdc34298 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntux_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -1,6 +1,6 @@ start:ubuntux_migration1_vm os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$UBUNTU_MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file cmd:copycds $$ISO check:rc==0 @@ -75,7 +75,7 @@ cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 -cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$MIGRATION1_VERSION" +cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$UBUNTU_MIGRATION1_VERSION" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntule_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le similarity index 95% rename from xCAT-test/autotest/testcase/migration/ubuntule_migration2_p8le rename to xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index 83efb9b4f..dbcdbe258 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntule_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -1,6 +1,6 @@ start:ubuntu_migration2_p8le os:Linux -description:update xCAT from $$MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$UBUNTU_MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file cmd:copycds $$ISO check:rc==0 @@ -76,7 +76,7 @@ cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 -cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$MIGRATION2_VERSION" +cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$UBUNTU_MIGRATION2_VERSION" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntux_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm similarity index 95% rename from xCAT-test/autotest/testcase/migration/ubuntux_migration2_vm rename to xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index c17bdffb2..6f7ffde31 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntux_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -1,6 +1,6 @@ start:ubuntux_migration2_vm os:Linux -description:update xCAT from $$MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$UBUNTU_MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file cmd:copycds $$ISO check:rc==0 @@ -75,7 +75,7 @@ cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 -cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$MIGRATION2_VERSION" +cmd:xdsh $$CN "cat /oldxcat/old_version|grep $$UBUNTU_MIGRATION2_VERSION" check:rc==0 cmd:xdsh $$CN "service xcatd status" check:rc==0 From 9c341f9bdd476fdcf23b5e9a4f644035643aab9d Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Mon, 7 Nov 2016 03:35:10 -0500 Subject: [PATCH 065/292] update ubuntu migration cases name --- xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 4 ++-- xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 4 ++-- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle index 9fac0a0f2..2bfb17f88 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle @@ -257,5 +257,5 @@ rmdocker_command rmdocker_f_command lsdocker_h_command lsdocker_l_command -ubuntux_migration1_vm -ubuntux_migration2_vm +ubuntu_migration1_vm +ubuntu_migration2_vm diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index 89789aa69..c49e45be8 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -253,5 +253,5 @@ run_command_with_XCATBYPASS disable_root_permission_in_policy_table assign_certain_command_permission xcatconfig_u_check_xcatsslversion_ubuntu -ubuntule_migration1_p8le -ubuntule_migration2_p8le +ubuntu_migration1_p8le +ubuntu_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 1f2ce26ba..9c4309d93 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -270,5 +270,5 @@ rmdocker_f_command lsdocker_h_command lsdocker_l_command xcatconfig_u_check_xcatsslversion_ubuntu -ubuntux_migration1_vm -ubuntux_migration2_vm +ubuntu_migration1_vm +ubuntu_migration2_vm diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 17244fa12..09b1af592 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -253,6 +253,6 @@ run_command_with_XCATBYPASS_systemd disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd xcatconfig_u_check_xcatsslversion_ubuntu -ubuntule_migration1_p8le -ubuntule_migration2_p8le +ubuntu_migration1_p8le +ubuntu_migration2_p8le diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 2b2b1d6e4..5caa4de79 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -262,5 +262,5 @@ disable_root_permission_in_policy_table_systemd assign_certain_command_permission_systemd nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_ubuntu -ubuntux_migration1_vm -ubuntux_migration2_vm +ubuntu_migration1_vm +ubuntu_migration2_vm diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index dfdc34298..996bc7d99 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -1,4 +1,4 @@ -start:ubuntux_migration1_vm +start:ubuntu_migration1_vm os:Linux description:update xCAT from $$UBUNTU_MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index 6f7ffde31..6a0bbe636 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -1,4 +1,4 @@ -start:ubuntux_migration2_vm +start:ubuntu_migration2_vm os:Linux description:update xCAT from $$UBUNTU_MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file From 1e6714a99d26dec6ffd4e04b431234b80b0e3647 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 29 Oct 2016 23:18:43 -0400 Subject: [PATCH 066/292] fix issue when using copycds -p, stateful install has yum point to the wrong repository. #1852 --- perl-xCAT/xCAT/Yum.pm | 25 +++++++------------ xCAT-server/lib/perl/xCAT/Template.pm | 15 ++++++++++- xCAT-server/lib/xcat/plugins/anaconda.pm | 24 +----------------- xCAT-server/lib/xcat/plugins/copycds.pm | 4 +++ .../share/xcat/install/scripts/post.xcat | 7 +++--- 5 files changed, 32 insertions(+), 43 deletions(-) diff --git a/perl-xCAT/xCAT/Yum.pm b/perl-xCAT/xCAT/Yum.pm index 774418634..b8eeb8c02 100644 --- a/perl-xCAT/xCAT/Yum.pm +++ b/perl-xCAT/xCAT/Yum.pm @@ -11,29 +11,23 @@ my $installpfx; sub localize_yumrepo { my $self = shift; - my $installroot = shift; - $distname = shift; - $arch = shift; - - $installpfx = "$installroot/$distname/$arch"; - mkpath("$installroot/postscripts/repos/$distname/$arch/"); - open($yumrepofile, ">", "$installroot/postscripts/repos/$distname/$arch/local-repository.tmpl"); + my $pkgdir = shift; + $distname=shift; + $arch=shift; + open($yumrepofile, ">", "$pkgdir/local-repository.tmpl"); my %options = ( wanted => \&check_tofix, follow_fast => 1 ); - find(\%options, $installpfx); + find(\%options, $pkgdir); close($yumrepofile); } sub remove_yumrepo { my $self = shift; - my $installroot = shift; - $distname = shift; - $arch = shift; - - rmtree("$installroot/postscripts/repos/$distname/$arch/"); + my $pkgdir = shift; + rmtree("$pkgdir/local-repository.tmpl"); } sub check_tofix { @@ -57,14 +51,13 @@ sub generate_repo my @dircomps = File::Spec->splitdir($dirlocation); pop(@dircomps); my $yumurl = File::Spec->catdir(@dircomps); - $yumurl =~ s!$installpfx!http://#INSTSERVER#/install/$distname/$arch/!; my $reponame = $dircomps[$#dircomps]; print $yumrepofile "[local-$distname-$arch-$reponame]\n"; - print $yumrepofile "name=xCAT configured yum repository for $distname/$arch/$reponame\n"; + print $yumrepofile "name=xCAT configured yum repository for $yumurl\n"; print $yumrepofile "baseurl=$yumurl\n"; print $yumrepofile "enabled=1\n"; print $yumrepofile "gpgcheck=0\n\n"; -} +} sub fix_directory { diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 52c8db034..e4d99e749 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -288,11 +288,11 @@ sub subvars { @pkgdirs = split(",", $media_dir); my $source; my $source_in_pre; + my $writerepo; my $c = 0; foreach my $pkgdir (@pkgdirs) { if ($platform =~ /^(rh|SL|centos|fedora)$/) { if ($c == 0) { - # After some tests, if we put the repo in pre scripts in the kickstart like for rhels6.x # the rhels5.9 will not be installed successfully. So put in kickstart directly. $source_in_pre .= "echo 'url --url http://'\$nextserver'/$pkgdir' >> /tmp/repos"; @@ -301,6 +301,18 @@ sub subvars { $source_in_pre .= "\necho 'repo --name=pkg$c --baseurl=http://'\$nextserver'/$pkgdir' >> /tmp/repos"; $source .= "repo --name=pkg$c --baseurl=http://#TABLE:noderes:\$NODE:nfsserver#/$pkgdir\n"; #for rhels5.9 } + if( -f "$pkgdir/local-repository.tmpl"){ + my $repofd; + my $repo_in_post; + local $/=undef; + open($repofd,"<","$pkgdir/local-repository.tmpl"); + $repo_in_post = <$repofd>; + close($repofd); + $repo_in_post =~ s#baseurl=#baseurl=http://$master/#g; + $writerepo .= "\ncat >/etc/yum.repos.d/local-repository-$c.repo << 'EOF'\n"; + $writerepo .="$repo_in_post\n"; + $writerepo .="EOF\n"; + } } elsif ($platform =~ /^(sles|suse)/) { my $http = "http://#TABLE:noderes:\$NODE:nfsserver#$pkgdir"; $source .= " @@ -320,6 +332,7 @@ sub subvars { if (("ubuntu" eq $platform) || ("debian" eq $platform)) { $inc =~ s/#INCLUDE_OSIMAGE_PKGDIR#/$pkgdirs[-1]/; } + $inc =~ s/#WRITEREPO#/$writerepo/g; } #ok, now do everything else.. diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a2a37be24..90f65cfa7 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2464,30 +2464,8 @@ sub copycd } - unless ($path =~ /^($defaultpath)/) - { - mkpath($defaultpath); - if (-d $defaultpath) - { - rmtree($defaultpath); - } - else - { - unlink($defaultpath); - } - - my $hassymlink = eval { symlink("", ""); 1 }; - if ($hassymlink) { - symlink($path, $defaultpath); - } else - { - link($path, $defaultpath); - } - - } - require xCAT::Yum; - xCAT::Yum->localize_yumrepo($installroot, $distname, $arch); + xCAT::Yum->localize_yumrepo($path, $distname, $arch); if ($rc != 0) { diff --git a/xCAT-server/lib/xcat/plugins/copycds.pm b/xCAT-server/lib/xcat/plugins/copycds.pm index d65c9b8b6..0a4ff32d5 100644 --- a/xCAT-server/lib/xcat/plugins/copycds.pm +++ b/xCAT-server/lib/xcat/plugins/copycds.pm @@ -145,6 +145,10 @@ sub process_request { if ($path) { + $path=Cwd::realpath($path); + unless(substr($path,0,length("/install")) eq "/install"){ + $callback->({ warning => "copycds: the specified path \"$path\" is not a subdirectory under /install. Make sure this path is configured for httpd/apache, otherwise, the provisioning with this iso will fail!" }); + } push @{ $newreq->{arg} }, ("-p", $path); } if ($specific) diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 6197c36df..f663f8161 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -396,9 +396,10 @@ chmod 755 /xcatpost/mypostscript export ARCH=#TABLE:nodetype:THISNODE:arch# export CONSOLEPORT=#TABLEBLANKOKAY:nodehm:THISNODE:serialport# -if [[ $OSVER != ubuntu* ]]; then - addsiteyum -fi +#for redhat: +##place-holder for the code to save the repo info on compute node,pointing to the "pkgdir" of the osimage +##so that the provisioned node +##WRITEREPO# if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "info" "running mypostscript" "/var/log/xcat/xcat.log" From 801a9cf69bf48700701c3f518eb01a5740e17676 Mon Sep 17 00:00:00 2001 From: yangsong Date: Mon, 7 Nov 2016 22:38:37 +0800 Subject: [PATCH 067/292] Revert "update dhcpd conf file when upgrade xcat" --- xCAT-server/sbin/xcatconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 840df68c5..e960e1640 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1464,13 +1464,6 @@ sub initDB xCAT::MsgUtils->message('E', "Could not add default value for site.xcatsslversion."); } } - - # Set dhcpd.conf be updated when update xcat - my $cmds = "XCATBYPASS=Y $::XCATROOT/sbin/makedhcp -n 2>/dev/null"; - xCAT::Utils->runcmd("$cmds", -1); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message('E', "Could not create a new dhcp configuration file."); - } } # remove xcatserver,xcatclient From 484c00cfa1513dec6a890c6be64a58c48bb8b281 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 Nov 2016 10:42:42 -0500 Subject: [PATCH 068/292] Fix some formatting and wording for copycds command --- .../references/man8/copycds-cdrom.8.rst | 4 ++-- .../admin-guides/references/man8/copycds.8.rst | 16 ++++++++-------- xCAT-client/pods/man8/copycds-cdrom.8.pod | 4 ++-- xCAT-client/pods/man8/copycds.8.pod | 18 +++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man8/copycds-cdrom.8.rst b/docs/source/guides/admin-guides/references/man8/copycds-cdrom.8.rst index 43400356f..ef33aff24 100644 --- a/docs/source/guides/admin-guides/references/man8/copycds-cdrom.8.rst +++ b/docs/source/guides/admin-guides/references/man8/copycds-cdrom.8.rst @@ -19,9 +19,9 @@ DESCRIPTION *********** -\ **copycds-cdrom**\ is a wrapper scripts for copycds to copy from physical CD/DVD-ROM drives located on the management server. +\ **copycds-cdrom**\ is a wrapper scripts for \ **copycds**\ to copy from physical CD/DVD-ROM drives located on the management server. -\ *[copycds options]*\ are passed unmolested to copycds. +\ *[copycds options]*\ are passed unchanged to copycds. If \ *[drive]*\ is not specified, /dev/cdrom is assumed. diff --git a/docs/source/guides/admin-guides/references/man8/copycds.8.rst b/docs/source/guides/admin-guides/references/man8/copycds.8.rst index e404383d9..5579dcac6 100644 --- a/docs/source/guides/admin-guides/references/man8/copycds.8.rst +++ b/docs/source/guides/admin-guides/references/man8/copycds.8.rst @@ -31,11 +31,11 @@ DESCRIPTION *********** -The \ **copycds**\ command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the -p option. If no path is specified, the default destination directory will be formed from the \ **installdir**\ site attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The \ **copycds**\ command can copy from one or more ISO files, or the CD/DVD device path. +The \ **copycds**\ command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the \ **-p**\ option. If no path is specified, the default destination directory will be formed from the \ **installdir**\ site table attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The \ **copycds**\ command can copy from one or more ISO files, or the CD/DVD device path. -You can specify \ **-i**\ or \ **-**\ **-inspection**\ option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the -n and -a options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. +You can specify \ **-i**\ or \ **-**\ **-inspection**\ option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the \ **-n**\ and \ **-a**\ options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. -You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (service xcatd reload). +You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (\ **service xcatd reload**\ ). ******* @@ -58,25 +58,25 @@ OPTIONS \ **-p|-**\ **-path**\ =\ *ospkgpath*\ - The destination directory to which the contents of ISO/DVD will be copied. When this option is not specified, the default destination directory will be formed from the \ **installdir**\ site attribute and the distro name and architecture, for example: /install/rhel6.3/x86_64. This option is only supported distributions of sles,redhat and windows. + The destination directory to which the contents of ISO/DVD will be copied. When this option is not specified, the default destination directory will be formed from the \ **installdir**\ site table attribute and the distro name and architecture, for example: /install/rhel6.3/x86_64. This option is only supported for distributions of sles, redhat and windows. \ **-i|-**\ **-inspection**\ - Check whether xCAT can recognize the DVDs/ISOs in the argument list, but do not copy the disc. Displays the os distribution name, architecture and disc no of each recognized DVD/ISO. This option only supported for distributions of sles,redhat and windows. + Check whether xCAT can recognize the DVDs/ISOs in the argument list, but do not copy the disc. Displays the os distribution name, architecture and disc no of each recognized DVD/ISO. This option is only supported for distributions of sles, redhat and windows. \ **-o|-**\ **-noosimage**\ - Do not create the default osimages based on the osdistro copied in. By default, copycds will create a set of osimages based on the osdistro. + Do not create the default osimages based on the osdistro copied in. By default, \ **copycds**\ will create a set of osimages based on the osdistro. \ **-w|-**\ **-nonoverwrite**\ - Complain and exit if the os disc has already been copied in. By default, copycds will overwrite the os disc already copied in. + Complain and exit if the os disc has already been copied in. By default, \ **copycds**\ will overwrite the os disc already copied in. @@ -155,7 +155,7 @@ EXAMPLES .. code-block:: perl - copycds -n /isodir/RHEL6.5/RHEL6.5-Supplementary-20131114.2-Server-ppc64-DVD1.iso -n rhels6.5-supp + copycds /isodir/RHEL6.5/RHEL6.5-Supplementary-20131114.2-Server-ppc64-DVD1.iso -n rhels6.5-supp Also, remember to add the new directory to your osimage definition: diff --git a/xCAT-client/pods/man8/copycds-cdrom.8.pod b/xCAT-client/pods/man8/copycds-cdrom.8.pod index 42d45ba53..dfba9011f 100644 --- a/xCAT-client/pods/man8/copycds-cdrom.8.pod +++ b/xCAT-client/pods/man8/copycds-cdrom.8.pod @@ -10,9 +10,9 @@ B I<[copycds options]> I<[drive]> =head1 DESCRIPTION -B is a wrapper scripts for copycds to copy from physical CD/DVD-ROM drives located on the management server. +B is a wrapper scripts for B to copy from physical CD/DVD-ROM drives located on the management server. -I<[copycds options]> are passed unmolested to copycds. +I<[copycds options]> are passed unchanged to copycds. If I<[drive]> is not specified, /dev/cdrom is assumed. diff --git a/xCAT-client/pods/man8/copycds.8.pod b/xCAT-client/pods/man8/copycds.8.pod index 40fc7c876..234c1e375 100644 --- a/xCAT-client/pods/man8/copycds.8.pod +++ b/xCAT-client/pods/man8/copycds.8.pod @@ -12,11 +12,11 @@ B [B<-h>|B<--help>] =head1 DESCRIPTION -The B command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the -p option. If no path is specified, the default destination directory will be formed from the B site attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The B command can copy from one or more ISO files, or the CD/DVD device path. +The B command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the B<-p> option. If no path is specified, the default destination directory will be formed from the B site table attribute, distro name and architecture, for example: /install/rhels6.3/x86_64. The B command can copy from one or more ISO files, or the CD/DVD device path. -You can specify B<-i> or B<--inspection> option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the -n and -a options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. +You can specify B<-i> or B<--inspection> option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the B<-n> and B<-a> options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. -You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (service xcatd reload). +You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (B). =head1 OPTIONS @@ -28,23 +28,23 @@ The linux distro name and version that the ISO/DVD contains. Examples: rhels6. =item B<-a|--arch>=I -The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x. +The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x. =item B<-p|--path>=I -The destination directory to which the contents of ISO/DVD will be copied. When this option is not specified, the default destination directory will be formed from the B site attribute and the distro name and architecture, for example: /install/rhel6.3/x86_64. This option is only supported distributions of sles,redhat and windows. +The destination directory to which the contents of ISO/DVD will be copied. When this option is not specified, the default destination directory will be formed from the B site table attribute and the distro name and architecture, for example: /install/rhel6.3/x86_64. This option is only supported for distributions of sles, redhat and windows. =item B<-i|--inspection> -Check whether xCAT can recognize the DVDs/ISOs in the argument list, but do not copy the disc. Displays the os distribution name, architecture and disc no of each recognized DVD/ISO. This option only supported for distributions of sles,redhat and windows. +Check whether xCAT can recognize the DVDs/ISOs in the argument list, but do not copy the disc. Displays the os distribution name, architecture and disc no of each recognized DVD/ISO. This option is only supported for distributions of sles, redhat and windows. =item B<-o|--noosimage> -Do not create the default osimages based on the osdistro copied in. By default, copycds will create a set of osimages based on the osdistro. +Do not create the default osimages based on the osdistro copied in. By default, B will create a set of osimages based on the osdistro. =item B<-w|--nonoverwrite> -Complain and exit if the os disc has already been copied in. By default, copycds will overwrite the os disc already copied in. +Complain and exit if the os disc has already been copied in. By default, B will overwrite the os disc already copied in. =back @@ -90,7 +90,7 @@ For the attributes that are not recognized, the value will be blank. =item 5. To copy the packages from a supplemental DVD ISO file: - copycds -n /isodir/RHEL6.5/RHEL6.5-Supplementary-20131114.2-Server-ppc64-DVD1.iso -n rhels6.5-supp + copycds /isodir/RHEL6.5/RHEL6.5-Supplementary-20131114.2-Server-ppc64-DVD1.iso -n rhels6.5-supp Also, remember to add the new directory to your osimage definition: From 1cd4b6446c8788ed0dc20a55b56ffba4f5e11b3e Mon Sep 17 00:00:00 2001 From: cxhong Date: Mon, 7 Nov 2016 21:21:56 -0500 Subject: [PATCH 069/292] Check in init version of cumulus support[Do Not Merge] (#2020) * Check in init version of cumulus support * Add cumulus installation doc * modify victor's comments. --- .../edgecore_switches/edgecore_switches.rst | 129 ++++++ .../networks/edgecore_switches/index.rst | 7 + docs/source/advanced/networks/index.rst | 1 + xCAT-server/lib/xcat/plugins/dhcp.pm | 7 +- .../lib/xcat/plugins/switchdiscover.pm | 59 ++- xCAT-server/share/xcat/scripts/configcumulus | 411 ++++++++++++++++++ 6 files changed, 596 insertions(+), 18 deletions(-) create mode 100644 docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst create mode 100644 docs/source/advanced/networks/edgecore_switches/index.rst create mode 100755 xCAT-server/share/xcat/scripts/configcumulus diff --git a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst new file mode 100644 index 000000000..db9a3cc11 --- /dev/null +++ b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst @@ -0,0 +1,129 @@ +Edgecore Switch +=============== + +The Edgecore switch from Mellanox is 1Gb top-of-rack switch. It's coming with ONIE installer. Open Network Install Environment (ONIE)is an open source initiative that defines an open "install environment" for bare metal network switches. For more information, see http://onie.opencompute.org/. Mellanox will ship the switch with Cumulus Network OS and along with a license file installed. In some case, user may get whitebox without OS and licenses. Since edgecore switch has different configuration than other switches that xCAT supports, xCAT handles edgecore switch differently. + + +ONIE Mode +--------- + +If the switch arrives without an OS pre-loaded, the ONIE installer and management port is the only thing enabled on the switch. Once the switch connects to the xCAT network, the switch should get a dynamic IP address. The xCAT DHCP server will get requests from the onie-installer from the switch and attempt to find an OS binary file to execute. The following messages will be logged in /var/log/messages on the management node. :: + + Info: Fetching http://172.1.0.1/onie-installer-arm-accton_as4610_54-r0 ... + Info: Fetching http://172.1.0.1/onie-installer-arm-accton_as4610_54 ... + Info: Fetching http://172.1.0.1/onie-installer-accton_as4610_54 ... + Info: Fetching http://172.1.0.1/onie-installer-arm ... + Info: Fetching http://172.1.0.1/onie-installer . + + +To remove the installed Cumulus Linux OS to boot back to ONIE mode, connect to the switch via serial-port or ssh and execute the following commands: :: + + ssh cumulus@172.1.0.1 + #clean up all the configuration + sudo onie-select -k + sudo reboot + #boot back to onie mode + sudo onie-select -i + sudo reboot + + +After switch reboots, it will enter ONIE mode and send DHCP request to attempt to fetch the OS binary file. + + +Discover Edgecore Switch +------------------------ + +ONIE supports a number of methods for locating OS binary file. xCAT choose to use a DHCP server to provide specific information to the switch. + +* IP address of the switch +* URL of the OS binary file on the Web server + +With the xCAT DHCP configuration, ONIE picks up an IP address and downloads the URL specified by the user and start to install of the OS. The steps take to discover the edgecore switch and process request from ONIE installer as follows: + +#. Pre-define switch object into xCAT db, make sure ip adress, netboot and provemethod are set, also define core switch and port number where edgecore switch connect to. :: + + + #lsdef edgecoresw1 + Object name: edgecoresw1 + groups=switch + ip=192.168.23.1 + mgt=switch + netboot=onie + nodetype=switch + postbootscripts=otherpkgs + postscripts=syslog,remoteshell,syncfiles + provmethod=/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin + switch=switch-10-5-23-1 + switchport=1 + + #makehosts edgecoresw1 + + +#. Run ``switchdiscover`` command, it will find edgecore switch and update mac address on pre-defined switch node definition. :: + + #switchdiscover --range 192.168.5.170-190 -s nmap + #lsdef edgecoresw1 + Object name: edgecoresw1 + groups=switch + ip=192.168.23.1 + mac=8C:EA:1B:12:CA:40 + mgt=switch + netboot=onie + nodetype=switch + postbootscripts=otherpkgs + postscripts=syslog,remoteshell,syncfiles + provmethod=/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin + status=Matched + switch=switch-10-5-23-1 + switchport=1 + switchtype=cumulus + usercomment=Edgecore switch + + +#. Run ``makedhcp`` after edgecore switch discovered, it will update ``dhcpd.conf`` and response the DHCP request from the onie-installer. :: + + #makedhcp -n + #makedhcp -a edgecoresw1 + + +#. Installation of the Cumulus Linux OS takes about 50 minutes. Monitor the /var/log/messages to check the status of the installation. :: + + + Oct 27 15:28:08 fs4 dhcpd: DHCPDISCOVER from 8c:ea:1b:12:ca:40 via enP4p1s0f2 + Oct 27 15:28:08 fs4 dhcpd: DHCPOFFER on 192.168.23.1 to 8c:ea:1b:12:ca:40 via enP4p1s0f2 + Oct 27 15:28:08 fs4 dhcpd: DHCPREQUEST for 192.168.23.1 (192.168.3.25) from 8c:ea:1b:12:ca:40 via enP4p1s0f2 + Oct 27 15:28:08 fs4 dhcpd: DHCPACK on 192.168.23.1 to 8c:ea:1b:12:ca:40 via enP4p1s0f2 + + +#. Once installation finished, the pre-defined switch name and IP address will be configured on edgecore switch. :: + + cumulus@edgecoresw1:~$ ifconfig + eth0 Link encap:Ethernet HWaddr 8c:ea:1b:12:ca:40 + inet addr:192.168.23.1 Bcast:192.168.255.255 Mask:255.255.0.0 + inet6 addr: fe80::8eea:1bff:fe12:ca40/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + cumulus@edgecoresw1:~$ hostname + edgecoresw1 + + +Configure Edgecore Switch +------------------------- + +xCAT provides a script ``/opt/xcat/share/xcat/script/configcumulus`` to configure attributes in the Cumulus Switch. Use the ``--help`` option to see more details. :: + + #configcumulus --help + Usage: + configcumulus [-?│-h│--help] + configcumulus [--switches switchnames] [--all] + configcumulus [--switches switchnames] [--ssh] + configcumulus [--switches switchnames] [--license filename ] + configcumulus [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] + configcumulus [--switches switchnames] [--ntp] + + + + + + + + diff --git a/docs/source/advanced/networks/edgecore_switches/index.rst b/docs/source/advanced/networks/edgecore_switches/index.rst new file mode 100644 index 000000000..6d3bdf038 --- /dev/null +++ b/docs/source/advanced/networks/edgecore_switches/index.rst @@ -0,0 +1,7 @@ +Edgecore Switches +================= + +.. toctree:: + :maxdepth: 2 + + edgecore_switches.rst diff --git a/docs/source/advanced/networks/index.rst b/docs/source/advanced/networks/index.rst index 6ab539c0b..5f19f7890 100644 --- a/docs/source/advanced/networks/index.rst +++ b/docs/source/advanced/networks/index.rst @@ -8,3 +8,4 @@ Networks switchdiscover/index.rst infiniband/index.rst ipv6/index.rst + edgecore_switches/index.rst diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 165cde2e2..03f6ff2b9 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -526,7 +526,7 @@ sub addnode { $guess_next_server = 1; } - if ($nrent->{netboot} and $nrent->{netboot} eq 'petitboot') { + if ($nrent->{netboot} and ($nrent->{netboot} eq 'petitboot' or $nrent->{netboot} eq 'onie' )) { if ($guess_next_server) { my $node_server = undef; if ($nrent->{xcatmaster}) { @@ -693,6 +693,8 @@ sub addnode $lstatements = 'filename = \"/boot/grub2/grub2-' . $node . '\";' . $lstatements; } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') { $lstatements = 'option conf-file \"http://' . $nxtsrv . '/tftpboot/petitboot/' . $node . '\";' . $lstatements; + } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'onie') { + $lstatements = 'if option vendor-class-identifier = \"onie_vendor:arm-accton_as4610_54-r0\" { option www-server = \"http://' . $nxtsrv . $ntent->{provmethod} . '\";}' . $lstatements; } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') { $lstatements = 'supersede server.filename=\"/vios/nodes/' . $node . '\";' . $lstatements; } @@ -1965,7 +1967,7 @@ sub process_request my $nodetypetab; $nodetypetab = xCAT::Table->new('nodetype', -create => 0); if ($nodetypetab) { - $nodetypeents = $nodetypetab->getNodesAttribs($req->{node}, [qw(os)]); + $nodetypeents = $nodetypetab->getNodesAttribs($req->{node}, [qw(os provmethod)]); } my $iscsitab = xCAT::Table->new('iscsi', -create => 0); if ($iscsitab) { @@ -2921,6 +2923,7 @@ sub newconfig push @dhcpconf, "option tcode \"" . $::XCATSITEVALS{timezone} . "\";\n"; } push @dhcpconf, "option gpxe.no-pxedhcp 1;\n"; + push @dhcpconf, "option www-server code 114 = string;\n"; push @dhcpconf, "\n"; push @dhcpconf, "omapi-port 7911;\n"; #Enable omapi... push @dhcpconf, "key xcat_key {\n"; diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 94fbc08e7..5a84a7978 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -32,6 +32,14 @@ my %global_scan_type = ( snmp => "snmp_scan" ); +my %global_mac_identity = ( + "a8:97:dc" => "BNT G8052 switch", + "6c:ae:8b" => "BNT G8264-T switch", + "fc:cf:62" => "BNT G8124 switch", + "7c:fe:90" => "Mellanox IB switch", + "8c:ea:1b" => "Edgecore switch" +); + my %global_switch_type = ( Juniper => "Juniper", juniper => "Juniper", @@ -44,7 +52,8 @@ my %global_switch_type = ( Mellanox => "Mellanox", mellanox => "Mellanox", MLNX => "Mellanox", - MELLAN => "Mellanox" + MELLAN => "Mellanox", + Edgecore => "cumulus" ); @@ -727,28 +736,42 @@ sub nmap_scan { if ($vendor) { my $search_string = join '|', keys(%global_switch_type); if ($vendor =~ /($search_string)/) { - $switches->{$mac}->{ip} = $ip; - $switches->{$mac}->{vendor} = $vendor; - $switches->{$mac}->{name} = $host->{hostname}; $found = 1; - if (exists($globalopt{verbose})) { - send_msg($request, 0, "FOUND Switch: ip=$ip, mac=$mac, vendor=$vendor\n"); - } } } if ( ($found == 0) && ($type eq "mac") ) { - push(@$osguess_ips, $ip); - } # end nmap osscan command + my $search_string = join '|', keys(%global_mac_identity); + if ($mac =~ /($search_string)/i) { + my $key = $1; + $vendor = $global_mac_identity{lc $key}; + $found = 1; + } + + # still not found, used nmap osscan command + if ( $found == 0) { + push(@$osguess_ips, $ip); + } + } + if ($found == 1) { + $switches->{$mac}->{ip} = $ip; + $switches->{$mac}->{vendor} = $vendor; + $switches->{$mac}->{name} = $host->{hostname}; + if (exists($globalopt{verbose})) { + send_msg($request, 0, "FOUND Switch: found = $found, ip=$ip, mac=$mac, vendor=$vendor\n"); + } + } } #end for each address } } #end for each host } } - my $guess_switches = nmap_osguess($request, $osguess_ips); - foreach my $guess_mac ( keys %$guess_switches ) { - $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip};; - $switches->{$guess_mac}->{vendor} = $guess_switches->{$guess_mac}->{vendor}; + if (!$osguess_ips) { + my $guess_switches = nmap_osguess($request, $osguess_ips); + foreach my $guess_mac ( keys %$guess_switches ) { + $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip};; + $switches->{$guess_mac}->{vendor} = $guess_switches->{$guess_mac}->{vendor}; + } } return $switches; @@ -1406,9 +1429,13 @@ sub switchsetup { my $config_script = "$::XCATROOT/share/xcat/scripts/config".$mytype; if (-r -x $config_script) { my $switches = join(",",@{${nodes_to_config}->{$mytype}}); - send_msg($request, 0, "call to config $mytype switches $switches\n"); - my $out = `$config_script --switches $switches --all`; - send_msg($request, 0, "output = $out\n"); + if ($mytype eq "cumulus") { + send_msg($request, 0, "Cumulus switch needs to take 50 mins to install, please run /opt/xcat/share/xcat/script/configcumulus after cumulus OS installed on switch\n"); + } else { + send_msg($request, 0, "call to config $mytype switches $switches\n"); + my $out = `$config_script --switches $switches --all`; + send_msg($request, 0, "output = $out\n"); + } } else { send_msg($request, 0, "the switch type $mytype is not support yet\n"); } diff --git a/xCAT-server/share/xcat/scripts/configcumulus b/xCAT-server/share/xcat/scripts/configcumulus new file mode 100755 index 000000000..7a6cbb55d --- /dev/null +++ b/xCAT-server/share/xcat/scripts/configcumulus @@ -0,0 +1,411 @@ +#!/usr/bin/env perl + +#--------------------------------------------------------- +# Configure Ethnet BNT switches +#--------------------------------------------------------- + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + + +use strict; +use Socket; +use Getopt::Long; +use Expect; +use Net::Ping; +use xCAT::Usage; +use xCAT::NodeRange; +use xCAT::NetworkUtils; +use xCAT::Utils; +use xCAT::Table; +use xCAT::MsgUtils; + +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; + +#global variables +my @nodes; +my @filternodes; + + +#--------------------------------------------------------- +#Main + +# parse the options +if ( + !GetOptions( + 'h|help' => \$::HELP, + 'switches=s' => \$::SWITCH, + 'port=s' => \$::PORT, + 'vlan=s' => \$::VLAN, + 'user=s' => \$::USER, + 'password=s' => \$::PASSWORD, + 'snmp' => \$::SNMP, + 'ssh' => \$::SSH, + 'license=s' => \$::LICENSE, + 'ntp' => \$::NTP, + 'all' => \$::ALL, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +if ($::SWITCH) { + my @filternodes = xCAT::NodeRange::noderange( $::SWITCH ); + if (nodesmissed) { + my $nodenotdefined = join(',', nodesmissed); + xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); + } + # check switch type + my $switchestab = xCAT::Table->new('switches'); + my $switches_hash = $switchestab->getNodesAttribs(\@filternodes,['switchtype']); + foreach my $fsw (@filternodes) { + if (($switches_hash->{$fsw}->[0]->{switchtype}) =~ /cumulus/) { + push @nodes, $fsw; + } else { + xCAT::MsgUtils->message("E","The $fsw is not cumulus switch, will not config"); + } + } + unless (@nodes) { + xCAT::MsgUtils->message("E","No Valid Switch to process"); + exit(1); + } +} else { + xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --switches"); + &usage; + exit(1); +} + +my $switches = join(",",@nodes); +my $cmd; +my $vlan; +my $port; +my $sub_req; +my $rc; + +if (($::SSH) || ($::ALL)) +{ + config_ssh(); +} + +if (($::LICENSE) || ($::ALL)) +{ + install_license(); +} + +if (($::SNMP) || ($::ALL)) +{ + config_snmp(); +} +if (($::NTP) || ($::ALL)) +{ + config_ntp(); +} +if ($::VLAN) +{ + #config_vlan(); +} +sub config_ssh { + my $password = "CumulusLinux!"; + my $userid = "cumulus"; + my $timeout = 10; + my $keyfile = "/root/.ssh/id_rsa.pub"; + my $rootkey = `cat /root/.ssh/id_rsa.pub`; + my $cmd; + my @config_switches; + + foreach my $switch (@nodes) { + #remove old host key from /root/.ssh/known_hosts + $cmd = `ssh-keygen -R $switch`; + + my ($exp, $errstr) = cumulus_connect($switch, $userid, $password, $timeout); + if (!defined $exp) { + print ("connect failed $errstr\n"); + next; + } + + my $ret; + my $err; + + ($ret, $err) = cumulus_exec($exp, "mkdir -p /root/.ssh"); + ($ret, $err) = cumulus_exec($exp, "chmod 700 /root/.ssh"); + ($ret, $err) = cumulus_exec($exp, "echo \"$rootkey\" >/root/.ssh/authorized_keys"); + ($ret, $err) = cumulus_exec($exp, "chmod 644 /root/.ssh/authorized_keys"); + + $exp->hard_close(); + push (@config_switches, $switch); + } + + if (@config_switches) { + #update switch status + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=ssh_configed "; + $rc= xCAT::Utils->runcmd($cmd, 0); + print "ssh configured for $csw\n"; + } +} + +sub cumulus_connect { + my $server = shift; + my $userid = shift; + my $password = shift; + my $timeout = shift; + + my $ssh = Expect->new; + my $command = 'ssh'; + my @parameters = ($userid . "@" . $server); + + $ssh->debug(0); + $ssh->log_stdout(0); # suppress stdout output.. + $ssh->slave->stty(qw(sane -echo)); + + unless ($ssh->spawn($command, @parameters)) + { + my $err = $!; + $ssh->soft_close(); + my $rsp; + return(undef, "unable to run command $command $err\n"); + } + + $ssh->expect($timeout, + [ "-re", qr/WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED/, sub {die "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!\n"; } ], + [ "-re", qr/\(yes\/no\)\?\s*$/, sub { $ssh->send("yes\n"); exp_continue; } ], + [ "-re", qr/ password:/, sub {$ssh->send("$password\n"); exp_continue; } ], + [ "-re", qr/:~\$/, sub { $ssh->send("sudo su\n"); exp_continue; } ], + [ "-re", qr/ password for cumulus:/, sub { $ssh->send("$password\n"); exp_continue; } ], + [ "-re", qr/.*\/home\/cumulus#/, sub { $ssh->clear_accum(); } ], + [ timeout => sub { die "No login.\n"; } ] + ); + $ssh->clear_accum(); + return ($ssh); +} + +sub cumulus_exec { + my $exp = shift; + my $cmd = shift; + my $timeout = shift; + my $prompt = shift; + + $timeout = 10 unless defined $timeout; + $prompt = qr/.*\/home\/cumulus#/ unless defined $prompt; + + + $exp->clear_accum(); + $exp->send("$cmd\n"); + my ($mpos, $merr, $mstr, $mbmatch, $mamatch) = $exp->expect(6, "-re", $prompt); + + if (defined $merr) { + return(undef,$merr); + } + return($mbmatch); +} + +# for cumulus switch, need to set the license file +sub install_license { + my @config_switches; + print "install_license\n"; + my $license_file; + my $file_name = "/root/license.txt"; + + if ($::LICENSE) { + $license_file = $::LICENSE; + } + + print "file = $license_file\n"; + if (!(-e $license_file) ) { + print "$license_file is not exist\n"; + } + + foreach my $switch (@nodes) { + my $cmd = "xdcp $switch $license_file $file_name"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to xscp $license_file to $switch"); + next; + } + + $cmd = "xdsh $switch '/usr/cumulus/bin/cl-license -i $file_name' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to $cmd to $switch"); + next; + } + push (@config_switches, $switch); + } + if (@config_switches) { + my $csw = join(",",@config_switches); + print "license is installed on $csw\n"; + } + +} + + +#setup secure SNMP v3 +sub config_snmp { + my $snmp_user; + my $snmp_passwd; + my @config_switches; + my $cmd; + + print "start to config_snmp\n"; + if ($::USER) { + $snmp_user = $::USER; + } else { + $snmp_user = "xcatadmin"; + } + if ($::PASSWORD) { + $snmp_passwd = $::PASSWORD; + } else { + $snmp_passwd = "xcatpassw0rd"; + } + + my $file = "temp.txt"; + open(FILE , ">$file") + or die "cannot open file $file\n"; + print FILE "#xCAT modify following line\n"; + print FILE "agentAddress udp:161,udp6:[::1]:161\n"; + print FILE "rocommunity public default\n"; + print FILE "rocommunity public default -V systemonly\n"; + print FILE "createUser $snmp_user SHA $snmp_passwd\n"; + print FILE "rwuser $snmp_user\n"; + + foreach my $switch (@nodes) { + #check if xdsh works + $cmd = "xdsh $switch date"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","xdsh command to $switch failed"); + next; + } + my $cmd_line = "sed -i 's/^agentAddress/#agentAddress/g' /etc/snmp/snmpd.conf"; + $cmd = "xdsh $switch $cmd_line"; + $rc= xCAT::Utils->runcmd($cmd, 0); + + $cmd = "xdcp $switch $file"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "xdsh $switch 'cat $file >> /etc/snmp/snmpd.conf;rm -fr $file;systemctl restart snmpd;systemctl enable snmpd' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to update snmpd.conf for $switch"); + next; + } + push (@config_switches, $switch); + } + close FILE; + $cmd = `rm -rf $file`; + if (@config_switches) { + #update switch status + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=snmp_configed snmpversion=3 snmpauth=sha snmpusername=$snmp_user snmppassword=$snmp_passwd"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + +} + +sub config_ntp { + my @config_switches; + my $cmd; + + my $master = `hostname -i`; + + my $file = "temp.txt"; + open(FILE , ">$file") + or die "cannot open file $file\n"; + print FILE "#This file is created by xCAT \n"; + print FILE "driftfile /var/lib/ntp/drift\n"; + print FILE "disable auth\n"; + print FILE "restrict 127.0.0.1\n"; + print FILE "server $master iburst\n"; + print FILE "interface listen eth0\n"; + + foreach my $switch (@nodes) { + #check if xdsh works + $cmd = "xdsh $switch date"; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","xdsh command to $switch failed"); + next; + } + my $cmd_line = "echo 'US/Eastern'>/etc/timezone;dpkg-reconfigure --frontend noninteractive tzdata"; + print "$cmd_line\n"; + $cmd = "xdsh $switch $cmd_line"; + if ($::RUNCMD_RC != 0) { + print "Failed to update ntp timezone\n"; + xCAT::MsgUtils->message("E","Failed to update ntp timezone for $switch"); + next; + } + print "$cmd\n"; + $cmd = "xdcp $switch $file"; + $rc= xCAT::Utils->runcmd($cmd, 0); + $cmd = "xdsh $switch 'cp /etc/ntp.conf /etc/ntp.conf.orig;cp $file /etc/ntp.conf;rm -fr $file;systemctl restart ntp;systemctl enable ntp' "; + $rc= xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) { + xCAT::MsgUtils->message("E","Failed to update ntp for $switch"); + next; + } + push (@config_switches, $switch); + } + close FILE; + $cmd = `rm -rf $file`; + + if (@config_switches) { + #update switch status + my $csw = join(",",@config_switches); + $cmd = "chdef $csw status=ntp_configed"; + $rc= xCAT::Utils->runcmd($cmd, 0); + } + + +} + +sub config_vlan { + if ($::PORT) { + $port = $::PORT; + } else { + &usage; + exit(1); + } + $vlan = $::VLAN; + print "Tagging VLAN=$vlan for $switches port $port\n"; + #create vlan, tagged vlan + #$cmd = `xdsh $switches --devicetype EthSwitch::BNT "enable;configure terminal;vlan $vlan;exit;interface port $port;switchport mode trunk;switchport trunk allowed vlan $vlan;write memory;exit;exit"`; + +} + + +#--------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#--------------------------------------------------------- +sub usage +{ + print "Usage: + configBNT [-?│-h│--help] + configBNT [--switches switchnames] [--all] + configBNT [--switches switchnames] [--ssh] + configBNT [--switches switchnames] [--license filename ] + configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] + configBNT [--switches switchnames] [--ntp] + configBNT [--switches switchnames] [--port port] [--vlan vlan] + \n"; +} + + From c933502500dd5a1caf32b12021a09567e2735e26 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 11:11:15 +0800 Subject: [PATCH 070/292] refine the dhcp conf for cumulus support --- xCAT-server/lib/xcat/plugins/dhcp.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 03f6ff2b9..9212e33df 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -694,7 +694,7 @@ sub addnode } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') { $lstatements = 'option conf-file \"http://' . $nxtsrv . '/tftpboot/petitboot/' . $node . '\";' . $lstatements; } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'onie') { - $lstatements = 'if option vendor-class-identifier = \"onie_vendor:arm-accton_as4610_54-r0\" { option www-server = \"http://' . $nxtsrv . $ntent->{provmethod} . '\";}' . $lstatements; + $lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $ntent->{provmethod} . '\";}' . $lstatements; } elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'nimol') { $lstatements = 'supersede server.filename=\"/vios/nodes/' . $node . '\";' . $lstatements; } @@ -2649,6 +2649,9 @@ sub addnet " } else if option client-architecture = 00:0e { #OPAL-v3\n "; push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n"; push @netent, +" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n"; + push @netent, " option www-server = \"http://install/onie/onie-installer\";\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"; push @netent, " }\n"; From 4f64a00b4bc0819c28e38d938f2de494538d4e56 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 8 Nov 2016 15:13:54 +0800 Subject: [PATCH 071/292] Fix a minor problem in the test case of updatenode --- xCAT-test/autotest/testcase/updatenode/cases1 | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/updatenode/cases1 b/xCAT-test/autotest/testcase/updatenode/cases1 index fac86011b..cafd28d45 100644 --- a/xCAT-test/autotest/testcase/updatenode/cases1 +++ b/xCAT-test/autotest/testcase/updatenode/cases1 @@ -9,7 +9,6 @@ cmd:updatenode $$CN -P blah >/tmp/updatenode.blah.out check:rc==0 cmd:grep 'FOO BAR BAZ QUX' /tmp/updatenode.blah.out check:rc==0 -check:rc==0 cmd:rm -f /install/postscripts/blah /tmp/updatenode.blah.out check:rc==0 end From 409e32bd70f8472db2e0b31aca52d6ed93e9c75a Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 8 Nov 2016 02:32:01 -0500 Subject: [PATCH 072/292] modified depending on comments --- perl-xCAT/xCAT/MacMap.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/perl-xCAT/xCAT/MacMap.pm b/perl-xCAT/xCAT/MacMap.pm index aab0e63ab..e857cf9f5 100644 --- a/perl-xCAT/xCAT/MacMap.pm +++ b/perl-xCAT/xCAT/MacMap.pm @@ -343,11 +343,9 @@ sub dump_mac_info { } elsif (defined($self->{macinfo}->{$switch}->{ErrorStr})) { $ret{$switch}->{ErrorStr} = $self->{macinfo}->{$switch}->{ErrorStr}; - if ($ret{$switch}->{ErrorStr} =~ /Unknown user name/) { - $ret{$switch}->{ErrorStr} = "Unknown snmp user name"; - } + # To show the error message that the username/password related error is for SNMP only - if ($ret{$switch}->{ErrorStr} =~ /username|password/i) { + if ($ret{$switch}->{ErrorStr} =~ /user\s*name|password/i) { $ret{$switch}->{ErrorStr} .= " through SNMP"; } } else { From c02c101156c3d9ca61219fb355558f3cba306303 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 15:51:30 +0800 Subject: [PATCH 073/292] refine the dhcp conf for cumulus support --- 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 9212e33df..460547f7e 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -2650,7 +2650,7 @@ sub addnet push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n"; push @netent, " } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n"; - push @netent, " option www-server = \"http://install/onie/onie-installer\";\n"; + push @netent, " option www-server = \"http://$tftp/install/onie/onie-installer\";\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"; From a2ae21321a08d284a844b535c3d78034722f9f2d Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 03:08:48 -0500 Subject: [PATCH 074/292] add cumulus switch definition template --- xCAT/templates/objects/node/cumulusswitch.stanza | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 xCAT/templates/objects/node/cumulusswitch.stanza diff --git a/xCAT/templates/objects/node/cumulusswitch.stanza b/xCAT/templates/objects/node/cumulusswitch.stanza new file mode 100644 index 000000000..48575c911 --- /dev/null +++ b/xCAT/templates/objects/node/cumulusswitch.stanza @@ -0,0 +1,14 @@ +# + +cumulusswitch: + objtype=node + arch="OPTIONAL: the arch of the switch management service processor, such as armv71" + groups=switch + ip="MANDATORY:the ip address of the management interface" + mac="MANDATORY:the mac of the management interface" + mgt=switch + netboot=onie + nodetype=switch + switchtype="OPTIONAL: the manufacturer of switch" + provmethod="OPTIONAL: the full path of the cumulus installer" + usercomment="the template for cumulus switch definition" From 7108fcb713dcc6852790c504876f816d707a6dfc Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 8 Nov 2016 02:39:59 -0500 Subject: [PATCH 075/292] if no ip definition get ip from getipaddr function --- xCAT-probe/subcmds/discovery | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 5a4a1cd82..e60cbae1e 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -844,11 +844,18 @@ sub get_node_ip { foreach my $node (keys %nodeipcheck) { $ip_net = xCAT::NetworkUtils->getipaddr($node); + my $isonmynet = xCAT::NetworkUtils->nodeonmynet($node); if ($nodeipcheck{$node}{"ip"} and $ip_net and ($nodeipcheck{$node}{"ip"} ne $ip_net)) { $nodeipcheck{$node}{"error"} = "IP $nodeipcheck{$node}{\"ip\"} definition for $node is not correct"; $nodeipcheck{$node}{"ip"} = $ip_net; + } elsif (!$nodeipcheck{$node}{"ip"} and $ip_net) { + $nodeipcheck{$node}{"ip"} = $ip_net; + } + if ($ip_net and !$isonmynet) { + $nodeipcheck{$node}{"error"} = "IP for $node is not on any network this server attached."; + } elsif (!$isonmynet) { + $nodeipcheck{$node}{"error"} = "Can not get IP for $node."; } - $nodeipcheck{$node}{"error"} = "IP for $node is not on any network this server attached, please run 'makehosts' and 'makedns -n'." unless (xCAT::NetworkUtils->nodeonmynet($node)); } return %nodeipcheck; From b7aae30d08354e10d79659dd295b437fb6a12013 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 23:07:56 +0800 Subject: [PATCH 076/292] correct the typo in commit 6f735b0e8d2eb90b5377da7baa5e2b855f7a798a --- xCAT-server/share/xcat/netboot/rh/genimage | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 2bfc3ffc4..0459c878f 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1994,8 +1994,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi copy("/install/postscripts/xcatpostinit1.netboot","$rootimg_dir/opt/xcat/xcatpostinit1"); chmod(0755,"$rootimg_dir/opt/xcat/xcatpostinit1"); copy("/install/postscripts/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/xcatpostinit1.service"); - symlink("$rootimg_dir/etc/systemd/system/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/multi-user.targ -et.wants/xcatpostinit1.service") ; + symlink("$rootimg_dir/etc/systemd/system/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service") ; }else{ #for traditional sysvinit copy("$installroot/postscripts/xcatpostinit1.netboot", "$rootimg_dir/etc/init.d/xcatpostinit"); From d1ca54598d54932da4880fbd62fb519d80f44259 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 8 Nov 2016 11:40:51 -0500 Subject: [PATCH 077/292] Update hypervisorKVM.rst Made [RHEV] and [PowerKVM] links --- .../ppc64le/virtual_machines/hypervisorKVM.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst index add5069d2..e4f0b0b14 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/hypervisorKVM.rst @@ -4,11 +4,13 @@ Install and Configure Hypervisor Provision Hypervisor -------------------- -* **[PowerKVM]** +**[PowerKVM]** +`````````````` .. include:: pKVMHypervisor.rst -* **[RHEV]** +**[RHEV]** +`````````` .. include:: RHEVHypervisor.rst From fd90ff371b3d19eccc24ce4d37d7d9ac907247d6 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Tue, 8 Nov 2016 15:27:45 -0800 Subject: [PATCH 078/292] ddns.pm: fix condition to append domainname to hostname Fix an issue where the domainname was not appended to the hostname when the domainname was contained in a substring of the hostname. Update the regular expression to make sure it only check for the domainname at the end of the hostname string. --- xCAT-server/lib/xcat/plugins/ddns.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 5f468b3e5..6f8ef970e 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -493,7 +493,7 @@ sub process_request { # for only the sake of comparison, ensure consistant dot suffix unless ($canonical =~ /\.\z/) { $canonical .= '.' } foreach my $alias (@aliases) { - unless ($alias =~ /$domain/) { + unless ($alias =~ /\.$domain\z/) { $alias .= "." . $domain; } unless ($alias =~ /\.\z/) { @@ -1417,7 +1417,7 @@ sub add_or_delete_records { my $domain = $nodedomains{$node}; if ($domain =~ /^\./) { $domain =~ s/^\.//; } # remove . if it's the first char of domain name - unless ($name =~ /$domain/) { $name .= "." . $domain } # $name needs to represent fqdn, but must preserve $node as a nodename for cfg lookup + unless ($name =~ /\.$domain\z/) { $name .= "." . $domain } # $name needs to represent fqdn, but must preserve $node as a nodename for cfg lookup if ($ctx->{hoststab} and $ctx->{hoststab}->{$node} and $ctx->{hoststab}->{$node}->[0]->{ip}) { @ips = ($ctx->{hoststab}->{$node}->[0]->{ip}); From a40f73972adf434604000e8601f0d508ecbfbc3f Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 22:54:26 -0500 Subject: [PATCH 079/292] use the relative path to enable xcatpostinit1.service;remove previous xcatpostinit1 sysvinit file and systemd service unit file --- xCAT-server/share/xcat/netboot/rh/genimage | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index df619c344..3289000a1 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -2013,6 +2013,14 @@ sub generic_post { #This function is meant to leave the image in a state approxi chmod(0755, "$rootimg_dir/etc/init.d/gettyset"); system("cd $rootimg_dir/etc/rc3.d; ln -sf ../init.d/gettyset S60gettyset"); } + + if(-e "$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service"){ + unlink("$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service"); + } + if(-e "$rootimg_dir/etc/rc3.d/S61xcatpostinit"){ + unlink("$rootimg_dir/etc/rc3.d/S61xcatpostinit"); + } + if(-e "$rootimg_dir/usr/lib/systemd/"){ #if systemd is the service management framework for the diskless image @@ -2020,7 +2028,7 @@ sub generic_post { #This function is meant to leave the image in a state approxi copy("/install/postscripts/xcatpostinit1.netboot","$rootimg_dir/opt/xcat/xcatpostinit1"); chmod(0755,"$rootimg_dir/opt/xcat/xcatpostinit1"); copy("/install/postscripts/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/xcatpostinit1.service"); - symlink("$rootimg_dir/etc/systemd/system/xcatpostinit1.service","$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service") ; + symlink("../xcatpostinit1.service","$rootimg_dir/etc/systemd/system/multi-user.target.wants/xcatpostinit1.service"); }else{ #for traditional sysvinit copy("$installroot/postscripts/xcatpostinit1.netboot", "$rootimg_dir/etc/init.d/xcatpostinit"); From 07df7fb89078ae9c9f1c72ff5da1c4e1bc5c4eab Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 8 Nov 2016 23:58:08 -0500 Subject: [PATCH 080/292] fix issue xcat object naming is too restrictive after sourceforge issue 4675 fix #2100 --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 37 ++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 78b17a189..263e38658 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -21,6 +21,7 @@ use Getopt::Long; use xCAT::MsgUtils; use xCAT::Utils; use xCAT::SvrUtils; +use xCAT::NetworkUtils; use File::Find; use strict; @@ -607,9 +608,9 @@ sub processArgs } # check the new object name specified with -n - if ($::command eq "chdef" && $::opt_n && ($::opt_n !~ /^[a-zA-Z0-9-_]+$/)) { + if ($::command eq "chdef" && $::opt_n && (!isobjnamevalid($::opt_n))) { my $rsp; - $rsp->{data}->[0] = "The new object name \'$::opt_n\' is not valid."; + $rsp->{data}->[0] = "The new object name \'$::opt_n\' is not valid.Please refer to \"man xcatdb\" for the valid \"xCAT Object Name Format\" "; xCAT::MsgUtils->message("E", $rsp, $::callback); return 2; } @@ -1542,12 +1543,24 @@ sub defmk &defmk_usage; return 1; } else { + my $invalidobjname = (); my $invalidnodename = (); foreach my $node (@::allobjnames) { + unless(isobjnamevalid($node)){ + $invalidobjname .= ",$node"; + } if (($node =~ /[A-Z]/) && (((!$::opt_t) && (!$::FILEATTRS{$node}{'objtype'})) || ($::FILEATTRS{$node}{'objtype'} eq "node") || ($::opt_t eq "node"))) { $invalidnodename .= ",$node"; } } + if ($invalidobjname) { + $invalidobjname =~ s/,//; + my $rsp; + $rsp->{data}->[0] = "The object name \'$invalidnodename\' is invalid, please refer to \"man xcatdb\" for the valid \"xCAT Object Name Format\""; + xCAT::MsgUtils->message("E", $rsp, $::callback); + $error = 1; + return 1; + } if ($invalidnodename) { $invalidnodename =~ s/,//; my $rsp; @@ -4523,5 +4536,25 @@ sub initialize_variables @::allobjnames = (); @::noderange = (); } + + +#----------------------- +#isobjnamevalid: +#description: check whether the object name is valid +#argument: +# $objname: the objname string +#return: +# 1: valid +# 0: invalid +#----------------------- +sub isobjnamevalid{ + my $objname=shift; + #the ip address as a valid object name is a hack for p7IH support + if(($objname !~ /^[a-zA-Z0-9-_]+$/) and !xCAT::NetworkUtils->isIpaddr($objname)){ + return 0; + } + return 1; +} + 1; From 9ce51e7c4dcddab4badba747eeacae8c10cde47e Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 9 Nov 2016 01:51:43 -0500 Subject: [PATCH 081/292] correct a typo --- xCAT/postscripts/xcatpostinit1.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index ac3e5cd73..3d7c3abd3 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -23,7 +23,7 @@ start) REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2` fi # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 - if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost -a "$RUNBOOTSCRIPT" = "1"]; then + if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost -a "$RUNBOOTSCRIPT" = "1" ]; then /opt/xcat/xcatdsklspost 6 elif [ "$REBOOT" = "TRUE" -a "NODESTATUS" != "n" ]; then /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" From 4ccaff7a3fd6f5b1467161163d5194f3da36ffc8 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 9 Nov 2016 03:08:25 -0500 Subject: [PATCH 082/292] fix issue 2117, distinguish discovery type --- xCAT-probe/subcmds/discovery | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index e60cbae1e..363a608fa 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -1342,12 +1342,14 @@ sub handle_cluster_msg { my $node_state_ref = shift; my $log_msg = $log_ref->{msg}; - if ($log_ref->{msg} =~ /xcat.discovery.$discovery_type: \((.+)\) Found node: (.+)/) { - my $mac = $1; - my $node = $2; + if ($log_ref->{msg} =~ /xcat\.discovery\.(.+): \((.+)\) Found node: (.+)/) { + my $type = $1; + my $mac = $2; + my $node = $3; $node_state_ref->{$mac}{id} = $node; $node_state_ref->{$node}{id} = $mac; - my $record = "Start to update node information"; + $node_state_ref->{$node}{discoverytype} = $type; + my $record = "Start to update node information, discovery type is $type"; probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_UPDATE); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); @@ -1524,14 +1526,19 @@ sub conclusion_report { my %failed_mac; my @success_node; + my %success_node_other_type; my @failed_node; foreach my $identify (keys %$node_state_ref) { if ($node_state_ref->{$identify}{type} eq "node") { my $mac = $node_state_ref->{$identify}{id}; if ($mac) { push @success_node, $identify; + my $type = $node_state_ref->{$identify}{discoverytype}; + if ($type and ($type ne $discovery_type)) { + push @{ $success_node_other_type{$type} }, $identify; + } } else { - push @failed_node, $identify; + push @failed_node, $identify; } } elsif ($node_state_ref->{$identify}{type} eq "mac") { foreach (@{ $node_state_ref->{$identify}{statehistory} }) { @@ -1548,6 +1555,12 @@ sub conclusion_report { my $failed_node_num = @failed_node; my $failed_nodes = join(",", @failed_node); probe_utils->send_msg("stdout", "", "Discovered $success_node_num node(s) successfully, $failed_node_num node(s) failed."); + + foreach my $type (keys %success_node_other_type) { + my $other_nodes = join(",", @{ $success_node_other_type{$type} }); + probe_utils->send_msg("stdout", "", "Discovered [$other_nodes] successfully, but discovery type is $type"); + + } probe_utils->send_msg("stdout", "", "Unmatched node(s):"); probe_utils->send_msg("stdout", "", "$failed_nodes"); From 8858d38c404076d7d87cff0648c600f261bc679f Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 9 Nov 2016 03:22:21 -0500 Subject: [PATCH 083/292] add makentp/setupntp cases --- .../installation/Full_installation_flat_p8_le | 11 +++ .../reg_linux_diskfull_installation_flat | 13 ++- xCAT-test/autotest/testcase/makentp/cases0 | 85 +++++++++++++------ 3 files changed, 81 insertions(+), 28 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 4ff715634..5f67d3418 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -6,6 +6,12 @@ cmd:copycds $$ISO check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "ubuntu" ]];then mkdir /tmp/iso; mount -o loop $$MINIISO /tmp/iso ; mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot; cp /tmp/iso/install/initrd.gz /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot;umount /tmp/iso; rmdir /tmp/iso; fi check:rc==0 +cmd:chtab key=extntpservers site.value="" +check:rc==0 +cmd:chtab key=ntpservers site.value="" +check:rc==0 +cmd:makentp +check:rc==0 cmd:makedhcp -n check:rc==0 cmd:makedhcp -a @@ -16,6 +22,8 @@ cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN +cmd:chdef -t node -o $$CN postscripts=setupntp +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:rpower $$CN boot @@ -29,4 +37,7 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN service ntpd status +check:rc==0 +check:output=~running end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 48b56899f..cca15abed 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,8 +5,6 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n @@ -18,6 +16,12 @@ check:output=~$$CN cmd:sleep 20 cmd:if [ "__GETNODEATTR($$CN,arch)__" = "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then getmacs -D $$CN; fi check:rc==0 +cmd:chtab key=extntpservers site.value="" +check:rc==0 +cmd:chtab key=ntpservers site.value="" +check:rc==0 +cmd:makentp +check:rc==0 cmd:makedhcp -n check:rc==0 cmd:makedhcp -a @@ -27,6 +31,8 @@ cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.l check:output=~$$CN cmd:copycds $$ISO check:rc==0 +cmd:chdef -t node -o $$CN postscripts=setupntp +check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 cmd:lsdef $$CN |grep provmethod @@ -52,6 +58,9 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 cmd:sleep 120 +cmd:xdsh $$CN service ntpd status +check:rc==0 +check:output=~running cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN diff --git a/xCAT-test/autotest/testcase/makentp/cases0 b/xCAT-test/autotest/testcase/makentp/cases0 index 91df12b35..b47ff3316 100644 --- a/xCAT-test/autotest/testcase/makentp/cases0 +++ b/xCAT-test/autotest/testcase/makentp/cases0 @@ -4,66 +4,99 @@ cmd:makentp -v check:rc==0 check:output=~Version end + start:makentp_h descriptiop:makentp -h cmd:makentp -h check:rc==0 check:output=~Usage: makentp end -start:makentp_V -descriptiop:makentp -V + +start:makentp_extntpserver_null +descriptiop:test makentp with default value. extntpserver is set to blank +cmd:lsdef -t site -o clustersite -i extntpservers -c >/tmp/extntpserver +check:rc==0 +cmd:chtab key=extntpservers site.value="" +check:rc==0 +cmd:makentp +check:rc==0 +check:output=~configuring management node: $$MN cmd:makentp -V check:rc==0 +check:output=~configuring management node: $$MN check:output=~checking if nptd is installed +check:output=~backing up the ntp configuration file /etc/ntp.conf +check:output=~stopping ntpserver +check:output=~starting ntpserver +check:output=~enabling ntpserver +cmd:extntpserver=`cat /tmp/ntpserver | awk -F = '{print \$2}'`;chtab key=extntpservers site.value=$extntpserver +check:rc==0 +cmd:rm -rf /tmp/extntpserver +cmd:makentp +check:rc==0 end -start:makentp -descriptiop:makentp + +start:makentp_extntpserver_value +descriptiop:test makentp with extntpserver is set to a specific value +cmd:lsdef -t site -o clustersite -i extntpservers -c >/tmp/extntpserver +check:rc==0 +cmd:chtab key=extntpservers site.value="$$extntpserversip" +check:rc==0 cmd:date -s 20000101 check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock -w;else hwclock -w ; fi -cmd:chtab key=extntpservers site.value="$$extntpserversip" check:rc==0 -cmd:makentp +cmd:makentp check:rc==0 -check:output=~configuring management node +check:output=~configuring management node: $$MN +cmd:makentp -V +check:rc==0 +check:output=~configuring management node: $$MN +check:output=~checking if nptd is installed +check:output=~backing up the ntp configuration file /etc/ntp.conf +check:output=~ntp servers are: $$extntpserversip +check:output=~stopping ntpserver +check:output=~starting ntpserver +check:output=~enabling ntpserver cmd:date check:output=~$$DATE cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock ;else hwclock ; fi -check:output=~$$DATE -end -start:makentp_a -descriptiop:makentp -a -cmd:date -s 20000101 check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock -w;else hwclock -w ; fi -cmd:chtab key=extntpservers site.value="$$extntpserversip" -check:rc==0 -cmd:makentp -a -check:rc==0 -check:output=~configuring management node -cmd:date -check:output=~$$DATE -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock ;else hwclock ; fi check:output=~$$DATE +cmd:extntpserver=`cat /tmp/extntpserver | awk -F = '{print \$2}'`;chtab key=extntpservers site.value=$extntpserver +check:rc==0 +cmd:rm -rf /tmp/extntpserver end start:updatenode_computenode_P_setupntp -descriptiop:using updatenode -p synch +descriptiop:using updatenode -P to setup ntp on compute node cmd:xdsh $$CN date -s 20000101 check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then xdsh $$CN clock -w;else xdsh $$CN hwclock -w ; fi -cmd:chdef $$CN -p postscripts=setupntp -cmd:chtab key=extntpservers site.value="" +cmd:lsdef -t node -o $$CN -i postscripts -c > /tmp/postscripts check:rc==0 +cmd:chdef $$CN postscripts=setupntp +cmd:lsdef -t site -o clustersite -i ntpservers -c >/tmp/ntpservers +cmd:chtab key=ntpservers site.value="" +cmd:makentp +check:rc==0 +check:output=~configuring management node: $$MN cmd:updatenode $$CN -P setupntp check:rc==0 check:output=~Running of postscripts has completed check:output=~Running postscript: setupntp +check:output=~setupntp exited with code 0 cmd:sleep 120 cmd:xdsh $$CN date check:output=~$$DATE -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then xdsh $$CN clock ;else xdsh $$CN hwclock ; fi +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]];then clock ;else hwclock ; fi +check:rc==0 check:output=~$$DATE -cmd:chdef $$CN -m postscripts=setupntp +cmd:ntpserver=`cat /tmp/ntpserver | awk -F = '{print \$2}'`;chtab key=ntpservers site.value=$ntpserver +check:rc==0 +cmd:rm -rf /tmp/ntpserve +cmd:postscript=`cat /tmp/postscript | awk -F = '{print \$2}'`;chdef -t node -o $$CN postscripts=$postscript +check:rc==0 +cmd:rm -rf /tmp/postscript end From 997f88c14331a50c86460a8609a4132d3994d0db Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 9 Nov 2016 04:37:18 -0500 Subject: [PATCH 084/292] Fix issue #2110 xcatprobe xcatmn requires tftp tool , add dependency to xcatprobe rpm --- xCAT-probe/debian/control | 4 ++++ xCAT-probe/xCAT-probe.spec | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/xCAT-probe/debian/control b/xCAT-probe/debian/control index e61da9c6c..a536453cc 100644 --- a/xCAT-probe/debian/control +++ b/xCAT-probe/debian/control @@ -8,4 +8,8 @@ Standards-Version: 3.7.2 Package: xcat-probe Architecture: all Depends: ${perl:Depends} + +#Sub-command 'xcatmn' need tools tftp, nslookup, wget. +Suggests: wget, dnsutils, tftp-hpa + Description: Provides a toolkits to help probe all the possible issues in xCAT diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 4748b1156..26e5d5404 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -16,6 +16,13 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root BuildArch: noarch %endif +%ifos linux +#Below tools are required by sub-command 'xcatmn' +Requires: /usr/bin/nslookup +Requires: /usr/bin/tftp +Requires: /usr/bin/wget +%endif + Provides: xCAT-probe = %{version} %description From abd96aa1d027fd7151c8a96ec940a8498eedcffe Mon Sep 17 00:00:00 2001 From: Weihua Hu Date: Wed, 9 Nov 2016 17:43:16 +0800 Subject: [PATCH 085/292] fix bug 1275 xcatprobe xcatmn usage errors in help menu (#2124) --- xCAT-probe/subcmds/xcatmn | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index e30f54650..20bcfcf03 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -872,6 +872,12 @@ if ($test) { exit 0; } +if (!$installnic){ + probe_utils->send_msg("$output", "f", "Option '-i' is required"); + probe_utils->send_msg("$output", "d", "$::USAGE"); + exit 1; +} + #Handle the interrupt signal from STDIN $SIG{TERM} = $SIG{INT} = sub { $terminal = 1; From e7a7da10cbec34ced8981d9a770e727f02262de9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Nov 2016 10:19:10 -0500 Subject: [PATCH 086/292] Fix backwards compatibility If a user has an existing rootimg.gz, use that so that an upgrade does not require re doing packimage for no particular reason. --- xCAT-server/lib/xcat/plugins/anaconda.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 90f65cfa7..a5d006985 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -464,6 +464,7 @@ sub mknetboot $platform = xCAT_plugin::anaconda::getplatform($osver); my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); + $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); @@ -515,7 +516,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); From 967dd0f5fba362ddf2624bcda8ba10e4eec63661 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Nov 2016 11:24:58 -0500 Subject: [PATCH 087/292] Fix Debian and SLES rootimg.gz compatibility Do not require repacking of a rootimage if the environment has the 'old style' packed image. --- xCAT-server/lib/xcat/plugins/debian.pm | 3 ++- xCAT-server/lib/xcat/plugins/sles.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 412e8a87f..6f9802468 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1171,6 +1171,7 @@ sub mknetboot $platform = xCAT_plugin::debian::getplatform($osver); my $suffix = 'cpio.gz'; + $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); @@ -1223,7 +1224,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 2de029f12..ea3518bb6 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -329,6 +329,7 @@ sub mknetboot my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); + $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); @@ -383,7 +384,7 @@ sub mknetboot } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] From 98e0972ef48cd08a8515683eb889a4ec5f2aed19 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 9 Nov 2016 14:48:24 -0500 Subject: [PATCH 088/292] Fixed some details in the RHEV support after running some verification testing. --- .../ppc64le/virtual_machines/RHEVHypervisor.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index 5ad65df54..8be5736f3 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -1,7 +1,14 @@ - At the time of this writing there is no ISO image availabe for RHEV. Individual RPM packages need to be downloaded. + Red Hat Virtualization (formally known as RHEV or Red Hat Enterprise Virtualization) is a virtualization solution provided by Red Hat. - * Download *Management-Agent-Power-7* and *Power_Tools-7* RPMs from RedHat to the xCAT management node. Steps below assume all RPMs were downloaded to ``/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA`` + At the time of this writing there is no RHEV-H prebuilt hypervisor image on Power LE. The method for creating a Red Hat Hypervisor on Power LE is to install first install RHEL and apply the KVM support on top with the provided RPMs. + + Obtain and download the RHEV RPM packages from the Red Hat download site. + + * Management-Agent-Power-7 + * Power_Tools-7 + + In the following example, the RPMs are downloaded to ``/install/post/otherpkgs/rhels7.3/ppc64le/RHEV4/4.0-GA`` * Create a yum repository for the downloaded RPMs :: @@ -20,6 +27,8 @@ * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhelv4.pkglist`` to include necessary packages provided from the OS. :: #INCLUDE:/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist# + libvirt + screen bridge-utils * Modify ``pkglist`` attribute to point to the package list file from the step above :: @@ -29,7 +38,6 @@ * Create a new package list file ``/install/custom/rhels7.3/ppc64le/rhev4.otherpkgs.pkglist`` to list required packages :: - libvirt qemu-kvm-rhev qemu-kvm-tools-rhev virt-manager-common From 843fee9ad3cf9fa27f8b6ee3ab6949bbb02046af Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 10 Nov 2016 10:44:03 +0800 Subject: [PATCH 089/292] Modify build spec to require ipmitool-xcat-1.8.17-1 --- xCAT/debian/control | 2 +- xCAT/xCAT.spec | 4 ++-- xCATsn/debian/control | 2 +- xCATsn/xCATsn.spec | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT/debian/control b/xCAT/debian/control index 29b2c2c1c..913d00c94 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -7,6 +7,6 @@ Standards-Version: 3.7.2 Package: xcat Architecture: amd64 ppc64el -Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.15-2), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat, xcat-buildkit, xcat-probe (>=2.12) +Depends: ${perl:Depends}, xcat-server, xcat-client, libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, nmap, bind9, libxml-parser-perl, xinetd, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, ipmitool-xcat (>=1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat, xcat-buildkit, xcat-probe (>=2.12) Description: Server and configuration utilities of the xCAT management project xcat-server provides the core server and configuration management components of xCAT. This package should be installed on your management server diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index 1d0f1d234..d1d935e3f 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -64,12 +64,12 @@ Requires: elilo-xcat xnba-undi %ifarch i386 i586 i686 x86 x86_64 Requires: syslinux -Requires: ipmitool-xcat >= 1.8.17 +Requires: ipmitool-xcat >= 1.8.17-1 %endif %ifos linux %ifarch ppc ppc64 ppc64le -Requires: ipmitool-xcat >= 1.8.17 +Requires: ipmitool-xcat >= 1.8.17-1 %endif %endif diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 105f97304..7ed6120d9 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: xcatsn Architecture: all -Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.15-2), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl, xcat-probe (>=2.12) +Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.17-1), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl, xcat-probe (>=2.12) Recommends: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale management, including hardware management and software management. diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index 688cffb2c..ed793aee6 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -59,11 +59,11 @@ Requires: elilo-xcat xnba-undi %ifarch i386 i586 i686 x86 x86_64 Requires: syslinux -Requires: ipmitool-xcat >= 1.8.17 +Requires: ipmitool-xcat >= 1.8.17-1 %endif %ifos linux %ifarch ppc ppc64 ppc64le -Requires: ipmitool-xcat >= 1.8.17 +Requires: ipmitool-xcat >= 1.8.17-1 %endif %endif From 6d415c704029c37c8a7ed785b0aa6228d44d2495 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 9 Nov 2016 22:37:58 -0500 Subject: [PATCH 090/292] Add back in the code to upload the deps package to xcat.org --- build-ubunturepo | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/build-ubunturepo b/build-ubunturepo index 6eae01394..b4220b4a6 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -96,6 +96,13 @@ if [ -z "$c_flag" -a -z "$d_flag" ];then exit 2 fi +USER="xcat" +SERVER="xcat.org" +FILES_PATH="files" +FRS="/var/www/${SERVER}/${FILES_PATH}" +APT_DIR="${FRS}/xcat" +APT_REPO_DIR="${APT_DIR}/repos/apt" + if [ "$c_flag" -a "$d_flag" ];then printusage exit 2 @@ -474,6 +481,32 @@ __EOF__ chgrp root $dep_tar_name chmod g+w $dep_tar_name + # Decide whether to upload or not (default NOT to upload) + if [ "$UP" != "1" ]; then + echo "Upload not specified, Done! (rerun with UP=1, to upload)" + cd $old_pwd + exit 0 + fi + + #upload the dep packages + i=0 + echo "Uploading debs from xcat-dep to ${APT_REPO_DIR}/xcat-dep/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete xcat-dep $USER@${SERVER}:${APT_REPO_DIR}/ + do : ; done + + #upload the tarball + i=0 + echo "Uploading $dep_tar_name to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -v --force $dep_tar_name $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ + do : ; done + + #upload the README file + cd debs + i=0 + echo "Uploading README to ${APT_DIR}/xcat-dep/2.x_Ubuntu/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -v --force README $USER@${SERVER}:${APT_DIR}/xcat-dep/2.x_Ubuntu/ + do : ; done + cd $old_pwd exit 0 fi From 214fc9ab0db97aef30db8d8a385eecb6b3cfd62c Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 10 Nov 2016 00:06:50 -0500 Subject: [PATCH 091/292] modify some message of bug 1528 --- xCAT-probe/subcmds/xcatmn | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index e30f54650..6285d06ff 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -510,9 +510,14 @@ sub check_disk { foreach $mountpoint (keys %mountpointinfo) { if ($mountpointinfo{$mountpoint}{need} > $mountpointinfo{$mountpoint}{available}) { foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { - $msg .= "'$_' needs $dir_expectedspace_list{$_} G, "; + $msg .= "'$_' needs $dir_expectedspace_list{$_} GiB disk space, "; + } + my $mountmun = $#{$mountpointinfo{$mountpoint}{mount}} +1 ; + if($mountmun >1){ + $msg .= "these directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it isn't enough."; + }else{ + $msg .= "This directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it isn't enough."; } - $msg .= "These directories are mounted on '$mountpoint', the free space of '$mountpoint' is $mountpointinfo{$mountpoint}{available} G, it isn't enough."; $rst = 1; } } From 78ec2e48367cb648e0b0e2a6dc86b4fbec3835c2 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 10 Nov 2016 00:11:37 -0500 Subject: [PATCH 092/292] modify depending on gongjie's comment: Consistency of singular vs. plural usage problem --- xCAT-probe/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-probe/debian/control b/xCAT-probe/debian/control index a536453cc..def2abb1b 100644 --- a/xCAT-probe/debian/control +++ b/xCAT-probe/debian/control @@ -12,4 +12,4 @@ Depends: ${perl:Depends} #Sub-command 'xcatmn' need tools tftp, nslookup, wget. Suggests: wget, dnsutils, tftp-hpa -Description: Provides a toolkits to help probe all the possible issues in xCAT +Description: Provides a toolkit to help probe all the possible issues in xCAT From b6311fa98324a1c3a7ea4b8b569815dd0460cd3a Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 10 Nov 2016 00:17:22 -0500 Subject: [PATCH 093/292] modify depending on gongjie's comment --- xCAT-probe/subcmds/xcatmn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 6285d06ff..36f10c4ef 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -514,9 +514,9 @@ sub check_disk { } my $mountmun = $#{$mountpointinfo{$mountpoint}{mount}} +1 ; if($mountmun >1){ - $msg .= "these directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it isn't enough."; + $msg .= "these directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; }else{ - $msg .= "This directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it isn't enough."; + $msg .= "This directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; } $rst = 1; } From a7dcbd93eb50bcb6674a3c49088c90301ba325ec Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 10 Nov 2016 00:20:36 -0500 Subject: [PATCH 094/292] modify depending on gongjie's comment --- xCAT-probe/subcmds/xcatmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 36f10c4ef..e62ee0688 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -516,7 +516,7 @@ sub check_disk { if($mountmun >1){ $msg .= "these directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; }else{ - $msg .= "This directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; + $msg .= "this directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; } $rst = 1; } From dffecd4e95c7dd8c150a8f60573aaa0e1759bc22 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 10 Nov 2016 00:23:24 -0500 Subject: [PATCH 095/292] modify depending on gongjie's comment --- xCAT-probe/subcmds/xcatmn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index e62ee0688..e439dfc7f 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -510,13 +510,13 @@ sub check_disk { foreach $mountpoint (keys %mountpointinfo) { if ($mountpointinfo{$mountpoint}{need} > $mountpointinfo{$mountpoint}{available}) { foreach (@{ $mountpointinfo{$mountpoint}{mount} }) { - $msg .= "'$_' needs $dir_expectedspace_list{$_} GiB disk space, "; + $msg .= "'$_' needs $dir_expectedspace_list{$_} GiB disk space. "; } my $mountmun = $#{$mountpointinfo{$mountpoint}{mount}} +1 ; if($mountmun >1){ - $msg .= "these directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; + $msg .= "These directories are parts of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; }else{ - $msg .= "this directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; + $msg .= "This directory is a part of file system '$mountpoint'. The free space available in directory '$mountpoint' is $mountpointinfo{$mountpoint}{available} GiB, it is not enough."; } $rst = 1; } From ee67c6808691bb1e626ad909ee19f4897c52ea19 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 9 Nov 2016 22:25:24 -0500 Subject: [PATCH 096/292] fix [FVT]mkdef with osimage returns object name invalid #2131 --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index 263e38658..dee9b82b1 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -608,7 +608,7 @@ sub processArgs } # check the new object name specified with -n - if ($::command eq "chdef" && $::opt_n && (!isobjnamevalid($::opt_n))) { + if ($::command eq "chdef" && $::opt_n && (!isobjnamevalid($::opt_n,$::opt_t))) { my $rsp; $rsp->{data}->[0] = "The new object name \'$::opt_n\' is not valid.Please refer to \"man xcatdb\" for the valid \"xCAT Object Name Format\" "; xCAT::MsgUtils->message("E", $rsp, $::callback); @@ -1546,7 +1546,7 @@ sub defmk my $invalidobjname = (); my $invalidnodename = (); foreach my $node (@::allobjnames) { - unless(isobjnamevalid($node)){ + unless(isobjnamevalid($node,$::opt_t)){ $invalidobjname .= ",$node"; } if (($node =~ /[A-Z]/) && (((!$::opt_t) && (!$::FILEATTRS{$node}{'objtype'})) || ($::FILEATTRS{$node}{'objtype'} eq "node") || ($::opt_t eq "node"))) { @@ -1556,7 +1556,7 @@ sub defmk if ($invalidobjname) { $invalidobjname =~ s/,//; my $rsp; - $rsp->{data}->[0] = "The object name \'$invalidnodename\' is invalid, please refer to \"man xcatdb\" for the valid \"xCAT Object Name Format\""; + $rsp->{data}->[0] = "The object name \'$invalidobjname\' is invalid, please refer to \"man xcatdb\" for the valid \"xCAT Object Name Format\""; xCAT::MsgUtils->message("E", $rsp, $::callback); $error = 1; return 1; @@ -4542,16 +4542,21 @@ sub initialize_variables #isobjnamevalid: #description: check whether the object name is valid #argument: -# $objname: the objname string +# $objname: the object name string +# $objtype: the object type string #return: # 1: valid # 0: invalid #----------------------- sub isobjnamevalid{ my $objname=shift; - #the ip address as a valid object name is a hack for p7IH support - if(($objname !~ /^[a-zA-Z0-9-_]+$/) and !xCAT::NetworkUtils->isIpaddr($objname)){ - return 0; + my $objtype=shift; + $objtype="node" unless(defined $objtype and ($objtype ne "")); + if($objtype eq "node"){ + #the ip address as a valid node object name is a hack for p7IH support + if(($objname !~ /^[a-zA-Z0-9-_]+$/) and !xCAT::NetworkUtils->isIpaddr($objname)){ + return 0; + } } return 1; } From aac736afcb7f463b00ea983638c568f533b8c018 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 10 Nov 2016 01:07:59 -0500 Subject: [PATCH 097/292] create /opt/xcat under rootimage dir incase it is not there --- xCAT-server/share/xcat/netboot/rh/genimage | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 3289000a1..17e06fd19 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -2020,7 +2020,10 @@ sub generic_post { #This function is meant to leave the image in a state approxi if(-e "$rootimg_dir/etc/rc3.d/S61xcatpostinit"){ unlink("$rootimg_dir/etc/rc3.d/S61xcatpostinit"); } - + + if (!-d "$rootimg_dir/opt/xcat/") { + mkdir "$rootimg_dir/opt/xcat/"; + } if(-e "$rootimg_dir/usr/lib/systemd/"){ #if systemd is the service management framework for the diskless image From d473bf9f3e3776b153d7448eb1b4dd6bd9fc1a23 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 10 Nov 2016 13:35:54 -0500 Subject: [PATCH 098/292] Disable ac97 for ppc64le platforms --- xCAT-server/lib/xcat/plugins/kvm.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index a7c53d8b2..15c0ad28c 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -897,6 +897,9 @@ sub build_xmldesc { } if (defined($hypcpumodel) and $hypcpumodel eq 'ppc64') { $xtree{devices}->{emulator}->{content} = "/usr/bin/qemu-system-ppc64"; + } elsif (defined($hypcpumodel) and $hypcpumodel eq 'ppc64le') { + # do nothing for ppc64le, do not support sound at this time + ; } else { $xtree{devices}->{sound}->{model} = 'ac97'; } From 378c8ef38f2e10ef0f1afca77d16d9e4031b3875 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 10 Nov 2016 14:38:02 -0500 Subject: [PATCH 099/292] Fixed extra word based on review comments --- .../manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst index 8be5736f3..59481768a 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/virtual_machines/RHEVHypervisor.rst @@ -1,7 +1,7 @@ Red Hat Virtualization (formally known as RHEV or Red Hat Enterprise Virtualization) is a virtualization solution provided by Red Hat. - At the time of this writing there is no RHEV-H prebuilt hypervisor image on Power LE. The method for creating a Red Hat Hypervisor on Power LE is to install first install RHEL and apply the KVM support on top with the provided RPMs. + At the time of this writing there is no RHEV-H prebuilt hypervisor image on Power LE. The method for creating a Red Hat Hypervisor on Power LE is to first install RHEL and apply the KVM support on top with the provided RPMs. Obtain and download the RHEV RPM packages from the Red Hat download site. From e627c393b3be3c9ae6dd99f70af0df7403742b08 Mon Sep 17 00:00:00 2001 From: zet809 Date: Fri, 11 Nov 2016 14:28:03 +0800 Subject: [PATCH 100/292] Add release information for 2.12.4 --- docs/source/overview/xcat2_release.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 7a8d7dc9f..369200bcb 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -14,6 +14,14 @@ xCAT 2.12.x |xCAT |New OS |New |New Feature | |Version | |Hardware | | +=================================+===============+=============+==================================+ +|| xCAT 2.12.4 |- RHEL 7.3 LE | |- `noboot` added to dhcpinterface | +|| 2016/11/11 |- RHEV 4.0 | |- new xcatprobe subcommand | +|| | | | xcatmn | +| `2.12.4 Release Notes `_ | | | | +| | | | | ++---------------------------------+---------------+-------------+----------------------------------+ || xCAT 2.12.3 | | |- GitHub Issues resolved | || 2016/09/30 | | |- rinv options for OpenPower | || | | |- switch based switch discovery | From 19d51d775a1413eef7ec708d416fa74f063fa8ac Mon Sep 17 00:00:00 2001 From: zet809 Date: Fri, 11 Nov 2016 14:33:08 +0800 Subject: [PATCH 101/292] Update xcat2_release.rst --- docs/source/overview/xcat2_release.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/overview/xcat2_release.rst b/docs/source/overview/xcat2_release.rst index 369200bcb..ec71b0834 100644 --- a/docs/source/overview/xcat2_release.rst +++ b/docs/source/overview/xcat2_release.rst @@ -15,10 +15,10 @@ xCAT 2.12.x |Version | |Hardware | | +=================================+===============+=============+==================================+ || xCAT 2.12.4 |- RHEL 7.3 LE | |- `noboot` added to dhcpinterface | -|| 2016/11/11 |- RHEV 4.0 | |- new xcatprobe subcommand | -|| | | | xcatmn | -| `2.12.4 Release Notes `_ | | | | | | | | | +---------------------------------+---------------+-------------+----------------------------------+ From 6570ff566f0e929c9953dc5ad4881ed15b61e9c2 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Fri, 11 Nov 2016 03:56:15 -0500 Subject: [PATCH 102/292] updated all --- xCAT-test/autotest/testcase/xcatconfig/case0 | 59 +++++--- .../xcatconfig/change_site_table_values | 131 ++++++++++++++++++ .../verify_site_table_values_is_changed | 130 +++++++++++++++++ 3 files changed, 298 insertions(+), 22 deletions(-) create mode 100755 xCAT-test/autotest/testcase/xcatconfig/change_site_table_values create mode 100755 xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 1b86b2c05..59bfcf65f 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -1,3 +1,8 @@ +start:testtest +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcatconfig/change_site_table_values +check:rc==0 +end + start:xcatconfig_null description:xcatconfig with no argument os:Linux @@ -10,8 +15,10 @@ start:xcatconfig_h description:xcatconfig -h and --help os:Linux cmd:xcatconfig -h +check:rc==0 check:output=~Usage cmd:xcatconfig --help +check:rc==0 check:output=~Usage end @@ -19,8 +26,10 @@ start:xcatconfig_v description:xcatconfig -v and --version os:Linux cmd:xcatconfig -v +check:rc==0 check:output=~version|Version cmd:xcatconfig --version +check:rc==0 check:output=~version|Version end @@ -43,7 +52,9 @@ check:rc==0 #step4. restore test environment cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 -cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +cmd:mv -f /root/sshbak/* /root/.ssh +check:rc==0 +cmd:rm -rf /root/sshbak check:rc==0 end @@ -70,7 +81,9 @@ check:rc==0 #step4:restore test environment cmd:cp -rf /root/sshbak/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 -cmd:mv -f /root/sshbak/* /root/.ssh;rm -rf /root/sshbak +cmd:mv -f /root/sshbak/* /root/.ssh +check:rc==0 +cmd:rm -rf /root/sshbak check:rc==0 end @@ -96,9 +109,13 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +check:rc==0 +cmd:rm -rf /install/postscripts/hostkeysbak check:rc==0 end @@ -125,24 +142,16 @@ check:rc!=0 cmd:diff /install/postscripts/hostkeys/ssh_host_rsa_key.pub /install/postscripts/hostkeysbak/ssh_host_rsa_key.pub check:rc!=0 #step5:restore test environment -cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys;rm -rf /etc/xcat/hostkeysbak +cmd:mv -f /etc/xcat/hostkeysbak/* /etc/xcat/hostkeys check:rc==0 -cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys;rm -rf /install/postscripts/hostkeysbak +cmd:rm -rf /etc/xcat/hostkeysbak +check:rc==0 +cmd:mv -f /install/postscripts/hostkeysbak/* /install/postscripts/hostkeys +check:rc==0 +cmd:rm -rf /install/postscripts/hostkeysbak check:rc==0 end - -step1:dumpxCATdb -p /tmp/xcatconfigtest -step2:change existed site.maxssh value:chtab key=maxssh site.value=888 -step3:add a new key with value: chtab key=testxcatconfigoptiond site.value=test -step4:xcatconfig -d -V -check:rc==0 -check:output=~Updated cluster site definition -step5:check the existed key value is inited to be default value: lsdef -t site -i maxssh | grep "=8$" -step6:check the added key and value is still the same:lsdef -t site -i testxcatconfigoptiond | grep "=test$" -step7:restorexCATdb -p /tmp/xcatconfigtest -step8:rm -rf /tmp/xcatconfigtest - start:xcatconfig_d_V description:This -d option will reinitialize the basic xCAT database table setup os:Linux @@ -187,7 +196,8 @@ check:rc==0 cmd:cp -rf /root/.ssh /root/sshbak check:rc==0 #prepare data:change existed site.maxssh, and add new key with value -cmd:chtab key=maxssh site.value=888 +#cmd:chtab key=maxssh site.value=888 +cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values check:rc==0 cmd:chtab key=testxcatconfigoptiond site.value=test check:rc==0 @@ -210,14 +220,17 @@ check:rc==0 cmd:diff /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys check:rc==0 #keys in site table are not changed -cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +#cmd:lsdef -t site -i testxcatconfigoptiond | grep "=test$" +cmd:cmd:./install/xcat-core/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed check:rc==0 cmd:lsdef -t site -i maxssh | grep "=888$" check:rc==0 #step4.restore test environment cmd:rm -rf /etc/xcat/hostkeysbak check:rc==0 -cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest check:rc==0 end @@ -264,7 +277,9 @@ check:rc==0 cmd:lsdef -t site -i maxssh | grep "=888$" check:rc==0 #step4.restore test environment -cmd:restorexCATdb -p /tmp/xcatconfigtest;rm -rf /tmp/xcatconfigtest +cmd:restorexCATdb -p /tmp/xcatconfigtest +check:rc==0 +cmd:rm -rf /tmp/xcatconfigtest check:rc==0 end diff --git a/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values b/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values new file mode 100755 index 000000000..7f91cf8a8 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcatconfig/change_site_table_values @@ -0,0 +1,131 @@ +#!/usr/bin/env perl + +$ENV{TERM} = "xterm-256color"; + +my $os = $ARGV[0]; +my $arch = $ARGV[1]; +my $log = "/tmp/change_site_table_values.log"; + +sub runcmd { + my $cmd = shift; + `$cmd >> $log 2>&1`; + if ($?) { + + exit 1; + } +} + +my $blademaxp_value=6400; +my $domain_value="testdomain"; +my $fsptimeout_value=100; +my $installdir_value="installdirtest"; +my $ipmimaxp_value=6400; +my $ipmiretries_value=300; +my $ipmitimeout_value=200; +my $consoleondemand_value="notest"; +my $master_value="mastertest"; +my $forwarders_value="forwarderstest"; +my $nameservers_value="mastertest"; +my $maxssh_value=800; +my $ppcmaxp_value=6400; +my $ppcretry_value=300; +my $ppctimeout_value=100; +my $powerinterval_value=100; +my $syspowerinterval_value=100; +my $sharedtftp_value=100; +my $SNsyncfiledir_value="syncdirtest"; +my $nodesyncfiledir_value="nodesyncdirtest"; +my $tftpdir_value="tftpdirtest"; +my $xcatdport_value="xcatporttest"; +my $xcatiport_value="xcatiporttest"; +my $xcatconfdir_value="confdirtest"; +my $timezone_value="test"; +my $useNmapfromMN_value="notest"; +my $enableASMI_value="notest"; +my $db2installloc_value="\/mntdb2test"; +my $databaseloc_value="\/var\/libtest"; +my $sshbetweennodes_value="ALLGROUPStest"; +my $dnshandler_value="ddnstest"; +my $vsftp_value="ntest"; +my $cleanupxcatpost_value="notest"; +my $dhcplease_value=43200; +my $auditnosyslog_value=100; +my $xcatsslversion_value="tLSv1test"; +my $auditskipcmds_value="ALLtest"; + + +$cmd = "chtab key=domain site.value=$domain_value"; +runcmd("$cmd"); +$cmd = "chtab key=fsptimeout site.value=$fsptimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=installdir site.value=$installdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmimaxp site.value=$ipmimaxp_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmiretries site.value=$ipmiretries_value"; +runcmd("$cmd"); +$cmd = "chtab key=ipmitimeout site.value=$ipmitimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=consoleondemand site.value=$consoleondemand_value"; +runcmd("$cmd"); +$cmd = "chtab key=master site.value=$master_value"; +runcmd("$cmd"); +$cmd = "chtab key=forwarders site.value=$forwarders_value"; +runcmd("$cmd"); +$cmd = "chtab key=nameservers site.value=$nameservers_value"; +runcmd("$cmd"); +$cmd = "chtab key=maxssh site.value=$maxssh_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppcmaxp site.value=$ppcmaxp_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppcretry site.value=$ppcretry_value"; +runcmd("$cmd"); +$cmd = "chtab key=ppctimeout site.value=$ppctimeout_value"; +runcmd("$cmd"); +$cmd = "chtab key=powerinterval site.value=$powerinterval_value"; +runcmd("$cmd"); +$cmd = "chtab key=syspowerinterval site.value=$syspowerinterval_value"; +runcmd("$cmd"); +$cmd = "chtab key=sharedtftp site.value=$sharedtftp_value"; +runcmd("$cmd"); +$cmd = "chtab key=SNsyncfiledir site.value=$SNsyncfiledir_value"; +runcmd("$cmd"); +$cmd = "chtab key=nodesyncfiledir site.value=$nodesyncfiledir_value"; +runcmd("$cmd"); +$cmd = "chtab key=tftpdir site.value=$tftpdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatdport site.value=$xcatdport_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatiport site.value=$xcatiport_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatconfdir site.value=$xcatconfdir_value"; +runcmd("$cmd"); +$cmd = "chtab key=timezone site.value=$timezone_value"; +runcmd("$cmd"); +$cmd = "chtab key=useNmapfromMN site.value=$useNmapfromMN_value"; +runcmd("$cmd"); +$cmd = "chtab key=enableASMI site.value=$enableASMI_value"; +runcmd("$cmd"); +$cmd = "chtab key=db2installloc site.value=$db2installloc_value"; +runcmd("$cmd"); +$cmd = "chtab key=databaseloc site.value=$databaseloc_value"; +runcmd("$cmd"); +$cmd = "chtab key=sshbetweennodes site.value=$sshbetweennodes_value"; +runcmd("$cmd"); +$cmd = "chtab key=dnshandler site.value=$dnshandler_value"; +runcmd("$cmd"); +$cmd = "chtab key=vsftp site.value=$vsftp_value"; +runcmd("$cmd"); +$cmd = "chtab key=cleanupxcatpost site.value=$cleanupxcatpost_value"; +runcmd("$cmd"); +$cmd = "chtab key=dhcplease site.value=$dhcplease_value"; +runcmd("$cmd"); +$cmd = "chtab key=auditnosyslog site.value=$auditnosyslog_value"; +runcmd("$cmd"); +$cmd = "chtab key=xcatsslversion site.value=$xcatsslversion_value"; +runcmd("$cmd"); +$cmd = "chtab key=auditskipcmds site.value=$auditskipcmds_value"; +runcmd("$cmd"); + +exit 0; + diff --git a/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed b/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed new file mode 100755 index 000000000..bc8ff0810 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcatconfig/verify_site_table_values_is_changed @@ -0,0 +1,130 @@ +#!/usr/bin/env perl + +$ENV{TERM} = "xterm-256color"; + +my $os = $ARGV[0]; +my $arch = $ARGV[1]; +my $log = "/tmp/verify_site_table_values_is_changed"; + +sub runcmd { + my $cmd = shift; + `$cmd >> $log 2>&1`; + if ($?) { + print "run $cmd ....[error]\n"; + exit 1; + } +} + +my $blademaxp_value=6400; +my $domain_value="testdomain"; +my $fsptimeout_value=100; +my $installdir_value="installdirtest"; +my $ipmimaxp_value=6400; +my $ipmiretries_value=300; +my $ipmitimeout_value=200; +my $consoleondemand_value="notest"; +my $master_value="mastertest"; +my $forwarders_value="forwarderstest"; +my $nameservers_value="mastertest"; +my $maxssh_value=800; +my $ppcmaxp_value=6400; +my $ppcretry_value=300; +my $ppctimeout_value=100; +my $powerinterval_value=100; +my $syspowerinterval_value=100; +my $sharedtftp_value=100; +my $SNsyncfiledir_value="syncdirtest"; +my $nodesyncfiledir_value="nodesyncdirtest"; +my $tftpdir_value="tftpdirtest"; +my $xcatdport_value="xcatporttest"; +my $xcatiport_value="xcatiporttest"; +my $xcatconfdir_value="confdirtest"; +my $timezone_value="test"; +my $useNmapfromMN_value="notest"; +my $enableASMI_value="notest"; +my $db2installloc_value="\/mntdb2test"; +my $databaseloc_value="\/var\/libtest"; +my $sshbetweennodes_value="ALLGROUPStest"; +my $dnshandler_value="ddnstest"; +my $vsftp_value="ntest"; +my $cleanupxcatpost_value="notest"; +my $dhcplease_value=43200; +my $auditnosyslog_value=100; +my $xcatsslversion_value="tLSv1test"; +my $auditskipcmds_value="ALLtest"; + +$cmd = "lsdef -t site -i blademaxp | grep \"\=$blademaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i domain | grep \"\=$domain_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i fsptimeout | grep \"\=$fsptimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i installdir | grep \"\=$installdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmimaxp | grep \"\=$ipmimaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmiretries | grep \"\=$ipmiretries_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ipmitimeout | grep \"\=$ipmitimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i consoleondemand | grep \"\=$consoleondemand_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i master | grep \"\=$master_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i forwarders | grep \"\=$forwarders_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i nameservers | grep \"\=$nameservers_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i maxssh | grep \"\=$maxssh_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppcmaxp | grep \"\=$ppcmaxp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppcretry | grep \"\=$ppcretry_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i ppctimeout | grep \"\=$ppctimeout_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i powerinterval | grep \"\=$powerinterval_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i syspowerinterval | grep \"\=$syspowerinterval_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i sharedtftp | grep \"\=$sharedtftp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i SNsyncfiledir | grep \"\=$SNsyncfiledir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i nodesyncfiledir | grep \"\=$nodesyncfiledir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i tftpdir | grep \"\=$tftpdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatdport | grep \"\=$xcatdport_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatiport | grep \"\=$xcatiport_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i xcatconfdir | grep \"\=$xcatconfdir_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i timezone | grep \"\=$timezone_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i useNmapfromMN | grep \"\=$useNmapfromMN_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i enableASMI | grep \"\=$enableASMI_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i db2installloc | grep \"\=$db2installloc_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i databaseloc | grep \"\=$databaseloc_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i sshbetweennodes | grep \"\=$sshbetweennodes_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i dnshandler | grep \"\=$dnshandler_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i vsftp | grep \"\=$vsftp_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i cleanupxcatpost | grep \"\=$cleanupxcatpost_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i dhcplease | grep \"\=$dhcplease_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i auditnosyslog | grep \"\=$auditnosyslog_value\$\""; +runcmd("$cmd"); +$cmd = "lsdef -t site -i auditskipcmds | grep \"\=$auditskipcmds_value\$\""; +runcmd("$cmd"); + + +exit 0; From 23ebada756599ca93688bebaf4e0f1025501b5b1 Mon Sep 17 00:00:00 2001 From: zet809 Date: Fri, 11 Nov 2016 17:26:15 +0800 Subject: [PATCH 103/292] Add document for 2.12.4 release --- README.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 797f7ba55..15abed55c 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2123| |docs_2122| |docs_212| |docs_211| +|docs_latest| |docs_2124| |docs_2123| |docs_2122| |docs_212| |docs_211| Open Source License ------------------- @@ -22,6 +22,11 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. +.. |docs_2124| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.4 + :alt: 2.12.4 documentation status + :scale: 100% + :target: http://xcat-docs.readthedocs.io/en/2.12.4/ + .. |docs_2123| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.3 :alt: 2.12.3 documentation status :scale: 100% From 9cb1f653ec47e5b6d536f5343104cfb7b3ddfc8c Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 13 Nov 2016 21:51:52 -0500 Subject: [PATCH 104/292] fix probe discovery usage bug --- xCAT-probe/subcmds/discovery | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 363a608fa..560705c29 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -32,6 +32,9 @@ my $monitor = 1; #used by developer, to debug the detail information about function running my $debug = 0; +my @valid_discovery_type = ("mtms", "switch"); +my $valid_discovery_type_str = join(",", @valid_discovery_type); + #--------------------------------------------- # Command Usage #--------------------------------------------- @@ -72,8 +75,6 @@ my $maxwaittime = 60; #unit is minute, the max wait time of monitor my $rollforward_time_of_replay; #used by feature replay discovery log my $noderange; my $discovery_type; -my @valid_discovery_type = ("mtms", "switch"); -my $valid_discovery_type_str = join(",", @valid_discovery_type); my $no_pre_check = 0; my $nics; if ( From 276fb1862422c5ac5bdaf3ea204b18b041c75cb5 Mon Sep 17 00:00:00 2001 From: XuWei Date: Sun, 13 Nov 2016 22:19:23 -0500 Subject: [PATCH 105/292] modified probe discovery usage --- xCAT-probe/subcmds/discovery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 560705c29..71a853227 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -46,7 +46,7 @@ $::USAGE = "Usage: Description: Probe the discovery process, including pre-check for required configuration, 'Realtime monitor' and 'Replay history' of discovery process. - If all pre-check items failed, $program_name will exit. + If any pre-check item fails, $program_name will exit. Realtime monitor: This is a default. This tool with monitor discovery state of the node. Trigger 'Realtime monitor' before rebooting target node to do discovery. Replay history: Used after discovery is finished to probe the previously completed discovery. From 907f384f6511a64ec0e6c8bdd3d9578c529f6290 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 8 Nov 2016 15:12:14 +0800 Subject: [PATCH 106/292] [go-xcat] More error messages when yum failed --- xCAT-server/share/xcat/tools/go-xcat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index fc2449872..6b34f2ee8 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.10 +# Version 1.0.11 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -923,8 +923,8 @@ function remove_repo_yum() # This deleting method is not good enough. Since there could be more # than one repostory definitions in a single repo file. # This is a quick and dirty method. - rm -f $(grep -l "^\[${repo_id}\]$" "/etc/yum.repos.d/"*".repo") - yum clean metadata >/dev/null 2>&1 + rm -f $(grep -l "^\[${repo_id}\]$" "/etc/yum.repos.d/"*".repo" 2>/dev/null) + yum clean metadata } # $1 repo id From b8e85b5179ecea6a4c4bf3a6fc5ebef150bb2896 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 14 Nov 2016 13:20:54 -0500 Subject: [PATCH 107/292] Update Version Update version for development branch to 2.13 --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 56beced9a..ae656d473 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.12.4 +2.13 From 2ca61ad9e8028a3c5e5393fdafa11b563efcc9d5 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 14 Nov 2016 13:27:27 -0500 Subject: [PATCH 108/292] Support noboot on interfaces that are tagged vlan on the mangement node --- xCAT-server/lib/xcat/plugins/mknb.pm | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 9e68b6887..16721de47 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -74,8 +74,27 @@ sub process_request { } my $nicips = xCAT::NetworkUtils->get_nic_ip(); foreach (keys %nobootnics) { - if (defined($nicips->{$_})) { - $nobootnicips{$nicips->{$_}} = 1; + # looping on each nics that has 'noboot' configured + print "DEBUG ==> Interface $_ is set to 'noboot'\n"; + if (defined($nicips)) { + foreach my $nicipkey (keys $nicips) { + if ( $nicipkey =~ "@" ) { + # If VLAN tagging is in use on this management node, the interface name is taken + # from 'ip addr show' command and will contain the physical interface: + # enP1p12s0f0.2@enP1p12s0f0 + if ($nicipkey =~ m/$_\@/i ) { + print "DEBUG ---- FOUND ---- Interface name $_ is part of $nicipkey, IP=$nicips->{$nicipkey}!\n"; + if (defined($nicips->{$nicipkey})) { + $nobootnicips{$nicips->{$nicipkey}} = 1; + } + } + } else { + # Non VLAN case + if (defined($nicips->{$_})) { + $nobootnicips{$nicips->{$_}} = 1; + } + } + } } } } From 4a2616fbaa5665b67ef446fb08f1d870ba7c1b75 Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 15 Nov 2016 00:27:57 -0500 Subject: [PATCH 109/292] modified depending on comments --- xCAT-probe/subcmds/discovery | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 71a853227..080d10ce0 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -45,23 +45,21 @@ $::USAGE = "Usage: $program_name -n -m -r [-V] [--noprecheck] Description: - Probe the discovery process, including pre-check for required configuration, 'Realtime monitor' and 'Replay history' of discovery process. - If any pre-check item fails, $program_name will exit. - Realtime monitor: This is a default. This tool with monitor discovery state of the node. Trigger 'Realtime monitor' before rebooting target node to do discovery. - Replay history: Used after discovery is finished to probe the previously completed discovery. + Probe the discovery process, including pre-check for required configuration. If any pre-checks fail, '$program_name' will exit. + The default behavior of xcatprobe discovery is to monitor the discovery process in real time. Use the -r option for 'replay' mode which probes the discovery based on information stored in various log files. [NOTE] Currently, hierarchial structure is not supported. Options: - -h : Get usage information of $program_name. - -V : Output more information for debug. - -m : The method of discovery, the valid values are $valid_discovery_type_str. - -n : The range of predefined nodes, must be used with option -m. - --noprecheck : skip pre-checking discovery to validate correct configuration. - -t : The maximum time to wait when doing monitor, unit is minutes. default is 60. - -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) - Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). - If unit is not specified, hour will be used by default. + -h : Get usage information of $program_name. + -V : Output more information for debug. + -m : The method of discovery, the valid values are $valid_discovery_type_str. + -n : The range of predefined nodes, must be used with option -m. + -t : The maximum time to wait when doing monitor, unit is minutes. default is 60. + -r : Trigger 'Replay history' mode. Follow the duration of rolling back. Units are 'h' (hour) or 'm' (minute) + Supported format examples: 3h30m (3 hours and 30 minutes ago), 2h (2 hours ago), 40m (40 minutes ago) and 3 (3 hours ago). + If unit is not specified, hour will be used by default. + --noprecheck : skip pre-checking discovery to validate correct configuration. "; #---------------------------------------------- From fb49715667bc80dbbd98abce372989013e35665b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 15 Nov 2016 13:19:53 -0500 Subject: [PATCH 110/292] postinstall script description, formatting and spelling --- .../prepostscripts/postinstall_script.rst | 7 +++++ .../customize_image/pre_post_script.rst | 12 ++++++- .../references/man5/linuximage.5.rst | 31 +++++++++++-------- .../references/man5/litefile.5.rst | 2 +- .../admin-guides/references/man5/site.5.rst | 2 +- .../admin-guides/references/man5/vm.5.rst | 2 +- .../admin-guides/references/man7/group.7.rst | 2 +- .../admin-guides/references/man7/node.7.rst | 2 +- .../references/man7/osimage.7.rst | 31 +++++++++++-------- .../references/man8/copycds.8.rst | 4 +-- perl-xCAT/xCAT/Schema.pm | 15 ++++----- 11 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst mode change 120000 => 100644 docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst new file mode 100644 index 000000000..e3d22884e --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst @@ -0,0 +1,7 @@ +.. _Using-Postinstallscript-label: + +Using Postinstall Script +------------------------ + +xCAT will run scripts specified by postinstall attribute when executing **genimage** command. The scripts will be exectuted after the package installation but before initrd generation. One of the uses of postinstall script is to install drivers into the rootimage during the **genimage** run. + diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst deleted file mode 120000 index 6fba27bf9..000000000 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst +++ /dev/null @@ -1 +0,0 @@ -../../diskful/customize_image/pre_post_script.rst \ No newline at end of file diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst new file mode 100644 index 000000000..f186b874c --- /dev/null +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script.rst @@ -0,0 +1,11 @@ +Prescripts and Postscripts +========================== + +.. toctree:: + :maxdepth: 2 + + ../../../common/deployment/prepostscripts/pre_script.rst + ../../../common/deployment/prepostscripts/post_script.rst + ../../../common/deployment/prepostscripts/postinstall_script.rst + ../../../common/deployment/prepostscripts/suggestions.rst + diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index e49d27e55..2e972ee76 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -92,17 +92,22 @@ linuximage Attributes: \ **postinstall**\ - Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: - IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), - IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), - IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), - IMG_KERNELVERSION(the "kernelver" attribute of the osimage), - IMG_PROFILE(the profile of the osimage, such as "service","compute"), - IMG_PKGLIST(the "pkglist" attribute of the osimage), - IMG_PKGDIR(the "pkgdir" attribute of the osimage), - IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), - IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), - IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) + Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + + + .. code-block:: perl + + IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), + IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), + IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), + IMG_PROFILE(the profile of the osimage, such as "service","compute"), + IMG_PKGLIST(the "pkglist" attribute of the osimage), + IMG_PKGDIR(the "pkgdir" attribute of the osimage), + IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), + IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), + IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) + @@ -168,13 +173,13 @@ linuximage Attributes: \ **partitionfile**\ - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," \ **driverupdatesrc**\ - The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm + The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_source_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm diff --git a/docs/source/guides/admin-guides/references/man5/litefile.5.rst b/docs/source/guides/admin-guides/references/man5/litefile.5.rst index 3691949ad..220627f91 100644 --- a/docs/source/guides/admin-guides/references/man5/litefile.5.rst +++ b/docs/source/guides/admin-guides/references/man5/litefile.5.rst @@ -57,7 +57,7 @@ litefile Attributes: tmpfs - It is the default option if you leave the options column blank. It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories.. - rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. + rw - Same as above. Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index bfdd13269..9e48d38c2 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -130,7 +130,7 @@ site Attributes: domain: The DNS domain name used for the cluster. forwarders: The DNS servers at your site that can provide names outside of the cluster. - The makedns command will configure the DNS on the management node to foward + The makedns command will configure the DNS on the management node to forward requests it does not know to these servers. Note that the DNS servers on the service nodes will ignore this value and always be configured to forward to the management node. diff --git a/docs/source/guides/admin-guides/references/man5/vm.5.rst b/docs/source/guides/admin-guides/references/man5/vm.5.rst index 604429dad..5809dbfd8 100644 --- a/docs/source/guides/admin-guides/references/man5/vm.5.rst +++ b/docs/source/guides/admin-guides/references/man5/vm.5.rst @@ -86,7 +86,7 @@ vm Attributes: \ **cfgstore**\ - Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistant store to place configuration data + Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistent store to place configuration data diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 9515ac052..dac4ee89e 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -1166,7 +1166,7 @@ group Attributes: \ **vmcfgstore**\ (vm.cfgstore) - Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistant store to place configuration data + Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistent store to place configuration data diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index 1ff923cbb..36599fc38 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -1202,7 +1202,7 @@ node Attributes: \ **vmcfgstore**\ (vm.cfgstore) - Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistant store to place configuration data + Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistent store to place configuration data diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index 287d406b6..03f66618e 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -83,7 +83,7 @@ osimage Attributes: \ **driverupdatesrc**\ (linuximage.driverupdatesrc) - The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm + The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_source_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm @@ -279,7 +279,7 @@ osimage Attributes: \ **partitionfile**\ (linuximage.partitionfile, winimage.partitionfile) - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," or @@ -313,17 +313,22 @@ osimage Attributes: \ **postinstall**\ (linuximage.postinstall) - Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: - IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), - IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), - IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), - IMG_KERNELVERSION(the "kernelver" attribute of the osimage), - IMG_PROFILE(the profile of the osimage, such as "service","compute"), - IMG_PKGLIST(the "pkglist" attribute of the osimage), - IMG_PKGDIR(the "pkgdir" attribute of the osimage), - IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), - IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), - IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) + Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + + + .. code-block:: perl + + IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), + IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), + IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), + IMG_PROFILE(the profile of the osimage, such as "service","compute"), + IMG_PKGLIST(the "pkglist" attribute of the osimage), + IMG_PKGDIR(the "pkgdir" attribute of the osimage), + IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), + IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), + IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) + diff --git a/docs/source/guides/admin-guides/references/man8/copycds.8.rst b/docs/source/guides/admin-guides/references/man8/copycds.8.rst index 5579dcac6..a5ba210ec 100644 --- a/docs/source/guides/admin-guides/references/man8/copycds.8.rst +++ b/docs/source/guides/admin-guides/references/man8/copycds.8.rst @@ -31,7 +31,7 @@ DESCRIPTION *********** -The \ **copycds**\ command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the \ **-p**\ option. If no path is specified, the default destination directory will be formed from the \ **installdir**\ site table attribute and the distro name and architecture, for example: /install/rhels6.3/x86_64. The \ **copycds**\ command can copy from one or more ISO files, or the CD/DVD device path. +The \ **copycds**\ command copies all contents of Distribution DVDs/ISOs or Service Pack DVDs/ISOs to a destination directory. The destination directory can be specified by the \ **-p**\ option. If no path is specified, the default destination directory will be formed from the \ **installdir**\ site table attribute, distro name and architecture, for example: /install/rhels6.3/x86_64. The \ **copycds**\ command can copy from one or more ISO files, or the CD/DVD device path. You can specify \ **-i**\ or \ **-**\ **-inspection**\ option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the \ **-n**\ and \ **-a**\ options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. @@ -52,7 +52,7 @@ OPTIONS \ **-a|-**\ **-arch**\ =\ *architecture*\ - The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x. + The architecture of the linux distro on the ISO/DVD. Examples: x86, x86_64, ppc64, s390x. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 296ee634a..a7045956d 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -154,7 +154,7 @@ use xCAT::ExtTab; file => "The full pathname of the file. e.g: /etc/hosts. If the path is a directory, then it should be terminated with a '/'. ", options => "Options for the file:\n\n" . qq{ tmpfs - It is the default option if you leave the options column blank. It provides a file or directory for the node to use when booting, its permission will be the same as the original version on the server. In most cases, it is read-write; however, on the next statelite boot, the original version of the file or directory on the server will be used, it means it is non-persistent. This option can be performed on files and directories..\n\n} . -qq{ rw - Same as Above.Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. \n\n} . +qq{ rw - Same as above. Its name "rw" does NOT mean it always be read-write, even in most cases it is read-write. Do not confuse it with the "rw" permission in the file system. \n\n} . qq{ persistent - It provides a mounted file or directory that is copied to the xCAT persistent location and then over-mounted on the local file or directory. Anything written to that file or directory is preserved. It means, if the file/directory does not exist at first, it will be copied to the persistent location. Next time the file/directory in the persistent location will be used. The file/directory will be persistent across reboots. Its permission will be the same as the original one in the statelite location. It requires the statelite table to be filled out with a spot for persistent statelite. This option can be performed on files and directories. \n\n} . qq{ con - The contents of the pathname are concatenated to the contents of the existing file. For this directive the searching in the litetree hierarchy does not stop when the first match is found. All files found in the hierarchy will be concatenated to the file when found. The permission of the file will be "-rw-r--r--", which means it is read-write for the root user, but readonly for the others. It is non-persistent, when the node reboots, all changes to the file will be lost. It can only be performed on files. Do not use it for one directory.\n\n} . qq{ ro - The file/directory will be overmounted read-only on the local file/directory. It will be located in the directory hierarchy specified in the litetree table. Changes made to this file or directory on the server will be immediately seen in this file/directory on the node. This option requires that the file/directory to be mounted must be available in one of the entries in the litetree table. This option can be performed on files and directories.\n\n} . @@ -169,7 +169,7 @@ qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted no vmmaster => { - #will add columns as approriate, for now: + #will add columns as appropriate, for now: #os arch profile to populate the corresponding nodetype fields of a cloned vm #storage to indicate where the master data is actually stored (i.e. virtual disk images) #storagemodel to allow chvm on a clone to be consistent with the master by default @@ -205,7 +205,7 @@ qq{ link,ro - The file is readonly, and will be placed in tmpfs on the booted no 'migrationdest' => 'A noderange representing candidate destinations for migration (i.e. similar systems, same SAN, or other criteria that xCAT can use', 'storage' => 'A list of storage files or devices to be used. i.e. dir:///cluster/vm/ or nfs:///path/to/folder/', 'storagemodel' => 'Model of storage devices to provide to guest', -'cfgstore' => 'Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistant store to place configuration data', +'cfgstore' => 'Optional location for persistent storage separate of emulated hard drives for virtualization solutions that require persistent store to place configuration data', 'memory' => 'Megabytes of memory the VM currently should be set to.', 'master' => 'The name of a master image, if any, this virtual machine is linked to. This is generally set by clonevm and indicates the deletion of a master that would invalidate the storage of this virtual machine', 'cpus' => 'Number of CPUs the node should see.', @@ -774,7 +774,8 @@ passed as argument rather than by table value', otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set to multiple paths. The multiple paths must be separated by ",".', otherpkgdir => 'The base directory where the non-distro packages are stored. Only 1 local directory supported at present.', exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.', - postinstall => 'Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + postinstall => 'Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), @@ -795,8 +796,8 @@ passed as argument rather than by table value', permission => 'The mount permission of /.statelite directory is used, its default value is 755', dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs:///". If you want to use the node's "xcatmaster" (its SN or MN), can be left blank. For example, "nfs:///" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.}, crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.', - partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file.For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', - driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_srouce_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm', + partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', + driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_source_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, @@ -1005,7 +1006,7 @@ passed as argument rather than by table value', " dnshandler: Name of plugin that handles DNS setup for makedns.\n\n" . " domain: The DNS domain name used for the cluster.\n\n" . " forwarders: The DNS servers at your site that can provide names outside of the cluster.\n" . -" The makedns command will configure the DNS on the management node to foward\n" . +" The makedns command will configure the DNS on the management node to forward\n" . " requests it does not know to these servers. Note that the DNS servers on the\n" . " service nodes will ignore this value and always be configured to forward \n" . " to the management node.\n\n" . From 263acbf5ce728b6b6bd738225843b65e72edb225 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 15 Nov 2016 16:43:09 -0500 Subject: [PATCH 111/292] Based on Er Tao's comments, before going into the code for determining the noboot nic names, parse out the interface names for the tagged vlans without the physical name in the string --- xCAT-server/lib/xcat/plugins/mknb.pm | 34 +++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 16721de47..8508a598a 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -73,28 +73,20 @@ sub process_request { } } my $nicips = xCAT::NetworkUtils->get_nic_ip(); + foreach (keys $nicips) { + # To support tagged vlan, create entries in the hash for the + # interface name removing the physical interface ending: + # 'enP1p12s0f0.2@enP1p12s0f0' => 'enP1p12s0f0.2' + if ($_ =~ "@") { + my $newkey = $_; + $newkey =~ s/\@.*//g; + $$nicips{$newkey} = ${nicips}->{$_}; + } + } + foreach (keys %nobootnics) { - # looping on each nics that has 'noboot' configured - print "DEBUG ==> Interface $_ is set to 'noboot'\n"; - if (defined($nicips)) { - foreach my $nicipkey (keys $nicips) { - if ( $nicipkey =~ "@" ) { - # If VLAN tagging is in use on this management node, the interface name is taken - # from 'ip addr show' command and will contain the physical interface: - # enP1p12s0f0.2@enP1p12s0f0 - if ($nicipkey =~ m/$_\@/i ) { - print "DEBUG ---- FOUND ---- Interface name $_ is part of $nicipkey, IP=$nicips->{$nicipkey}!\n"; - if (defined($nicips->{$nicipkey})) { - $nobootnicips{$nicips->{$nicipkey}} = 1; - } - } - } else { - # Non VLAN case - if (defined($nicips->{$_})) { - $nobootnicips{$nicips->{$_}} = 1; - } - } - } + if (defined($nicips->{$_})) { + $nobootnicips{$nicips->{$_}} = 1; } } } From ef6eeb5ff8b16063d8a8d64234e00292541bd367 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 16 Nov 2016 14:46:17 +0800 Subject: [PATCH 112/292] [go-xcat] Ask the end user to use at least yum version 3.2.29-17 --- xCAT-server/share/xcat/tools/go-xcat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 6b34f2ee8..30a57c24c 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -2,7 +2,7 @@ # # go-xcat - Install xCAT automatically. # -# Version 1.0.11 +# Version 1.0.12 # # Copyright (C) 2016 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -1106,7 +1106,8 @@ function update_repo_yum() # Check if `yum' support `updateinfo' command. yum --help 2>/dev/null | grep -q "^updateinfo" >/dev/null 2>&1 warn_if_bad "$?" "Lacking support of \`updateinfo' command for \`yum'." - exit_if_bad "$?" "Install the \`yum-plugin-security' package and rerun." + warn_if_bad "$?" "Please rerun after install package \`yum-plugin-security'." + exit_if_bad "$?" "And please update package \`yum' to at least version 3.2.29-17." yum --nogpgcheck updateinfo } From b0791921bb0b07cef558a55fe10618cca5d9cb15 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 16 Nov 2016 03:22:48 -0500 Subject: [PATCH 113/292] fix issue "xCAT Object Name Format" error when trying to name osimages starting with "rhels7.3" #2157 --- xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm index dee9b82b1..90ddb541f 100755 --- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm +++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm @@ -1546,7 +1546,12 @@ sub defmk my $invalidobjname = (); my $invalidnodename = (); foreach my $node (@::allobjnames) { - unless(isobjnamevalid($node,$::opt_t)){ + my $myobjtype=$::opt_t; + if(!$myobjtype and $::FILEATTRS{$node}{'objtype'}){ + $myobjtype=$::FILEATTRS{$node}{'objtype'}; + } + + unless(isobjnamevalid($node,$myobjtype)){ $invalidobjname .= ",$node"; } if (($node =~ /[A-Z]/) && (((!$::opt_t) && (!$::FILEATTRS{$node}{'objtype'})) || ($::FILEATTRS{$node}{'objtype'} eq "node") || ($::opt_t eq "node"))) { From 429dc7867b9d65ccf0cf38893feb1168e15bf16a Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 16 Nov 2016 15:37:38 +0800 Subject: [PATCH 114/292] [go-xcat] Run zypper in non-interactive mode when run `zypper refresh' --- xCAT-server/share/xcat/tools/go-xcat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 30a57c24c..efa921180 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1114,7 +1114,7 @@ function update_repo_yum() function update_repo_zypper() { type zypper >/dev/null 2>&1 || return 255 - zypper --gpg-auto-import-keys refresh + zypper --gpg-auto-import-keys -n refresh } function update_repo_apt() From f231fd24f13f89537d9a409e93cdbe84602442ee Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 16 Nov 2016 15:11:40 -0500 Subject: [PATCH 115/292] support different minor version for kits --- .../advanced/kit/custom/build/createkit.rst | 10 ++- xCAT-buildkit/bin/buildkit | 18 ++++-- xCAT-server/lib/xcat/plugins/kit.pm | 64 +++++++++++++------ 3 files changed, 67 insertions(+), 25 deletions(-) diff --git a/docs/source/advanced/kit/custom/build/createkit.rst b/docs/source/advanced/kit/custom/build/createkit.rst index 6543a1779..4061fbef4 100644 --- a/docs/source/advanced/kit/custom/build/createkit.rst +++ b/docs/source/advanced/kit/custom/build/createkit.rst @@ -56,7 +56,7 @@ The ``buildkit.conf`` file is a sample file that contains a description of all t kitlicense=ILAN <== the default kit license string is "EPL" kitdeployparams=pe.env <== pe.env has to define in the other_files dir. -**kitrepo** --- This stanza defines a Kit Package Repository. There must be at least one kitrepo stanza in a kit build file. If this kit need to support multiple OSes, user should create a separate repository for each OS. Also, no two repositories can be defined with the same OS name, major/minor version, and arch. :: +**kitrepo** --- This stanza defines a Kit Package Repository. There must be at least one kitrepo stanza in a kit build file. If this kit need to support multiple OSes, user should create a separate repository for each OS. Also, no two repositories can be defined with the same OS name, major version, and arch. :: kitrepo: kitrepoid=rhels6_x86_64 @@ -70,6 +70,14 @@ The ``buildkit.conf`` file is a sample file that contains a description of all t osmajorversion=11 osarch=x86_64 +minor version can be support following format: :: + + osminorversion=2 <<-- minor version has to be exactly matched to 2 + osminorversion=>=2 <<-- minor version can be 2 or greater than 2 + osminorversion=<=2 <<-- minor version can be 2 or less than 2 + osminorversion=>2 <<-- minor version has to be greater than 2 + osminorversion=<2 <<-- minor version has to be less than 2 + **kitcomponent** --- This stanza defines one Kit Component. A kitcomponent definition is a way of specifying a subset of the product Kit that may be installed into an xCAT osimage. A kitcomponent may or may not be dependent on other kitcomponents.If user want to build a component which supports multiple OSes, need to create one kitcomponent stanza for each OS. :: kitcomponent: diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 34521cfaf..3d705c54f 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1390,12 +1390,13 @@ sub validate_bldkitconf $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osmajorversion}; } if (defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) { + my $kitminor = split /<=|>=|==|<|>/, $::bldkit_config->{kit}{entries}[0]->{osminorversion}; if ((!defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) || (!defined($::bldkit_config->{kit}{entries}[0]->{osmajorversion}))) { print "Error: Kit osminorversion attribute was specified but either Kit osbasename or Kit osmajorversion were not set. \n"; return 1; } - $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + $full_kitname .= '-' . $kitminor; } if (defined($::bldkit_config->{kit}{entries}[0]->{osarch})) { $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osarch}; @@ -1500,12 +1501,14 @@ sub validate_bldkitconf } $reponame .= '-' . $kr->{osmajorversion}; if (defined($kr->{osminorversion})) { + my $krminor = split /<=|>=|==|<|>/, $kr->{osminorversion}; if ((defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) && ($::bldkit_config->{kit}{entries}[0]->{osminorversion} ne $kr->{osminorversion})) { print "Warning: Kit osminorversion is set to \"$::bldkit_config->{kit}{entries}[0]->{osminorversion}\", but this does not match kitrepo $kr->{kitrepoid} osminorversion \"$kr->{osminorversion}\". Processing will continue, but verify that you do not have an error in your buildkit configuration file. \n"; } - $reponame .= '.' . $kr->{osminorversion}; + $reponame .= '.' . $krminor; + $::bldkit_config->{kit}{entries}[0]->{osminorversion} = $krminor; } if ((defined($::bldkit_config->{kit}{entries}[0]->{osarch})) && ($::bldkit_config->{kit}{entries}[0]->{osarch} ne @@ -1549,7 +1552,8 @@ sub validate_bldkitconf $compname .= '-' . $repo{osbasename}; $compname .= '-' . $repo{osmajorversion}; if (defined($repo{osminorversion})) { - $compname .= '.' . $repo{osminorversion}; + my $minorversion = split /<=|>=|==|<|>/, $repo{osminorversion}; + $compname .= '.' . $minorversion; } $compname .= '-' . $repo{osarch}; $kc->{kitcompname} = $compname; @@ -1931,8 +1935,10 @@ sub validate_os } $osinfo =~ s/\,//; my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; + my $minorversion; if (defined($repo->{osminorversion})) { - $repo_osinfo .= ".$repo->{osminorversion}"; + $minorversion = split /<=|>=|==|<|>/, $repo->{osminorversion}; + $repo_osinfo .= ".$minorversion"; } $repo_osinfo .= "-$repo->{osarch} "; my $mismatch_msg = "The local host is running $osinfo-$osarch. This does not match the Kit Repository \"$repo->{kitrepoid}\" data: $repo_osinfo"; @@ -1968,7 +1974,7 @@ sub validate_os return 1; } if (defined($repo->{osminorversion})) { - if (($repo->{osminorversion} ne $osminorversion) && + if (($minorversion ne $osminorversion) && (!$compat_match)) { print "$mismatch_msg \n"; if ($::VERBOSE) { @@ -3411,6 +3417,7 @@ sub kit_addpkgs # - could be list of pkgdir s my @pkgdirlist = split(",", $::PKGDIR); + print "$tmpdir_base\n"; # Cleanup - should have been removed when last command ran # - but just in case system("rm -Rf $tmpdir_base"); @@ -3425,6 +3432,7 @@ sub kit_addpkgs $kittarfile = abs_path($kittarfile); foreach my $rpmdir (@pkgdirlist) { + print "rpmdir = $rmpdir\n"; if (!(-d $rpmdir)) { print "The package directory $rpmdir could not be read. \n"; return 1; diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index ba1db981f..649d67d81 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -1108,7 +1108,7 @@ sub read_kit_config $key =~ s/\s+//g; $value =~ s/\s+//g; } else { - ($key, $value) = split /=/, $line; + ($key, $value) = split(/=/, $line,2); } } @@ -1803,6 +1803,24 @@ sub rmkit } +sub check_minorversion +{ + my $kitminor = shift; + my $osminor = shift; + + if ($kitminor eq $osminor) { + return 0; + } + + if (($kitminor =~ />/) || ($kitminor =~ /{osminorversion} and ($osimage->{minorversion} lt $kitcomp->{osminorversion})) { - - # my %rsp; - # push@{ $rsp{data} }, "osimage $os is not compatible with kit component $kitcomp->{kitcompname} with attribute minorversion"; - # xCAT::MsgUtils->message( "E", \%rsp, $::CALLBACK ); - return 1; + if ($kitcomp->{osminorversion}) { + if (check_minorversion($kitcomp->{osminorversion}, $osimage->{minorversion})) + { + return 1; + } } if ($osimage->{arch} ne $kitcomp->{osarch} && $kitcomp->{osarch} ne 'noarch') { @@ -2149,11 +2166,14 @@ sub addkitcomp return 1; } - if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} lt $kitcomps{$kitcomp}{osminorversion})) { - my %rsp; - push @{ $rsp{data} }, "osimage $osimage is not compatible with kit component $kitcomp with attribute minorversion"; - xCAT::MsgUtils->message("E", \%rsp, $callback); - return 1; + if ($kitcomps{$kitcomp}{osminorversion}) { + if (check_minorversion($kitcomps{$kitcomp}{osminorversion}, $os{$osimage}{minorversion})) + { + my %rsp; + push @{ $rsp{data} }, "osimage $osimage is not compatible with kit component $kitcomp with attribute minorversion"; + xCAT::MsgUtils->message("E", \%rsp, $callback); + return 1; + } } if ($os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch') { @@ -3606,11 +3626,14 @@ sub chkkitcomp return 1; } - if ($kitcomps{$kitcomp}{osminorversion} and ($os{$osimage}{minorversion} lt $kitcomps{$kitcomp}{osminorversion})) { - my %rsp; - push @{ $rsp{data} }, "kit component $kitcomp is not compatible with osimage $osimage with attribute minorversion"; - xCAT::MsgUtils->message("E", \%rsp, $callback); - return 1; + if ($kitcomps{$kitcomp}{osminorversion} ) { + if (check_minorversion($kitcomps{$kitcomp}{osminorversion}, $os{$osimage}{minorversion})) + { + my %rsp; + push @{ $rsp{data} }, "kit component $kitcomp is not compatible with osimage $osimage with attribute minorversion"; + xCAT::MsgUtils->message("E", \%rsp, $callback); + return 1; + } } if ($os{$osimage}{arch} ne $kitcomps{$kitcomp}{osarch} && $kitcomps{$kitcomp}{osarch} ne 'noarch') { @@ -5080,8 +5103,11 @@ sub get_compat_kitreponames { if (defined($kitrepo->{osmajorversion}) && $kitrepo->{osmajorversion} ne $osdistro->{majorversion}) { next; } - if (defined($kitrepo->{osminorversion}) && $osdistro->{minorversion} lt $kitrepo->{osminorversion} ) { - next; + if (defined($kitrepo->{osminorversion})) { + if (check_minorversion($kitrepo->{osminorversion},$osdistro->{minorversion})) + { + next; + } } if (defined($kitrepo->{osarch}) && $kitrepo->{osarch} ne $osdistro->{arch} && $kitrepo->{osarch} ne 'noarch') { next; From c972a8989bbfc1c6b83ddc5bb9eec650615b6264 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 16 Nov 2016 15:40:21 -0500 Subject: [PATCH 116/292] Filter out global local ipv6 address for makedhcp command --- xCAT-server/lib/xcat/plugins/dhcp.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 460547f7e..831609b83 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -1591,7 +1591,8 @@ sub process_request foreach (@ip6routes) { #TODO: filter out multicast? Don't know if multicast groups *can* appear in ip -6 route... - if (/^default/ or /^fe80::\/64/ or /^unreachable/ or /^[^ ]+ via/) { #ignore link-local, junk, and routed networks + #ignore link-local, global-local, junk, and routed networks + if (/^default/ or /^fe80::\/64/ or /^2002::\/64/ or /^unreachable/ or /^[^ ]+ via/) { next; } my @parts = split /\s+/; From 5948dc15642278a14cebadb868e9949caf907c90 Mon Sep 17 00:00:00 2001 From: "jdunham@us.ibm.com" Date: Wed, 16 Nov 2016 17:43:40 -0500 Subject: [PATCH 117/292] Added sample scripts for the various node roles in csm. Each postscript will scp the latest version of the config file appropriate for it and then start the daemon. The master script will perform some degree of automatic configuration. --- .../install/postscripts/ibm-csm-aggregator | 15 +++++ xCAT-csm/install/postscripts/ibm-csm-compute | 14 ++++ xCAT-csm/install/postscripts/ibm-csm-master | 67 +++++++++++++++++++ xCAT-csm/install/postscripts/ibm-csm-utility | 15 +++++ 4 files changed, 111 insertions(+) create mode 100644 xCAT-csm/install/postscripts/ibm-csm-aggregator create mode 100644 xCAT-csm/install/postscripts/ibm-csm-compute create mode 100644 xCAT-csm/install/postscripts/ibm-csm-master create mode 100644 xCAT-csm/install/postscripts/ibm-csm-utility diff --git a/xCAT-csm/install/postscripts/ibm-csm-aggregator b/xCAT-csm/install/postscripts/ibm-csm-aggregator new file mode 100644 index 000000000..0a09c365a --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-aggregator @@ -0,0 +1,15 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Aggregator postscript. + + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_aggregator.cfg" +daemon="csmd-aggregator" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} diff --git a/xCAT-csm/install/postscripts/ibm-csm-compute b/xCAT-csm/install/postscripts/ibm-csm-compute new file mode 100644 index 000000000..e207e8d10 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-compute @@ -0,0 +1,14 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Compute postscript. + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_compute.cfg" +daemon="csmd-compute" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} diff --git a/xCAT-csm/install/postscripts/ibm-csm-master b/xCAT-csm/install/postscripts/ibm-csm-master new file mode 100644 index 000000000..468da51a9 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-master @@ -0,0 +1,67 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Master postscript, designed to be run with or without arguments. + +usage() +{ + cat << EOF + Usage ibm-csm-master options: + + Modifies the csm configuration files (if /etc/ibm/csm/ is empty), then executes the local + post scripts to reflect the change. + + OPTIONS + -h Displays this message + -c Sets the xCAT group for the compute nodes (default: compute) + -a Sets the xCAT group for the aggregator nodes (default: aggregator) + -u Sets the xCAT group for the utility nodes (default: utility) + +EOF +} + +# Determine the master ip address. +master=$(lsdef -t site clustersite -i master | awk -F "=" '/master/{print $2}') + +# Daemon names. +master_daemon="csmd-master" +aggregator_daemon="csmd-aggregator" + +# The node groups for utility, compute, and aggregator. +utility_nodes="utility" +compute_nodes="compute" +aggregator_nodes="aggregator" + +# Parse the option strings. +optstring="u:c:a:h" +while getopts $optstring OPTION +do + case $OPTION in + u) + utility_nodes=$OPTARG;; + c) + compute_nodes=$OPTARG;; + a) + aggregator_nodes=$OPTARG;; + h) + usage; exit 1;; + esac +done + +# Replace the master tags in the configuation files. +if [[ $(ls -l /etc/ibm/csm/ | wc -l) == 0 ]] +then + echo "here" + mkdir -p /etc/ibm/csm/ + cp /opt/ibm/csm/share/etc/* /etc/ibm/csm/ + sed -i "s/__MASTER__/$master/g" /etc/ibm/csm/* +fi + +# Start the daemons. +systemctl restart ${master_daemon} +systemctl restart ${aggregator_daemon} + +# Run the post scripts on the other nodes. +updatenode ${utility_nodes} -P ibm-csm-utility +#updatenode ${aggregator_nodes} -P ibm-csm-aggregator +updatenode ${compute_nodes} -P ibm-csm-compute diff --git a/xCAT-csm/install/postscripts/ibm-csm-utility b/xCAT-csm/install/postscripts/ibm-csm-utility new file mode 100644 index 000000000..38716f3e0 --- /dev/null +++ b/xCAT-csm/install/postscripts/ibm-csm-utility @@ -0,0 +1,15 @@ +#!/bin/bash +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +#(C)IBM Corp +# Sample Utility postscript. + + +# Configuration locations. +target_file_location="/etc/ibm/csm/csm_utility.cfg" +daemon="csmd-utility" + +# Copy the configuration file. +scp ${MASTER_IP}:${target_file_location} ${target_file_location} + +# Start the csm daemon. +systemctl start ${daemon} From 907c4971a943edbdaf91a8302252716a87186016 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 10 Nov 2016 02:25:54 -0500 Subject: [PATCH 118/292] fix issue [CUSTOMER] the old diskless image built by xCAT can not be used after xcat 2.12.2 #2130 --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 37 +++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/anaconda.pm | 18 +++++------ xCAT-server/lib/xcat/plugins/debian.pm | 10 ++---- xCAT-server/lib/xcat/plugins/imgport.pm | 15 +++------ xCAT-server/lib/xcat/plugins/packimage.pm | 1 + xCAT-server/lib/xcat/plugins/sles.pm | 11 ++----- 6 files changed, 55 insertions(+), 37 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 3c813ca45..5428cd1a3 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -2099,4 +2099,41 @@ sub getplatform { return $platform; } + +#-------------------------------------------------------------------------------------------------------- +#searchcompressedrootimg: +#description: search the compressed rootimage for diskless or statelite osimage under specified directory +#argument: +# $rootimgdir: the directory in which the compressed rootimage exist +#return: +# on success: the basename of the compressed rootimage +# on fail: undef +#-------------------------------------------------------------------------------------------------------- +sub searchcompressedrootimg{ + my $rootimgdir = shift; + if (($rootimgdir) && ($rootimgdir =~ /xCAT::SvrUtils/)) { + $rootimgdir = shift; + } + + my $cpsdrootimg=undef; + if (-f -r "$rootimgdir/rootimg.sfs"){ + $cpsdrootimg="rootimg.sfs"; + }elsif(-f -r "$rootimgdir/rootimg.gz"){ + $cpsdrootimg="rootimg.gz"; + } + + if(-f -r "$rootimgdir/rootimg.cpio.gz"){ + $cpsdrootimg = 'rootimg.cpio.gz'; + }elsif(-f -r "$rootimgdir/rootimg.cpio.xz"){ + $cpsdrootimg = 'rootimg.cpio.xz'; + }elsif(-f -r "$rootimgdir/rootimg.tar.gz"){ + $cpsdrootimg = 'rootimg.tar.gz'; + }elsif(-f -r "$rootimgdir/rootimg.tar.xz"){ + $cpsdrootimg = 'rootimg.tar.xz'; + } + + return $cpsdrootimg; +} + + 1; diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a5d006985..7d00474e3 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -462,13 +462,9 @@ sub mknetboot } $platform = xCAT_plugin::anaconda::getplatform($osver); - my $suffix = 'cpio.gz'; - $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); - $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); - $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); - $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); - + my $compressedrootimg=xCAT::SvrUtils->searchcompressedrootimg("$rootimgdir"); + + # statelite images are not packed. if ($statelite) { unless (-r "$rootimgdir/kernel") { @@ -516,7 +512,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { + unless ( -f -r "$rootimgdir/$compressedrootimg") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); @@ -757,12 +753,12 @@ sub mknetboot $kcmdline .= "NODE=$node "; } else { - if (-r "$rootimgdir/rootimg.$suffix.metainfo") { + if (-r "$rootimgdir/$compressedrootimg.metainfo") { $kcmdline = -"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix.metainfo "; +"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg.metainfo "; } else { $kcmdline = -"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix "; +"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg "; } $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; $kcmdline .= "NODE=$node "; diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 6f9802468..57d66d4e6 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1170,11 +1170,7 @@ sub mknetboot } $platform = xCAT_plugin::debian::getplatform($osver); - my $suffix = 'cpio.gz'; - $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); - $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); - $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); - $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); + my $compressedrootimg=xCAT::SvrUtils->searchcompressedrootimg("$rootimgdir"); # statelite images are not packed. if ($statelite) { @@ -1224,7 +1220,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { + unless (-f -r $compressedrootimg) { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); @@ -1452,7 +1448,7 @@ sub mknetboot else { $kcmdline = - "imgurl=http://$imgsrv/$rootimgdir/rootimg.$suffix "; + "imgurl=http://$imgsrv/$rootimgdir/$compressedrootimg "; $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; } diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index e6ed1661e..0eb2f5b37 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -32,6 +32,7 @@ use File::Path qw/rmtree/; use File::Basename; use xCAT::NodeRange; use xCAT::Schema; +use xCAT::SvrUtils; use Cwd; my $requestcommand; $::VERBOSE = 0; @@ -607,17 +608,9 @@ sub get_files { if (-f "$rootimgdir/kernel") { $kernel = "$rootimgdir/kernel"; } - if (-f "$rootimgdir/rootimg.cpio.xz") { - $rootimg = "$rootimgdir/rootimg.cpio.xz"; - } elsif (-f "$rootimgdir/rootimg.cpio.gz") { - $rootimg = "$rootimgdir/rootimg.cpio.gz"; - } elsif (-f "$rootimgdir/rootimg.tar.xz") { - $rootimg = "$rootimgdir/rootimg.tar.xz"; - } elsif (-f "$rootimgdir/rootimg.tar.gz") { - $rootimg = "$rootimgdir/rootimg.tar.gz"; - } elsif (-f "$rootimgdir/rootimg.gz") { - $rootimg = "$rootimgdir/rootimg.gz"; - } + + my $compressedrootimg=xCAT::SvrUtils->searchcompressedrootimg("$rootimgdir"); + $rootimg = "$rootimgdir/$compressedrootimg"; } else { $ramdisk = look_for_file('initrd-stateless.gz', $callback, $attrs, @arr); diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 929f2d578..82ec70285 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -488,6 +488,7 @@ sub process_request { $suffix = $method.".".$suffix; unlink("$destdir/rootimg.sfs"); + unlink("$destdir/rootimg.gz"); unlink("$destdir/rootimg.cpio.xz"); unlink("$destdir/rootimg.cpio.gz"); unlink("$destdir/rootimg.tar.xz"); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index ea3518bb6..033574f34 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -327,12 +327,7 @@ sub mknetboot $platform = "sles"; } - my $suffix = 'cpio.gz'; - $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'gz' if (-r "$rootimgdir/rootimg.gz"); - $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); - $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); - $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); + my $compressedrootimg=xCAT::SvrUtils->searchcompressedrootimg("$rootimgdir"); if ($statelite) { unless (-r "$rootimgdir/kernel") { @@ -384,7 +379,7 @@ sub mknetboot } } - unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs" or -r "$rootimgdir/rootimg.gz") { + unless (-r -f $compressedrootimg) { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] @@ -588,7 +583,7 @@ sub mknetboot else { $kcmdline = - "imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg.$suffix "; + "imgurl=$httpmethod://$imgsrv/$rootimgdir/$compressedrootimg "; } $kcmdline .= "XCAT=$xcatmaster:$xcatdport quiet "; From 555cffdf241c247f3c8b0fec6fb60b29afb9ca9c Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 17 Nov 2016 03:44:44 -0500 Subject: [PATCH 119/292] Add debug info for issue 1958: [FVT]Failed to run rmvm when setup SN in x86_64 for rh7.3 and rh6.8 --- xCAT-server/lib/xcat/plugins/kvm.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 15c0ad28c..ec87a53eb 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -48,7 +48,7 @@ if (Sys::Virt->VERSION =~ /^0\.[10]\./) { use XML::Simple; $XML::Simple::PREFERRED_PARSER = 'XML::Parser'; -#use Data::Dumper; +use Data::Dumper; use POSIX "WNOHANG"; use Storable qw(freeze thaw store_fd fd_retrieve); use IO::Select; @@ -3765,12 +3765,20 @@ sub process_request { $confdata = {}; unless ($command eq 'lsvm' or $command eq 'rscan') { xCAT::VMCommon::grab_table_data($noderange, $confdata, $callback); + # Add debug info for issue 1958, the rmvm issue + my $test_file_fd; + open($test_file_fd, ">> $::XCATROOT//share/xcat/tools/autotest/result/$command.$$.rec"); + print $test_file_fd "====================start==========================\n"; my $kvmdatatab = xCAT::Table->new("kvm_nodedata", -create => 0); #grab any pertinent pre-existing xml if ($kvmdatatab) { $confdata->{kvmnodedata} = $kvmdatatab->getNodesAttribs($noderange, [qw/xml/]); + print $test_file_fd Dumper($confdata->{kvmnodedata}); } else { $confdata->{kvmnodedata} = {}; + print $test_file_fd "***Error: Can not open kvm_nodedata table==\n"; } + print $test_file_fd "====================end==========================\n"; + close $test_file_fd; } if ($command eq 'mkvm' or ($command eq 'clonevm' and (grep { "$_" eq '-b' } @exargs)) or ($command eq 'rpower' and (grep { "$_" eq "on" or $_ eq "boot" or $_ eq "reset" } @exargs))) { xCAT::VMCommon::requestMacAddresses($confdata, $noderange); From ddd9a1267815eb3d9beb53bb73394e7ae21a4513 Mon Sep 17 00:00:00 2001 From: John Dunham Date: Thu, 17 Nov 2016 08:45:56 -0500 Subject: [PATCH 120/292] Updated the spec file for xCAT-csm to place the csm post scripts in the directory and not a subdirectory. Removed the empty file. --- xCAT-csm/install/postscripts/csm_post | 1 - xCAT-csm/xCAT-csm.spec | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 xCAT-csm/install/postscripts/csm_post diff --git a/xCAT-csm/install/postscripts/csm_post b/xCAT-csm/install/postscripts/csm_post deleted file mode 100644 index bfad0d20e..000000000 --- a/xCAT-csm/install/postscripts/csm_post +++ /dev/null @@ -1 +0,0 @@ -#example postscript for CSM diff --git a/xCAT-csm/xCAT-csm.spec b/xCAT-csm/xCAT-csm.spec index 23c1a9b92..e0d993026 100644 --- a/xCAT-csm/xCAT-csm.spec +++ b/xCAT-csm/xCAT-csm.spec @@ -33,10 +33,10 @@ xCAT-csm provides Packages for installation of CSM nodes rm -rf %{buildroot} mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/rh/ -mkdir -p $RPM_BUILD_ROOT/install/postscripts/csm/ +mkdir -p $RPM_BUILD_ROOT/install/postscripts/ cp csm* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/rh/ -cp install/postscripts/* $RPM_BUILD_ROOT/install/postscripts/csm/ +cp install/postscripts/* $RPM_BUILD_ROOT/install/postscripts/ %clean # This step does not happen until *after* the %files packaging below From f623d48887bc0e6934cb30de96edeb790e28b940 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 17 Nov 2016 16:57:14 -0500 Subject: [PATCH 121/292] Updated information about postinstall scripts based on PR#2165 --- .../prepostscripts/postinstall_script.rst | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst index e3d22884e..4eb204078 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst @@ -2,6 +2,50 @@ Using Postinstall Script ------------------------ +While generating the rootimage directory for diskless or statelite osimage with ``genimage``, you may want to customize the rootimage after the package installation. The `postinstall` attribute of the osimage definition provides a hook to run user specicied script(s) against the rootimage directory in non-chrooted mode. -xCAT will run scripts specified by postinstall attribute when executing **genimage** command. The scripts will be exectuted after the package installation but before initrd generation. One of the uses of postinstall script is to install drivers into the rootimage during the **genimage** run. +xCAT ships the default postinstall scripts for the diskless/statelite osimages created with ``copycds``, for example :: + + >lsdef -t osimage -o rhels7.3-ppc64le-netboot-compute -i postinstall + Object name: rhels7.3-ppc64le-netboot-compute + postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + +Notice: All the operations inside the default postinstall scripts are mandatory for the osimage provision. If you want to customize the postinstall script for an osimage, you should make sure the contents of default postinstall script are included. This can be done in either of the following ways: + + 1. Append your own postinstall scripts by ``chdef -t osimage -o -p postinstall=`` + 2. Create your own postinstall script based on the default postinstall script, then ``chdef -t osimage -o postinstall=`` + +The following are some key points in Q/A format, that will help you understand the usage of postinstall scripts: + +When will the postinstall scripts run? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In general, the brief workflow of ``genimage`` is: + +a) install the packages specified in package list under rootimage directory +b) cumstomizing the rootimage directory, such as system configuration file generation/modification +c) generate the initrd based on the rootimage directory + +The postinstall scripts are run in step b). + +Are postinstall scripts run in chrooted mode under rootimage directory? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +No. Unlike postscripts & postbootscripts, the postinstall scripts are run in non-chrooted mode. In the postinstall scripts, all the paths of the directories and files are based on the "/" of the managememnt node. You can change the working directory to rootimage directory with ``cd $IMG_ROOTIMGDIR``. "$IMG_ROOTIMGDIR" is an environment variable exported by genimage containing the full path of the rootimage directory on management node. + +What are some of the environment variables available to my customized scripts? +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Besides "$IMG_ROOTIMGDIR" mentioned above, ``genimage`` exports a batch of environment variables while postinstall scripts are run, which can be used in your customized scipts. :: + + IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), + IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), + IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), + IMG_KERNELVERSION(the "kernelver" attribute of the osimage), + IMG_PROFILE(the profile of the osimage, such as "service","compute"), + IMG_PKGLIST(the "pkglist" attribute of the osimage), + IMG_PKGDIR(the "pkgdir" attribute of the osimage), + IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), + IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), + IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) From dc1558f8748f2da4071f99322ad5f3f995cd2081 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 18 Nov 2016 03:58:19 -0500 Subject: [PATCH 122/292] fix issue xcat is failing to run postbootscripts on stateful node. #2167 --- xCAT/postscripts/xcatpostinit1.install | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index 3d7c3abd3..7bb736b84 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -9,9 +9,9 @@ if [ -x /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions fi -[ -f /opt/xcat/xcatinfo ] && XCATSERVER=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2 2>/dev/null` -[ -f /xcatpost/mypostscript ] && NODESTATUS=`grep 'NODESTATUS=' /xcatpost/mypostscript |awk -F = '{print $2}' 2>/dev/null` -[ -f /xcatpost/mypostscript ] && RUNBOOTSCRIPT=`grep 'RUNBOOTSCRIPT=' /xcatpost/mypostscript |awk -F = '{print $2}' 2>/dev/null` +[ -f /opt/xcat/xcatinfo ] && XCATSERVER=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2 | tr -d \'\" ` +[ -f /xcatpost/mypostscript ] && NODESTATUS=`grep 'NODESTATUS=' /xcatpost/mypostscript |awk -F = '{print $2}'|tr -d \'\" | tr A-Z a-z ` +[ -f /xcatpost/mypostscript ] && RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z ` case $1 in stop) @@ -20,12 +20,12 @@ stop) start) # check for the REBOOT specified in xcatinfo to run post boot scripts on reboot if [ -f /opt/xcat/xcatinfo ]; then - REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2` + REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2 | tr -d \'\"` fi # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 - if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost -a "$RUNBOOTSCRIPT" = "1" ]; then + if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost ] && [[ "$RUNBOOTSCRIPTS" =~ ^1|yes|y$ ]]; then /opt/xcat/xcatdsklspost 6 - elif [ "$REBOOT" = "TRUE" -a "NODESTATUS" != "n" ]; then + elif [ "$REBOOT" = "TRUE" ] && [[ "$NODESTATUS" =~ ^1|yes|y$ ]]; then /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" else # run /opt/xcat/xcatinstallpost From 167fb753a8655516f125405ed70bfb9445a74ea9 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 18 Nov 2016 10:49:29 -0500 Subject: [PATCH 123/292] Add security bulletin for removal of hard coded password --- .../2016/20161130_hard_code_password.rst | 60 +++++++++++++++++++ docs/source/security/2016/index.rst | 1 + 2 files changed, 61 insertions(+) create mode 100644 docs/source/security/2016/20161130_hard_code_password.rst diff --git a/docs/source/security/2016/20161130_hard_code_password.rst b/docs/source/security/2016/20161130_hard_code_password.rst new file mode 100644 index 000000000..5c1fb3988 --- /dev/null +++ b/docs/source/security/2016/20161130_hard_code_password.rst @@ -0,0 +1,60 @@ +2016-11-30 - Removal of Service Stream Password +=============================================== + +It has been brought to our attention that the xCAT product has hard-coded default passwords for the HMC/FSP to allow for IBM Service to connect to customer machines for L2/L3 support activities. This creates a security vulnerability where third parties could potentially gain root level access using these weak, hard coded passwords. + + + Example: :: + + create_pwd => "netsDynPwdTool --create dev FipSdev", + password => "FipSdev" + + +In response, xCAT will remove these hard-coded password and interfaces from the xCAT code. + + +Action +------ + +No action is required for xCAT 2.12.3, and higher. + +If running older versions of xCAT, update xCAT to a higher level code base that has the hard-coded default passwords removed. + +The following table describes the recommended update path: + ++-------------------------+-----------------------------------+---------------------------------------+ +| xCAT Version | Action | Release Notes | ++=========================+===================================+=======================================+ +| **2.13**, or higher | No applicable | | +| | | | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.12.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.11.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.10.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.9.x** | Update to **2.9.4**, or higher | `2.9.4 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.8.x** | Update to **2.9.4**, or higher | `2.9.4 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.7.x** | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | ++-------------------------+-----------------------------------+---------------------------------------+ +| **2.6.x**, or earlier | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | +| | | | ++-------------------------+-----------------------------------+---------------------------------------+ + diff --git a/docs/source/security/2016/index.rst b/docs/source/security/2016/index.rst index 43cebeb61..e0db9a230 100644 --- a/docs/source/security/2016/index.rst +++ b/docs/source/security/2016/index.rst @@ -4,6 +4,7 @@ .. toctree:: :maxdepth: 1 + 20161130_hard_code_password.rst 20160824_openssl.rst 20160815_openssl.rst 20160503_openssl.rst From dc9ffa4307b511b51b393f7eab332648774be920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Obih=C3=B6rnchen?= Date: Fri, 18 Nov 2016 15:47:47 -0500 Subject: [PATCH 124/292] Fix mknb: Undefined subroutine noderange Add missing xCAT::NodeRange module --- xCAT-server/lib/xcat/plugins/mknb.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 8508a598a..76e0b2a05 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -3,6 +3,7 @@ use strict; use File::Temp qw(tempdir); use xCAT::Utils; use xCAT::TableUtils; +use xCAT::NodeRange; use File::Path; use File::Copy; From c936778f21c6ca0aade6730a37c4aedf6fdf8d14 Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 19 Nov 2016 07:36:35 -0500 Subject: [PATCH 125/292] fix issue [DEV] several issues on generating grub.cfg-xxx when netboot=grub2 #2174; fix issue kcmdline for centos netboot images set incorrectly #1502 --- perl-xCAT/xCAT/NetworkUtils.pm | 3 +-- xCAT-server/lib/xcat/plugins/grub2.pm | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/perl-xCAT/xCAT/NetworkUtils.pm b/perl-xCAT/xCAT/NetworkUtils.pm index ed4694a70..423ea320d 100755 --- a/perl-xCAT/xCAT/NetworkUtils.pm +++ b/perl-xCAT/xCAT/NetworkUtils.pm @@ -2636,11 +2636,10 @@ sub gen_net_boot_params $net_params->{ip} = "ip=$nicname:dhcp"; $net_params->{netdev} = "netdev=$nicname"; $net_params->{netdevice} = "netdevice=$nicname"; - $net_params->{ifname} = "ifname=$nicname:$mac"; # todo: may not use mac arbitrary + $net_params->{bootdev} = "bootdev=$nicname"; } elsif ($mac) { $net_params->{ksdevice} = "ksdevice=$mac"; $net_params->{BOOTIF} = "BOOTIF=$mac"; - $net_params->{bootdev} = "bootdev=$mac"; $net_params->{ip} = "ip=dhcp"; $net_params->{netdevice} = "netdevice=$mac"; } diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index d315ad241..34ddd9d8a 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -302,7 +302,6 @@ sub setstate { $macstring = $ment->{mac}; my @macs = split(/\|/, $ment->{mac}); foreach (@macs) { - $nodemac = $_; if (/!(.*)/) { my $ipaddr = xCAT::NetworkUtils->getipaddr($1); if ($ipaddr) { @@ -317,7 +316,7 @@ sub setstate { # my $hassymlink = eval { symlink("",""); 1 }; foreach $ip (keys %ipaddrs) { my @ipa = split(/\./, $ip); - my $pname = "grub.cfg-" . sprintf("%02x%02x%02x%02x", @ipa); + my $pname = "grub.cfg-" . sprintf("%02X%02X%02X%02X", @ipa); # remove the old boot configuration file and copy (link) a new one, but only if not offline directive unlink($tftpdir . "/boot/grub2/" . $pname); @@ -325,7 +324,18 @@ sub setstate { link($tftpdir . "/boot/grub2/" . $node, $tftpdir . "/boot/grub2/" . $pname); } } - if ($macstring) { + + my $nrent=$nrhash{$node}->[0]; + if($nrent and $nrent->{installnic}){ + my $myinstallnic=$nrent->{installnic}; + if(xCAT::NetworkUtils->isValidMAC($myinstallnic)){ + $nodemac=$myinstallnic; + } + } + + + + if (! $nodemac and $macstring) { $nodemac = xCAT::Utils->parseMacTabEntry($macstring, $node); } @@ -579,7 +589,7 @@ sub process_request { my $mactab = xCAT::Table->new('mac', -create => 1); my $machash = $mactab->getNodesAttribs(\@nodes, ['mac']); my $nrtab = xCAT::Table->new('noderes', -create => 1); - my $nrhash = $nrtab->getNodesAttribs(\@nodes, [ 'servicenode', 'tftpserver', 'xcatmaster', 'netboot' ]); + my $nrhash = $nrtab->getNodesAttribs(\@nodes, [ 'servicenode', 'tftpserver', 'xcatmaster', 'netboot' , 'installnic']); my $typetab = xCAT::Table->new('nodetype', -create => 1); my $typehash = $typetab->getNodesAttribs(\@nodes, [ 'os', 'provmethod', 'arch', 'profile' ]); my $linuximgtab = xCAT::Table->new('linuximage', -create => 1); From be8c25587481bfff717c39cbee2dcc08b14b505e Mon Sep 17 00:00:00 2001 From: bybai Date: Sun, 20 Nov 2016 22:07:00 -0500 Subject: [PATCH 126/292] fix 2025 Re-enable the creation of statelite when copycds on RHEL 7 --- xCAT-server/lib/xcat/plugins/anaconda.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 7d00474e3..6decce701 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2491,7 +2491,7 @@ sub copycd #if ($ret[0] != 0) { #$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); #} - + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); } } } From 29e539176e8008288b342f7555a740cebd517a7b Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 21 Nov 2016 07:03:36 -0500 Subject: [PATCH 127/292] update for bug #1958 --- .../testcase/installation/Diskless_installation_flat_p8_le | 2 +- xCAT-test/autotest/testcase/installation/SN_setup_case | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index c298b2319..28db2b5b4 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -5,7 +5,7 @@ cmd:copycds $$ISO check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p ;mkvm $$CN -s 20G; fi;fi check:rc==0 cmd:makedns -n check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 87db2d52d..7e8d25f37 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -11,7 +11,7 @@ check:rc==0 #Add for debug rmvm issue cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p ;mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 20G; fi;fi check:rc==0 cmd:makedns -n From 7287b047021f880939b4aa6870517a1abb643ae2 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 21 Nov 2016 12:47:16 -0500 Subject: [PATCH 128/292] modify switchdiscovery cases for issue 1137 --- xCAT-test/autotest/testcase/switchdiscover/cases0 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT-test/autotest/testcase/switchdiscover/cases0 b/xCAT-test/autotest/testcase/switchdiscover/cases0 index 7de8bb7e3..abf7220a3 100644 --- a/xCAT-test/autotest/testcase/switchdiscover/cases0 +++ b/xCAT-test/autotest/testcase/switchdiscover/cases0 @@ -12,6 +12,8 @@ check:output=~Discovering switches using nmap check:output=~switch end start:switchdiscover_range_default_w +cmd:lsdef -l switch -z >/tmp/switch.standa +cmd:rmdef switch cmd:switchdiscover --range $$range -w check:rc==0 check:output=~Discovering switches using nmap @@ -20,6 +22,11 @@ check:output=~Writing the data into xCAT DB cmd: lsdef |grep switch check:rc==0 check:output=~switch +cmd:rmdef switch +check:rc==0 +cmd:cat /tmp/switch.standa |mkdef -z +cmd:rm -rf /tmp/switch.standa +check:rc==0 end start:switchdiscover_range_s cmd:switchdiscover --range $$range -s nmap From 093f966522adf2c60c10203854f16245195f279d Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 28 Oct 2016 20:20:06 -0400 Subject: [PATCH 129/292] Configure different model of BNT switches --- .../lib/xcat/plugins/switchdiscover.pm | 51 +++--- xCAT-server/share/xcat/scripts/configBNT | 161 ++++++++++++++++-- 2 files changed, 181 insertions(+), 31 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 5a84a7978..2433d4154 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -326,7 +326,7 @@ sub process_request { my $req = shift; my $callback = shift; my $sub_req = shift; - + ########################################### # Build hash to pass around ########################################### @@ -472,20 +472,21 @@ sub process_request { my $msg = sprintf $format, $ip, $name, $vendor, $mac; send_msg(\%request, 0, $msg); } + send_msg(\%request, 0,"\n"); } + my ($discoverswitch, $predefineswitch) = matchPredefineSwitch($result, \%request, $sub_req); # writes the data into xCAT db if (exists($globalopt{w})) { send_msg(\%request, 0, "Writing the data into xCAT DB...."); - xCATdB($result, \%request, $sub_req); + xCATdB($discoverswitch, \%request, $sub_req); } if (exists($globalopt{setup})) { - switchsetup($result, \%request, $sub_req); + switchsetup($predefineswitch, \%request, $sub_req); } - return; } @@ -1199,7 +1200,6 @@ sub xCATdB { $mac=" "; } - ################################################# # use lsdef command to check if this switch is # already in the switch table @@ -1369,13 +1369,9 @@ sub format_xml { } #-------------------------------------------------------------------------------- -=head3 switchsetup +=head3 matchPredefineSwitch find discovered switches with predefine switches for each discovered switches: - 1) matching mac to a predefined node - 2) if get predefined node, config the discovered switch, if failed, update - 'otherinterface' attribute of predefined node - 3) remove hosts record and node definition for the discovered switch Arguments: outhash: a hash containing the switches discovered Returns: @@ -1383,14 +1379,13 @@ sub format_xml { =cut #-------------------------------------------------------------------------------- -sub switchsetup { +sub matchPredefineSwitch { my $outhash = shift; my $request = shift; my $sub_req = shift; - my @switchnode = (); + my $discoverswitch; + my $configswitch; my $static_ip; - my $discover_switch; - my $nodes_to_config; #print Dumper($outhash); my $macmap = xCAT::MacMap->new(); @@ -1409,7 +1404,10 @@ sub switchsetup { my $node = $macmap->find_mac($mac,0,1); if (!$node) { - send_msg($request, 0, "NO predefined switch matched this switch $dswitch with ip address $ip and mac address $mac"); + send_msg($request, 0, "Switch discovered: $dswitch "); + $discoverswitch->{$mac}->{ip} = $ip; + $discoverswitch->{$mac}->{vendor} = $vendor; + $discoverswitch->{$mac}->{name} = $dswitch; next; } @@ -1417,14 +1415,29 @@ sub switchsetup { $static_ip = xCAT::NetworkUtils->getipaddr($node); my $stype = get_switchtype($vendor); - if (exists($globalopt{verbose})) { - send_msg($request, 0, "Found Discovery switch $dswitch, $ip, $mac with predefine switch $node, $static_ip $stype switch\n" ); - } + send_msg($request, 0, "Switch discovered and matched: $dswitch to $node" ); + xCAT::Utils->runxcmd({ command => ['chdef'], arg => ['-t','node','-o',$node,"otherinterfaces=$ip",'status=Matched',"mac=$mac","switchtype=$stype","usercomment=$vendor"] }, $sub_req, 0, 1); - push (@{$nodes_to_config->{$stype}}, $node); + push (@{$configswitch->{$stype}}, $node); } + return ($discoverswitch, $configswitch); +} + +#-------------------------------------------------------------------------------- +=head3 switchsetup + configure the switch + Arguments: + outhash: a hash containing the switches need to configure + Returns: + result: +=cut +#-------------------------------------------------------------------------------- +sub switchsetup { + my $nodes_to_config = shift; + my $request = shift; + my $sub_req = shift; foreach my $mytype (keys %$nodes_to_config) { my $config_script = "$::XCATROOT/share/xcat/scripts/config".$mytype; if (-r -x $config_script) { diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index c2a3f4355..0c4059236 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -118,12 +118,28 @@ sub config_ip { my @config_switches; my @discover_switches; my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces','mac']); + # get netmask from network table + my $nettab = xCAT::Table->new("networks"); + my @nets; + if ($nettab) { + @nets = $nettab->getAllAttribs('net','mask'); + } + #get mac address for the switches + my $mactab = xCAT::Table->new("mac"); + my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); + foreach my $switch (@nodes) { print "change $switch to static ip address\n"; + + #makesure host is in the /etc/hosts + $cmd = "makehosts $switch"; + $rc= xCAT::Utils->runcmd($cmd, 0); + my $dip= $nodehash->{$switch}->[0]->{otherinterfaces}; + my $mac= $machash->{$switch}->[0]->{mac}; if (!$dip) { - print "Add otherinterfaces attribute for discover ip: chdef $switch otherinterfaces=x.x.x.x\n"; + print "ERROR: Add otherinterfaces attribute for discover ip: chdef $switch otherinterfaces=x.x.x.x\n"; next; } @@ -139,6 +155,8 @@ sub config_ip { # don't need to set if ip addresses are same if ($dip eq $static_ip) { print "static ip $static_ip and discovery ip $dip is same, will not process command for $switch\n"; + $cmd = "chdef $csw otherinterfaces="; + $rc= xCAT::Utils->runcmd($cmd, 0); next; } @@ -161,16 +179,45 @@ sub config_ip { $cmd = "makehosts $dswitch"; $rc= xCAT::Utils->runcmd($cmd, 0); - # verify if xdsh works - $cmd = "xdsh $dswitch --devicetype EthSwitch::BNT 'enable;configure terminal;exit' "; + #get netmask + my $mask; + foreach my $net (@nets) { + if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $static_ip, $net->{'mask'}, 0)) { + $mask=$net->{'mask'}; + } + } + + # For RackSwitch G8124 + if ($mac =~ /fc\:cf\:62/i) { + $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT 'enable;configure terminal;show interface ip;interface ip-mgmt enable;interface ip-mgmt address $static_ip $mask;exit' "; + } elsif ($mac =~ /6c\:ae\:8b/i){ + print "this is BNT G8264-T switch\n"; + $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT '/cfg/l3/if 128/maskplen $mask;/cfg/l3/if 128/addr $static_ip;apply' "; + } else { + $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT 'enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit' "; + } $rc= xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) { - xCAT::MsgUtils->message("E","Couldn't communicate with $dswitch, $dip"); + + # check if static ip address is reachable + my $retry = 0; + my $retry_failed = 1; + while ($retry < 3) { + if (!$p->ping($static_ip)) { + $retry = $retry + 1; + print "sleep 10\n"; + sleep 10; + } else { + $retry_failed = 0; + last; + } + } + print "retry $retry_failed\n"; + if ($retry_failed) { + print "Failed to set up static ip address: $static_ip for $switch\n"; + push (@discover_switches, $dswitch); next; } - $cmd="xdsh $dswitch -t 10 --devicetype EthSwitch::BNT 'enable;configure terminal;show interface ip;interface ip 1;ip address $static_ip;exit;exit' "; - $rc= xCAT::Utils->runcmd($cmd, 0); - print "finish setup static ip address for $switch\n"; + push (@discover_switches, $dswitch); push (@config_switches, $switch); } @@ -194,15 +241,24 @@ sub config_hostname { my @config_switches; my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','sshpassword']); + + #get mac address for the switches + my $mactab = xCAT::Table->new("mac"); + my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); foreach my $switch (@nodes) { my $user= $switchhash->{$switch}->[0]->{sshusername}; my $pwd= $switchhash->{$switch}->[0]->{sshpassword}; + my $mac= $machash->{$switch}->[0]->{mac}; if ((!$user)||(!$pwd)) { print "switch ssh username or password is not define, add default one\n"; $cmd = "chdef $switch username=root password=admin"; $rc= xCAT::Utils->runcmd($cmd, 0); } - $cmd="xdsh $switch --devicetype EthSwitch::BNT 'enable;configure terminal;hostname $switch;write memory' "; + if ($mac =~ /6c\:ae\:8b/i){ + $cmd="xdsh $switch --devicetype EthSwitch::BNT '/cfg/sys/hprompt enable;/cfg/sys/ssnmp/name $switch;apply' "; + } else { + $cmd="xdsh $switch --devicetype EthSwitch::BNT 'enable;configure terminal;hostname $switch;write memory;exit' "; + } $rc= xCAT::Utils->runcmd($cmd, 0); if ($::RUNCMD_RC != 0) { xCAT::MsgUtils->message("E","Failed to setup hostname for $switch"); @@ -235,7 +291,7 @@ sub config_snmp { $snmp_passwd = $::PASSWORD; } else { # Need a special character - $snmp_passwd = "xcatadminpassw0rd\@snmp\r"; + $snmp_passwd = "xcatadminpassw1rd\@snmp\r"; } if ($::GROUP) { $snmp_group = $::GROUP; @@ -243,8 +299,22 @@ sub config_snmp { $snmp_group = "xcatgroup\r"; } + #get mac address for the switches + my $mactab = xCAT::Table->new("mac"); + my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); + foreach my $switch (@nodes) { my $mysw; + + my $mac= $machash->{$switch}->[0]->{mac}; + if ($mac =~ /6c\:ae\:8b/i){ + my $rc = config_G8264($switch,$snmp_user,$snmp_passwd,$snmp_group); + if ($rc == 0){ + push (@config_switches, $switch); + } + next; + } + my $enable_cmd="enable\r"; my $config_cmd="configure terminal\r"; my $exit_cmd="exit\r"; @@ -351,11 +421,78 @@ sub config_snmp { if (@config_switches) { #update switch status my $csw = join(",",@config_switches); - $cmd = "chdef $csw status=switch_configed snmpversion=3 snmpauth=sha snmpusername=$snmp_user snmppassword=$snmp_passwd"; + $cmd = "chdef $csw status=switch_configed snmpversion=3 snmpauth=sha snmpprivacy=authNoPriv snmpusername=$snmp_user snmppassword=$snmp_passwd"; $rc= xCAT::Utils->runcmd($cmd, 0); } } +sub config_G8264 { + my $switch = shift; + my $snmp_user = shift; + my $snmp_passwd = shift; + my $snmp_group = shift; + my $cmd; + + $cmd="xdsh $switch --devicetype EthSwitch::BNT '/cfg/sys/ssnmp/snmpv3/usm 5/name $snmp_user;/cfg/sys/ssnmp/snmpv3/usm 5/auth sha;/cfg/sys/ssnmp/snmpv3/usm 5/priv none;/cfg/sys/ssnmp/snmpv3/group 5/model usm;/cfg/sys/ssnmp/snmpv3/group 5/uname $snmp_user;/cfg/sys/ssnmp/snmpv3/group 5/gname $snmp_group;/cfg/sys/ssnmp/snmpv3/access 5/name $snmp_group;/cfg/sys/ssnmp/snmpv3/access 5/model usm;/cfg/sys/ssnmp/snmpv3/access 5/level authNoPriv;apply' "; + + $rc= xCAT::Utils->runcmd($cmd, 0); + + #use expect to set password + my $mysw = new Expect; + my $timeout = 20; + my $login_cmd = "telnet $switch\r"; + my $passwd = "admin\r"; + my $pwd_prompt = "password: "; + my $main_prompt="Main#"; + my $authpw_cmd = "/cfg/sys/ssnmp/snmpv3/usm 5/authpw\r"; + + $mysw->slave->stty(qw(sane -echo)); + + unless ($mysw->spawn($login_cmd)) + { + $mysw->soft_close(); + print "Unable to run $login_cmd\n"; + return 1; + } + my @result = $mysw->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysw->clear_accum(); + $mysw->send("$passwd\r"); + $mysw->clear_accum(); + $mysw->exp_continue(); + } + ], + [ + "-re", $main_prompt, + sub { + $mysw->clear_accum(); + $mysw->send($authpw_cmd); + $mysw->send($passwd); + $mysw->send($snmp_passwd); + $mysw->send($snmp_passwd); + sleep 1; + $mysw->clear_accum(); + $mysw->send("apply\r"); + $mysw->send("save\r"); + $mysw->send("y\r"); + $mysw->send("exit\r"); + } + ], + ); + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysw->soft_close(); + print "Failed expect command $errmsg\n"; + return 1; + } + $mysw->soft_close(); + return 0; +} + sub config_vlan { if ($::PORT) { $port = $::PORT; From 91b67db41138cbd2e526412042b873e35679c97b Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 18 Nov 2016 11:55:47 -0500 Subject: [PATCH 130/292] modify from ErTao's review --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 6 ++---- xCAT-server/share/xcat/scripts/configBNT | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index 2433d4154..cee804d59 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -721,6 +721,7 @@ sub nmap_scan { my $mac; if (exists($host->{address})) { my $addr_ref = $host->{address}; + $found = 0; foreach my $addr ( @$addr_ref ) { my $type = $addr->{addrtype}; if ( $type ne "mac" ) { @@ -767,7 +768,7 @@ sub nmap_scan { } } - if (!$osguess_ips) { + if ($osguess_ips) { my $guess_switches = nmap_osguess($request, $osguess_ips); foreach my $guess_mac ( keys %$guess_switches ) { $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip};; @@ -1385,7 +1386,6 @@ sub matchPredefineSwitch { my $sub_req = shift; my $discoverswitch; my $configswitch; - my $static_ip; #print Dumper($outhash); my $macmap = xCAT::MacMap->new(); @@ -1411,8 +1411,6 @@ sub matchPredefineSwitch { next; } - # get predefine node ip address - $static_ip = xCAT::NetworkUtils->getipaddr($node); my $stype = get_switchtype($vendor); send_msg($request, 0, "Switch discovered and matched: $dswitch to $node" ); diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index 0c4059236..fda59767a 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -118,7 +118,7 @@ sub config_ip { my @config_switches; my @discover_switches; my $nodetab = xCAT::Table->new('hosts'); - my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces','mac']); + my $nodehash = $nodetab->getNodesAttribs(\@nodes,['ip','otherinterfaces']); # get netmask from network table my $nettab = xCAT::Table->new("networks"); my @nets; @@ -184,6 +184,7 @@ sub config_ip { foreach my $net (@nets) { if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $static_ip, $net->{'mask'}, 0)) { $mask=$net->{'mask'}; + last; } } From eeb750f59294f0c75a77cab3f49fb35707c27450 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Mon, 21 Nov 2016 13:53:42 -0500 Subject: [PATCH 131/292] modified review comments from ErTao --- xCAT-server/lib/xcat/plugins/switchdiscover.pm | 2 +- xCAT-server/share/xcat/scripts/configBNT | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/switchdiscover.pm b/xCAT-server/lib/xcat/plugins/switchdiscover.pm index cee804d59..1b90ea155 100644 --- a/xCAT-server/lib/xcat/plugins/switchdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/switchdiscover.pm @@ -771,7 +771,7 @@ sub nmap_scan { if ($osguess_ips) { my $guess_switches = nmap_osguess($request, $osguess_ips); foreach my $guess_mac ( keys %$guess_switches ) { - $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip};; + $switches->{$guess_mac}->{ip} = $guess_switches->{$guess_mac}->{ip}; $switches->{$guess_mac}->{vendor} = $guess_switches->{$guess_mac}->{vendor}; } } diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index fda59767a..712dcd122 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -89,6 +89,10 @@ if ($::SWITCH) { exit(1); } +#get mac address for the switches +my $mactab = xCAT::Table->new("mac"); +my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); + my $switches = join(",",@nodes); my $cmd; my $vlan; @@ -125,9 +129,6 @@ sub config_ip { if ($nettab) { @nets = $nettab->getAllAttribs('net','mask'); } - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); foreach my $switch (@nodes) { print "change $switch to static ip address\n"; @@ -165,7 +166,7 @@ sub config_ip { # if hostnames are same, created different one for discovery name if ($dswitch eq $switch) { - $dswitch=""; + $dswitch="$switch-discovery"; } #if not defined, need to create one for xdsh to use @@ -243,9 +244,6 @@ sub config_hostname { my $switchtab = xCAT::Table->new('switches'); my $switchhash = $switchtab->getNodesAttribs(\@nodes,['sshusername','sshpassword']); - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); foreach my $switch (@nodes) { my $user= $switchhash->{$switch}->[0]->{sshusername}; my $pwd= $switchhash->{$switch}->[0]->{sshpassword}; @@ -300,10 +298,6 @@ sub config_snmp { $snmp_group = "xcatgroup\r"; } - #get mac address for the switches - my $mactab = xCAT::Table->new("mac"); - my $machash = $mactab->getNodesAttribs(\@nodes,['mac']); - foreach my $switch (@nodes) { my $mysw; From 69fff6a31ead857c12558ad2bd9207c5463ddf6c Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 18 Nov 2016 13:20:39 +0800 Subject: [PATCH 132/292] Load the cryptmethod in the passwd table to generate the password sha256 and sha512 crypt methods are supported from glibc 2.7 version. This patch enable the crypt feature on linux system and encrypt the password with sha256 by default. implement: #1890 --- .../admin-guides/references/man5/passwd.5.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 2 +- xCAT-server/lib/perl/xCAT/PasswordUtils.pm | 50 +++++++++++++++++++ xCAT-server/lib/perl/xCAT/Template.pm | 38 +++++++------- xCAT-server/lib/xcat/plugins/packimage.pm | 44 +++++++--------- xCAT-server/lib/xcat/plugins/statelite.pm | 45 +++++++---------- 6 files changed, 109 insertions(+), 72 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/passwd.5.rst b/docs/source/guides/admin-guides/references/man5/passwd.5.rst index 70d8dd672..3438aa4b6 100644 --- a/docs/source/guides/admin-guides/references/man5/passwd.5.rst +++ b/docs/source/guides/admin-guides/references/man5/passwd.5.rst @@ -56,7 +56,7 @@ passwd Attributes: \ **cryptmethod**\ - Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod is not supported however the code attempts to auto-discover MD5 encrypted passwords. + Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 296ee634a..d7c58b808 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -824,7 +824,7 @@ passed as argument rather than by table value', key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, cec, frame, switch.', username => 'The default userid for this type of component', password => 'The default password for this type of component', - cryptmethod => 'Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod is not supported however the code attempts to auto-discover MD5 encrypted passwords.', + cryptmethod => 'Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default.', authdomain => 'The domain in which this entry has meaning, e.g. specifying different domain administrators per active directory domain', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", diff --git a/xCAT-server/lib/perl/xCAT/PasswordUtils.pm b/xCAT-server/lib/perl/xCAT/PasswordUtils.pm index 72ab1343e..d9647deec 100644 --- a/xCAT-server/lib/perl/xCAT/PasswordUtils.pm +++ b/xCAT-server/lib/perl/xCAT/PasswordUtils.pm @@ -1,9 +1,14 @@ package xCAT::PasswordUtils; use xCAT::Table; +use xCAT::MsgUtils; +use xCAT::Utils; + my $ipmiuser = "USERID"; # default username to apply if nothing specified my $ipmipass = "PASSW0RD"; # default password to apply if nothing specified my $bladeuser = "USERID"; # default username to apply if nothing specified my $bladepass = "PASSW0RD"; # default password to apply if nothing specified +my %CRYPT_METHOD = ('md5' => '$1$', 'sha256' => '$5$', 'sha512' => '$6$'); + # Picks the IPMI authentication to use with or deploy to a BMC # mandatory arguments: @@ -112,3 +117,48 @@ sub getIPMIAuth { return \%authmap; } +# Encrypt system password based on the values in passwd table +# The values for system root user will be used if query key-pair is not defined +sub crypt_system_password { + # Just leave these arguments here for the compability reasons in Template.pm + # which get these values by parsing the template files. + my ($table, $kp, $fields) = @_; + if (!defined($table)) { + $table = 'passwd'; + } + if (!defined($kp)) { + $kp->{'key'} = 'system'; + $kp->{username} = 'root'; + $fields->[0] = 'password'; + $fields->[1] = 'cryptmethod'; + } + my $tabh = xCAT::Table->new($table); + unless ($tabh) { + return undef; + } + $data = $tabh->getAttribs($kp, @{$fields}); + if (!defined($data)) { + xCAT::MsgUtils->message("S", + "ERROR: Unable to get data from database table $table, key=$key"); + return undef; + } + $tabh->close(); + $password = $data->{'password'}; + if (!defined($password)) { + xCAT::MsgUtils->message("S", + "ERROR: Unable to get password from database table $table, key=$key"); + return undef; + } + $cryptmethod = $data->{'cryptmethod'}; + if (!$cryptmethod) { + # Use sha256 crypt method by default + $result = crypt($password, $CRYPT_METHOD{'sha256'} . xCAT::Utils::genpassword(8)); + } elsif( defined($CRYPT_METHOD{$cryptmethod})) { + $result = crypt($password, + $CRYPT_METHOD{$cryptmethod} . xCAT::Utils::genpassword(8)); + } else { + xCAT::MsgUtils->message("S", "Unsupported crypt method $cryptmethod"); + return undef; + } + return $result; +} diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index e4d99e749..2b72c6e39 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -15,6 +15,7 @@ use xCAT::ADUtils; #to allow setting of one-time machine passwords use xCAT::Utils; use xCAT::TableUtils; use xCAT::NetworkUtils; +use xCAT::PasswordUtils; use XML::Simple; BEGIN @@ -1573,28 +1574,27 @@ sub envvar return ($ENV{$envvar}); } -sub genpassword { - - #Generate a pseudo-random password of specified length - my $length = shift; - my $password = ''; - my $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890'; - srand; #have to reseed, rand is not rand otherwise - while (length($password) < $length) { - $password .= substr($characters, int(rand 63), 1); - } - return $password; -} - sub crydb { - my $result = tabdb(@_); + my ($table, $key, $field) = @_; + my @fields = [$field, 'cryptmethod']; + my $kp; - # 1 - MD5, 5 - SHA256, 6 - SHA512 - unless (($result =~ /^\$1\$/) || ($result =~ /^\$5\$/) || ($result =~ /^\$6\$/)) { - $result = crypt($result, '$1$' . genpassword(8)); - } - return $result; + my $get_query_map = sub { + my $key = shift; + my %kp; + foreach (split /,/, $key) { + my ($k, $v); + ($k, $v) = split /=/, $_; + $kp{$k} = $v if defined($k); + } + return \%kp if %kp; + sendmsg([ 1, "Unable to parse password parameters $key" ]); + return undef; + }; + $kp = $get_query_map->($key); + return undef if (!defined($kp)); + return xCAT::PasswordUtils::crypt_system_password($table, $kp, \@fields); } sub tabdb diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 929f2d578..688a800fc 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -37,6 +37,7 @@ use File::Path; use xCAT::Utils; use xCAT::TableUtils; use xCAT::SvrUtils; +use xCAT::PasswordUtils; use Digest::MD5 qw(md5_hex); Getopt::Long::Configure("bundling"); @@ -390,34 +391,27 @@ sub process_request { # before packaging the image system("umount $rootimg_dir/proc"); copybootscript($installroot, $rootimg_dir, $osver, $arch, $profile, $callback); - my $passtab = xCAT::Table->new('passwd'); - if ($passtab) { - my $pass = 'cluster'; - (my $pent) = $passtab->getAttribs({ key => 'system', username => 'root' }, 'password'); - if ($pent and defined($pent->{password})) { - $pass = $pent->{password}; - } - my $oldmask = umask(0077); - my $shadow; - open($shadow, "<", "$rootimg_dir/etc/shadow"); - my @shadents = <$shadow>; - close($shadow); - open($shadow, ">", "$rootimg_dir/etc/shadow"); - # 1 - MD5, 5 - SHA256, 6 - SHA512 - unless (($pass =~ /^\$1\$/) || ($pass =~ /^\$5\$/) || ($pass =~ /^\$6\$/)) { - $pass = crypt($pass, '$1$' . xCAT::Utils::genpassword(8)); - } - print $shadow "root:$pass:13880:0:99999:7:::\n"; - foreach (@shadents) { - unless (/^root:/) { - print $shadow "$_"; - } - } - close($shadow); - umask($oldmask); + my $pass = xCAT::PasswordUtils::crypt_system_password(); + if (!defined($pass)) { + $pass = 'cluster'; } + my $oldmask = umask(0077); + my $shadow; + open($shadow, "<", "$rootimg_dir/etc/shadow"); + my @shadents = <$shadow>; + close($shadow); + open($shadow, ">", "$rootimg_dir/etc/shadow"); + print $shadow "root:$pass:13880:0:99999:7:::\n"; + foreach (@shadents) { + unless (/^root:/) { + print $shadow "$_"; + } + } + close($shadow); + umask($oldmask); + # sync fils configured in the synclist to the rootimage $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename); if (defined($syncfile) && -f $syncfile diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index 9435e390d..4b5667648 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -16,6 +16,7 @@ use File::Temp; use xCAT::Utils qw(genpassword); use xCAT::TableUtils qw(get_site_attribute); use xCAT::SvrUtils; +use xCAT::PasswordUtils; use Data::Dumper; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -182,34 +183,26 @@ sub process_request { #get the root password for the node - my $passtab = xCAT::Table->new('passwd'); - if ($passtab) { - my $pass = 'cluster'; - (my $pent) = $passtab->getAttribs({ key => 'system', username => 'root' }, 'password'); - if ($pent and defined($pent->{password})) { - $pass = $pent->{password}; - } - my $oldmask = umask(0077); - my $shadow; - open($shadow, "<", "$rootimg_dir/etc/shadow"); - my @shadents = <$shadow>; - close($shadow); - open($shadow, ">", "$rootimg_dir/etc/shadow"); - - # 1 - MD5, 5 - SHA256, 6 - SHA512 - unless (($pass =~ /^\$1\$/) || ($pass =~ /^\$5\$/) || ($pass =~ /^\$6\$/)) { - $pass = crypt($pass, '$1$' . genpassword(8)); - } - print $shadow "root:$pass:13880:0:99999:7:::\n"; - foreach (@shadents) { - unless (/^root:/) { - print $shadow "$_"; - } - } - close($shadow); - umask($oldmask); + my $pass = xCAT::PasswordUtils::crypt_system_password(); + if (!defined($pass)) { + $pass = 'cluster'; } + my $oldmask = umask(0077); + my $shadow; + open($shadow, "<", "$rootimg_dir/etc/shadow"); + my @shadents = <$shadow>; + close($shadow); + open($shadow, ">", "$rootimg_dir/etc/shadow"); + print $shadow "root:$pass:13880:0:99999:7:::\n"; + foreach (@shadents) { + unless (/^root:/) { + print $shadow "$_"; + } + } + close($shadow); + umask($oldmask); + my $distname = $osver; unless (-r "$::XCATROOT/share/xcat/netboot/$distname/" or not $distname) { chop($distname); From b769d36e06c9f486581b69f8fcfdc74e7ce2b002 Mon Sep 17 00:00:00 2001 From: bybai Date: Tue, 22 Nov 2016 01:39:59 -0500 Subject: [PATCH 133/292] fix issue1873 Failed to find the directory: /.statelite/persistent after statelite installation --- xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh | 2 ++ xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh | 2 ++ 2 files changed, 4 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh index 40c1dbbe5..394009dac 100644 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-premount.sh @@ -1,6 +1,8 @@ #!/bin/sh #script to update nodelist.nodestatus during provision +XCAT="$(getarg XCAT=)" +STATEMNT="$(getarg STATEMNT=)" MASTER=`echo $XCAT |awk -F: '{print $1}'` getarg nonodestatus diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh index d0e4c97ba..131b5f74e 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh @@ -3,6 +3,8 @@ NEWROOT=/sysroot SERVER=${SERVER%%/*} SERVER=${SERVER%:} RWDIR=.statelite +XCAT="$(getarg XCAT=)" +STATEMNT="$(getarg STATEMNT=)" if [ ! -z $STATEMNT ]; then #btw, uri style might have left future options other than nfs open, will u se // to detect uri in the future I guess SNAPSHOTSERVER=${STATEMNT%:*} SNAPSHOTROOT=${STATEMNT#*/} From b31dda6da02f32d4a3ffe3f207dc02a41881644e Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 22 Nov 2016 02:37:54 -0500 Subject: [PATCH 134/292] Fix issue for genesis ppc64, wait 2+number_of_nics seconds for all NICs to be UP --- xCAT-genesis-builder/xcat-cmdline.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index babe106a5..67b08484e 100755 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -51,7 +51,7 @@ if [ $ARCH = "ppc64le" ]; then fi if [ $ARCH == 'ppc64' ]; then - + waittime=2 ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` for tmp in $ALL_NICS; do tmp_data=`ip link show $tmp | grep -v "^ " | grep "UP"` @@ -59,8 +59,10 @@ if [ $ARCH == 'ppc64' ]; then ip link set $tmp up fi tmp_data="UP" - sleep 1 + waittime=$(($waittime+1)) done + # wait 2+number_of_nics seconds for all the LINKed NICs to be UP + sleep $waittime fi while :; do screen -L -ln doxcat; done From 72f66aed71e23e37dbdafc8e992f2eaec91b66bd Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 22 Nov 2016 02:59:09 -0500 Subject: [PATCH 135/292] fix [fvt] nodeset node diskless image failed for could not find the diskless image #2188 --- xCAT-server/lib/xcat/plugins/debian.pm | 2 +- xCAT-server/lib/xcat/plugins/sles.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 57d66d4e6..89c405cbf 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1220,7 +1220,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-f -r $compressedrootimg) { + unless (-f -r "$rootimgdir/$compressedrootimg") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 033574f34..0d14e4080 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -379,7 +379,7 @@ sub mknetboot } } - unless (-r -f $compressedrootimg) { + unless (-r -f "$rootimgdir/$compressedrootimg") { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] From c4a058c6d523c50cf6a9a850b1cd37091856e83d Mon Sep 17 00:00:00 2001 From: immarvin Date: Sat, 19 Nov 2016 05:02:11 -0500 Subject: [PATCH 136/292] refine the conditional code logic on swith variables site table --- .../share/xcat/install/scripts/post.debian | 6 +++--- .../share/xcat/install/scripts/post.xcat | 7 ++++--- xCAT/postscripts/xcatdsklspost | 20 +++++++++---------- xCAT/postscripts/xcatinstallpost | 6 +++--- xCAT/postscripts/xcatpostinit1.install | 4 ++-- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index ad7a32ed3..f11296a24 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -160,12 +160,12 @@ mkdir -p /opt/xcat cat >/opt/xcat/xcatinstallpost << 'EOF' #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# if [ -f /xcatpost/mypostscript.post ]; then - RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` + RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2 | tr -d \'\" | tr A-Z a-z` fi -if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then +if [[ ! "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then chkconfig xcatpostinit1 off fi -echo "REBOOT=TRUE" >> /opt/xcat/xcatinf +echo "REBOOT=TRUE" >> /opt/xcat/xcatinfo EOF chmod 755 /opt/xcat/xcatinstallpost diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index f663f8161..2d6cffec7 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -28,6 +28,7 @@ if [[ $TFTPDIR != /* ]]; then TFTPDIR="/"$TFTPDIR fi +NODESTATUS=$(echo "$NODESTATUS"| tr -d \'\"| tr A-Z a-z) (cat << 'EOF' #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/updateflag.awk# @@ -337,18 +338,18 @@ cat >/opt/xcat/xcatinstallpost << 'EOF' #INCLUDE:#TABLE:site:key=installdir:value#/postscripts/xcatinstallpost# if [ -f /xcatpost/mypostscript.post ]; then - RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2` + RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /xcatpost/mypostscript.post |cut -d= -f2 | tr -d \'\" | tr A-Z a-z` fi if [[ $OSVER == ubuntu* ]]; then - if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + if [[ ! "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then update-rc.d -f xcatpostinit1 remove fi if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "update-rc.d -f xcatpostinit1 remove" "/var/log/xcat/xcat.log" fi else - if [ "$RUNBOOTSCRIPTS" != "'yes'" ] && [ "$NODESTATUS" = "'n'" ]; then + if [[ ! "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]] && [[ ! "$NODESTATUS" =~ ^(1|yes|y)$ ]]; then chkconfig xcatpostinit1 off if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then msgutil_r "$MASTER_IP" "debug" "service xcatpostinit1 disabled" "/var/log/xcat/xcat.log" diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 45b021da9..79379c960 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -24,13 +24,13 @@ if [ -f /xcatpost/mypostscript.post ]; then - XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` + XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post | cut -d= -f2 | tr -d \'\" | tr A-Z a-z` MASTER_IP=`grep '^MASTER_IP=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` else for param in `cat /proc/cmdline`; do key=`echo $param|awk -F= '{print $1}'` if [ "$key" = "xcatdebugmode" ]; then - XCATDEBUGMODE=`echo $param|awk -F= '{print $2}'` + XCATDEBUGMODE=`echo $param|awk -F= '{print $2}'| tr -d \'\" | tr A-Z a-z` fi if [ "$key" = "LOGSERVER" ]; then @@ -654,7 +654,7 @@ fi #save the USEFLOWCONTROL into the xcatinfo file #for updatenode case, passwd in with the -f flag if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ]; then - useflowcontrol=`grep '^USEFLOWCONTROL' /$xcatpost/mypostscript |cut -d= -f2` + useflowcontrol=`grep '^USEFLOWCONTROL' /$xcatpost/mypostscript |cut -d= -f2 | tr -d \'\" | tr A-Z a-z` fi if [ ! -f /opt/xcat/xcatinfo ]; then mkdir -p /opt/xcat @@ -662,7 +662,7 @@ if [ ! -f /opt/xcat/xcatinfo ]; then fi if [ -n "$useflowcontrol" ]; then # lets just put YES or NO in xcatinfo - if [ "$useflowcontrol" = "1" ] || [ "$useflowcontrol" = "yes" ] || [ "$useflowcontrol" = "YES" ]; then + if [[ "$useflowcontrol" =~ ^(1|yes|y)$ ]]; then new_fc="YES" else new_fc="NO" @@ -711,11 +711,11 @@ if [ "$MODE" = "6" ]; then echo "$TMP" > /$xcatpost/mypostscript # get the RUNBOOTSCRIPTS site variable if [ -f /$xcatpost/mypostscript ]; then - RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /$xcatpost/mypostscript |cut -d= -f2` + RUNBOOTSCRIPTS=`grep 'RUNBOOTSCRIPTS=' /$xcatpost/mypostscript |cut -d= -f2 | tr -d \'\" | tr A-Z a-z ` fi # if admin did not requested running of post boot scripts - then remove PBS - if [ "$RUNBOOTSCRIPTS" != "'yes'" ]; then + if [[ ! "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then #remove all the postscripts TMP=`sed "/# postbootscripts-start-here/,/# postbootscripts-end-here/ d" /$xcatpost/mypostscript` echo "$TMP" > /$xcatpost/mypostscript @@ -890,8 +890,8 @@ echo "$TMP" > /$xcatpost/mypostscript if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ] || [ "$MODE" = "6" ]; then #notify the server that we are done with netbooting - CNS=`grep NODESTATUS= /$xcatpost/mypostscript |awk -F = '{print $2}'` - if [ -z "$CNS" ] || [ "$CNS" != "'0'" -a "$CNS" != "'N'" -a "$CNS" != "'n'" ]; then + CNS=`grep NODESTATUS= /$xcatpost/mypostscript |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z` + if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then # TMP=`sed "/postscripts-start-here/ i\updateflag.awk \\$MASTER 3002 \\"installstatus configuring\\"" /$xcatpost/mypostscript` # echo "$TMP"> /$xcatpost/mypostscript if [ "$MODE" = "6" ]; then @@ -922,8 +922,8 @@ fi DHCP_TMP=`sed 's/\(DHCPINTERFACES=\)\(.*\)$/\1"\2"/' /$xcatpost/mypostscript` echo "$DHCP_TMP" > /$xcatpost/mypostscript -CLEANUPXCATPOST=`grep CLEANUPXCATPOST= /$xcatpost/mypostscript |awk -F = '{print $2}'` -if [ "$CLEANUPXCATPOST" = "'1'" ] || [ "$CLEANUPXCATPOST" = "'yes'" ]; then +CLEANUPXCATPOST=`grep CLEANUPXCATPOST= /$xcatpost/mypostscript |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z` +if [[ "$CLEANUPXCATPOST" =~ ^(1|yes|y)$ ]]; then echo "cd /" >> /$xcatpost/mypostscript # /xcatpost might be read-only for statelite nodes echo "rm -rf /$xcatpost/*" >> /$xcatpost/mypostscript diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 21309a79d..15c2068e5 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -7,7 +7,7 @@ . /xcatpost/xcatlib.sh if [ -f /xcatpost/mypostscript.post ]; then - XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` + XCATDEBUGMODE=`grep 'XCATDEBUGMODE=' /xcatpost/mypostscript.post |cut -d= -f2 | tr -d \'\" | tr A-Z a-z ` MASTER_IP=`grep '^MASTER_IP=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` OSVER=`grep '^OSVER=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` fi @@ -83,8 +83,8 @@ else fi -CNS=`grep NODESTATUS= /xcatpost/mypostscript.post |awk -F = '{print $2}'` -if [ -z "$CNS" ] || [ "$CNS" != "'0'" -a "$CNS" != "'N'" -a "$CNS" != "'n'" ]; then +CNS=`grep NODESTATUS= /xcatpost/mypostscript.post |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z` +if [ -z "$CNS" ] || [[ "$CNS" =~ ^(1|yes|y)$ ]]; then #update the node status during the postbootscript running #TMP=`sed "/postbootscripts-start-here/ i\updateflag.awk \\$MASTER 3002 \\"installstatus configuring\\"" /xcatpost/mypostscript.post` #echo "$TMP"> /xcatpost/mypostscript.post diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index 7bb736b84..4042b6699 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -23,9 +23,9 @@ start) REBOOT=`grep 'REBOOT' /opt/xcat/xcatinfo |cut -d= -f2 | tr -d \'\"` fi # if the xcatdsklspost file exists and this is a reboot - run xcatdsklspost with a mode of 6 - if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost ] && [[ "$RUNBOOTSCRIPTS" =~ ^1|yes|y$ ]]; then + if [ "$REBOOT" = "TRUE" -a -r /opt/xcat/xcatdsklspost ] && [[ "$RUNBOOTSCRIPTS" =~ ^(1|yes|y)$ ]]; then /opt/xcat/xcatdsklspost 6 - elif [ "$REBOOT" = "TRUE" ] && [[ "$NODESTATUS" =~ ^1|yes|y$ ]]; then + elif [ "$REBOOT" = "TRUE" ] && [[ "$NODESTATUS" =~ ^(1|yes|y)$ ]]; then /xcatpost/updateflag.awk $XCATSERVER 3002 "installstatus booted" else # run /opt/xcat/xcatinstallpost From 046cfe97a37c4d80a45f0438f3435db3993b7dd8 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 22 Nov 2016 13:17:31 -0500 Subject: [PATCH 137/292] Add more information to the tables to indicate the different update path for Linux vs AIX --- .../2016/20161130_hard_code_password.rst | 73 ++++++++++--------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/docs/source/security/2016/20161130_hard_code_password.rst b/docs/source/security/2016/20161130_hard_code_password.rst index 5c1fb3988..e9f57fd69 100644 --- a/docs/source/security/2016/20161130_hard_code_password.rst +++ b/docs/source/security/2016/20161130_hard_code_password.rst @@ -22,39 +22,42 @@ If running older versions of xCAT, update xCAT to a higher level code base that The following table describes the recommended update path: -+-------------------------+-----------------------------------+---------------------------------------+ -| xCAT Version | Action | Release Notes | -+=========================+===================================+=======================================+ -| **2.13**, or higher | No applicable | | -| | | | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.12.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.11.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.10.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.9.x** | Update to **2.9.4**, or higher | `2.9.4 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.8.x** | Update to **2.9.4**, or higher | `2.9.4 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.7.x** | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | -+-------------------------+-----------------------------------+---------------------------------------+ -| **2.6.x**, or earlier | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | -| | | | -+-------------------------+-----------------------------------+---------------------------------------+ ++-------------------------+-----------------------------------------------+---------------------------------------+ +| xCAT Version | Action | Release Notes | ++=========================+===============================================+=======================================+ +| **2.13**, or higher | No applicable | | +| | | | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.12.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.11.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.10.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.9.x** | Update to: | `2.9.4 Release Notes `_ | +| | - **2.12.3**, or higher for **LINUX** | | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.8.x** | Update to: | `2.9.4 Release Notes `_ | +| | - **2.12.3**, or higher for **LINUX** | | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.7.x** | Update to: | `2.7.10 Release Notes `_ | +| | - **2.12.3**, or higher for **LINUX** | | ++-------------------------+-----------------------------------------------+---------------------------------------+ +| **2.6.x**, or earlier | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | +| | | | ++-------------------------+-----------------------------------------------+---------------------------------------+ From 2e01c9b2d54a2bed6b1a6d480125465cbc486924 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 22 Nov 2016 21:41:21 -0500 Subject: [PATCH 138/292] check whether the network access between MN/CN and the node is ready with ping instead of checking whether the installnic is ip --- xCAT/postscripts/xcatinstallpost | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 15c2068e5..598cb93d4 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -25,25 +25,18 @@ MACADDR=`grep MACADDRESS= /xcatpost/mypostscript.post |awk -F = '{print $2}'|sed INSTALLNIC=`ip -o link|grep -i $MACADDR|awk '{print $2}'|sed s/://` -#the nics have not been configured when running the PBS sometimes, need to make sure... +# the network between the node and MASTER might be not well configured and activated when running the PBS sometimes +# need to make sure... RETRY=0 -NETUP=0 while true; do - #scan the nics with the specified mac address - #there will be multiple nic names for a mac address when the network bridge exists - for nic in $INSTALLNIC ;do - #check whether the nic is configured and linkup - ip -4 --oneline addr show dev $nic |grep inet >/dev/null && NETUP=1 && break - done + #check whether the network access between MN/CN and the node is ready + ping $MASTER_IP -c 1 >/dev/null && break - #nic is configured,terminate scan... - [ $NETUP -ne 0 ] && break; - RETRY=$[ $RETRY + 1 ] if [ $RETRY -eq 90 ];then #timeout, complain and exit - msgutil_r "$MASTER_IP" "err" "`date`: xcatinstallpost: Network not configured, please check..." "/var/log/xcat/xcat.log" + msgutil_r "$MASTER_IP" "err" "`date`: xcatinstallpost: the network between the node and $MASTER_IP is not ready, please check..." "/var/log/xcat/xcat.log" exit 1 fi From 63ffbae66ba36379d750876792c21a06a99ba15a Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 23 Nov 2016 00:30:08 -0500 Subject: [PATCH 139/292] Modify building failure in ubuntu --- xCAT-probe/debian/control | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xCAT-probe/debian/control b/xCAT-probe/debian/control index def2abb1b..89768f3c8 100644 --- a/xCAT-probe/debian/control +++ b/xCAT-probe/debian/control @@ -7,9 +7,5 @@ Standards-Version: 3.7.2 Package: xcat-probe Architecture: all -Depends: ${perl:Depends} - -#Sub-command 'xcatmn' need tools tftp, nslookup, wget. -Suggests: wget, dnsutils, tftp-hpa - +Depends: wget, dnsutils, tftp-hpa, ${perl:Depends} Description: Provides a toolkit to help probe all the possible issues in xCAT From 22d581b8c0afb54da5f854cf527c61711e8b7a40 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 23 Nov 2016 01:31:10 -0500 Subject: [PATCH 140/292] modify depending on gongjie's comment --- xCAT-probe/debian/control | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-probe/debian/control b/xCAT-probe/debian/control index 89768f3c8..f0b56bb3f 100644 --- a/xCAT-probe/debian/control +++ b/xCAT-probe/debian/control @@ -7,5 +7,6 @@ Standards-Version: 3.7.2 Package: xcat-probe Architecture: all -Depends: wget, dnsutils, tftp-hpa, ${perl:Depends} +Depends: ${perl:Depends} +Recommends: wget, dnsutils, tftp-hpa Description: Provides a toolkit to help probe all the possible issues in xCAT From d07f1e9a7791b41b8290a7bb73564989b7699e2e Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 23 Nov 2016 03:41:49 -0500 Subject: [PATCH 141/292] Fix bug2193:xcatprobe xcatmn could not probe mn's dns status #2193 --- xCAT-probe/subcmds/xcatmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index cee2a9e99..37d7ac33f 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -671,7 +671,7 @@ sub check_dns_service { } } } - } esle { + } else { $rst = 2; } From fd3b598e42cde9a0c9653f3ed05b7d5583f9e41a Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 24 Nov 2016 00:21:03 -0500 Subject: [PATCH 142/292] fix issue [CentOS6.8 and RHEL6.8] User will see ERROR message during running updatenode and in xcat.log on compute node. #2104 --- xCAT-server/sbin/xcatconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index e960e1640..fe6244c3b 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -989,7 +989,8 @@ sub genSSHNodeHostKey } # see if this system supports the ecdsa - if (-e "/etc/ssh/ssh_host_ecdsa_key") { + xCAT::Utils->runcmd('rm -rf /tmp/ecdsa_key >/dev/null 2>&1 ; /usr/bin/ssh-keygen -t ecdsa -f /tmp/ecdsa_key -P "" &>/dev/null', 0); + if ($::RUNCMD_RC == 0) { xCAT::MsgUtils->message('I', "Generating SSH2 ECDSA Key..."); $cmd = "/usr/bin/ssh-keygen -t ecdsa -f /etc/xcat/hostkeys/ssh_host_ecdsa_key -C '' -N ''"; From 113ed0de314a4231b5a71de219a36fb7e977c51f Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Thu, 24 Nov 2016 03:23:43 -0500 Subject: [PATCH 143/292] Fix issue2072 xCAT 2.12.3 - Policy table read incorrectly --- xCAT-server/lib/perl/xCAT/xcatd.pm | 70 ++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/xcatd.pm b/xCAT-server/lib/perl/xCAT/xcatd.pm index e9a3ef5cd..69de2fd25 100644 --- a/xCAT-server/lib/perl/xCAT/xcatd.pm +++ b/xCAT-server/lib/perl/xCAT/xcatd.pm @@ -85,6 +85,16 @@ sub validate { last; } } + + my %req_noderange_info; + if (defined $request->{noderange}->[0]) { + my @tmpn = xCAT::NodeRange::noderange($request->{noderange}->[0]); + $req_noderange_info{leftnodenum} = @tmpn; + if($req_noderange_info{leftnodenum}){ + $req_noderange_info{leftnodes} = \@tmpn; + } + } + RULE: foreach $rule (@sortedpolicies) { if ($rule->{name} and $rule->{name} ne '*') { @@ -113,10 +123,11 @@ sub validate { } } if ($found == 0) { # no command match - next; + next; } - } - if ($rule->{parameters} and $rule->{parameters} ne '*') { + } + + if ($rule->{parameters} and $rule->{parameters} ne '*') { my $parms; if ($request->{arg}) { $parms = join(' ', @{ $request->{arg} }); @@ -129,31 +140,36 @@ sub validate { } } if ($rule->{noderange} and $rule->{noderange} ne '*') { - my $matchall = 0; - if ($rule->{rule} =~ /allow/i or $rule->{rule} =~ /accept/i or $rule->{rule} =~ /trusted/i) { - $matchall = 1; + unless($req_noderange_info{leftnodenum}){ + next RULE; } - if (defined $request->{noderange}->[0]) { - my @tmpn = xCAT::NodeRange::noderange($request->{noderange}->[0]); - $request->{node} = \@tmpn; + my $allow = 0; + if ($rule->{rule} =~ /allow/i or $rule->{rule} =~ /accept/i or $rule->{rule} =~ /trusted/i) { + $allow = 1; } - unless (defined $request->{node}) { - next RULE; - } - my @reqnodes = @{ $request->{node} }; - my %matchnodes; + + my %rulenodes; foreach (noderange($rule->{noderange})) { - $matchnodes{$_} = 1; + $rulenodes{$_} = 1; } - REQN: foreach (@reqnodes) { - if (defined($matchnodes{$_})) { - if ($matchall) { - next REQN; - } else { - last REQN; - } - } elsif ($matchall) { + + my $hitnum = 0; + my @non_hit_nodes; + foreach (@{$req_noderange_info{leftnodes}}) { + if (defined($rulenodes{$_})) { + ++$hitnum; + }else{ + push @non_hit_nodes, $_; + } + } + + if($hitnum == 0){ + next RULE; + }elsif($hitnum && $hitnum != $req_noderange_info{leftnodenum}){ + if($allow){ + $req_noderange_info{leftnodenum} = @non_hit_nodes; + $req_noderange_info{leftnodes} = \@non_hit_nodes; next RULE; } } @@ -300,7 +316,13 @@ sub validate { } } # end RULE #Reached end of policy table, reject by default. - xCAT::MsgUtils->message("S", "Request matched no policy rule: peername=$peername, peerhost=$peerhost " . $request->{command}->[0]); + + if($req_noderange_info{leftnodenum}){ + my $leftnodes = join(",", @{$req_noderange_info{leftnodes}}); + xCAT::MsgUtils->message("S", "Request matched no policy rule: peername=$peername, peerhost=$peerhost $request->{command}->[0] to $leftnodes"); + }else{ + xCAT::MsgUtils->message("S", "Request matched no policy rule: peername=$peername, peerhost=$peerhost " . $request->{command}->[0]); + } return 0; } From 1a179e0f60e38603b5f144ed91da63bca4e0ff9c Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Thu, 24 Nov 2016 03:54:51 -0500 Subject: [PATCH 144/292] complete --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le | 4 ++-- xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index 99fb91d37..45e63dddc 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -72,7 +72,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index dbcdbe258..5697e813a 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -72,7 +72,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 4db9cbcf1851de423004027b451e2f342e36a98f Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 24 Nov 2016 20:29:07 -0500 Subject: [PATCH 145/292] update cases since statelite osimage is default defined after copycds --- .../installation/reg_linux_statelite_installation_flat | 2 -- .../reg_linux_statelite_installation_hierarchy_by_nfs | 2 -- .../reg_linux_statelite_installation_hierarchy_by_ramdisk | 2 -- xCAT-test/autotest/testcase/lslite/cases0 | 4 +++- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index f91187513..13885735d 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -19,8 +19,6 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:mkdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -u profile=compute provmethod=statelite osvers=__GETNODEATTR($$CN,os)__ -check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null; then cp /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile_sles.csv /tmp/litefile.csv;tabrestore /tmp/litefile.csv; elif cat /etc/*release |grep "Red Hat" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv;fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 467d6acab..d33cc5b1c 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -20,8 +20,6 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:mkdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -u profile=compute provmethod=statelite osvers=__GETNODEATTR($$CN,os)__ -check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi check:rc==0 cmd:xdsh $$SN 'cat /etc/exports|grep install; if [ "$?" -ne "0" ]; then echo "/install *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports; fi' diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index 36371771e..b0b3094c2 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -20,8 +20,6 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:mkdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -u profile=compute provmethod=statelite osvers=__GETNODEATTR($$CN,os)__ -check:rc==0 cmd:xdsh $$SN df|grep /install;if [ $? -eq 0 ] ;then xdsh $$SN umount /install;fi check:rc==0 cmd:xdsh $$SN 'cat /etc/exports|grep install; if [ "$?" -ne "0" ]; then echo "/install *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports; fi' diff --git a/xCAT-test/autotest/testcase/lslite/cases0 b/xCAT-test/autotest/testcase/lslite/cases0 index 7c6461b5a..5c350922c 100644 --- a/xCAT-test/autotest/testcase/lslite/cases0 +++ b/xCAT-test/autotest/testcase/lslite/cases0 @@ -1,7 +1,9 @@ start:lslite_i description:lslite -i os:Linux -cmd:mkdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -u profile=compute provmethod=statelite osvers=__GETNODEATTR($$CN,os)__ +cmd:copycds $$ISO +check:rc==0 +cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute check:rc==0 From bea547512a62502353a2c530ea6cda49c21eff08 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Tue, 20 Sep 2016 04:30:30 -0400 Subject: [PATCH 146/292] fix issue 1734: Update the help info for node.mac to know how to handle installnic bond --- docs/source/guides/admin-guides/references/man5/mac.5.rst | 4 +--- docs/source/guides/admin-guides/references/man7/group.7.rst | 2 +- docs/source/guides/admin-guides/references/man7/node.7.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man5/mac.5.rst b/docs/source/guides/admin-guides/references/man5/mac.5.rst index e25ae8291..3da1e7873 100644 --- a/docs/source/guides/admin-guides/references/man5/mac.5.rst +++ b/docs/source/guides/admin-guides/references/man5/mac.5.rst @@ -50,9 +50,7 @@ mac Attributes: \ **mac**\ - The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1"). - - + The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default. \ **comments**\ diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 25a2486a3..8aba447fa 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -431,7 +431,7 @@ group Attributes: \ **mac**\ (mac.mac) - The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1"). + The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default. diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index 52581902c..7099d763e 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -443,7 +443,7 @@ node Attributes: \ **mac**\ (mac.mac) - The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1"). + The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default. diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ebe64b87d..fb31b80b8 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -472,7 +472,7 @@ passed as argument rather than by table value', descriptions => { node => 'The node name or group name.', interface => 'The adapter interface name that will be used to install and manage the node. E.g. eth0 (for linux) or en0 (for AIX).)', - mac => 'The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1").', + mac => 'The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default.', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", }, From 8470c1409096cb725247cb9d54dbe948a90a1782 Mon Sep 17 00:00:00 2001 From: chenglch Date: Fri, 25 Nov 2016 16:09:31 +0800 Subject: [PATCH 147/292] Redirect progress message to rflash log files when updating firmware Previously rflash process will be terminated when the tty session is closed which is a very dangerous operation that may bricked the BMC. This patch will ignore the `int`, `term` and `hup` signal when rflash is running and redirect the output of ipmitool command to `/var/log/xcat/rflash/` which make the progress trackable. In addition, -V option is provided to print more verbose message from ipmitool when `hpm upgrade` command is running. This patch also update the node status in the `nodelist` table to record the rflash status. fix-issue: #1849 --- .../admin-guides/references/man1/rflash.1.rst | 10 +- xCAT-client/pods/man1/rflash.1.pod | 6 +- xCAT-server/lib/xcat/plugins/ipmi.pm | 134 ++++++++++++------ 3 files changed, 104 insertions(+), 46 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rflash.1.rst b/docs/source/guides/admin-guides/references/man1/rflash.1.rst index 8df12fca5..a77444506 100644 --- a/docs/source/guides/admin-guides/references/man1/rflash.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rflash.1.rst @@ -50,7 +50,7 @@ OpenPOWER BMC specific: ======================= -\ **rflash**\ \ *noderange*\ \ *hpm file path*\ [\ **-c | -**\ **-check**\ ] +\ **rflash**\ \ *noderange*\ \ *hpm file path*\ [\ **-c | -**\ **-check**\ ] [\ **-V**\ ] @@ -251,6 +251,14 @@ The command will update firmware for OpenPOWER BMC when given an OpenPOWER node rflash fs3 /firmware/8335_810.1543.20151021b_update.hpm + Print verbose message to rflash log file per node when updading firmware: + + + .. code-block:: perl + + rflash fs3 /firmware/8335_810.1543.20151021b_update.hpm -V + + diff --git a/xCAT-client/pods/man1/rflash.1.pod b/xCAT-client/pods/man1/rflash.1.pod index 9f501f3cf..4f55d8ea8 100644 --- a/xCAT-client/pods/man1/rflash.1.pod +++ b/xCAT-client/pods/man1/rflash.1.pod @@ -24,7 +24,7 @@ B I I =head2 OpenPOWER BMC specific: -B I I [B<-c>|B<--check>] +B I I [B<-c>|B<--check>] [B<-V>] =head1 B @@ -159,6 +159,10 @@ To update the firmware on OpenPOWER machine specify the node name and the file p rflash fs3 /firmware/8335_810.1543.20151021b_update.hpm +Print verbose message to rflash log file per node when updading firmware: + + rflash fs3 /firmware/8335_810.1543.20151021b_update.hpm -V + =back =head1 B diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index b4fd10250..5f72fa77d 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -31,6 +31,8 @@ use xCAT::ServiceNodeUtils; use xCAT::SvrUtils; use xCAT::NetworkUtils; use xCAT::Usage; +use File::Path; + use Thread qw(yield); use LWP 5.64; use HTTP::Request::Common; @@ -44,6 +46,11 @@ my %child_pids; my $IPMIXCAT = "/opt/xcat/bin/ipmitool-xcat"; my $NON_BLOCK = 1; +use constant RFLASH_LOG_DIR => "/var/log/xcat/rflash"; +unless (-d RFLASH_LOG_DIR) { + mkpath(RFLASH_LOG_DIR); +} + require xCAT::data::ibmhwtypes; eval { @@ -1722,23 +1729,23 @@ sub do_firmware_update { my $ret; my $ipmitool_ver; $ret = get_ipmitool_version(\$ipmitool_ver); - return $ret if $ret < 0; + exit $ret if $ret < 0; # only 1.8.15 or above support hpm update for firestone machines. if (calc_ipmitool_version($ipmitool_ver) < calc_ipmitool_version("1.8.15")) { $callback->({ error => "IPMITool $ipmitool_ver do not support firmware update for " . "firestone mathines, please setup IPMITool 1.8.15 or above.", errorcode => 1 }); - return -1; + exit -1; } - if (($hpm_data_hash{deviceID} ne $sessdata->{device_id}) || ($hpm_data_hash{productID} ne $sessdata->{prod_id}) || ($hpm_data_hash{manufactureID} ne $sessdata->{mfg_id})) { xCAT::SvrUtils::sendmsg([ 1, "The image file doesn't match this machine" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } + my $output; my $bmc_addr = $sessdata->{ipmisession}->{bmc}; my $bmc_userid = $sessdata->{ipmisession}->{userid}; @@ -1751,6 +1758,7 @@ sub do_firmware_update { $hpm_file = xCAT::Utils->full_path($hpm_file, $::cwd); } + # NOTE (chenglch) lanplus should be used for the task of hpm update # which indicate the bmc support ipmi protocol version 2.0. my $pre_cmd = "$IPMIXCAT -H $bmc_addr -I lanplus -U $bmc_userid"; @@ -1767,7 +1775,7 @@ sub do_firmware_update { if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } if ($output =~ /8335-GTB/) { $buffer_size = "15000"; @@ -1780,7 +1788,7 @@ sub do_firmware_update { if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } my $grs_version = $output =~ /OP8_v(\d*\.\d*_\d*\.\d*)/; if ($grs_version =~ /\d\.(\d+)_(\d+\.\d+)/) { @@ -1789,7 +1797,7 @@ sub do_firmware_update { if ($prim_grs_version <= 7 && $sec_grs_version < 2.55) { xCAT::SvrUtils::sendmsg([ 1, "Error: Current firmware level OP8v_$grs_version requires one-time manual update to at least version OP8v_1.7_2.55" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } } } @@ -1800,7 +1808,7 @@ sub do_firmware_update { if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } # step 2 reset cold @@ -1809,14 +1817,14 @@ sub do_firmware_update { if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } # check reset status unless (check_bmc_status_with_ipmitool($pre_cmd, 5, 24)) { xCAT::SvrUtils::sendmsg([ 1, "Timeout to check the bmc status" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } # step 3 protect network @@ -1825,25 +1833,24 @@ sub do_firmware_update { if ($::RUNCMD_RC != 0) { xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed: $output" ], $callback, $sessdata->{node}, %allerrornodes); - return -1; + exit -1; } # step 4 upgrade firmware - $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force"; - $output = xCAT::Utils->runcmd($cmd, -1); - - if ($::RUNCMD_RC != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Running ipmitool command $cmd failed." ], - $callback, $sessdata->{node}, %allerrornodes); - - # NOTE(chenglch) as the output message contains tty control text, just print - # the output message for debug. - print $output; - return -1; + $cmd = $pre_cmd . " -z " . $buffer_size . " hpm upgrade $hpm_file force "; + # check verbose debug option + for my $opt (@{$sessdata->{'extraargs'}}) { + if ($opt =~ /-V{1,4}/) { + $cmd .= lc($opt); + last; + } } - xCAT::SvrUtils::sendmsg("rflash completed.", $callback, $sessdata->{node}, - %allerrornodes); - return 0; + my $rflash_log_file = xCAT::Utils->full_path($sessdata->{node}.".log", RFLASH_LOG_DIR); + $cmd .= " >".$rflash_log_file." 2>&1"; + xCAT::SvrUtils::sendmsg([ 0, + "rflashing ... See the detail progress :\"tail -f $rflash_log_file\"" ], + $callback, $sessdata->{node}); + exec($cmd); } sub rflash { @@ -1855,7 +1862,8 @@ sub rflash { foreach my $opt (@{ $sessdata->{extraargs} }) { if ($opt =~ /^(-c|--check)$/i) { $sessdata->{subcommand} = "check"; - } elsif ($opt !~ /.*\.hpm$/i) { + # support verbose options for ipmitool command + } elsif ($opt !~ /.*\.hpm$/i && $opt !~ /^-V{1,4}$/) { $callback->({ error => "The option $opt is not supported", errorcode => 1 }); return; @@ -1916,8 +1924,13 @@ sub do_rflash_process { # child elsif ($pid == 0) { - $SIG{CHLD} = $SIG{INT} = $SIG{TERM} = "DEFAULT"; - + my $extra = $_[8]; + my @exargs = @$extra; + my $programe = \$0; + $$programe = "$node: rflash child process"; + if (grep(/^(-c|--check)$/i, @exargs)) { + $SIG{INT} = $SIG{TERM} = $SIG{HUP} = "DEFAULT"; + } # NOTE (chenglch): Actually if multiple client or rest api works on the same node, # the bmc of the node may not be protected while rflash is running. As xcat may not # support lock on node level, just require a lock for rflash command for specific node. @@ -1949,27 +1962,60 @@ sub start_rflash_processes { my %namedargs = @_; my $extra = $namedargs{-args}; my @exargs = @$extra; - - $SIG{INT} = $SIG{TERM} = sub { - foreach (keys %child_pids) { - kill 2, $_; - } - exit 0; - }; - $SIG{CHLD} = sub { - my $cpid; - while (($cpid = waitpid(-1, WNOHANG)) > 0) { - if ($child_pids{$cpid}) { - delete $child_pids{$cpid}; + # rflash processes can not be terminated from client + if (!grep(/^(-c|--check)$/i, @exargs)) { + $SIG{INT} = $SIG{TERM} = $SIG{HUP}="IGNORE"; + } else { + $SIG{INT} = $SIG{TERM} = $SIG{HUP} = sub { + foreach (keys %child_pids) { + kill 2, $_; } - } - }; + exit 0; + }; + } + my $rflash_status; foreach (@donargs) { do_rflash_process($_->[0], $_->[1], $_->[2], $_->[3], $_->[4], $ipmitimeout, $ipmitrys, $command, -args => \@exargs); + $rflash_status->{$_->[0]}->{status} = "updating firmware"; } - while ((scalar(keys %child_pids)) > 0) { - yield; + if (!grep(/^(-c|--check)$/i, @exargs)) { + my $nodelist_table = xCAT::Table->new('nodelist'); + if (!$nodelist_table) { + xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); + } else { + $nodelist_table->setNodesAttribs($rflash_status); + $nodelist_table->close(); + } + } + + # Wait for all processes to end + while (keys %child_pids) { + my ($node_status, $rc, $cpid); + if (($cpid = wait()) > 0) { + $rc = $?; + if (!grep(/^(-c|--check)$/i, @exargs)) { + $node_status->{node} = $child_pids{$cpid}; + if ($rc == 0) { + $node_status->{status} = "success to update firmware"; + } else { + $node_status->{status} = "failed to update firmware"; + } + my $nodelist_table = xCAT::Table->new('nodelist'); + if (!$nodelist_table) { + xCAT::MsgUtils->message("S", "Unable to open nodelist table, denying"); + } else { + $nodelist_table->setNodeAttribs($node_status->{node}, + { status => $node_status->{status} }); + $nodelist_table->close(); + } + xCAT::MsgUtils->message("S", + $node_status->{node}.": ". $node_status->{status}); + xCAT::SvrUtils::sendmsg([ $rc, + $node_status->{status} ], $callback, $node_status->{node}); + } + delete $child_pids{$cpid}; + } } } From ba9ddb06da3beda65a0ba04c0637672d58bdf71e Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 28 Nov 2016 09:33:15 -0500 Subject: [PATCH 148/292] fix issue [fvt]2.13 mypostscript syntax error in subroutine run_ps on sles11.4 #2183 --- xCAT/postscripts/xcatdsklspost | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 79379c960..28d9a3838 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -827,7 +827,7 @@ if [ $NODE_DEPLOYMENT -eq 1 ] || [ "$MODE" = "4" ] || [ "$MODE" = "6" ]; then else TMP=`sed "/# postscripts-start-here/,/# postscripts-end-here/ s/\(.*\)/run_ps postscript \1/;s/run_ps postscript\s*#/#/;s/run_ps postscript\s*$//" /$xcatpost/mypostscript` fi -echo " +echo "#!/bin/bash . /xcatpost/xcatlib.sh # global value to store the running status of the postbootscripts,the value is non-zero if one postbootscript failed From df6bf32775504c6bba4544fec9161a92ace89e26 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 28 Nov 2016 11:14:52 -0500 Subject: [PATCH 149/292] Add function to set description text into the switch --- xCAT-server/share/xcat/scripts/configBNT | 62 ++++++++++++++++++------ 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index c2a3f4355..cf98a3491 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -32,9 +32,11 @@ my @nodes; my @filternodes; -#--------------------------------------------------------- -#Main +$::SWITCH_TYPE="EthSwitch::BNT"; +#--------------------------------------------------------- +# Main +#--------------------------------------------------------- # parse the options if ( !GetOptions( @@ -49,6 +51,8 @@ if ( 'ip' => \$::IP, 'name' => \$::NAME, 'all' => \$::ALL, + 'V' => \$::VERBOSE, + 'desc=s' => \$::DESC, ) ) { @@ -67,7 +71,7 @@ if ($::SWITCH) { my @filternodes = xCAT::NodeRange::noderange( $::SWITCH ); if (nodesmissed) { my $nodenotdefined = join(',', nodesmissed); - xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT DB: $nodenotdefined"); + xCAT::MsgUtils->message("I","The following nodes are not defined in xCAT: $nodenotdefined"); } # check switch type my $switchestab = xCAT::Table->new('switches'); @@ -80,11 +84,11 @@ if ($::SWITCH) { } } unless (@nodes) { - xCAT::MsgUtils->message("E","No Valid Switch to process"); + xCAT::MsgUtils->message("E","No valid switches provided."); exit(1); } } else { - xCAT::MsgUtils->message("E","Invalid flag, please provide switches with --switches"); + xCAT::MsgUtils->message("E","A switch must be provided using the --switches keyword"); &usage; exit(1); } @@ -96,23 +100,21 @@ my $port; my $sub_req; my $rc; -if (($::IP) || ($::ALL)) -{ +if (($::IP) || ($::ALL)) { config_ip(); } - -if (($::NAME) || ($::ALL)) -{ +if (($::NAME) || ($::ALL)) { config_hostname(); } -if (($::SNMP) || ($::ALL)) -{ +if (($::SNMP) || ($::ALL)) { config_snmp(); } -if ($::VLAN) -{ +if ($::VLAN) { config_vlan(); } +if ($::DESC) { + config_desc(); +} sub config_ip { my @config_switches; @@ -370,6 +372,34 @@ sub config_vlan { } +sub config_desc { + # checking for port number, switches is checked earlier + if ($::PORT) { + $port = $::PORT; + } else { + xCAT::MsgUtils->message("E","Error - When setting description, a port must be provided."); + &usage; + exit(1); + } + + my $cmd_prefix = "xdsh $switches --devicetype $::SWITCH_TYPE"; + my $cmd; + + # Build up the commands for easier readability + $cmd = $cmd . "enable\;"; + $cmd = $cmd . "configure terminal\;"; + $cmd = $cmd . "interface port $port\;"; + $cmd = $cmd . "description \\\"$::DESC\\\"\;"; + $cmd = $cmd . "write memory\;"; + $cmd = $cmd . "exit\;exit\;"; + + my $final_cmd = $cmd_prefix . " \"" . $cmd . "\""; + print "Setting description=\"$::DESC\" on port $port of switches=$switches\n"; + if ($::VERBOSE) { + print "Executing cmd: \n==> $final_cmd\n"; + } + `$final_cmd` +} #--------------------------------------------------------- @@ -389,6 +419,10 @@ sub usage configBNT [--switches switchnames] [--name ] configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] configBNT [--switches switchnames] [--port port] [--vlan vlan] + + To set the description for a port on the switch: + + configBNT --switches switchnames --port port --desc \"description\" \n"; } From 8eb68137c20f4cabc355edba3507c2de15e08d64 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Tue, 29 Nov 2016 01:00:19 -0500 Subject: [PATCH 150/292] update to remove ntp check --- .../testcase/installation/Full_installation_flat_p8_le | 7 ++++--- .../installation/reg_linux_diskfull_installation_flat | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 5f67d3418..1963e34b0 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -37,7 +37,8 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d -cmd:xdsh $$CN service ntpd status -check:rc==0 -check:output=~running +#comment for futher discussion. +#cmd:xdsh $$CN service ntpd status +#check:rc==0 +#check:output=~running end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index cca15abed..7dd221137 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -58,9 +58,10 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 cmd:sleep 120 -cmd:xdsh $$CN service ntpd status -check:rc==0 -check:output=~running +#comment for further discussion +#cmd:xdsh $$CN service ntpd status +#check:rc==0 +#check:output=~running cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN From e48098eddd678322e8b924b43687f3c8235eb807 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Nov 2016 01:22:15 -0500 Subject: [PATCH 151/292] fix issue [fvt]diskfull provison node status always booting #2204 --- xCAT/postscripts/xcatpostinit1.install | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index 4042b6699..fcbd7bbe9 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -4,6 +4,18 @@ # description: the hook for systemd service unit to run PB and report node status on diskful node # processname: xcatpostinit1 +### BEGIN INIT INFO +# Provides: xcatpostinit1 +# Required-Start: $network $syslog +# Should-Start: +# Required-Stop: $network $syslog +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: hook to run xcat PBS and report node status +# Description: +### END INIT INFO + # Source function library. if [ -x /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions From 31832bc8fad027682f057b131a5c5dabf4ac4978 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Nov 2016 08:16:28 -0500 Subject: [PATCH 152/292] change the shebang of xcatpostinit1 to bash, since xcatpostinit1 used some bash features, in case that sh is not linked to bash --- xCAT/postscripts/xcatpostinit1 | 2 +- xCAT/postscripts/xcatpostinit1.install | 2 +- xCAT/postscripts/xcatpostinit1.netboot | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/xcatpostinit1 b/xCAT/postscripts/xcatpostinit1 index e4966b677..2af370840 100755 --- a/xCAT/postscripts/xcatpostinit1 +++ b/xCAT/postscripts/xcatpostinit1 @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html # This script is deprecated, please use xcatpostinit1.install instead # chkconfig: 345 84 59 diff --git a/xCAT/postscripts/xcatpostinit1.install b/xCAT/postscripts/xcatpostinit1.install index fcbd7bbe9..6a42d5e15 100755 --- a/xCAT/postscripts/xcatpostinit1.install +++ b/xCAT/postscripts/xcatpostinit1.install @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html # chkconfig: 345 84 59 # description: the hook for systemd service unit to run PB and report node status on diskful node diff --git a/xCAT/postscripts/xcatpostinit1.netboot b/xCAT/postscripts/xcatpostinit1.netboot index eae32c188..099c0b725 100755 --- a/xCAT/postscripts/xcatpostinit1.netboot +++ b/xCAT/postscripts/xcatpostinit1.netboot @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html # chkconfig: 345 84 59 # description: the hook in systemd service unit to run PB or report node status on diskless & statelite node From dc6581a1f277c5ad2c37670c6a92bbbd02a18cf9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:31:22 -0500 Subject: [PATCH 153/292] Have snmpmon set the community string Some BMCs do not default to 'public' for alerts. Change this to do public for now, since other parts of the code are still hard baked. --- xCAT-server/lib/xcat/monitoring/snmpmon.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/monitoring/snmpmon.pm b/xCAT-server/lib/xcat/monitoring/snmpmon.pm index 1a7cf4d4d..c0bbb6c1e 100644 --- a/xCAT-server/lib/xcat/monitoring/snmpmon.pm +++ b/xCAT-server/lib/xcat/monitoring/snmpmon.pm @@ -514,8 +514,8 @@ sub configBMC { $ret_text .= "Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"; } } elsif ($action == 1) { - print "XCATBYPASS=Y rspconfig $noderange alert=en\n"; - my $result = `XCATBYPASS=Y rspconfig $noderange alert=en 2>&1`; + print "XCATBYPASS=Y rspconfig $noderange alert=en community=public\n"; + my $result = `XCATBYPASS=Y rspconfig $noderange alert=en community=public 2>&1`; if ($?) { $ret_val = 1; xCAT::MsgUtils->message('S', "[mon]: Changeing SNMP PEF policy for IPMI nodes $noderange:\n $result\n"); From 95ae5430863df58d09ea20b873bf546f218aa64f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 29 Nov 2016 13:37:32 -0500 Subject: [PATCH 154/292] Revert "Undefine the release number so that the spec files will continue" This reverts commit 505a1c0556f684b204c0d5cbf955648d1df14209. --- makerpm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 912ddf3db..471943f1c 100755 --- a/makerpm +++ b/makerpm @@ -55,7 +55,7 @@ function makenoarch { tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" + rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz --define "version $VER" $REL "$EASE" RC=$? if [ $RPMNAME = "xCAT-UI" ]; then @@ -137,7 +137,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" RC=$? fi } @@ -170,7 +170,7 @@ function makegenesis { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec --define "version $VER" $REL "$EASE" } function makegenesisscripts { @@ -190,7 +190,7 @@ function makegenesisscripts { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$ARCH-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER*rpm echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$ARCH-$VER-snap*.noarch.rpm $EMBEDTXT..." - rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" + rpmbuild $QUIET -ba $DIR/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" } From 3e47bfb091082962ff41b4fca6dca8b97ca1988b Mon Sep 17 00:00:00 2001 From: Patrick Lundgren Date: Tue, 29 Nov 2016 13:41:53 -0500 Subject: [PATCH 155/292] Added instructions to update i40e driver on build machine to output --- xCAT-genesis-builder/buildrpm | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index 94f3399c5..d58980c64 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -24,19 +24,27 @@ if [ -z $1 ]; then HOSTOS="fedora23" fi if [ $BUILDARCH = 'ppc64' -a $HOSTOS != 'mcp' -a $HOSTOS != '-y' ]; then - echo "The steps below is used to installed mlnx driver 3.2-1, if you are sure you have it or newer driver, pls use \"-y\" to skip!" + echo "The steps below are used to install mlnx driver 3.2-1 and i40e driver 1.5.16, if you are sure you have these or newer drivers, pls use \"-y\" to skip!" echo "1. Install OS related packages" + echo " yum install rpmbuild" echo " yum install kernel-devel-`uname -r`" echo " yum install kernel-headers-`uname -r`" echo " yum install gcc-c++" echo "2. Download Mellanox EN Driver for Linux from http://www.mellanox.com/downloads/Drivers/mlnx-en-3.2-1.0.1.1.tgz" - echo "3. Extract it and run ./install.sh from the extracted directory" + echo " Download Intel EN Driver follow this link and download from webpage https://downloadcenter.intel.com/downloads/eula/24411/Intel-Network-Adapter-Driver-for-PCI-E-40-Gigabit-Ethernet-Network-Connections-under-Linux-?httpDown=https%3A%2F%2Fdownloadmirror.intel.com%2F24411%2Feng%2Fi40e-1.5.16.tar.gz" + echo "3. To install Mellanox Driver, extract it and run ./install.sh from the extracted directory" echo " tar -xvf mlnx-en-3.2-1.0.1.1.tgz" echo " ./mlnx-en-3.2-1.0.1.1/install.sh" - echo "4. Check whether the mlx4 driver is updated" + echo " To install Intel Driver, create rpm and install" + echo " rpmbuild -tb i40e-1.5.16.tar.gz" + echo " rpm -i //i40e-1.5.16-1.ppc64le.rpm" + echo " Additional Intel instructions can be found in README included in i40e-1.5.16.tar.gz" + echo "4. Check whether the drivers are updated" echo " modprobe mlx4-en" echo " modinfo mlx4-en | grep version" echo " version: 3.2-1.0.1.1 (31 Jan 2016)" + echo " modinfo i40e | grep version" + echo " version: 1.5.16" echo "5. Once the steps above done, run \"$0 -y\" to build xCAT-genesis-base-ppc64" exit 0 fi From c30cc158692cb353493bff9daf5df55d7cb9251a Mon Sep 17 00:00:00 2001 From: Patrick Lundgren Date: Tue, 29 Nov 2016 14:21:41 -0500 Subject: [PATCH 156/292] Corrected i40e-1.5.16.tar.gz download link --- xCAT-genesis-builder/buildrpm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/buildrpm b/xCAT-genesis-builder/buildrpm index d58980c64..2bad105ca 100755 --- a/xCAT-genesis-builder/buildrpm +++ b/xCAT-genesis-builder/buildrpm @@ -31,7 +31,7 @@ if [ $BUILDARCH = 'ppc64' -a $HOSTOS != 'mcp' -a $HOSTOS != '-y' ]; then echo " yum install kernel-headers-`uname -r`" echo " yum install gcc-c++" echo "2. Download Mellanox EN Driver for Linux from http://www.mellanox.com/downloads/Drivers/mlnx-en-3.2-1.0.1.1.tgz" - echo " Download Intel EN Driver follow this link and download from webpage https://downloadcenter.intel.com/downloads/eula/24411/Intel-Network-Adapter-Driver-for-PCI-E-40-Gigabit-Ethernet-Network-Connections-under-Linux-?httpDown=https%3A%2F%2Fdownloadmirror.intel.com%2F24411%2Feng%2Fi40e-1.5.16.tar.gz" + echo " Download Intel EN Driver follow this link and download from webpage https://downloadcenter.intel.com/downloads/eula/26370/Intel-Network-Adapter-Driver-for-PCI-E-Intel-40-Gigabit-Ethernet-Network-Connections-under-Linux-?httpDown=https%3A%2F%2Fdownloadmirror.intel.com%2F26370%2Feng%2Fi40e-1.5.16.tar.gz" echo "3. To install Mellanox Driver, extract it and run ./install.sh from the extracted directory" echo " tar -xvf mlnx-en-3.2-1.0.1.1.tgz" echo " ./mlnx-en-3.2-1.0.1.1/install.sh" From 8686edb86d6e5325899e102304c0c937d8511b8e Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Nov 2016 21:54:18 -0500 Subject: [PATCH 157/292] fix issue [CUSTOMER] Stale rootimg.gz file left in the rootimg dir caused node boot failed. #2225 --- xCAT-server/lib/xcat/plugins/packimage.pm | 9 ++------- xCAT-server/lib/xcat/plugins/rmimage.pm | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 60b419ec3..6d5d723a5 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -481,13 +481,8 @@ sub process_request { } $suffix = $method.".".$suffix; - unlink("$destdir/rootimg.sfs"); - unlink("$destdir/rootimg.gz"); - unlink("$destdir/rootimg.cpio.xz"); - unlink("$destdir/rootimg.cpio.gz"); - unlink("$destdir/rootimg.tar.xz"); - unlink("$destdir/rootimg.tar.gz"); - + unlink glob("$destdir/rootimg.*"); + if ($method =~ /cpio/) { if (!$exlistloc) { $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index ad35bd605..b6df56cd9 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -197,7 +197,7 @@ sub process_request { } my @filestoremove = ("$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); - my @rootimgtars=glob "$imagedir/rootimg.{tar,cpio}.{xz,gz}"; + my @rootimgtars=glob "$imagedir/rootimg.*"; push @filestoremove,@rootimgtars; #unmount all the mount points under rootimg directory #to avoid removing the directory/files on management node by mistake From 607dbd6c5c2c6b761eceb0febc5539e6c8dcae15 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 29 Nov 2016 22:26:00 -0500 Subject: [PATCH 158/292] buildkit returns Global symbol "$rmpdir" requires explicit package name --- xCAT-buildkit/bin/buildkit | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 3d705c54f..846edad06 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -3432,7 +3432,6 @@ sub kit_addpkgs $kittarfile = abs_path($kittarfile); foreach my $rpmdir (@pkgdirlist) { - print "rpmdir = $rmpdir\n"; if (!(-d $rpmdir)) { print "The package directory $rpmdir could not be read. \n"; return 1; From 003290702e0045d1baf193912bf75736f6f3b38e Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 30 Nov 2016 02:59:40 -0500 Subject: [PATCH 159/292] a syntax error within mknb.pm --- 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 76e0b2a05..e920fb1e4 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -74,7 +74,7 @@ sub process_request { } } my $nicips = xCAT::NetworkUtils->get_nic_ip(); - foreach (keys $nicips) { + foreach (keys %$nicips) { # To support tagged vlan, create entries in the hash for the # interface name removing the physical interface ending: # 'enP1p12s0f0.2@enP1p12s0f0' => 'enP1p12s0f0.2' From 9781c1a2b87d1ec81aee4b15e53806a3cf5b7a52 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 30 Nov 2016 03:48:24 -0500 Subject: [PATCH 160/292] uopdate for vm debug --- .../testcase/installation/Diskless_installation_flat_p8_le | 4 +++- .../testcase/installation/ubuntu_diskless_installation_vm | 4 +++- xCAT-test/autotest/testcase/migration/redhat_migration | 4 ++-- xCAT-test/autotest/testcase/migration/sles_migration | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 28db2b5b4..cdd4e875d 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -5,7 +5,9 @@ cmd:copycds $$ISO check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p ;mkvm $$CN -s 20G; fi;fi +#comment for vm debug +#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p ;mkvm $$CN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi check:rc==0 cmd:makedns -n check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 5ada5a6ca..abf14d1c8 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -5,7 +5,9 @@ cmd:copycds $$ISO check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc=0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +#comment for vm debug +#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p ;mkvm $$CN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index 30882049f..a5fad7718 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -7,7 +7,7 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n @@ -118,7 +118,7 @@ stop:yes #check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index 91fec010c..a41e56828 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -7,7 +7,7 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n @@ -120,7 +120,7 @@ description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two #check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p && mkvm $$CN -s 20G; fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n From 3c6fc950567e1b793f19e866fa0efd84ac937a9b Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 30 Nov 2016 03:50:54 -0500 Subject: [PATCH 161/292] complete --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 4 ++-- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 996bc7d99..9d76147bb 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -71,7 +71,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index 6a0bbe636..139391885 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -71,7 +71,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 4902e5703426ad81f6fb1c717b681fde1858e284 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 30 Nov 2016 17:00:14 +0800 Subject: [PATCH 162/292] update spelling mistake --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 996bc7d99..9d76147bb 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -71,7 +71,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 2559fdd9f369fc339517d767f11a962fab332045 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 30 Nov 2016 17:00:56 +0800 Subject: [PATCH 163/292] update spelling mistake --- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index 6a0bbe636..139391885 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -71,7 +71,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y install xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y install xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /oldxcat/old_version" check:rc==0 @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xCAT-test" +cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 6dbd5c88d5aff39f6f4162108f78afb5f7af0704 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 30 Nov 2016 06:38:29 -0500 Subject: [PATCH 164/292] fix 2231 Failed to generate osimage definiton for sles11.4-x86_64-statelite-compute after copycds --- xCAT-server/lib/xcat/plugins/sles.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 0d14e4080..d564f74eb 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -2215,6 +2215,10 @@ sub copycd if ($ret[0] != 0) { $callback->({ data => "Error when updating the osimage tables for stateless: " . $ret[1] }); } + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); + } } } From d92f4b06970d6e569ebe8f3d06b863c1776ec229 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 30 Nov 2016 08:36:12 -0500 Subject: [PATCH 165/292] fix no persistent dir in statelite ramdisk --- xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 8c567823d..6e9e524ba 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -6,7 +6,7 @@ RWDIR=.statelite . /lib/dracut-lib.sh XCAT="$(getarg XCAT=)" XCATMASTER=$XCAT - +STATEMNT="$(getarg STATEMNT=)" rootlimit="$(getarg rootlimit=)" getarg nonodestatus From 45a7f59b853b8d67f512408e1d25f1fdd02913be Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 30 Nov 2016 12:27:31 -0500 Subject: [PATCH 166/292] Update the table to reflect the update path for security bulletin to be for 2.9 release only for AIX --- .../2016/20161130_hard_code_password.rst | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/docs/source/security/2016/20161130_hard_code_password.rst b/docs/source/security/2016/20161130_hard_code_password.rst index e9f57fd69..80d81a695 100644 --- a/docs/source/security/2016/20161130_hard_code_password.rst +++ b/docs/source/security/2016/20161130_hard_code_password.rst @@ -25,7 +25,7 @@ The following table describes the recommended update path: +-------------------------+-----------------------------------------------+---------------------------------------+ | xCAT Version | Action | Release Notes | +=========================+===============================================+=======================================+ -| **2.13**, or higher | No applicable | | +| **2.13**, or newer | No applicable | | | | | | +-------------------------+-----------------------------------------------+---------------------------------------+ | **2.12.x** | Update to **2.12.3**, or higher | `2.12.3 Release Notes `_ | +-------------------------+-----------------------------------------------+---------------------------------------+ -| **2.9.x** | Update to: | `2.9.4 Release Notes `_ | | | - **2.12.3**, or higher for **LINUX** | | +-------------------------+-----------------------------------------------+---------------------------------------+ -| **2.8.x** | Update to: | `2.9.4 Release Notes `_ | -| | - **2.12.3**, or higher for **LINUX** | | -+-------------------------+-----------------------------------------------+---------------------------------------+ -| **2.7.x** | Update to: | `2.7.10 Release Notes `_ | -| | - **2.12.3**, or higher for **LINUX** | | -+-------------------------+-----------------------------------------------+---------------------------------------+ -| **2.6.x**, or earlier | Update to **2.7.10**, or higher | `2.7.10 Release Notes `_ | -| | | | -+-------------------------+-----------------------------------------------+---------------------------------------+ From 9cf54f66cbae39837339503e22da4a2b171602e6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 30 Nov 2016 13:41:48 -0500 Subject: [PATCH 167/292] Review recommended changes --- .../prepostscripts/postinstall_script.rst | 61 +++++++++---------- .../references/man5/linuximage.5.rst | 2 +- .../references/man7/osimage.7.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 2 +- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst index 4eb204078..f212c8691 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/prepostscripts/postinstall_script.rst @@ -1,51 +1,48 @@ .. _Using-Postinstallscript-label: -Using Postinstall Script ------------------------- -While generating the rootimage directory for diskless or statelite osimage with ``genimage``, you may want to customize the rootimage after the package installation. The `postinstall` attribute of the osimage definition provides a hook to run user specicied script(s) against the rootimage directory in non-chrooted mode. +========================= +Using postinstall scripts +========================= +While running ``genimage`` to generate diskless or statelite osimage, you may want to customize the root image after the package installation step. The ``postinstall`` attribute of the osimage definition provides a hook to run user specified script(s), in non-chroot mode, against the directory specified by ``rootimgdir`` attribute. -xCAT ships the default postinstall scripts for the diskless/statelite osimages created with ``copycds``, for example :: +xCAT ships a default ``postinstall`` script for the diskless/statelite osimages that must be executed to ensure a successful provisioning of the OS: :: - >lsdef -t osimage -o rhels7.3-ppc64le-netboot-compute -i postinstall + lsdef -t osimage -o rhels7.3-ppc64le-netboot-compute -i postinstall Object name: rhels7.3-ppc64le-netboot-compute postinstall=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall -Notice: All the operations inside the default postinstall scripts are mandatory for the osimage provision. If you want to customize the postinstall script for an osimage, you should make sure the contents of default postinstall script are included. This can be done in either of the following ways: +Customizing the ``postinstall`` script, can be done by either one of the methods below: - 1. Append your own postinstall scripts by ``chdef -t osimage -o -p postinstall=`` - 2. Create your own postinstall script based on the default postinstall script, then ``chdef -t osimage -o postinstall=`` + * Append your own ``postinstall`` scripts :: -The following are some key points in Q/A format, that will help you understand the usage of postinstall scripts: + chdef -t osimage -o -p postinstall=/install/custom/postinstall/rh7/mypostscript -When will the postinstall scripts run? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * Create your own ``postinstall`` script based on the default ``postinstall`` script :: -In general, the brief workflow of ``genimage`` is: + cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall /install/custom/postinstall/rh7/mypostscript + # edit /install/custom/postinstall/rh7/mypostscript + chdef -t osimage -o postinstall=/install/custom/postinstall/rh7/mypostscript -a) install the packages specified in package list under rootimage directory -b) cumstomizing the rootimage directory, such as system configuration file generation/modification -c) generate the initrd based on the rootimage directory +Common questions about the usage of ``postinstall`` scripts: +------------------------------------------------------------ -The postinstall scripts are run in step b). +When do ``postinstall`` scripts run? +```````````````````````````````````` -Are postinstall scripts run in chrooted mode under rootimage directory? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +High level flow of ``genimage`` process: -No. Unlike postscripts & postbootscripts, the postinstall scripts are run in non-chrooted mode. In the postinstall scripts, all the paths of the directories and files are based on the "/" of the managememnt node. You can change the working directory to rootimage directory with ``cd $IMG_ROOTIMGDIR``. "$IMG_ROOTIMGDIR" is an environment variable exported by genimage containing the full path of the rootimage directory on management node. +a) install the packages specified by ``pkglist`` into ``rootimgdir`` directory +b) cumstomize the ``rootimgdir`` directory +c) generate the initrd based on the ``rootimgdir`` directory -What are some of the environment variables available to my customized scripts? -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +The ``postinstall`` scripts are executed in step b). -Besides "$IMG_ROOTIMGDIR" mentioned above, ``genimage`` exports a batch of environment variables while postinstall scripts are run, which can be used in your customized scipts. :: +Do ``postinstall`` scripts execute in chroot mode under ``rootimgdir`` directory? +````````````````````````````````````````````````````````````````````````````````` - IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), - IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), - IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"), - IMG_KERNELVERSION(the "kernelver" attribute of the osimage), - IMG_PROFILE(the profile of the osimage, such as "service","compute"), - IMG_PKGLIST(the "pkglist" attribute of the osimage), - IMG_PKGDIR(the "pkgdir" attribute of the osimage), - IMG_OTHERPKGLIST(the "otherpkglist" attribute of the osimage), - IMG_OTHERPKGDIR(the "otherpkgdir" attribute of the osimage), - IMG_ROOTIMGDIR(the "rootimgdir" attribute of the osimage) +No. Unlike postscripts and postbootscripts, the ``postinstall`` scripts are run in non-chroot environment, directly on the management node. In the postinstall scripts, all the paths of the directories and files are based on ``/`` of the managememnt node. To reference inside the ``rootimgdir``, use the ``$IMG_ROOTIMGDIR`` environment variable, exported by ``genimage``. +What are some of the environment variables available to my customized ``postinstall`` scripts? +`````````````````````````````````````````````````````````````````````````````````````````````` + +Environment variables, available to be used in the ``postinstall`` scripts are listed in ``postinstall`` attribute section of :doc:`linuximage ` diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index 2e972ee76..a8f7eb915 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -92,7 +92,7 @@ linuximage Attributes: \ **postinstall**\ - Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + Supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: .. code-block:: perl diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index 03f66618e..8ed314325 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -313,7 +313,7 @@ osimage Attributes: \ **postinstall**\ (linuximage.postinstall) - Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + Supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: .. code-block:: perl diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index a7045956d..6ee250ccf 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -774,7 +774,7 @@ passed as argument rather than by table value', otherpkglist => 'The fully qualified name of the file that stores non-distro package lists that will be included in the image. It could be set to multiple paths. The multiple paths must be separated by ",".', otherpkgdir => 'The base directory where the non-distro packages are stored. Only 1 local directory supported at present.', exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.', - postinstall => 'Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: + postinstall => 'Supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be seperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts: IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"), IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"), From 3370a7d48e333f4fe3c6c55d39dc8ab8e67373b1 Mon Sep 17 00:00:00 2001 From: bybai Date: Wed, 30 Nov 2016 22:34:42 -0500 Subject: [PATCH 168/292] fix statelite persistent dir use short name --- xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh | 2 +- xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh index 131b5f74e..56401e96d 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh @@ -41,7 +41,7 @@ fi mount -t tmpfs rw $NEWROOT/$RWDIR mkdir -p $NEWROOT/$RWDIR/tmpfs -ME=`hostname` +ME=`hostname -s` if [ ! -z $NODE ]; then ME=$NODE fi diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 6e9e524ba..c4d6c17dd 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -160,7 +160,7 @@ elif [ -r /rootimg-statelite.gz ]; then mount -t tmpfs rw $NEWROOT/$RWDIR mkdir -p $NEWROOT/$RWDIR/tmpfs - ME=`hostname` + ME=`hostname -s` if [ ! -z $NODE ]; then ME=$NODE fi From 77bc92534e9e1f999c7961d5d769cb8ccc931d31 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 1 Dec 2016 00:51:03 -0500 Subject: [PATCH 169/292] remove invalid cases from bundle files --- xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle | 3 --- xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle | 3 --- xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle | 3 --- xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle | 3 --- xCAT-test/autotest/bundle/sles11.4_ppc64.bundle | 3 --- 5 files changed, 15 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle index ba479da63..2ce66a4df 100644 --- a/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.7_ppc64.bundle @@ -270,9 +270,6 @@ switchdiscover_range_z switchdiscover_range_z_V makentp_v makentp_h -makentp_V -makentp -makentp_a nodeset_check_warninginfo runcmdinstaller_h runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle index 0528fa834..a3693a1f2 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_ppc64.bundle @@ -275,9 +275,6 @@ switchdiscover_range_z switchdiscover_range_z_V makentp_v makentp_h -makentp_V -makentp -makentp_a nodeset_check_warninginfo runcmdinstaller_h runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle index 0528fa834..a3693a1f2 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64.bundle @@ -275,9 +275,6 @@ switchdiscover_range_z switchdiscover_range_z_V makentp_v makentp_h -makentp_V -makentp -makentp_a nodeset_check_warninginfo runcmdinstaller_h runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle index 0528fa834..a3693a1f2 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64.bundle @@ -275,9 +275,6 @@ switchdiscover_range_z switchdiscover_range_z_V makentp_v makentp_h -makentp_V -makentp -makentp_a nodeset_check_warninginfo runcmdinstaller_h runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle index d0992c014..6084ed160 100644 --- a/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_ppc64.bundle @@ -257,9 +257,6 @@ switchdiscover_range_z switchdiscover_range_z_V makentp_v makentp_h -makentp_V -makentp -makentp_a nodeset_check_warninginfo xcatconfig_u_check_xcatsslversion_rhels_sles reg_linux_diskless_installation_flat From 7c5ef745659f383fff01a6254782a0b64e1838ee Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 1 Dec 2016 16:37:46 +0800 Subject: [PATCH 170/292] Become process group leader when updating firmware As exec is invoked, child process can not ignore the signal sent to the process group, use setpgrp to set the pgid to itself. close-issue: #1849 --- xCAT-server/lib/xcat/plugins/ipmi.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 5f72fa77d..1138bac9b 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -1924,6 +1924,11 @@ sub do_rflash_process { # child elsif ($pid == 0) { + unless (setpgrp()) { + xCAT::SvrUtils::sendmsg([ 1, "Faild to run setgprp for $$ process" ], + $callback, $node); + exit(1); + } my $extra = $_[8]; my @exargs = @$extra; my $programe = \$0; From e2bbd534fbb9bb590c639bb7caad3d96ada5407c Mon Sep 17 00:00:00 2001 From: ertaozh Date: Fri, 2 Dec 2016 01:39:43 -0500 Subject: [PATCH 171/292] To have xcat 2.13 build use package name like snap... --- buildcore.sh | 2 +- makerpm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/buildcore.sh b/buildcore.sh index d9e7a7899..0343d0376 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -180,7 +180,7 @@ function setversionvars { VER=`cat Version` fi XCATVER=$VER - export XCATVER + #export XCATVER SHORTVER=`echo $VER|cut -d. -f 1,2` SHORTSHORTVER=`echo $VER|cut -d. -f 1` BUILD_TIME=`date` diff --git a/makerpm b/makerpm index 471943f1c..f29794b10 100755 --- a/makerpm +++ b/makerpm @@ -215,6 +215,8 @@ fi OSNAME=$(uname) if [ -z "$XCATVER" ] ; then VER=`cat Version` + REL="--define" + EASE='usedate 1' else VER=$XCATVER REL="--define" From 7c20f65fefeaf51d6d652f14958d7ef037dc7bd5 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 2 Dec 2016 09:07:04 -0500 Subject: [PATCH 172/292] modify litefile for ntp issue --- xCAT-test/autotest/testcase/installation/litefile.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/litefile.csv b/xCAT-test/autotest/testcase/installation/litefile.csv index a199574bf..7eaf1527d 100644 --- a/xCAT-test/autotest/testcase/installation/litefile.csv +++ b/xCAT-test/autotest/testcase/installation/litefile.csv @@ -13,6 +13,8 @@ "ALL","/etc/resolv.conf.predhclient","tmpfs",, "ALL","/etc/sysconfig/","tmpfs",, "ALL","/etc/ssh/","tmpfs",, +"ALL","/etc/systemd/system/multi-user.target.wants/","tmpfs",, +"ALL","/usr/lib/systemd/system/ntpd.service","tmpfs",, "ALL","/tmp/","tmpfs",, "ALL","/var/","tmpfs",, "ALL","/opt/xcat/","tmpfs",, From b30ed57db28abe36be9259da8cfcce336d762d25 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 2 Dec 2016 10:05:55 -0500 Subject: [PATCH 173/292] - Bump up the version to 2.13.0 - Edit the makerpm to replace version of xCAT-genesis-base.spec file so there's no need to manually set the VERSION. We do need a better way for the RELEASE variable - Require xCAT-genesis-base >= 2.13.0 for the rebuild of genesis-base - Clean up the builder rpm to include directories to clean up correctly on rpm removal --- Version | 2 +- makerpm | 6 ++++++ xCAT-genesis-builder/xCAT-genesis-base.spec | 6 ++---- xCAT-genesis-builder/xCAT-genesis-builder.spec | 8 +++++++- xCAT-genesis-scripts/xCAT-genesis-scripts.spec | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Version b/Version index ae656d473..fb2c0766b 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13 +2.13.0 diff --git a/makerpm b/makerpm index f29794b10..0eb34bdcf 100755 --- a/makerpm +++ b/makerpm @@ -162,9 +162,15 @@ function makeironic { # Make the xCAT-genesis rpm function makegenesis { DIR="xCAT-genesis-builder" + SPEC_FILE="xCAT-genesis-base.spec" RPMNAME="$1" cd `dirname $0`/$DIR + GEN_BASE_REL=0 + sed -i s/%%REPLACE_CURRENT_VERSION%%/${VER}/g ${SPEC_FILE} + sed -i s/%%REPLACE_RELEASE%%/${GEN_BASE_REL}/g ${SPEC_FILE} tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 . + # undo the changes from the SED command above so it's not tracked by Git + git checkout ${SPEC_FILE} cp LICENSE.html $RPMROOT/BUILD cp $RPMNAME.spec $RPMROOT/SOURCES cd - >/dev/null diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index f90bfa022..1fb25a3e5 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,5 @@ -%define version 2.12 +%define version %%REPLACE_CURRENT_VERSION%% +%define release %%REPLACE_RELEASE%% Version: %{?version:%{version}}%{!?version:%(cat Version)} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 @@ -17,13 +18,10 @@ BuildArch: noarch %define __prelink_undo_cmd %{nil} # To fix the issue error: Arch dependent binaries in noarch package, the following line is needed on Fedora 23 ppc64 %define _binaries_in_noarch_packages_terminate_build 0 -Epoch: 1 AutoReq: false Prefix: /opt/xcat AutoProv: false - - Name: %{name} Group: System/Utilities License: Various (see individual packages for details) diff --git a/xCAT-genesis-builder/xCAT-genesis-builder.spec b/xCAT-genesis-builder/xCAT-genesis-builder.spec index b69f6bfdd..91d301d44 100644 --- a/xCAT-genesis-builder/xCAT-genesis-builder.spec +++ b/xCAT-genesis-builder/xCAT-genesis-builder.spec @@ -40,4 +40,10 @@ cd - %Files %defattr(-,root,root) %doc LICENSE.html -/opt/xcat/share/xcat/netboot/genesis/builder +%dir %{prefix} +%dir %{prefix}/share +%dir %{prefix}/share/xcat +%dir %{prefix}/share/xcat/netboot +%dir %{prefix}/share/xcat/netboot/genesis +%dir %{prefix}/share/xcat/netboot/genesis/builder +%{prefix}/share/xcat/netboot/genesis/builder/* diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index c10abfbf6..b85ad7b7e 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -31,7 +31,7 @@ Vendor: IBM Corp Summary: xCAT Genesis netboot image - Core content URL: http://xcat.org Source1: xCAT-genesis-scripts.tar.bz2 -Requires: xCAT-genesis-base-%{tarch} +Requires: xCAT-genesis-base-%{tarch} >= 2.13.0 Buildroot: %{_localstatedir}/tmp/xCAT-genesis Packager: IBM Corp. From 2510697f039a9b8fbf091ed08241137fa64b4568 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 29 Nov 2016 01:16:03 -0500 Subject: [PATCH 174/292] refine the doc on raid --- .../common/deployment/raid_cfg.rst | 52 +++++-------------- 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst index cc90f1f4a..2374f13ae 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst @@ -6,59 +6,31 @@ Overview This section describes how to use xCAT to deploy diskful nodes with RAID1 setup, and the procedure for RAID1 maintainence activities such as replacing a failed disk. -All the examples in this section are based on three configuration scenarios: +xCAT provides an user interface :doc:`linuximage.partitionfile ` to specify the customized partition script for diskful provision, and provides some default partition scripts to configure RAID1 on system Power server. -#. RHEL6 on a system p machine with two SCSI disks sda and sdb - -#. RHEL6 on a system p machine with two SAS disks and multipath configuration. - -#. SLES 11 SP1 on a system p machine with two SCSI disks sda and sdb - -If you are not using the configuration scenarios listed above, you may need to modify some of the steps in this documentation to make it work in your environment. Deploy Diskful Nodes with RAID1 Setup on RedHat ----------------------------------------------- -xCAT provides two sample kickstart template files with the RAID1 settings, ``/opt/xcat/share/xcat/install/rh/service.raid1.rhel6.ppc64.tmpl`` is for the configuration scenario **1** listed above and ``/opt/xcat/share/xcat/install/rh/service.raid1.multipath.rhel6.ppc64.tmpl`` is for the configuration scenario **2** listed above. You can customize the template file and put it under ``/install/custom/install//`` if the default one does not match your requirements. +xCAT provides a partition script `raid1_rh.partscript `_ which setup RAID1 on 2 disks on Power8 LE server, "raid1_rh.partscript" is composed of 2 parts: -Here is the RAID1 partitioning section in ``service.raid1.rhel6.ppc64.tmpl``: :: +1) the logic to pickup the disks to setup RAID +2) the logic to generate raid/partition scheme file "/tmp/partitionfile". - #Full RAID 1 Sample - part None --fstype "PPC PReP Boot" --size 8 --ondisk sda --asprimary - part None --fstype "PPC PReP Boot" --size 8 --ondisk sdb --asprimary +In most cases, this partition script "raid1_rh.partscript" is suffice for you to create a basic 2-disk RAID1 on your server. If you have some specific requirements on disks or partition scheme of the RAID, you need to provide your own partition script, "raid1_rh.partscript" is self-explanation and can be a reference for you. To simplify the introduction here, "raid1_rh.partscript" will be used as the partition script, the steps is listed below: - part raid.01 --size 200 --fstype ext4 --ondisk sda - part raid.02 --size 200 --fstype ext4 --ondisk sdb - raid /boot --level 1 --device md0 raid.01 raid.02 +1. obtain the partition script: :: - part raid.11 --size 1024 --ondisk sda - part raid.12 --size 1024 --ondisk sdb - raid swap --level 1 --device md1 raid.11 raid.12 + wget -O /install/custom/raid1_rh.partscript - part raid.21 --size 1 --fstype ext4 --grow --ondisk sda - part raid.22 --size 1 --fstype ext4 --grow --ondisk sdb - raid / --level 1 --device md2 raid.21 raid.22 +2. specify the partition script for osimage: :: -Here is the RAID1 partitioning section in ``service.raid1.multipath.rhel6.ppc64.tmpl``: :: + chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/raid1_rh.partscript" - #Full RAID 1 Sample - part None --fstype "PPC PReP Boot" --size 8 --ondisk mpatha --asprimary - part None --fstype "PPC PReP Boot" --size 8 --ondisk mpathb --asprimary - - part raid.01 --size 200 --fstype ext4 --ondisk mpatha - part raid.02 --size 200 --fstype ext4 --ondisk mpathb - raid /boot --level 1 --device md0 raid.01 raid.02 - - part raid.11 --size 1024 --ondisk mpatha - part raid.12 --size 1024 --ondisk mpathb - raid swap --level 1 --device md1 raid.11 raid.12 - - part raid.21 --size 1 --fstype ext4 --grow --ondisk mpatha - part raid.22 --size 1 --fstype ext4 --grow --ondisk mpathb - raid / --level 1 --device md2 raid.21 raid.22 - -The samples above created one PReP partition, one 200MB ``/boot`` partition and one ``/`` partition on ``sda/sdb`` and ``mpatha/mpathb``. If you want to use different partitioning scheme in your cluster, modify this RAID1 section in the kickstart template file accordingly. +3. provision the node: :: + rinstall cn1 osimage=rhels7.3-ppc64le-install-compute + After the diskful nodes are up and running, you can check the RAID1 settings with the following commands: Mount command shows the ``/dev/mdx`` devices are mounted to various file systems, the ``/dev/mdx`` indicates that the RAID is being used on this node. :: From cc5dbb0930cb95a4d5526d6136c43f2e68837a6e Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 30 Nov 2016 04:37:09 -0500 Subject: [PATCH 175/292] docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst refine the doc on raid on rh7 --- .../common/deployment/raid_cfg.rst | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst index 2374f13ae..22fabc71d 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst @@ -1,12 +1,10 @@ -Configure RAID before Deploy OS -=============================== +Configure RAID before deploying the OS +====================================== Overview -------- -This section describes how to use xCAT to deploy diskful nodes with RAID1 setup, and the procedure for RAID1 maintainence activities such as replacing a failed disk. - -xCAT provides an user interface :doc:`linuximage.partitionfile ` to specify the customized partition script for diskful provision, and provides some default partition scripts to configure RAID1 on system Power server. +xCAT provides an user interface :doc:`linuximage.partitionfile ` to specify the customized partition script for diskful provision, and provides some default partition scripts. Deploy Diskful Nodes with RAID1 Setup on RedHat @@ -14,20 +12,20 @@ Deploy Diskful Nodes with RAID1 Setup on RedHat xCAT provides a partition script `raid1_rh.partscript `_ which setup RAID1 on 2 disks on Power8 LE server, "raid1_rh.partscript" is composed of 2 parts: -1) the logic to pickup the disks to setup RAID -2) the logic to generate raid/partition scheme file "/tmp/partitionfile". +# the logic to select the disks to setup RAID +# the logic to generate the partition scheme and save it to /tmp/partitionfile in the installer. -In most cases, this partition script "raid1_rh.partscript" is suffice for you to create a basic 2-disk RAID1 on your server. If you have some specific requirements on disks or partition scheme of the RAID, you need to provide your own partition script, "raid1_rh.partscript" is self-explanation and can be a reference for you. To simplify the introduction here, "raid1_rh.partscript" will be used as the partition script, the steps is listed below: +In most scenarios, the sample partitioning script is sufficient to create a basic RAID1 across two disks and is provided as a sample to build upon. -1. obtain the partition script: :: +1. Obtain the partition script: :: wget -O /install/custom/raid1_rh.partscript -2. specify the partition script for osimage: :: +2. Associate the partition script to the osimage: :: - chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/raid1_rh.partscript" + chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/partition/rhels7/raid1.partitionfile" -3. provision the node: :: +3. Provision the node: :: rinstall cn1 osimage=rhels7.3-ppc64le-install-compute @@ -36,28 +34,33 @@ After the diskful nodes are up and running, you can check the RAID1 settings wit Mount command shows the ``/dev/mdx`` devices are mounted to various file systems, the ``/dev/mdx`` indicates that the RAID is being used on this node. :: # mount - /dev/md2 on / type ext4 (rw) - proc on /proc type proc (rw) - sysfs on /sys type sysfs (rw) - devpts on /dev/pts type devpts (rw,gid=5,mode=620) - tmpfs on /dev/shm type tmpfs (rw) - /dev/md0 on /boot type ext4 (rw) - none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) + ... + /dev/md1 on / type xfs (rw,relatime,attr2,inode64,noquota) + /dev/md0 on /boot type xfs (rw,relatime,attr2,inode64,noquota) + /dev/md2 on /var type xfs (rw,relatime,attr2,inode64,noquota) The file ``/proc/mdstat`` includes the RAID devices status on the system, here is an example of ``/proc/mdstat`` in the non-multipath environment: :: # cat /proc/mdstat Personalities : [raid1] - md2 : active raid1 sda5[0] sdb5[1] - 19706812 blocks super 1.1 [2/2] [UU] + md2 : active raid1 sdk2[0] sdj2[1] + 1047552 blocks super 1.2 [2/2] [UU] + resync=DELAYED bitmap: 1/1 pages [64KB], 65536KB chunk - - md1 : active raid1 sda2[0] sdb2[1] - 1048568 blocks super 1.1 [2/2] [UU] - - md0 : active raid1 sda3[0] sdb3[1] - 204788 blocks super 1.0 [2/2] [UU] - + + md3 : active raid1 sdk3[0] sdj3[1] + 1047552 blocks super 1.2 [2/2] [UU] + resync=DELAYED + + md0 : active raid1 sdk5[0] sdj5[1] + 524224 blocks super 1.0 [2/2] [UU] + bitmap: 0/1 pages [0KB], 65536KB chunk + + md1 : active raid1 sdk6[0] sdj6[1] + 973998080 blocks super 1.2 [2/2] [UU] + [==>..................] resync = 12.8% (125356224/973998080) finish=138.1min speed=102389K/sec + bitmap: 1/1 pages [64KB], 65536KB chunk + unused devices: On the system with multipath configuration, the ``/proc/mdstat`` looks like: :: From 18d7251103cb3f02330050a57106fd16f8b3e61d Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 30 Nov 2016 04:58:03 -0500 Subject: [PATCH 176/292] docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst refine the doc on raid on rh7 --- .../manage_clusters/common/deployment/raid_cfg.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst index 22fabc71d..35d75f89b 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst @@ -4,7 +4,7 @@ Configure RAID before deploying the OS Overview -------- -xCAT provides an user interface :doc:`linuximage.partitionfile ` to specify the customized partition script for diskful provision, and provides some default partition scripts. +xCAT provides an user interface :doc:`linuximage.partitionfile ` to specify the customized partition script for diskful provision, and provides some default partition scripts. Deploy Diskful Nodes with RAID1 Setup on RedHat @@ -12,8 +12,8 @@ Deploy Diskful Nodes with RAID1 Setup on RedHat xCAT provides a partition script `raid1_rh.partscript `_ which setup RAID1 on 2 disks on Power8 LE server, "raid1_rh.partscript" is composed of 2 parts: -# the logic to select the disks to setup RAID -# the logic to generate the partition scheme and save it to /tmp/partitionfile in the installer. +* the logic to select the disks to setup RAID +* the logic to generate the partition scheme and save it to /tmp/partitionfile in the installer. In most scenarios, the sample partitioning script is sufficient to create a basic RAID1 across two disks and is provided as a sample to build upon. From 8ec6065322f28d0fef27476c4ce0e5740b1b3400 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 1 Dec 2016 01:52:22 -0500 Subject: [PATCH 177/292] refine the doc for linuximage.partitionfile --- perl-xCAT/xCAT/Schema.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 9605c5da8..47907ce0b 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -796,7 +796,14 @@ passed as argument rather than by table value', permission => 'The mount permission of /.statelite directory is used, its default value is 755', dump => qq{The NFS directory to hold the Linux kernel dump file (vmcore) when the node with this image crashes, its format is "nfs:///". If you want to use the node's "xcatmaster" (its SN or MN), can be left blank. For example, "nfs:///" means the NFS directory to hold the kernel dump file is on the node's SN, or MN if there's no SN.}, crashkernelsize => 'the size that assigned to the kdump kernel. If the kernel size is not set, 256M will be the default value.', - partitionfile => 'The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," ', + partitionfile => 'Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: + "": For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. + "s:": a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. + "d:": only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. + "s:d:": only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. + "c:": only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. + "s:c:": only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," +', driverupdatesrc => 'The source of the drivers which need to be loaded during the boot. Two types of driver update source are supported: Driver update disk and Driver rpm package. The value for this attribute should be comma separated sources. Each source should be the format tab:full_path_of_source_file. The tab keyword can be: dud (for Driver update disk) and rpm (for driver rpm). If missing the tab, the rpm format is the default. e.g. dud:/install/dud/dd.img,rpm:/install/rpm/d.rpm', comments => 'Any user-written notes.', disable => "Set to 'yes' or '1' to comment out this row.", From fdb12ecf8f5c8caed3da129f8acc9c481197c185 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 1 Dec 2016 02:14:15 -0500 Subject: [PATCH 178/292] refine the doc on raid --- .../manage_clusters/common/deployment/raid_cfg.rst | 6 +++--- .../guides/admin-guides/references/man5/linuximage.5.rst | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst index 35d75f89b..82aa0bbd1 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst @@ -10,7 +10,7 @@ xCAT provides an user interface :doc:`linuximage.partitionfile `_ which setup RAID1 on 2 disks on Power8 LE server, "raid1_rh.partscript" is composed of 2 parts: +xCAT provides a partition script `./raid1_rh.sh `_ which setup RAID1 on 2 disks on Power8 LE server, ``raid1_rh.sh`` is composed of 2 parts: * the logic to select the disks to setup RAID * the logic to generate the partition scheme and save it to /tmp/partitionfile in the installer. @@ -19,11 +19,11 @@ In most scenarios, the sample partitioning script is sufficient to create a basi 1. Obtain the partition script: :: - wget -O /install/custom/raid1_rh.partscript + wget https://raw.githubusercontent.com/xcat2/xcat-extensions/master/partition/raid1_rh.sh -O /install/custom/raid1_rh.sh 2. Associate the partition script to the osimage: :: - chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/partition/rhels7/raid1.partitionfile" + chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/raid1_rh.sh" 3. Provision the node: :: diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index a8f7eb915..ad5715d86 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -173,7 +173,14 @@ linuximage Attributes: \ **partitionfile**\ - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: + + * ````: For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. + * ``s:``: a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. + * ``d:``: only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. + * ``s:d:``: only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. + * ``c:``: only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. + * ``s:c:``: only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," From 2911746a47abba1727c1de95a0e2d770ec8b5bce Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 1 Dec 2016 20:57:25 -0500 Subject: [PATCH 179/292] refine the doc on soft raid1 setup during node provision --- .../common/deployment/raid_cfg.rst | 16 ++++++++-------- perl-xCAT/xCAT/Schema.pm | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst index 82aa0bbd1..0acea9a4e 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/raid_cfg.rst @@ -10,28 +10,28 @@ xCAT provides an user interface :doc:`linuximage.partitionfile `_ which setup RAID1 on 2 disks on Power8 LE server, ``raid1_rh.sh`` is composed of 2 parts: - -* the logic to select the disks to setup RAID -* the logic to generate the partition scheme and save it to /tmp/partitionfile in the installer. +xCAT provides a partition script `raid1_rh.sh `_ which configures RAID1 across 2 disks on RHEL 7.x operating systems. In most scenarios, the sample partitioning script is sufficient to create a basic RAID1 across two disks and is provided as a sample to build upon. 1. Obtain the partition script: :: - wget https://raw.githubusercontent.com/xcat2/xcat-extensions/master/partition/raid1_rh.sh -O /install/custom/raid1_rh.sh + mkdir -p /install/custom/partition/ + wget https://raw.githubusercontent.com/xcat2/xcat-extensions/master/partition/raid1_rh.sh \ + -O /install/custom/partition/raid1_rh.sh 2. Associate the partition script to the osimage: :: - chdef -t osimage -o rhels7.3-ppc64le-install-compute partitionfile="s:/install/custom/raid1_rh.sh" + chdef -t osimage -o rhels7.3-ppc64le-install-compute \ + partitionfile="s:/install/custom/partition/raid1_rh.sh" 3. Provision the node: :: rinstall cn1 osimage=rhels7.3-ppc64le-install-compute -After the diskful nodes are up and running, you can check the RAID1 settings with the following commands: +After the diskful nodes are up and running, you can check the RAID1 settings with the following process: -Mount command shows the ``/dev/mdx`` devices are mounted to various file systems, the ``/dev/mdx`` indicates that the RAID is being used on this node. :: +``mount`` command shows the ``/dev/mdx`` devices are mounted to various file systems, the ``/dev/mdx`` indicates that the RAID is being used on this node. :: # mount ... diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 47907ce0b..228ab4770 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -799,7 +799,7 @@ passed as argument rather than by table value', partitionfile => 'Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: "": For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. "s:": a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. - "d:": only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. + "d:": only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. "s:d:": only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. "c:": only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. "s:c:": only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," From 66d9c1b05c12475e94d61587efa6792295d02828 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 5 Dec 2016 05:08:29 -0500 Subject: [PATCH 180/292] modify statelite testcase --- .../testcase/installation/Diskless_installation_flat_p8_le | 7 +++++++ .../reg_linux_statelite_installation_hierarchy_by_nfs | 2 -- .../reg_linux_statelite_installation_hierarchy_by_ramdisk | 2 -- .../testcase/installation/ubuntu_diskless_installation_vm | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index cdd4e875d..42b35a1cf 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -17,6 +17,9 @@ cmd:makedhcp -a check:rc==0 cmd:makeconservercf $$CN check:rc==0 +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi +check:rc==0 + cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -d /install/custom/netboot/sles ]; then mkdir -p /install/custom/netboot/sles; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -d /install/custom/netboot/rh ]; then mkdir -p /install/custom/netboot/rh; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -d /install/custom/netboot/ubuntu ]; then mkdir -p /install/custom/netboot/ubuntu; fi; fi check:rc==0 cmd:if cat /etc/*release |grep SUSE >/dev/null;then if [ ! -e /install/custom/netboot/sles/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/sles/compute.synclist; fi; elif cat /etc/*release |grep "Red Hat" >/dev/null;then if [ ! -e /install/custom/netboot/rh/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/rh/compute.synclist; fi; elif cat /etc/*release |grep "Ubuntu" >/dev/null;then if [ ! -e /install/custom/netboot/ubuntu/compute.synclist ]; then echo "/etc/resolv.conf -> /etc/resolv.conf" > /install/custom/netboot/ubuntu/compute.synclist;fi; fi @@ -61,4 +64,8 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +check:rc==0 +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 + end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index d33cc5b1c..6d5a07282 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -93,6 +93,4 @@ check:output=~compute/rootimg on / type nfs cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 -cmd:rmdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index b0b3094c2..9531d7c4e 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -95,6 +95,4 @@ check:output=~rootfs on / type cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 -cmd:rmdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index abf14d1c8..1ac941c80 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -17,7 +17,7 @@ cmd:makedhcp -a check:rc==0 cmd:makeconservercf $$CN check:rc==0 -cmd:rm -rf /install/netboot/__GETNODEATTR($$CN,os)__/x86_64/compute +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi check:rc==0 cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 @@ -44,4 +44,6 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi +check:rc==0 end From d17230e96fd0f696778408b2e5e87dd669646809 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 5 Dec 2016 05:11:34 -0500 Subject: [PATCH 181/292] modify Diskless_installation_flat_p8_le testcase --- .../testcase/installation/Diskless_installation_flat_p8_le | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 42b35a1cf..20795590b 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -64,7 +64,6 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d -check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 From f492431a59f2654ed4d9177cfad00b1394eb7a0e Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 5 Dec 2016 05:16:15 -0500 Subject: [PATCH 182/292] modify reg_linux_statelite_installation_flat testcase --- .../testcase/installation/reg_linux_statelite_installation_flat | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 13885735d..f5ddc704e 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -129,6 +129,4 @@ check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 -cmd:rmdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute -check:rc==0 end From aadcffbc15b75191a2384c9d19596e22ef5947b9 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 5 Dec 2016 07:31:45 -0500 Subject: [PATCH 183/292] modify litefile --- xCAT-test/autotest/testcase/installation/litefile.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/litefile.csv b/xCAT-test/autotest/testcase/installation/litefile.csv index 7eaf1527d..0fed94364 100644 --- a/xCAT-test/autotest/testcase/installation/litefile.csv +++ b/xCAT-test/autotest/testcase/installation/litefile.csv @@ -14,7 +14,6 @@ "ALL","/etc/sysconfig/","tmpfs",, "ALL","/etc/ssh/","tmpfs",, "ALL","/etc/systemd/system/multi-user.target.wants/","tmpfs",, -"ALL","/usr/lib/systemd/system/ntpd.service","tmpfs",, "ALL","/tmp/","tmpfs",, "ALL","/var/","tmpfs",, "ALL","/opt/xcat/","tmpfs",, From 483923eae79aa581564d4b3972ce732f2f4415ea Mon Sep 17 00:00:00 2001 From: immarvin Date: Mon, 5 Dec 2016 03:42:57 -0500 Subject: [PATCH 184/292] correct a syntax --- .../share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh | 6 +++--- xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh index 56401e96d..6df3011e6 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcat-prepivot.sh @@ -66,7 +66,7 @@ if [ ! -z $SNAPSHOTSERVER ]; then /bin/sh exit fi - RS= $(( $RANDOM % 20 )) + RS=$(( $RANDOM % 20 )) echo "Trying again in $RS seconds..." sleep $RS done @@ -83,7 +83,7 @@ if [ ! -z $SNAPSHOTSERVER ]; then /bin/sh exit fi - RS= $(( $RANDOM % 20 )) + RS=$(( $RANDOM % 20 )) echo "Trying again in $RS seconds..." sleep $RS done @@ -98,7 +98,7 @@ if [ ! -z $SNAPSHOTSERVER ]; then /bin/sh exit fi - RS= $(( $RANDOM % 20 )) + RS=$(( $RANDOM % 20 )) echo "Trying again in $RS seconds..." sleep $RS done diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index c4d6c17dd..94e1f026e 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -212,7 +212,7 @@ elif [ -r /rootimg-statelite.gz ]; then /bin/sh exit fi - RS= $(( $RANDOM % 20 )) + RS=$(( $RANDOM % 20 )) echo "Trying again in $RS seconds..." sleep $RS done @@ -227,7 +227,7 @@ elif [ -r /rootimg-statelite.gz ]; then /bin/sh exit fi - RS= $(( $RANDOM % 20 )) + RS=$(( $RANDOM % 20 )) echo "Trying again in $RS seconds..." sleep $RS done From 50241fc7bfcddc7d37ac5487515af8afaec14fc3 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 5 Dec 2016 10:22:13 -0500 Subject: [PATCH 185/292] Update the man pages in preparation for the 2.13.0 release --- .../references/man1/xcattest.1.rst | 18 +++++++++++------- .../references/man5/linuximage.5.rst | 15 +++++++-------- .../admin-guides/references/man5/mac.5.rst | 2 ++ .../admin-guides/references/man7/osimage.7.rst | 8 +++++++- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst index e3b56aff0..5b07c71cc 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -33,9 +33,9 @@ SYNOPSIS \ **xcattest**\ [\ **-c**\ \ *cmd list*\ ] [\ **-l**\ ] -\ **xcattest**\ [\ **-s**\ \ *command*\ ] +\ **xcattest**\ [\ **-s**\ \ **command**\ ] -\ **xcattest**\ [\ **-s**\ \ *bundle*\ ] +\ **xcattest**\ [\ **-s**\ \ **bundle**\ ] *********** @@ -62,13 +62,13 @@ OPTIONS \ **-f**\ \ *configure file*\ -Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template + Specifies the configuration file with full-path. xCAT supports an example config file: /opt/xcat/share/xcat/tools/autotest/linux.conf.template \ **-b**\ \ *case bundle list*\ - Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. + Comma separated list of test cases bundle files, each test cases bundle can contain multiple lines and each line for one test case name. The bundle files should be listed in: /opt/xcat/share/xcat/tools/autotest/bundle. @@ -89,9 +89,13 @@ Specifies the configuration file with full-path. xCAT supports an example config Display the test cases names specified by the flag -b, -t or -c. -\ **-s**\ +\ **-s**\ + Display the bundle files and command with value: bundle or command. + + + ************ RETURN VALUE @@ -160,7 +164,7 @@ EXAMPLES .. code-block:: perl - xcattest -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle + xcattest -c lsdef -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle xcattest -f /tmp/config -b custom.bundle @@ -169,7 +173,7 @@ EXAMPLES 3. - To run specified test cases with /tmp/config: + To run specified test cases with /tmp/config file: .. code-block:: perl diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index ad5715d86..74810be1c 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -173,14 +173,13 @@ linuximage Attributes: \ **partitionfile**\ - Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: - - * ````: For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. - * ``s:``: a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. - * ``d:``: only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. - * ``s:d:``: only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. - * ``c:``: only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. - * ``s:c:``: only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: + "": For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. + "s:": a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. + "d:": only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. + "s:d:": only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. + "c:": only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. + "s:c:": only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," diff --git a/docs/source/guides/admin-guides/references/man5/mac.5.rst b/docs/source/guides/admin-guides/references/man5/mac.5.rst index 3da1e7873..993fdd0cf 100644 --- a/docs/source/guides/admin-guides/references/man5/mac.5.rst +++ b/docs/source/guides/admin-guides/references/man5/mac.5.rst @@ -51,6 +51,8 @@ mac Attributes: \ **mac**\ The mac address or addresses for which xCAT will manage static bindings for this node. This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:04:05:0F!node6-eth1"). If there are multiple nics connected to Management Network(usually for bond), in order to make sure the OS deployment finished successfully, the macs of those nics must be able to resolve to same IP address. First, users have to create alias of the node for each mac in the Management Network through either: 1. adding the alias into /etc/hosts for the node directly or: 2. setting the alias to the "hostnames" attribute and then run "makehost" against the node. Then, configure the "mac" attribute of the node like "mac1!node|mac2!node-alias". For the first mac address (mac1 in the example) set in "mac" attribute, do not need to set a "node name" string for it since the nodename of the node will be used for it by default. + + \ **comments**\ diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index 8ed314325..c74014cf6 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -279,7 +279,13 @@ osimage Attributes: \ **partitionfile**\ (linuximage.partitionfile, winimage.partitionfile) - The path of the configuration file which will be used to partition the disk for the node. For stateful osimages,two types of files are supported: "" which contains a partitioning definition that will be inserted directly into the generated autoinst configuration file and must be formatted for the corresponding OS installer (e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). "s:" which specifies a shell script that will be run from the OS installer configuration file %pre section; the script must write the correct partitioning definition into the file /tmp/partitionfile on the node which will be included into the configuration file during the install process. For statelite osimages, partitionfile should specify ""; see the xCAT Statelite documentation for the xCAT defined format of this configuration file. For Ubuntu, besides "" or "s:", the disk name(s) to partition must be specified in traditional, non-devfs format, delimited with space, it can be specified in 2 forms: "d:" which contains the disk name(s) to partition and "s:d:" which runs in pressed/early_command and writes the disk names into the "/tmp/xcat.install_disk" . To support other specific partition methods such as RAID or LVM in Ubuntu, some additional preseed values should be specified, these values can be specified with "c:" which contains the additional pressed entries in "d-i ..." form and "s:c:" which runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," + Only available for diskful osimages and statelite osimages(localdisk enabled). The full path of the partition file or the script to generate the partition file. The valid value includes: + "": For diskful osimages, the partition file contains the partition definition that will be inserted directly into the template file for os installation. The syntax and format of the partition file should confirm to the corresponding OS installer of the Linux distributions(e.g. kickstart for RedHat, autoyast for SLES, pressed for Ubuntu). For statelite osimages, when the localdisk is enabled, the partition file with specific syntax and format includes the partition scheme of the local disk, please refer to the statelite documentation for details. + "s:": a shell script to generate the partition file "/tmp/partitionfile" inside the installer before the installation start. + "d:": only available for ubuntu osimages, includes the name(s) of the disks to partition in traditional, non-devfs format(e.g, /dev/sdx, not e.g. /dev/discs/disc0/disc), and be delimited with space. All the disks involved in the partition file should be specified. + "s:d:": only available for ubuntu osimages, a script to generate the disk name file "/tmp/xcat.install_disk" inside the debian installer. This script is run in the "pressed/early_command" section. + "c:": only availbe for ubuntu osimages, contains the additional pressed entries in "d-i ..." form. This can be used to specify some additional preseed options to support RAID or LVM in Ubuntu. + "s:c:": only available for ubuntu osimages, runs in pressed/early_command and set the preseed values with "debconf-set". The multiple values should be delimited with comma "," or From 4aab65ea0a5404f1410c3a8c857c7aa5cc92fc14 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 5 Dec 2016 13:56:44 -0500 Subject: [PATCH 186/292] Revert the naming back to using snap and instead use the Epoch keyword to control the priority of the xCAT-genesis-base package --- makerpm | 2 -- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- xCAT-genesis-scripts/xCAT-genesis-scripts.spec | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/makerpm b/makerpm index 0eb34bdcf..c80ed0edf 100755 --- a/makerpm +++ b/makerpm @@ -165,9 +165,7 @@ function makegenesis { SPEC_FILE="xCAT-genesis-base.spec" RPMNAME="$1" cd `dirname $0`/$DIR - GEN_BASE_REL=0 sed -i s/%%REPLACE_CURRENT_VERSION%%/${VER}/g ${SPEC_FILE} - sed -i s/%%REPLACE_RELEASE%%/${GEN_BASE_REL}/g ${SPEC_FILE} tar --exclude .svn -cjf $RPMROOT/SOURCES/$RPMNAME.tar.bz2 . # undo the changes from the SED command above so it's not tracked by Git git checkout ${SPEC_FILE} diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 1fb25a3e5..989980591 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,5 +1,4 @@ %define version %%REPLACE_CURRENT_VERSION%% -%define release %%REPLACE_RELEASE%% Version: %{?version:%{version}}%{!?version:%(cat Version)} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 @@ -18,6 +17,7 @@ BuildArch: noarch %define __prelink_undo_cmd %{nil} # To fix the issue error: Arch dependent binaries in noarch package, the following line is needed on Fedora 23 ppc64 %define _binaries_in_noarch_packages_terminate_build 0 +Epoch: 2 AutoReq: false Prefix: /opt/xcat AutoProv: false diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index b85ad7b7e..c10abfbf6 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -31,7 +31,7 @@ Vendor: IBM Corp Summary: xCAT Genesis netboot image - Core content URL: http://xcat.org Source1: xCAT-genesis-scripts.tar.bz2 -Requires: xCAT-genesis-base-%{tarch} >= 2.13.0 +Requires: xCAT-genesis-base-%{tarch} Buildroot: %{_localstatedir}/tmp/xCAT-genesis Packager: IBM Corp. From bc112393c16cac610798bdf5f3a9ffaa11f31481 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 6 Dec 2016 01:35:53 -0500 Subject: [PATCH 187/292] complete --- xCAT-test/autotest/testcase/buildkit/cases0 | 2 -- 1 file changed, 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/buildkit/cases0 b/xCAT-test/autotest/testcase/buildkit/cases0 index 17149110d..fd8fd2774 100644 --- a/xCAT-test/autotest/testcase/buildkit/cases0 +++ b/xCAT-test/autotest/testcase/buildkit/cases0 @@ -103,7 +103,6 @@ cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create pro check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all check:rc==0 -check:output!~error cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* @@ -154,7 +153,6 @@ cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create pro check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;reponame=`cat buildkit.conf|grep kitrepoid|sed 's/ //g' |grep ^kitrepoid=|head -1|awk -F= '{print $2}'`;buildkit buildrepo $reponame check:rc==0 -check:output!~error cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* From 212afb35c2a8e386b74773d67fdaa9334b3d5850 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 6 Dec 2016 06:17:38 -0500 Subject: [PATCH 188/292] modify all installation testcases to get provisioned cn's xcat.log --- .../testcase/installation/Diskless_installation_flat_p8_le | 3 ++- .../testcase/installation/Full_installation_flat_p8_le | 1 + .../testcase/installation/reg_linux_SN_installation_hierarchy | 2 +- .../installation/reg_linux_diskfull_installation_flat | 1 + .../installation/reg_linux_diskfull_installation_hierarchy | 1 + .../installation/reg_linux_diskless_installation_flat | 1 + .../installation/reg_linux_diskless_installation_hierarchy | 3 +-- .../installation/reg_linux_statelite_installation_flat | 4 ++-- .../reg_linux_statelite_installation_hierarchy_by_nfs | 2 +- .../reg_linux_statelite_installation_hierarchy_by_ramdisk | 2 +- .../testcase/installation/ubuntu_diskless_installation_vm | 2 ++ .../testcase/installation/ubuntu_full_installation_vm | 1 + 12 files changed, 15 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 20795590b..0c4459990 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -53,6 +53,7 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:nodeset $$CN osimage check:rc==0 cmd:rpower $$CN reset @@ -64,7 +65,7 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 - end diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 1963e34b0..17a700b82 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -41,4 +41,5 @@ check:output=~\d\d:\d\d:\d\d #cmd:xdsh $$CN service ntpd status #check:rc==0 #check:output=~running +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 56f0d2c20..9bfce9ae7 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -102,5 +102,5 @@ check:output=~/tftpboot on /tftpboot cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif cat /etc/*release |grep "Red Hat" >/dev/null;then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi check:rc==0 - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 7dd221137..4a41b62e4 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -65,4 +65,5 @@ cmd:sleep 120 cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index c3b2f0157..2c109d547 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -56,4 +56,5 @@ check:rc==0 check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 2f1b61b8b..f5ba01239 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -77,4 +77,5 @@ check:output=~64 bytes from $$CN cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 31e06f096..3d235921f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -65,8 +65,7 @@ check:output=~\d\d:\d\d:\d\d cmd:xdsh $$CN mount check:rc==0 check:output=~on / type tmpfs - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 - end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index f5ddc704e..f70ef0b70 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -82,7 +82,7 @@ cmd:xdsh $$CN mount check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 @@ -121,7 +121,7 @@ cmd:sleep 120 cmd:ping $$CN -c 3 check:rc==0 check:output=~64 bytes from $$CN - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rm -rf /tmp/image;mkdir /tmp/image check:rc==0 cmd:imgexport __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute /tmp/image/image.tgz diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs index 6d5a07282..316c12604 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_nfs @@ -90,7 +90,7 @@ cmd:xdsh $$CN mount check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~compute/rootimg on / type nfs - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then rm -rf $rootimgdir;fi check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk index 9531d7c4e..e2bd85350 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_hierarchy_by_ramdisk @@ -92,7 +92,7 @@ cmd:xdsh $$CN mount check:rc==0 check:output=~/nodedata/$$CN on /.statelite/persistent check:output=~rootfs on / type - +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-statelite-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 1ac941c80..721baf449 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -34,6 +34,7 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:nodeset $$CN osimage check:rc==0 cmd:rpower $$CN reset @@ -44,6 +45,7 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi check:rc==0 end diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index fd6f3e176..cbb275b52 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -27,4 +27,5 @@ check:output=~booted cmd:xdsh $$CN date check:rc==0 check:output=~\d\d:\d\d:\d\d +cmd:xdsh $$CN "cat /var/log/xcat/xcat.log" end From 9c018631d386c2348ad6b77b00270afedf63cc23 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 6 Dec 2016 01:52:32 -0500 Subject: [PATCH 189/292] fix issue [DEV] go-xcat test case in ubuntu16.04.1 still obtain apt.key from SourceForge #2263 --- xCAT-test/autotest/testcase/go-xcat/case0 | 14 +++++++------- xCAT-test/autotest/testcase/go-xcat/case1 | 8 ++++---- xCAT-test/autotest/testcase/go-xcat/case2 | 8 ++++---- xCAT-test/autotest/testcase/go-xcat/case4 | 2 +- .../testcase/migration/ubuntu_migration1_p8le | 2 +- .../testcase/migration/ubuntu_migration1_vm | 2 +- .../testcase/migration/ubuntu_migration2_p8le | 2 +- .../testcase/migration/ubuntu_migration2_vm | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case0 b/xCAT-test/autotest/testcase/go-xcat/case0 index e1939271c..ea16ba1b8 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case0 +++ b/xCAT-test/autotest/testcase/go-xcat/case0 @@ -17,7 +17,7 @@ check:rc==0 cmd:xdsh $$CN "cd /xcat-core; ./mklocalrepo.sh" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -53,7 +53,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -89,7 +89,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; bunzip2 /xcat-core.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -125,7 +125,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -169,7 +169,7 @@ check:rc==0 cmd:xdsh $$CN "cd /xcat-core; ./mklocalrepo.sh" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -208,7 +208,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; tar -jxf /xcat-core.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -242,7 +242,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 index 7976c0d45..2d2791199 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case1 +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -11,7 +11,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -43,7 +43,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -75,7 +75,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -107,7 +107,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/go-xcat/case2 b/xCAT-test/autotest/testcase/go-xcat/case2 index 80049f229..989e7a09d 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case2 +++ b/xCAT-test/autotest/testcase/go-xcat/case2 @@ -39,7 +39,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -72,7 +72,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -134,7 +134,7 @@ cmd:xdsh $$CN "cd /; scp -r $$MN:/opt/xcat/share/xcat/tools/go-xcat ./" check:rc==0 cmd:dir="__GETNODEATTR($$CN,os)__"; if grep SUSE /etc/*release;then os=`echo $dir |cut -c 1-6` && xdsh $$CN "cd /xcat-dep/$os/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh" ; elif grep "Red Hat" /etc/*release;then os=`echo $dir |cut -c 1-2` && xdsh $$CN "cd /xcat-dep/$os`echo __GETNODEATTR($$CN,os)__ | cut -c6`/__GETNODEATTR($$CN,arch)__/; ./mklocalrepo.sh"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cd /xcat-dep; ./mklocalrepo.sh"; else echo "Sorry,this is not supported os"; fi cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 @@ -166,7 +166,7 @@ check:rc==0 cmd:cp /xcat-dep-*.tar.bz2 /install/ check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/go-xcat/case4 b/xCAT-test/autotest/testcase/go-xcat/case4 index b2dfeeb86..c85d2a6dc 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case4 +++ b/xCAT-test/autotest/testcase/go-xcat/case4 @@ -15,7 +15,7 @@ check:rc==0 cmd:xdsh $$CN "cd /; scp -r $$MN:/xcat-dep*.tar.bz2 /xcat-dep.tar.bz2" check:rc==0 cmd:if grep Ubuntu /etc/*release;then code=`lsb_release -sc` && xdsh $$CN "scp -r $$MN:/opt/xcat/share/xcat/tools/autotest/testcase/go-xcat/$code-__GETNODEATTR($$CN,arch)__.sources.list /etc/apt/sources.list"; fi -cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -"; fi +cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /etc/resolv.conf" && xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -"; fi check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index 45e63dddc..3e6d26560 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -45,7 +45,7 @@ cmd:xdsh $$CN "sed -i '/install/d' /etc/apt/sources.list" check:rc==0 cmd:xdsh $$CN "sed -i '/security.ubuntu.com/d' /etc/apt/sources.list" check:rc==0 -cmd:xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -" +cmd:xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -" check:rc==0 cmd:xdsh $$CN "apt-get clean all" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 9d76147bb..7b7133c17 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -44,7 +44,7 @@ cmd:xdsh $$CN "sed -i '/install/d' /etc/apt/sources.list" check:rc==0 cmd:xdsh $$CN "sed -i '/security.ubuntu.com/d' /etc/apt/sources.list" check:rc==0 -cmd:xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -" +cmd:xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -" check:rc==0 cmd:xdsh $$CN "apt-get clean all" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index 5697e813a..25d1707cc 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -45,7 +45,7 @@ cmd:xdsh $$CN "sed -i '/install/d' /etc/apt/sources.list" check:rc==0 cmd:xdsh $$CN "sed -i '/security.ubuntu.com/d' /etc/apt/sources.list" check:rc==0 -cmd:xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -" +cmd:xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -" check:rc==0 cmd:xdsh $$CN "apt-get clean all" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index 139391885..c8acb1318 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -44,7 +44,7 @@ cmd:xdsh $$CN "sed -i '/install/d' /etc/apt/sources.list" check:rc==0 cmd:xdsh $$CN "sed -i '/security.ubuntu.com/d' /etc/apt/sources.list" check:rc==0 -cmd:xdsh $$CN "wget -O - http://sourceforge.net/projects/xcat/files/ubuntu/apt.key/download | apt-key add -" +cmd:xdsh $$CN "wget -O - http://xcat.org/files/xcat/repos/apt/apt.key | apt-key add -" check:rc==0 cmd:xdsh $$CN "apt-get clean all" check:rc==0 From d3bd65e833c61aa623719b947fbef6d1a1dff287 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 6 Dec 2016 06:49:50 -0500 Subject: [PATCH 190/292] modify testcases using "makedhcp -q " to validate the "makedhcp" result check --- .../testcase/installation/Full_installation_flat_p8_le | 2 ++ .../testcase/installation/reg_linux_SN_installation_hierarchy | 3 ++- .../testcase/installation/reg_linux_diskfull_installation_flat | 3 ++- .../installation/reg_linux_diskfull_installation_hierarchy | 3 ++- .../testcase/installation/reg_linux_diskless_installation_flat | 3 ++- .../installation/reg_linux_diskless_installation_hierarchy | 3 ++- .../testcase/installation/ubuntu_diskless_installation_vm | 2 ++ .../autotest/testcase/installation/ubuntu_full_installation_vm | 2 ++ 8 files changed, 16 insertions(+), 5 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 17a700b82..178056088 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -18,6 +18,8 @@ cmd:makedhcp -a check:rc==0 cmd:makedns -n check:rc==0 +cmd:makedhcp -q $$CN +check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 9bfce9ae7..2541fb4b6 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -20,7 +20,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi +#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi +cmd:makedhcp -q $$SN check:output=~$$SN cmd:chdef -t node $$SN groups=service,all diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 4a41b62e4..221176570 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -27,7 +27,8 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:sleep 10 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +cmd:makedhcp -q $$CN check:output=~$$CN cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index 2c109d547..816877b43 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -23,7 +23,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +cmd:makedhcp -q $$CN check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index f5ba01239..798fe3731 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -17,7 +17,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +cmd:makedhcp -q $$CN check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 3d235921f..8c806bd04 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -21,7 +21,8 @@ cmd:makedhcp -a check:rc==0 cmd:service dhcpd restart check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi +cmd:makedhcp -q $$CN check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 721baf449..3bbff17ce 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -15,6 +15,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:makedhcp -q $$CN +check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index cbb275b52..80d0fdb18 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -10,6 +10,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:makedhcp -q $$CN +check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN From 60c6599d1e6c0052ac84b10f75ab991e9f8e539b Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 6 Dec 2016 07:09:22 -0500 Subject: [PATCH 191/292] modify testcases using "makedhcp -q " to validate the "makedhcp" result check --- .../testcase/installation/Full_installation_flat_p8_le | 5 +++-- .../installation/reg_linux_SN_installation_hierarchy | 3 +-- .../installation/reg_linux_diskfull_installation_flat | 2 +- .../installation/reg_linux_diskfull_installation_hierarchy | 3 +-- .../installation/reg_linux_diskless_installation_flat | 2 +- .../installation/reg_linux_diskless_installation_hierarchy | 2 +- .../testcase/installation/ubuntu_diskless_installation_vm | 1 + .../testcase/installation/ubuntu_full_installation_vm | 1 + 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 178056088..a058f5560 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -16,10 +16,11 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 +cmd:makedhcp -q $$CN +check:rc==0 +check:output=~$$CN cmd:makedns -n check:rc==0 -cmd:makedhcp -q $$CN -check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 2541fb4b6..40f52918d 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -20,10 +20,9 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$SN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi cmd:makedhcp -q $$SN +check:rc==0 check:output=~$$SN - cmd:chdef -t node $$SN groups=service,all check:rc==0 cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 221176570..e564080d8 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -27,8 +27,8 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:sleep 10 -#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi cmd:makedhcp -q $$CN +check:rc==0 check:output=~$$CN cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index 816877b43..355887076 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -23,10 +23,9 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi cmd:makedhcp -q $$CN check:output=~$$CN - +check:rc==0 cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 798fe3731..32cd3a986 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -17,8 +17,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi cmd:makedhcp -q $$CN +check:rc==0 check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 8c806bd04..43de73914 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -21,8 +21,8 @@ cmd:makedhcp -a check:rc==0 cmd:service dhcpd restart check:rc==0 -#cmd:if cat /etc/*release |grep SUSE >/dev/null;then cat /var/lib/dhcp/db/dhcpd.leases|grep $$CN;elif cat /etc/*release |grep "Red Hat" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$CN;fi cmd:makedhcp -q $$CN +check:rc==0 check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 3bbff17ce..568c3125f 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -16,6 +16,7 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:makedhcp -q $$CN +check:rc==0 check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index 80d0fdb18..274ad028f 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -11,6 +11,7 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:makedhcp -q $$CN +check:rc==0 check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 From 770768404a58a4ef8790e19f9c3a122cf5622e82 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 6 Dec 2016 03:57:30 -0500 Subject: [PATCH 192/292] complete --- xCAT-test/autotest/testcase/runcmdinstaller/cases0 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 index 2051218f1..9505023c1 100644 --- a/xCAT-test/autotest/testcase/runcmdinstaller/cases0 +++ b/xCAT-test/autotest/testcase/runcmdinstaller/cases0 @@ -14,9 +14,9 @@ cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ check:rc==0 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep installing >/dev/null`; do sleep 20;((a++));if [ $a -gt 30 ];then break;fi done cmd:lsdef -l $$CN | grep status -cmd:runcmdinstaller $$CN "ls -al /tmp" +cmd:runcmdinstaller $$CN "ls /" check:rc==0 -check:output=~yum +check:output=~tmp cmd:chtab key=xcatdebugmode site.value="0" end start:get_xcat_postscripts_loginfo From 1740361bfd544152063b4cc4db8e78e0408700e8 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 6 Dec 2016 07:38:31 -0500 Subject: [PATCH 193/292] modify testcase for rmvm issues:2235 --- .../testcase/installation/reg_linux_SN_installation_hierarchy | 4 ++-- .../installation/reg_linux_diskfull_installation_flat | 3 ++- .../testcase/installation/ubuntu_full_installation_vm_docker | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 40f52918d..0ff095d64 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -5,8 +5,8 @@ cmd:chtab key=nameservers site.value="" check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rmvm $$SN -f -p && mkvm $$SN -s 40G; fi - +#cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rmvm $$SN -f -p && mkvm $$SN -s 40G; fi +cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p; mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 40G; fi;fi cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index e564080d8..b9c7d65bf 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,7 +5,8 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index c1c077691..e6d948e68 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -4,7 +4,8 @@ cmd:copycds $$ISO check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi check:rc=0 cmd:makedns -n check:rc==0 From 69c98a10a8a767cc268ea86291fb0e10c3c3174e Mon Sep 17 00:00:00 2001 From: junxiawang Date: Tue, 6 Dec 2016 08:54:19 -0500 Subject: [PATCH 194/292] modify litefile for rhels6.8 statelite issue for ntp --- xCAT-test/autotest/testcase/installation/litefile.csv | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/litefile.csv b/xCAT-test/autotest/testcase/installation/litefile.csv index 0fed94364..383b49c52 100644 --- a/xCAT-test/autotest/testcase/installation/litefile.csv +++ b/xCAT-test/autotest/testcase/installation/litefile.csv @@ -16,6 +16,11 @@ "ALL","/etc/systemd/system/multi-user.target.wants/","tmpfs",, "ALL","/tmp/","tmpfs",, "ALL","/var/","tmpfs",, +"ALL","/etc/ntp.conf.org","tmpfs",, "ALL","/opt/xcat/","tmpfs",, "ALL","/xcatpost/","tmpfs",, "ALL","/root/.ssh/","tmpfs",, +"ALL","/etc/rc3.d/","tmpfs",, +"ALL","/etc/rc2.d/","tmpfs",, +"ALL","/etc/rc4.d/","tmpfs",, +"ALL","/etc/rc5.d/","tmpfs",, From 386ae4ec06a04c2f253bec212c7ebf96958a68be Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 6 Dec 2016 21:25:35 -0500 Subject: [PATCH 195/292] Wrong repository name if osminorversion doesn't have comparison operator --- xCAT-buildkit/bin/buildkit | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/xCAT-buildkit/bin/buildkit b/xCAT-buildkit/bin/buildkit index 846edad06..dc825a660 100755 --- a/xCAT-buildkit/bin/buildkit +++ b/xCAT-buildkit/bin/buildkit @@ -1390,7 +1390,10 @@ sub validate_bldkitconf $full_kitname .= '-' . $::bldkit_config->{kit}{entries}[0]->{osmajorversion}; } if (defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) { - my $kitminor = split /<=|>=|==|<|>/, $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + my $kitminor = $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + unless ($kitminor =~ /^\d/) { + $kitminor = split /<=|>=|==|<|>|=/, $::bldkit_config->{kit}{entries}[0]->{osminorversion}; + } if ((!defined($::bldkit_config->{kit}{entries}[0]->{osbasename})) || (!defined($::bldkit_config->{kit}{entries}[0]->{osmajorversion}))) { print "Error: Kit osminorversion attribute was specified but either Kit osbasename or Kit osmajorversion were not set. \n"; @@ -1501,7 +1504,10 @@ sub validate_bldkitconf } $reponame .= '-' . $kr->{osmajorversion}; if (defined($kr->{osminorversion})) { - my $krminor = split /<=|>=|==|<|>/, $kr->{osminorversion}; + my $krminor = $kr->{osminorversion}; + unless ($krminor =~ /^\d/) { + $krminor = split /<=|>=|==|<|>|=/, $kr->{osminorversion}; + } if ((defined($::bldkit_config->{kit}{entries}[0]->{osminorversion})) && ($::bldkit_config->{kit}{entries}[0]->{osminorversion} ne $kr->{osminorversion})) { @@ -1552,7 +1558,10 @@ sub validate_bldkitconf $compname .= '-' . $repo{osbasename}; $compname .= '-' . $repo{osmajorversion}; if (defined($repo{osminorversion})) { - my $minorversion = split /<=|>=|==|<|>/, $repo{osminorversion}; + my $minorversion = $repo{osminorversion}; + unless ($minorversion =~ /^\d/) { + $minorversion = split /<=|>=|==|<|>|=/, $repo{osminorversion}; + } $compname .= '.' . $minorversion; } $compname .= '-' . $repo{osarch}; @@ -1937,7 +1946,10 @@ sub validate_os my $repo_osinfo = "$repo->{osbasename}$repo->{osmajorversion}"; my $minorversion; if (defined($repo->{osminorversion})) { - $minorversion = split /<=|>=|==|<|>/, $repo->{osminorversion}; + $minorversion = $repo->{osminorversion}; + unless ($minorversion =~ /^\d/) { + $minorversion = split /<=|>=|==|<|>|=/, $repo->{osminorversion}; + } $repo_osinfo .= ".$minorversion"; } $repo_osinfo .= "-$repo->{osarch} "; From 0107b43bee489ae7864146848c68d6730dda2c10 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 7 Dec 2016 04:57:32 -0500 Subject: [PATCH 196/292] modify genesis testcase for nodeset shell case issue --- xCAT-test/autotest/testcase/genesis/genesistest.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/genesis/genesistest.pl b/xCAT-test/autotest/testcase/genesis/genesistest.pl index 4ba521608..a7301f1b3 100755 --- a/xCAT-test/autotest/testcase/genesis/genesistest.pl +++ b/xCAT-test/autotest/testcase/genesis/genesistest.pl @@ -266,7 +266,7 @@ sub testxdsh { $checkstring = "testimg"; $checkfile = "/tmp/testresult"; } elsif ($value == 3) { - $checkstring = "xcatd=$master:3001"; + $checkstring = "destiny=shell"; $checkfile = "/proc/cmdline"; } if (($value == 1) || ($value == 2) || ($value == 3)) { From 0dda9e4d9ea67a5dfaabed28df0f918978d4ff3c Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 7 Dec 2016 01:21:41 -0500 Subject: [PATCH 197/292] complete --- xCAT-test/autotest/testcase/buildkit/cases0 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-test/autotest/testcase/buildkit/cases0 b/xCAT-test/autotest/testcase/buildkit/cases0 index fd8fd2774..17149110d 100644 --- a/xCAT-test/autotest/testcase/buildkit/cases0 +++ b/xCAT-test/autotest/testcase/buildkit/cases0 @@ -103,6 +103,7 @@ cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create pro check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;buildkit buildrepo all check:rc==0 +check:output!~error cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* @@ -153,6 +154,7 @@ cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit;buildkit create pro check:rc==0 cmd:cd /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit;reponame=`cat buildkit.conf|grep kitrepoid|sed 's/ //g' |grep ^kitrepoid=|head -1|awk -F= '{print $2}'`;buildkit buildrepo $reponame check:rc==0 +check:output!~error cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir check:output=~prodkit-1.0-1 cmd:ls /opt/xcat/share/xcat/tools/autotest/testcase/buildkit/prodkit/build/kit_repodir/prodkit-1.0-1-* From 46daf64a9322de5971099a3610407f53130c3a61 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 7 Dec 2016 01:58:29 -0500 Subject: [PATCH 198/292] fix issue [DEV] 'makentp -a' always return 1 #2282 --- xCAT-server/lib/xcat/plugins/makentp.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index f2e784751..9f404ae1c 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -454,11 +454,12 @@ sub process_request { }, $sub_req, -1, 1 ); + my $retcode=$::RUNCMD_RC; my $msg; foreach my $line (@$ret) { $msg .= "$line\n"; } - send_msg(\%request, 1, "$msg"); + send_msg(\%request, $retcode, "$msg"); } } From 40e9608cf45e1a5e366ec26c3099547c04adebd1 Mon Sep 17 00:00:00 2001 From: ertaozh Date: Wed, 7 Dec 2016 02:10:32 -0500 Subject: [PATCH 199/292] To have xcat-genesis-script depended on xcat-genesis-base 2.13.0 or higher --- xCAT-genesis-scripts/debian/control-amd64 | 2 +- xCAT-genesis-scripts/debian/control-ppc64el | 2 +- xCAT-genesis-scripts/xCAT-genesis-scripts.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-scripts/debian/control-amd64 b/xCAT-genesis-scripts/debian/control-amd64 index 20b99c52e..ada257a83 100644 --- a/xCAT-genesis-scripts/debian/control-amd64 +++ b/xCAT-genesis-scripts/debian/control-amd64 @@ -7,7 +7,7 @@ Standards-Version: 3.9.2 Package: xcat-genesis-scripts-amd64 Architecture: all -Depends: xcat-genesis-base-amd64 +Depends: xcat-genesis-base-amd64 (>=2.13.0) Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 Replaces: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 Description: xCAT genesis diff --git a/xCAT-genesis-scripts/debian/control-ppc64el b/xCAT-genesis-scripts/debian/control-ppc64el index 08459a6cf..825592d88 100644 --- a/xCAT-genesis-scripts/debian/control-ppc64el +++ b/xCAT-genesis-scripts/debian/control-ppc64el @@ -7,7 +7,7 @@ Standards-Version: 3.9.2 Package: xcat-genesis-scripts-ppc64 Architecture: all -Depends: xcat-genesis-base-ppc64 +Depends: xcat-genesis-base-ppc64 (>=2.13.0) Conflicts: xcat-genesis-scripts Replaces: xcat-genesis-scripts Description: xCAT genesis diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index c10abfbf6..2dcd33925 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -31,7 +31,7 @@ Vendor: IBM Corp Summary: xCAT Genesis netboot image - Core content URL: http://xcat.org Source1: xCAT-genesis-scripts.tar.bz2 -Requires: xCAT-genesis-base-%{tarch} +Requires: xCAT-genesis-base-%{tarch} >= 2:2.13.0 Buildroot: %{_localstatedir}/tmp/xCAT-genesis Packager: IBM Corp. From 7577ab8efe122f40566b3d9725aa7472b3f4d705 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 7 Dec 2016 07:04:40 -0500 Subject: [PATCH 200/292] SN ntp service setup --- xCAT-test/autotest/testcase/installation/SN_setup_case | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 7e8d25f37..9b6ea5490 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -34,7 +34,7 @@ cmd:chdef -t node $$SN groups=service,all check:rc==0 cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac check:rc==0 -cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1 +cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=1 setupntp=1 check:rc==0 cmd:chdef -t group -o service nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN monserver=$$MN check:rc==0 @@ -96,5 +96,6 @@ check:output=~/tftpboot on /tftpboot cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if [[ "__GETNODEATTR($$SN,os)__" =~ "sles" ]];then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]];then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi check:rc==0 - +cmd:makentp -a +check:rc==0 end From 6495de9cdae682b82f078891492c317e6937438d Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 7 Dec 2016 03:59:23 -0500 Subject: [PATCH 201/292] correct the path of genimage lock --- perl-xCAT/xCAT/Utils.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index d28ea58ae..af8f42fcf 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4817,7 +4817,7 @@ sub acquire_lock_imageop { my $lock = xCAT::Utils->acquire_lock("$mylockfile", $NON_BLOCK); unless ($lock){ my $pidfd; - open($pidfd,"<","/var/run/lock/xcat/$mylockfile"); + open($pidfd,"<","/var/lock/xcat/$mylockfile"); my $pid=<$pidfd>; close($pidfd); return (1, "failed to acquire lock, seems there is another genimage/packimage/rmimage process $pid running on root image dir \"$rootimg_dir\""); From 5af0a890a400a41d192fe02c743460a3ec904bae Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 7 Dec 2016 21:39:21 -0500 Subject: [PATCH 202/292] Add messages to trace the ntpd commands in genesis --- xCAT-genesis-scripts/bin/doxcat | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index e03df7a83..6a637fb91 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -262,18 +262,24 @@ openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' + +logger -s -t $log_label -p local4.info "Starting ntpd..." ntpd -g -x if [ -e "/dev/rtc" ]; then + logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." ( sleep 8 ; hwclock --systohc ) /dev/null 2>&1 & disown fi # rv 0 state does not work with the new ntp versions +logger -s -t $log_label -p local4.info "Checking ntpq for the offset values..." while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do sleep 1 done +logger -s -t $log_label -p local4.info "Checking ntpq for the offset values... Done" +logger -s -t $log_label -p local4.info "Restarting syslog..." read -r RSYSLOG_PID /dev/null kill "$RSYSLOG_PID" 2>/dev/null while kill -0 "$RSYSLOG_PID" 2>/dev/null From 32ccaf70e0712fbf13a668bd82e040f4ef7c6b18 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 8 Dec 2016 14:14:13 -0500 Subject: [PATCH 203/292] change the URL for go-xcat to github --- docs/source/guides/install-guides/common_sections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/install-guides/common_sections.rst b/docs/source/guides/install-guides/common_sections.rst index d4fdad136..e9f7cc87e 100644 --- a/docs/source/guides/install-guides/common_sections.rst +++ b/docs/source/guides/install-guides/common_sections.rst @@ -64,7 +64,7 @@ The following sections describe the different methods for installing xCAT. #. Download the ``go-xcat`` tool using ``wget``: :: - wget http://xcat.org/files/go-xcat -O - >/tmp/go-xcat + wget https://raw.githubusercontent.com/xcat2/xcat-core/master/xCAT-server/share/xcat/tools/go-xcat -O - >/tmp/go-xcat chmod +x /tmp/go-xcat #. Run the ``go-xcat`` tool: :: From 174145f1a32418349e8d844d7b924d59645b625d Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 8 Dec 2016 14:45:53 -0500 Subject: [PATCH 204/292] Update README.rst Update the documentation badges --- README.rst | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index 15abed55c..963df8f96 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ Documentation xCAT documentation is available at: http://xcat-docs.readthedocs.io/en/latest/ -|docs_latest| |docs_2124| |docs_2123| |docs_2122| |docs_212| |docs_211| +|docs_latest| |docs_2130| |docs_212| |docs_211| Open Source License ------------------- @@ -22,26 +22,16 @@ Developers Developers and prospective contributors are encouraged to read the `Developers Guide `_ In particular the `GitHub `_ related subsection. -.. |docs_2124| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.4 - :alt: 2.12.4 documentation status +.. |docs_2130| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.13.0 + :alt: 2.13.0 documentation status :scale: 100% - :target: http://xcat-docs.readthedocs.io/en/2.12.4/ - -.. |docs_2123| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.3 - :alt: 2.12.3 documentation status - :scale: 100% - :target: http://xcat-docs.readthedocs.io/en/2.12.3/ + :target: http://xcat-docs.readthedocs.io/en/2.13.0/ -.. |docs_2122| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.2 - :alt: 2.12.2 documentation status +.. |docs_212| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12 + :alt: 2.12 documentation status :scale: 100% - :target: http://xcat-docs.readthedocs.io/en/2.12.2/ - -.. |docs_212| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.12.0 - :alt: 2.12.0 documentation status - :scale: 100% - :target: http://xcat-docs.readthedocs.io/en/2.12.0/ - + :target: http://xcat-docs.readthedocs.io/en/2.12/ + .. |docs_211| image:: https://readthedocs.org/projects/xcat-docs/badge/?version=2.11 :alt: 2.11 documentation status :scale: 100% From 5b882fc24d92ea29867dba93fe18e1d691332912 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 8 Dec 2016 22:21:12 -0500 Subject: [PATCH 205/292] fix issue [fvt]sles12.2 mysqlsetup -i could not work #2297 --- xCAT-client/bin/mysqlsetup | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index e242ed930..b8936aa30 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -165,12 +165,8 @@ if ($::linuxos == "sles12") { close($relfile); chomp(@lines); - # if == 12.1 - if (grep /VERSION_ID="12.1"/, @lines) { - - #$::linuxos == "sles12.1"; - $sp1flag = 1; - } + # for sles12.x + $sp1flag = 1; } # set flag From 9a4e78ed5aee2efa104a0e1533b9642c9953174b Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 9 Dec 2016 01:07:41 -0500 Subject: [PATCH 206/292] Modify issue 2299: xcatprobe xcatmn do not clear the /etc/hosts if no usefull cn node to check dhcp in the environment --- xCAT-probe/subcmds/xcatmn | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 37d7ac33f..199262d19 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -156,6 +156,7 @@ sub do_main_job { $rc |= $rst; } + cleanup(); return $rc; } From fd79f1c1ac82a3f63a876b6b1d72a99f418e2cd9 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 9 Dec 2016 01:52:57 -0500 Subject: [PATCH 207/292] update Version to 2.13.1 --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index fb2c0766b..94f15e9cc 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.13.0 +2.13.1 From b47445b763fc48e56af9712e25d68e326a995bd9 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 13 Dec 2016 09:19:49 -0500 Subject: [PATCH 208/292] Global symbol "$csw" requires explicit package name at configBNT --- xCAT-server/share/xcat/scripts/configBNT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index 3dc4062bc..c307d2806 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -158,7 +158,7 @@ sub config_ip { # don't need to set if ip addresses are same if ($dip eq $static_ip) { print "static ip $static_ip and discovery ip $dip is same, will not process command for $switch\n"; - $cmd = "chdef $csw otherinterfaces="; + $cmd = "chdef $switch otherinterfaces="; $rc= xCAT::Utils->runcmd($cmd, 0); next; } From c1673f730b485f2a2aed1dcff03251ff0896e410 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Mon, 12 Dec 2016 15:43:17 -0500 Subject: [PATCH 209/292] Since the genesis kernel is not intended to be long running, there's no need to start ntp daemon, simply attempt to sync with ntpdate. There's an issue in this code where we query ntpq for the offset too quickly after starting the ntp daemon. This causes the offset to always be 0 and we continue. We have seen situations where ntpd starts before the first check and becomes > 1000. Then it takes 15 minutes before the 2nd attempt and delays the hardware discovery process --- xCAT-genesis-scripts/bin/doxcat | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 6a637fb91..f57234a49 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -260,11 +260,10 @@ fi openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" - ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' -logger -s -t $log_label -p local4.info "Starting ntpd..." -ntpd -g -x +logger -s -t $log_label -p local4.info "Attempting to sync the date with $XCATMASTER..." +ntpdate $XCATMASTER if [ -e "/dev/rtc" ]; then logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." @@ -272,13 +271,6 @@ if [ -e "/dev/rtc" ]; then disown fi -# rv 0 state does not work with the new ntp versions -logger -s -t $log_label -p local4.info "Checking ntpq for the offset values..." -while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do - sleep 1 -done -logger -s -t $log_label -p local4.info "Checking ntpq for the offset values... Done" - logger -s -t $log_label -p local4.info "Restarting syslog..." read -r RSYSLOG_PID /dev/null kill "$RSYSLOG_PID" 2>/dev/null From 23179aeaa90dd32ac06eab85f1f8ec1a724decc4 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 13 Dec 2016 13:21:03 -0500 Subject: [PATCH 210/292] Adding ntpdate to the list of commands to put into xCAT-genesis-base --- 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 67e6950fa..137d7f008 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -9,7 +9,7 @@ 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 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 poweroff ntpq ntpd ntpdate 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/whoami /usr/bin/head /usr/bin/tail 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 From 482f6b7fc2f40a592b746b39883e6914c27f2f05 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 13 Dec 2016 13:42:07 -0500 Subject: [PATCH 211/292] Use the -b option to force the time change --- xCAT-genesis-scripts/bin/doxcat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index f57234a49..12d4e3191 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -263,7 +263,7 @@ logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' logger -s -t $log_label -p local4.info "Attempting to sync the date with $XCATMASTER..." -ntpdate $XCATMASTER +ntpdate -b $XCATMASTER if [ -e "/dev/rtc" ]; then logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." From 09a661c8003af49905935f7f63a55c1aea32f94a Mon Sep 17 00:00:00 2001 From: XuWei Date: Tue, 13 Dec 2016 21:58:27 -0500 Subject: [PATCH 212/292] enhance xcatprobe osdeploy functions --- xCAT-probe/lib/perl/LogParse.pm | 29 +++++++--- xCAT-probe/subcmds/osdeploy | 95 ++++++++++++++++++++++++--------- 2 files changed, 92 insertions(+), 32 deletions(-) diff --git a/xCAT-probe/lib/perl/LogParse.pm b/xCAT-probe/lib/perl/LogParse.pm index a7c6e5379..026c1adfe 100644 --- a/xCAT-probe/lib/perl/LogParse.pm +++ b/xCAT-probe/lib/perl/LogParse.pm @@ -249,7 +249,7 @@ sub obtain_one_second_logs { while (<$fd>) { chomp; $self->debuglogger("[$loglabel]read: $_"); - my $log_content_ref = $self->obtain_log_content($self->{log_open_info}->{$loglabel}{filetype}, $_); + my $log_content_ref = $self->obtain_log_content($self->{log_open_info}->{$loglabel}{filetype}, $_, 0); #if read the log whoes time bigger than target time, stop to read $self->debuglogger("\t$log_content_ref->{time} $the_time_to_load"); @@ -472,13 +472,15 @@ sub obtain_log_content { my $self = shift; my $log_type = shift; my $original_log = shift; + my $is_monitor = shift; my %log_content = (); my @split_line = split(/\s+/, $original_log); if ($log_type == $::LOGTYPE_RSYSLOG) { if ($split_line[0] =~ /(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)(.+)-(.+)/) { - $log_content{time} = $self->convert_to_epoch_seconds($split_line[0]); + $log_content{time_record} = "$4:$5:$6"; + $log_content{time} = $self->convert_to_epoch_seconds($split_line[0], $is_monitor); if (!xCAT::NetworkUtils->isIpaddr($split_line[1])) { my @sender_tmp = split(/\./, $split_line[1]); $log_content{sender} = $sender_tmp[0]; @@ -505,7 +507,8 @@ sub obtain_log_content { } } else { my $timestamp = join(" ", @split_line[ 0 .. 2 ]); - $log_content{time} = $self->convert_to_epoch_seconds($timestamp); + $log_content{time_record} = $split_line[2]; + $log_content{time} = $self->convert_to_epoch_seconds($timestamp, $is_monitor); if (!xCAT::NetworkUtils->isIpaddr($split_line[3])) { my @sender_tmp = split(/\./, $split_line[3]); $log_content{sender} = $sender_tmp[0]; @@ -533,7 +536,10 @@ sub obtain_log_content { } } elsif ($log_type == $::LOGTYPE_HTTP) { $split_line[3] =~ s/^\[(.+)/$1/g; - $log_content{time} = $self->convert_to_epoch_seconds($split_line[3]); + if ($split_line[3] =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/) { + $log_content{time_record} = "$4:$5:$6"; + } + $log_content{time} = $self->convert_to_epoch_seconds($split_line[3], $is_monitor); if (!xCAT::NetworkUtils->isIpaddr($split_line[0])) { my @sender_tmp = split(/\./, $split_line[0]); $log_content{sender} = $sender_tmp[0]; @@ -561,6 +567,7 @@ sub obtain_log_content { sub convert_to_epoch_seconds { my $self = shift; my $timestr = shift; + my $is_monitor = shift; my $yday; my $mday; @@ -581,15 +588,23 @@ sub convert_to_epoch_seconds { ($mday, $dday, $h, $m, $s) = ($1, $2, $3, $4, $5); $yday = $self->{current_ref_year}; $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); - if ($epoch_seconds > $self->{current_ref_time}) { - --$yday; - $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); + if ($is_monitor) { + if ($epoch_seconds < $self->{current_ref_time}) { + ++$yday; + $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); + } + } else { + if ($epoch_seconds > $self->{current_ref_time}) { + --$yday; + $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); + } } # The time format looks like "15/Aug/2016:01:10:24" } elsif ($timestr =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/) { $epoch_seconds = timelocal($6, $5, $4, $1, $monthsmap{$2}, $3); } + return $epoch_seconds; } diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 63231b5e2..4b64f67cd 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -330,6 +330,7 @@ sub init_node_state { my @nodes = probe_utils->parse_node_range($noderange); foreach my $node (@nodes) { @{ $node_state_ref->{$node}{statehistory} } = (); + %{ $node_state_ref->{$node}{errors} } = (); $node_state_ref->{$node}{done} = 0; } } @@ -463,7 +464,6 @@ sub conclusion_report { foreach (@{ $node_state_ref->{$node}{statehistory} }) { $stop_stage = $_ if ($stop_stage < $_); $start_rpower = 1 if ($_ == $::STATE_POWER_ON); - $power_on = 1 if ($_ == $::STATE_POWERINGON); $isntalling = 1 if ($_ == $::STATE_INSTALLING); $postbootscript = 1 if ($_ == $::STATE_POSTBOOTSCRIPT); } @@ -476,19 +476,29 @@ sub conclusion_report { # 3 There isn't reboot operation for target node during the rollback time window # That means there isn't provision process happened - if ($start_rpower && !$power_on) { - $failed_node{$node}{non_provision_prediction} = "Trigger target node reboot failed"; - } elsif ($start_rpower && $power_on && !$isntalling && $postbootscript) { - $failed_node{$node}{non_provision_prediction} = "Target node just reboot from disk"; - } elsif (! $start_rpower){ - $failed_node{$node}{non_provision_prediction} = "Without provision process during rollback time window"; + if ($monitor) { + if (!$isntalling && $postbootscript) { + $failed_node{$node}{non_provision_prediction} = "Target node just reboot from disk"; + next; + } } else { - if ($stop_stage != $::STATE_COMPLETED) { - $failed_node{$node}{provision_stop_point} = $stop_stage; + if (! $start_rpower) { + $failed_node{$node}{non_provision_prediction} = "Without provision process during rollback time window"; + next; + } elsif (!$isntalling && $postbootscript) { + $failed_node{$node}{non_provision_prediction} = "Target node just reboot from disk"; + next; } } - } + if ($stop_stage != $::STATE_COMPLETED) { + $failed_node{$node}{provision_stop_point} = $stop_stage; + } + + if (@{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }) { + $failed_node{$node}{provision_stop_point} = $stop_stage; + } + } if (%failed_node) { my $failed_node_num = keys %failed_node; @@ -503,6 +513,17 @@ sub conclusion_report { probe_utils->send_msg("stdout", "f", "$node : $failed_node{$node}{non_provision_prediction}"); } else { probe_utils->send_msg("stdout", "f", "$node : stop at stage '$::STATE_DESC{$failed_node{$node}{provision_stop_point}}'"); + if ($failed_node{$node}{provision_stop_point} < $::STATE_POSTSCRIPT) { + foreach my $node_error (@{ $node_state_ref->{$node}{errors}{$failed_node{$node}{provision_stop_point}} }) { + probe_utils->send_msg("stdout", "d", "$node_error"); + } + } else { + for (my $stage = $::STATE_POSTSCRIPT; $stage <= $::STATE_COMPLETED; $stage++) { + foreach my $node_error (@{ $node_state_ref->{$node}{errors}{$stage} }) { + probe_utils->send_msg("stdout", "d", "$node_error"); + } + } + } } } } else { @@ -590,7 +611,7 @@ Start capturing every message during OS provision process.... foreach my $hdl (@hdls) { my $line = ""; chomp($line = <$hdl>); - my $log_content_ref = $log_parse->obtain_log_content($fd_filetype_map{$hdl}, $line); + my $log_content_ref = $log_parse->obtain_log_content($fd_filetype_map{$hdl}, $line, $monitor); dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); } } @@ -718,7 +739,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = "Receive DHCPDISCOVER via $nic"; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); } } elsif ($log_ref->{msg} =~ /DHCPOFFER\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/i) { @@ -729,7 +750,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = "Send DHCPOFFER on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); } } elsif ($log_ref->{msg} =~ /DHCPREQUEST\s+for\s+(.+)\s+[\(\)0-9\.]*\s*from\s+(.+)\s+via\s+(.+)/) { @@ -740,7 +761,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = $log_ref->{msg}; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); } } elsif ($log_ref->{msg} =~ /DHCPACK\s+on\s+(.+)\s+to\s+(.+)\s+via\s+(.+)/) { @@ -751,7 +772,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = "Send DHCPACK on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { @@ -770,7 +791,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = "Receive BOOTREQUEST from $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); } } elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { @@ -781,7 +802,7 @@ sub handle_dhcp_msg { if (exists $macmap{$mac}) { my $node = $macmap{$mac}{"node"}; my $record = "Send BOOTREPLY on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); if ($macmap{$mac}{"ip"} != "NOIP" and $macmap{$mac}{"ip"} != $ip) { @@ -817,7 +838,7 @@ sub handle_tftp_msg { my $file = $2; my $record = "Via TFTP download $file"; if (exists($node_state_ref->{ $ipnodemap{$ip} })) { - probe_utils->send_msg("stdout", "d", "[$ipnodemap{$ip}] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$ipnodemap{$ip}] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{ $ipnodemap{$ip} }{log} }, $log_ref->{msg}) if ($debug); if ($file =~ /xcat\/xnba.*/i or $file =~ /\/boot\/grub2\/powerpc-ieee1275\//i or $file =~ /\/yb\/node\/yaboot\-/i) { @@ -852,21 +873,26 @@ sub handle_http_msg { if (exists($node_state_ref->{ $ipnodemap{$ip} })) { - if ($log_ref->{msg} =~ /GET\s+(.+)\s+HTTP.+/ or $log_ref->{msg} =~ /HEAD\s+(.+)\s+HTTP.+/) { + if ($log_ref->{msg} =~ /"GET\s+(.+)\s+HTTP.+" (\d+)/ or $log_ref->{msg} =~ /"HEAD\s+(.+)\s+HTTP.+" (\d+)/) { my $file = $1; + my $http_code = $2; my $record = "Via HTTP get $file"; - probe_utils->send_msg("stdout", "d", "[$ipnodemap{$ip}] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$ipnodemap{$ip}] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{ $ipnodemap{$ip} }{log} }, $log_ref->{msg}) if ($debug); if ($file =~ /vmlinuz|inst64/i or ($file =~ /linux/i and $file =~ /osimage/i)) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_KERNEL); + push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_KERNEL} }, "$record failed with $http_code") if ($http_code >= 400); } elsif ($file =~ /initrd/i and $file =~ /osimage/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_INITRD); + push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_INITRD} }, "$record failed with $http_code") if ($http_code >= 400); } elsif (($file =~ /^\/install\/autoinst\//i) and ($file !~ /getinstdisk$/i) and ($file !~ /\.pre$/i) and ($file !~ /\.post$/i)) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_KICKSTART); + push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_KICKSTART} }, "$record failed with $http_code") if ($http_code >= 400); } elsif ($file =~ /\.deb$/i or $file =~ /\/Packages\/.+\.rpm$/ or $file =~ /\/suse\/noarch\/.+\.rpm$/i) { set_node_state($node_state_ref, $ipnodemap{$ip}, $::STATE_INSTALLRPM); + push (@{ $node_state_ref->{ $ipnodemap{$ip} }{errors}{$::STATE_INSTALLRPM} }, "$record failed with $http_code") if ($http_code >= 400); } } } @@ -897,11 +923,11 @@ sub handle_cluster_msg { my $nodes_str = $split_log[4]; my $sub_command = $split_log[5]; - if ($command eq "rinstall" or $command eq "rnetboot" or ($command eq "rpower" and $sub_command =~ /on|boot|reset/)) { + if ($command eq "rinstall" or $command eq "rnetboot" or ($command eq "rpower" and $sub_command =~ /on|boot|reset/) or ($command eq "xdsh" and $log_msg =~ /reboot|shutdown -r/)) { my @nodes = probe_utils->parse_node_range($nodes_str); foreach my $node (@nodes) { if (exists $node_state_ref->{$node}) { - probe_utils->send_msg("stdout", "d", "[$node] Use command $command to reboot node $node") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} Use command $command to reboot node $node") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); set_node_state($node_state_ref, $node, $::STATE_POWER_ON); } @@ -915,7 +941,7 @@ sub handle_cluster_msg { foreach my $node (@split_node) { if (exists $node_state_ref->{$node}) { - probe_utils->send_msg("stdout", "d", "[$node] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); if ($status eq "installing") { @@ -951,16 +977,34 @@ sub handle_compute_msg { my $node = $log_ref->{sender}; if (exists $node_state_ref->{$node}) { - probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{msg}") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$node] $log_ref->{time_record} $log_ref->{msg}") if ($monitor); push(@{ $node_state_ref->{$node}{log} }, $log_ref->{msg}) if ($debug); if ($log_ref->{msg} =~ /Running postscript:/i) { set_node_state($node_state_ref, $node, $::STATE_POSTSCRIPT); + } elsif ($log_ref->{msg} =~ /postscript (.+) return with (\d+)/) { + my $script_name = $1; + my $return_code = $2; + if ($return_code != 0) { + my $error_str = "postscript $script_name return with $return_code"; + unless (grep {$_ eq $error_str} @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }) { + push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }, $error_str; + } + } } elsif ($log_ref->{msg} =~ /Running postbootscript:/i) { set_node_state($node_state_ref, $node, $::STATE_POSTBOOTSCRIPT); + } elsif ($log_ref->{msg} =~ /postbootscript (.+) return with (\d+)/) { + my $script_name = $1; + my $return_code = $2; + if ($return_code != 0) { + my $error_str = "postbootscript $script_name return with $return_code"; + unless (grep {$_ eq $error_str} @{ $node_state_ref->{$node}{errors}{$::STATE_POSTBOOTSCRIPT} }) { + push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTBOOTSCRIPT} }, $error_str; + } + } } elsif ($log_ref->{msg} =~ /provision completed/) { set_node_state($node_state_ref, $node, $::STATE_COMPLETED); $node_state_ref->{$node}{done} = 1; - probe_utils->send_msg("stdout", "o", "[$node] provision completed") if ($monitor); + probe_utils->send_msg("stdout", "o", "[$node] $log_ref->{time_record} provision completed") if ($monitor); } } } @@ -1021,6 +1065,7 @@ sub set_node_state { if ($newstate == $::STATE_POWER_ON) { push @{ $node_state_ref->{$node}{allstatehistory} }, @{ $node_state_ref->{$node}{statehistory} }; @{ $node_state_ref->{$node}{statehistory} } = (); + %{ $node_state_ref->{$node}{errors} } = (); push @{ $node_state_ref->{$node}{statehistory} }, $newstate; } else { my $index = @{ $node_state_ref->{$node}{statehistory} } - 1; From c9d09d68cf2c4faa262175514b572e8610c5f44e Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 14 Dec 2016 01:23:30 -0500 Subject: [PATCH 213/292] change file name, replace hyphens by underscores --- xCAT-probe/subcmds/switch_macmap | 136 +++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100755 xCAT-probe/subcmds/switch_macmap diff --git a/xCAT-probe/subcmds/switch_macmap b/xCAT-probe/subcmds/switch_macmap new file mode 100755 index 000000000..3a52ca5df --- /dev/null +++ b/xCAT-probe/subcmds/switch_macmap @@ -0,0 +1,136 @@ +#! /usr/bin/perl +# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } + +use lib "$::XCATROOT/probe/lib/perl"; +use Cwd 'abs_path'; +use Cwd; +use File::Basename; +use File::Path; +use probe_utils; +use Getopt::Long qw(:config no_ignore_case); + +my $proname = basename("$0"); +my $currdir = dirname(abs_path($0)); +my $output = "stdout"; + +$::USAGE = "Usage: + $proname -h + $proname [-c] [-V] + +Description: + To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. + Currently, this command does not support hierarchy. + +Options: + -c: Check if the switch is OK to retrieve MAC address mapping. + -V: Output verbose information when accessing the switch +"; + +my $help; +my $test; +my $check; +my @nodes = (); +my $verbose = ''; +if (!GetOptions("help|h" => \$help, + "T" => \$test, + "c" => \$check, + "V" => \$verbose)) { + probe_utils->send_msg("$output", "f", "Option not supported"); + probe_utils->send_msg("$output", "d", $::USAGE); + exit 1; +} +foreach (@ARGV) { + if (/^-\w*/) { + probe_utils->send_msg("$output", "f", "Option $_ not supported"); + exit 1; + } else { + push @nodes, $_; + } +} +if ($help) { + probe_utils->send_msg("$output", "d", $::USAGE); + exit 0; +} + +if (!-d "$currdir/bin") { + mkpath("$currdir/bin/"); +} +if (!-e "$currdir/bin/switchprobe") { + link("$::XCATROOT/bin/xcatclient", "$currdir/bin/switchprobe"); +} + +if ($test) { + `$currdir/bin/switchprobe -h`; + if ($?) { + probe_utils->send_msg("$output", "f", "No 'switchprobe' tool is available at $currdir/bin/"); + exit 1; + } else { + probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in 'switches' table in xCAT db. Currently, this command does not support hierarchy."); + exit 0; + } +} +if ($verbose) { + $verbose = "-V"; +} +my $noderange = join(',', @nodes); +my $normal_file = "/tmp/result_normal"; +my $error_file = "/tmp/result_error"; +if (-f $normal_file) { + unlink($normal_file); +} +if (-f $error_file) { + unlink($error_file); +} +if ($check) { +`$currdir/bin/switchprobe $noderange -c $verbose >$normal_file 2>$error_file`; +} +else { + `$currdir/bin/switchprobe $noderange $verbose >$normal_file 2>$error_file`; +} +if (-f $error_file) { + `cat $error_file >> $normal_file`; +} +my $fd; +open($fd, "<", "$normal_file"); +my @fails = (); +my @error_nodes = (); +# There is 2 kinds of error message: +# 1. Error: The nodetype is not 'switch' for nodes: switch1 +# Error: No switch configuration info find for switch-10-5-23-1 +# 2. switch-10-5-23-1: Error: Timeout +foreach (<$fd>) { + chomp($_); + if (/Error:/) { + if (/^(\S*):\s*Error:\s*(.*)/) { + push @fails, "$1 - $2"; + } elsif (/^Error:\s*The nodetype is not 'switch' for nodes: (.+)/) { + push @error_nodes, "$1"; + } elsif (/^Error:\s*(.*)/) { + push @fails, $1; + } else { + push @fails, $_; + } + } + elsif (/^(\S*):\s*PASS/) { + probe_utils->send_msg("$output", "o", "$1"); + } + else { + probe_utils->send_msg("$output", "d", $_); + } +} +close($fd); +if (-f $normal_file) { + unlink($normal_file); +} +if (-f $error_file) { + unlink($error_file); +} +if (@error_nodes) { + my $error_node = join(",", @error_nodes); + probe_utils->send_msg("$output", "d", "[$error_node] : Error, switch-macmap can only be run against xCAT objects that have 'nodetype=switch'"); +} +foreach (@fails) { + probe_utils->send_msg("$output", "f", "$_"); +} +exit 0; From 9ae9d9c2d23663fff6dec9ac522fef7d17be9f81 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 14 Dec 2016 01:32:24 -0500 Subject: [PATCH 214/292] change file name, replace hyphens by underscores --- xCAT-probe/subcmds/switch-macmap | 136 ------------------------------- 1 file changed, 136 deletions(-) delete mode 100755 xCAT-probe/subcmds/switch-macmap diff --git a/xCAT-probe/subcmds/switch-macmap b/xCAT-probe/subcmds/switch-macmap deleted file mode 100755 index 3a52ca5df..000000000 --- a/xCAT-probe/subcmds/switch-macmap +++ /dev/null @@ -1,136 +0,0 @@ -#! /usr/bin/perl -# IBM(c) 2016 EPL license http://www.eclipse.org/legal/epl-v10.html -BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; } - -use lib "$::XCATROOT/probe/lib/perl"; -use Cwd 'abs_path'; -use Cwd; -use File::Basename; -use File::Path; -use probe_utils; -use Getopt::Long qw(:config no_ignore_case); - -my $proname = basename("$0"); -my $currdir = dirname(abs_path($0)); -my $output = "stdout"; - -$::USAGE = "Usage: - $proname -h - $proname [-c] [-V] - -Description: - To retrieve MAC address mapping for the specified switch, or all the switches defined in switches table in xCAT db. - Currently, this command does not support hierarchy. - -Options: - -c: Check if the switch is OK to retrieve MAC address mapping. - -V: Output verbose information when accessing the switch -"; - -my $help; -my $test; -my $check; -my @nodes = (); -my $verbose = ''; -if (!GetOptions("help|h" => \$help, - "T" => \$test, - "c" => \$check, - "V" => \$verbose)) { - probe_utils->send_msg("$output", "f", "Option not supported"); - probe_utils->send_msg("$output", "d", $::USAGE); - exit 1; -} -foreach (@ARGV) { - if (/^-\w*/) { - probe_utils->send_msg("$output", "f", "Option $_ not supported"); - exit 1; - } else { - push @nodes, $_; - } -} -if ($help) { - probe_utils->send_msg("$output", "d", $::USAGE); - exit 0; -} - -if (!-d "$currdir/bin") { - mkpath("$currdir/bin/"); -} -if (!-e "$currdir/bin/switchprobe") { - link("$::XCATROOT/bin/xcatclient", "$currdir/bin/switchprobe"); -} - -if ($test) { - `$currdir/bin/switchprobe -h`; - if ($?) { - probe_utils->send_msg("$output", "f", "No 'switchprobe' tool is available at $currdir/bin/"); - exit 1; - } else { - probe_utils->send_msg("$output", "o", "To retrieve MAC address mapping for the specified switch, or all the switches defined in 'switches' table in xCAT db. Currently, this command does not support hierarchy."); - exit 0; - } -} -if ($verbose) { - $verbose = "-V"; -} -my $noderange = join(',', @nodes); -my $normal_file = "/tmp/result_normal"; -my $error_file = "/tmp/result_error"; -if (-f $normal_file) { - unlink($normal_file); -} -if (-f $error_file) { - unlink($error_file); -} -if ($check) { -`$currdir/bin/switchprobe $noderange -c $verbose >$normal_file 2>$error_file`; -} -else { - `$currdir/bin/switchprobe $noderange $verbose >$normal_file 2>$error_file`; -} -if (-f $error_file) { - `cat $error_file >> $normal_file`; -} -my $fd; -open($fd, "<", "$normal_file"); -my @fails = (); -my @error_nodes = (); -# There is 2 kinds of error message: -# 1. Error: The nodetype is not 'switch' for nodes: switch1 -# Error: No switch configuration info find for switch-10-5-23-1 -# 2. switch-10-5-23-1: Error: Timeout -foreach (<$fd>) { - chomp($_); - if (/Error:/) { - if (/^(\S*):\s*Error:\s*(.*)/) { - push @fails, "$1 - $2"; - } elsif (/^Error:\s*The nodetype is not 'switch' for nodes: (.+)/) { - push @error_nodes, "$1"; - } elsif (/^Error:\s*(.*)/) { - push @fails, $1; - } else { - push @fails, $_; - } - } - elsif (/^(\S*):\s*PASS/) { - probe_utils->send_msg("$output", "o", "$1"); - } - else { - probe_utils->send_msg("$output", "d", $_); - } -} -close($fd); -if (-f $normal_file) { - unlink($normal_file); -} -if (-f $error_file) { - unlink($error_file); -} -if (@error_nodes) { - my $error_node = join(",", @error_nodes); - probe_utils->send_msg("$output", "d", "[$error_node] : Error, switch-macmap can only be run against xCAT objects that have 'nodetype=switch'"); -} -foreach (@fails) { - probe_utils->send_msg("$output", "f", "$_"); -} -exit 0; From 842da3e2ba71a3dd28a44aa391732aed37a2eb96 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Wed, 14 Dec 2016 03:43:23 -0500 Subject: [PATCH 215/292] completed --- .../autotest/bundle/sles12.2_ppc64le.bundle | 228 +++++++++++++++++ .../autotest/bundle/sles12.2_x86_64.bundle | 234 ++++++++++++++++++ 2 files changed, 462 insertions(+) create mode 100644 xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle create mode 100644 xCAT-test/autotest/bundle/sles12.2_x86_64.bundle diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle new file mode 100644 index 000000000..469a3527c --- /dev/null +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -0,0 +1,228 @@ +Diskless_installation_flat_p8_le +Full_installation_flat_p8_le +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 +makehosts_h +makehosts_help +makehosts_n +makehosts_n_noderange +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_err_symble +chtab_err_table +chtab_h +chtab_v +packimage_o_p_a_m +packimage_imagename +packimage_h +packimage_v +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_err_node +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_n +makedns +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_i_linux +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +xcatd_start_systemd +xcatd_stop_systemd +xcatd_restart_systemd +run_command_with_XCATBYPASS_systemd +disable_root_permission_in_policy_table_systemd +assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles +sles_migration1 +sles_migration2 +reg_linux_statelite_installation_flat +SN_setup_case +reg_linux_diskfull_installation_hierarchy +reg_linux_diskless_installation_hierarchy +reg_linux_statelite_installation_hierarchy_by_ramdisk +reg_linux_statelite_installation_hierarchy_by_nfs +clean_up_env diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle new file mode 100644 index 000000000..225f6cdad --- /dev/null +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -0,0 +1,234 @@ +reg_linux_diskfull_installation_flat +go_xcat_local_repo_case7 +go_xcat_noinput +go_xcat_with_x +go_xcat_with_xcat-version-1 +go_xcat_online_repo_case6 +makehosts_h +makehosts_help +makehosts_n +makehosts_n_noderange +chdef_null +chdef_z +chdef_t_o_error +chtab_null +chtab_d +chtab_modify_node +chtab_modify_key +chtab_err_symble +chtab_err_table +chtab_h +chtab_v +packimage_o_p_a_m +packimage_imagename +packimage_h +packimage_v +pping_h +pping_v +pping_node +gettab_key_table +gettab_H +gettab_err +gettab_h +lsdef_null +lsdef_a +lsdef_t_o_l +lsdef_t_o_l_z +lsdef_t +lsdef_t_i_o +lsdef_t_w +lsdef_t_err +lslite_i +lslite_noderange +lslite_h +makeconservercf_null +makeconservercf_noderange +makeconservercf_d +makedhcp_n +makedhcp_a +makedhcp_a_d +makedhcp_d +mkdef_null +mkdef_z +mkdef_t_o_error +nodeadd_noderange +nodeadd_err_symbol +nodeadd_null +nodeadd_noderange_nodetype +nodeadd_v +nodeadd_h +nodegrpch_v +nodegrpch_h +nodegrpch_groups +nodegrpch_err +nodech_noderange_table +nodech_noderange_table_comma +nodech_noderange_table_arrow +nodech_noderanage_table_at +nodech_delete +nodech_error_node +nodech_error_table +nodech_h +nodech_v +nodech_noderange_table_include +nodech_noderange_table_uninclude +nodech_noderange_table_equal +nodech_noderange_table_unequal +nodech_noderange_shortname_groups +nodech_noderange_shortname_tags +nodech_noderange_shortname_mgt +nodels_null +nodels_H +nodels_noderange +nodels_err_symbol +nodels_err_noderange +nodels_noderange_shortname_groups +nodels_noderange_shortname_tags +nodels_noderange_shortname_mgt +nodels_table_include +nodels_noderange_table_uninclude +nodels_noderange_table_equal +nodels_noderange_table_unequal +nodels_b +nodels_S +nodels_noderange_table +nodels_tablevalue +nodels_tablevalue_tablecolumn +nodels_noderange_tablecolumn +nodels_h +nodels_v +xcatstanzafile_normal +xcatstanzafile_colon +xcatstanzafile_attribute +xcatstanzafile_objtype +xcatstanzafile_tab +xcatstanzafile_multattr +xcatstanzafile_defaultvalue +xcatstanzafile_specificvalue +noderm_noderange +noderm_h +noderm_null +noderm_err_node +nodeset_stat +nodeset_noderange +nodestat_noderange +nodestat_err_node +rinv_noderange_err +rmdef_null +rmdef_t_err +rpower_err_noderange +rvitals_noderange_err +tabdump_table +tabdump_d +tabdump_v +tabdump_h +tabdump_help +tabdump_w_match +tabdump_w_equal +tabdump_w_ne +tabdump_w_notmatch +tabdump_w_gt +tabdump_w_ge +tabdump_w_lt +tabdump_w_le +tabdump_f_d +tabdump_d_nodehm +tabprune_h +tabprune_v +tabprune_a_eventlog +tabprune_V_a_eventlog +tabprune_i_auditlog +tabprune_V_n_auditlog +tabgrep_node +tabgrep_null +tabgrep_h +tabgrep_err +tabrestore_table +tabrestore_null +tabrestore_h +tabrestore_err +dumpxCATdb_h +dumpxCATdb_v +dumpxCATdb_p_nullskiptables +dumpxCATdb_a_p_nullskiptables +dumpxCATdb_p_skiptables +dumpxCATdb_a_p_skiptables +dumpxCATdb_p_nullskiptables_V +dumpxCATdb_a_p_nullskiptables_V +dumpxCATdb_p_V +restorexCAT_h +restorexCATdb_v +restorexCATdb_p_V +restorexCATdb_a_p_V +restorexCATdb_wrongpath +regnotif_null +regnotif_o +regnotif_err +regnotif_h +regnotif_v +unregnotif_null +unregnotif_f +unregnotif_h +unregnotif_v +lsxcatd_null +lsxcatd_h +lsxcatd_d +lsxcatd_a +makedns_d_node +makedns_n +makedns +copycds_iso +copycds_n +copycds_a +copycds_n_a +copycds_a_err +copycds_n_err +xdsh_h +xdsh_V +xdsh_regular_command +xdsh_Q_command +xdsh_c_cn +xdsh_e_filename +xdsh_E +xdsh_i_linux +xdsh_t +xdsh_q +xdsh_T +xdsh_o +switchdiscover_range_default +switchdiscover_h +switchdiscover_range_s +switchdiscover_range_default_w +switchdiscover_range_r +switchdiscover_range_x +switchdiscover_range_z +switchdiscover_range_z_V +nodeset_shell +nodeset_cmdline +nodeset_runimg +nodeset_check_warninginfo +xcatd_start_systemd +xcatd_stop_systemd +xcatd_restart_systemd +run_command_with_XCATBYPASS_systemd +disable_root_permission_in_policy_table_systemd +assign_certain_command_permission_systemd +xcatconfig_u_check_xcatsslversion_rhels_sles +sles_migration1 +sles_migration2 +reg_linux_diskless_installation_flat +packimage_m_cpio_c_gzip +packimage_m_cpio_c_pigz +packimage_m_cpio_c_xz +packimage_m_tar_c_pigz +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +reg_linux_statelite_installation_flat +SN_setup_case +reg_linux_diskfull_installation_hierarchy +reg_linux_diskless_installation_hierarchy +reg_linux_statelite_installation_hierarchy_by_ramdisk +reg_linux_statelite_installation_hierarchy_by_nfs +clean_up_env From 4897acedf787a5ffd93822cf39c7a71658e610e7 Mon Sep 17 00:00:00 2001 From: zet809 Date: Wed, 14 Dec 2016 17:35:55 +0800 Subject: [PATCH 216/292] Revert "[CUSTOMER] Use ntpdate in genesis kernel instead of starting the ntp daemon to reduce discovery time" --- xCAT-genesis-builder/install | 2 +- xCAT-genesis-scripts/bin/doxcat | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 137d7f008..67e6950fa 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -9,7 +9,7 @@ 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 dracut_install lldptool /lib64/libnss_dns-2.12.so /lib64/libnss_dns.so.2 -dracut_install poweroff ntpq ntpd ntpdate hwclock date /usr/share/terminfo/x/xterm /usr/share/terminfo/s/screen /etc/nsswitch.conf /etc/services +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/whoami /usr/bin/head /usr/bin/tail 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 diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 12d4e3191..6a637fb91 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -260,10 +260,11 @@ fi openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" + ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6|grep inet|awk '{print $2}' -logger -s -t $log_label -p local4.info "Attempting to sync the date with $XCATMASTER..." -ntpdate -b $XCATMASTER +logger -s -t $log_label -p local4.info "Starting ntpd..." +ntpd -g -x if [ -e "/dev/rtc" ]; then logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." @@ -271,6 +272,13 @@ if [ -e "/dev/rtc" ]; then disown fi +# rv 0 state does not work with the new ntp versions +logger -s -t $log_label -p local4.info "Checking ntpq for the offset values..." +while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do + sleep 1 +done +logger -s -t $log_label -p local4.info "Checking ntpq for the offset values... Done" + logger -s -t $log_label -p local4.info "Restarting syslog..." read -r RSYSLOG_PID /dev/null kill "$RSYSLOG_PID" 2>/dev/null From 27a35ff46c12d4b40480634cc68faa88e2538b05 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Wed, 14 Dec 2016 08:19:09 -0500 Subject: [PATCH 217/292] modify makedhcp -q issue --- .../autotest/testcase/installation/Full_installation_flat_p8_le | 2 +- .../testcase/installation/reg_linux_SN_installation_hierarchy | 2 +- .../testcase/installation/reg_linux_diskfull_installation_flat | 2 +- .../installation/reg_linux_diskfull_installation_hierarchy | 2 +- .../testcase/installation/reg_linux_diskless_installation_flat | 2 +- .../installation/reg_linux_diskless_installation_hierarchy | 2 +- .../testcase/installation/ubuntu_diskless_installation_vm | 2 +- .../autotest/testcase/installation/ubuntu_full_installation_vm | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index a058f5560..66aeb4c49 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -16,7 +16,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 0ff095d64..20a536aa7 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -20,7 +20,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$SN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$SN cmd:chdef -t node $$SN groups=service,all diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index b9c7d65bf..4ec302dfd 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -28,7 +28,7 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:sleep 10 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index 355887076..b33db473e 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -23,7 +23,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:output=~$$CN check:rc==0 cmd:copycds $$ISO diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 32cd3a986..7ac0f0711 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -17,7 +17,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index 43de73914..b0977c417 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -21,7 +21,7 @@ cmd:makedhcp -a check:rc==0 cmd:service dhcpd restart check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index 568c3125f..d29e8cfae 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -15,7 +15,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN cmd:makeconservercf $$CN diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index 274ad028f..3a6c2559b 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -10,7 +10,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:makedhcp -q $$CN +cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done check:rc==0 check:output=~$$CN cmd:makeconservercf $$CN From 3266a819b475067ca6521885ceee8eedd0fc46af Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 15 Dec 2016 01:00:21 -0500 Subject: [PATCH 218/292] correct the doc on ubt upgrade --- docs/source/guides/install-guides/apt/update_xcat.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/install-guides/apt/update_xcat.rst b/docs/source/guides/install-guides/apt/update_xcat.rst index dfa08f6f5..bc1aa8cdf 100644 --- a/docs/source/guides/install-guides/apt/update_xcat.rst +++ b/docs/source/guides/install-guides/apt/update_xcat.rst @@ -3,6 +3,6 @@ Updating xCAT If at a later date you want to update xCAT, first, update the software repositories and then run: :: apt-get update - apt-get --only-upgrade install xcat* + apt-get -y --only-upgrade install *xcat* From ac2cb01097e1678b66231218e588c0e6721d5103 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 15 Dec 2016 04:47:20 -0500 Subject: [PATCH 219/292] modify ubuntu migration test for ubuntu migration hang issue --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index 3e6d26560..1e473c166 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" +cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 7b7133c17..ad3bb7913 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" +cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index 25d1707cc..c30790aec 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" +cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index c8acb1318..f4cbc3f2b 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y upgrade xcat xcat-test" +cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 3c0f8e9e0cc373b47accc179a836ef28c8528267 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 15 Dec 2016 06:31:17 -0500 Subject: [PATCH 220/292] modify makedhcp -q issue --- .../testcase/installation/Full_installation_flat_p8_le | 3 +-- .../testcase/installation/reg_linux_SN_installation_hierarchy | 3 +-- .../testcase/installation/reg_linux_diskfull_installation_flat | 3 +-- .../installation/reg_linux_diskfull_installation_hierarchy | 3 +-- .../testcase/installation/reg_linux_diskless_installation_flat | 3 +-- .../installation/reg_linux_diskless_installation_hierarchy | 3 +-- .../testcase/installation/ubuntu_diskless_installation_vm | 3 +-- .../autotest/testcase/installation/ubuntu_full_installation_vm | 3 +-- 8 files changed, 8 insertions(+), 16 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 66aeb4c49..0b7779db2 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -16,9 +16,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:makedns -n check:rc==0 cmd:makeconservercf $$CN diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index 20a536aa7..f9d36a595 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -20,9 +20,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$SN);[ $? -ne 0 ] && exit 1;echo $output|grep $$SN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$SN cmd:chdef -t node $$SN groups=service,all check:rc==0 cmd:chdef -t group -o service profile=service primarynic=mac installnic=mac diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 4ec302dfd..c99eb4aa0 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -28,9 +28,8 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:sleep 10 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:copycds $$ISO check:rc==0 cmd:chdef -t node -o $$CN postscripts=setupntp diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy index b33db473e..5e3ce50c8 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_hierarchy @@ -23,8 +23,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done -check:output=~$$CN +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat index 7ac0f0711..9b3c04e60 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -17,9 +17,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy index b0977c417..219d8cda9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -21,9 +21,8 @@ cmd:makedhcp -a check:rc==0 cmd:service dhcpd restart check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm index d29e8cfae..492a26820 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_diskless_installation_vm @@ -15,9 +15,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm index 3a6c2559b..951693ce7 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm @@ -10,9 +10,8 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true;do output=`makedhcp -q $$CN|grep $$CN`;if [ $? -gt 0 ]; then let a++;sleep 1; else exit 0;fi; if [ $a -gt 100 ]; then exit 1;fi done +cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done check:rc==0 -check:output=~$$CN cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN From 3d3f367f69d18e09e849101d7110e16536cc2030 Mon Sep 17 00:00:00 2001 From: chenglch Date: Thu, 15 Dec 2016 17:12:19 +0800 Subject: [PATCH 221/292] Fix DB error caused by alarm 'xCAT::MsgUtils->trace' will retrive data from xCAT site table, at this time timeout event happens and alarm signal received, current process will exit unexpectly. partial-bug: pmr 87739,077,724 --- xCAT-server/sbin/xcatd | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 2cffabf5c..a2122f4d8 100644 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -1514,9 +1514,6 @@ until ($quit) { $$progname = "xcatd SSL: Instance for " . ($peername ? $peername . "@" . $peerhost : $peerhost) if $peerhost; service_connection($connection, $peername, $peerhost, $peerfqdn, $peerhostorg); - - $debugmsg = "xcatd: close connection with " . ($peername ? $peername . "@" . $peerhost : $peerhost) . "\n"; - xCAT::MsgUtils->trace(0, "D", "$debugmsg"); xexit(0); } if ($sslfudgefactor) { $sslfudgefactor -= 1; } @@ -2636,7 +2633,6 @@ sub service_connection { my $peerfqdn = shift; my $peerhostorg = shift; my $peerport = $sock->peerport; - my %tables = (); # some paranoid measures could reduce a third party abusing stage3 image to attempting to get USER/PASS for BMCs: # -Well, minimally, ignore requests if requesting node is not in spconfig mode (stage3) @@ -2873,12 +2869,10 @@ sub service_connection { cmdlog_submitlog(); # ----used for command log end--------- - + my $debugmsg = "xcatd: close connection with " . ($peername ? $peername . "@" . $peerhost : $peerhost) . "\n"; + xCAT::MsgUtils->trace(0, "D", "$debugmsg"); $SIG{ALRM} = sub { xCAT::MsgUtils->message("S", "$$ failed shutting down"); die; }; alarm(10); - foreach (keys %tables) { - $tables{$_}->commit; - } $sock->close(SSL_fast_shutdown => 1); if ($timedout == 1) { printf("Client timeout"); From 9939be28dbae686b6c322e4bc463482733719c80 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 15 Dec 2016 10:20:34 -0500 Subject: [PATCH 222/292] Modify usage for config switch scripts --- xCAT-server/share/xcat/scripts/configBNT | 17 +++++----- xCAT-server/share/xcat/scripts/configMellanox | 16 ++++++---- xCAT-server/share/xcat/scripts/configcumulus | 31 ++++++------------- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/configBNT b/xCAT-server/share/xcat/scripts/configBNT index 3dc4062bc..23e81e656 100755 --- a/xCAT-server/share/xcat/scripts/configBNT +++ b/xCAT-server/share/xcat/scripts/configBNT @@ -158,7 +158,7 @@ sub config_ip { # don't need to set if ip addresses are same if ($dip eq $static_ip) { print "static ip $static_ip and discovery ip $dip is same, will not process command for $switch\n"; - $cmd = "chdef $csw otherinterfaces="; + $cmd = "chdef $switch otherinterfaces="; $rc= xCAT::Utils->runcmd($cmd, 0); next; } @@ -545,15 +545,16 @@ sub config_desc { sub usage { print "Usage: - configBNT [-?│-h│--help] - configBNT [--switches switchnames] [--all] - configBNT [--switches switchnames] [--ip] - configBNT [--switches switchnames] [--name ] - configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] - configBNT [--switches switchnames] [--port port] [--vlan vlan] + configBNT -h│--help + configBNT --switches switchnames --ip + configBNT --switches switchnames --name + configBNT --switches switchnames --snmp [--user snmp_user] [--password snmp_password] [--group snmp_group] + configBNT --switches switchnames --port port --vlan vlan + + To set the ip address, hostname and config snmp: + configBNT --switches switchnames --all To set the description for a port on the switch: - configBNT --switches switchnames --port port --desc \"description\" \n"; } diff --git a/xCAT-server/share/xcat/scripts/configMellanox b/xCAT-server/share/xcat/scripts/configMellanox index f0a771488..2e6f1db34 100755 --- a/xCAT-server/share/xcat/scripts/configMellanox +++ b/xCAT-server/share/xcat/scripts/configMellanox @@ -329,12 +329,16 @@ sub run_rspconfig { sub usage { print "Usage: - configMellanox [-?│-h│--help] - configMellanox [--switches switchnames] [--all] - configMellanox [--switches switchnames] [--ip] - configMellanox [--switches switchnames] [--name] - configMellanox [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--auth snmp_auth] - configMellanox [--switches switchnames] [--config] + configMellanox -h│--help + configMellanox --switches switchnames --ip + configMellanox --switches switchnames --name + configMellanox --switches switchnames --snmp [--user snmp_user] [--password snmp_password] [--auth snmp_auth] + + To set the ip address, hostname, config snmp and run rspconfig command: + configMellanox --switches switchnames --all + + To run rspconfig command: + configMellanox --switches switchnames --config \n"; } diff --git a/xCAT-server/share/xcat/scripts/configcumulus b/xCAT-server/share/xcat/scripts/configcumulus index 7a6cbb55d..d367c2977 100755 --- a/xCAT-server/share/xcat/scripts/configcumulus +++ b/xCAT-server/share/xcat/scripts/configcumulus @@ -227,6 +227,7 @@ sub install_license { print "file = $license_file\n"; if (!(-e $license_file) ) { print "$license_file is not exist\n"; + return; } foreach my $switch (@nodes) { @@ -371,21 +372,6 @@ sub config_ntp { } -sub config_vlan { - if ($::PORT) { - $port = $::PORT; - } else { - &usage; - exit(1); - } - $vlan = $::VLAN; - print "Tagging VLAN=$vlan for $switches port $port\n"; - #create vlan, tagged vlan - #$cmd = `xdsh $switches --devicetype EthSwitch::BNT "enable;configure terminal;vlan $vlan;exit;interface port $port;switchport mode trunk;switchport trunk allowed vlan $vlan;write memory;exit;exit"`; - -} - - #--------------------------------------------------------- =head3 usage @@ -398,13 +384,14 @@ sub config_vlan { sub usage { print "Usage: - configBNT [-?│-h│--help] - configBNT [--switches switchnames] [--all] - configBNT [--switches switchnames] [--ssh] - configBNT [--switches switchnames] [--license filename ] - configBNT [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] [--group snmp_group] - configBNT [--switches switchnames] [--ntp] - configBNT [--switches switchnames] [--port port] [--vlan vlan] + configcumulus -h│--help + configcumulus --switches switchnames --ssh + configcumulus --switches switchnames --license filename + configcumulus --switches switchnames --snmp [--user snmp_user] [--password snmp_password] [--group snmp_group] + configcumulus --switches switchnames --ntp + + To set ssh, install license(license file: /root/license.txt), config snmp and ntp: + configcumulus --switches switchnames --all \n"; } From 1f113afdc837ecf11bdfc826304e466688663a12 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 15 Dec 2016 15:32:41 -0500 Subject: [PATCH 223/292] makeconservercf -d to remove all xCAT nodes --- .../admin-guides/references/man8/makeconservercf.8.rst | 10 ++++++---- xCAT-client/pods/man8/makeconservercf.8.pod | 10 ++++++---- xCAT-server/lib/xcat/plugins/conserver.pm | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man8/makeconservercf.8.rst b/docs/source/guides/admin-guides/references/man8/makeconservercf.8.rst index 28221da31..19ae43ea6 100644 --- a/docs/source/guides/admin-guides/references/man8/makeconservercf.8.rst +++ b/docs/source/guides/admin-guides/references/man8/makeconservercf.8.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-d|-**\ **-delete**\ ] \ *noderange*\ +\ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-d|-**\ **-delete**\ ] [\ *noderange*\ ] \ **makeconservercf**\ [\ **-V|-**\ **-verbose**\ ] [\ **-l|-**\ **-local**\ ] [\ *noderange*\ ] @@ -36,14 +36,16 @@ DESCRIPTION The \ **makeconservercf**\ command will write out the /etc/conserver.cf, using information from the nodehm table -and related tables (e.g. mp, ipmi, ppc). Normally, \ **makeconservercf**\ will write all nodes to the conserver.cf -file. If a noderange is specified, it will write on those nodes to the file. In either case, if a node +and related tables (e.g. mp, ipmi, ppc). Normally, \ **makeconservercf**\ will write all nodes to the /etc/conserver.cf +file. If a \ *noderange*\ is specified, it will write only those nodes to the file. In either case, if a node does not have nodehm.cons set, it will not be written to the file. +If \ **-d**\ is specified, \ **makeconservercf**\ will remove specified nodes from /etc/conserver.cf file. If \ *noderange*\ is not specified, all xCAT nodes will be removed from /etc/conserver.cf file. + In the case of a hierarchical cluster (i.e. one with service nodes) \ **makeconservercf**\ will determine which nodes will have their consoles accessed from the management node and which from a service node (based on the nodehm.conserver attribute). The /etc/conserver.cf file will be created accordingly on -all relevant management/service nodes. If -l is specified, it will only create the local file. +all relevant management/service nodes. If \ **-l**\ is specified, it will only create the local file. ******* diff --git a/xCAT-client/pods/man8/makeconservercf.8.pod b/xCAT-client/pods/man8/makeconservercf.8.pod index 06ea193c6..5b4dad03d 100644 --- a/xCAT-client/pods/man8/makeconservercf.8.pod +++ b/xCAT-client/pods/man8/makeconservercf.8.pod @@ -4,7 +4,7 @@ B - creates the conserver configuration file from info in the x =head1 SYNOPSIS -B [B<-V|--verbose>] [B<-d|--delete>] I +B [B<-V|--verbose>] [B<-d|--delete>] [I] B [B<-V|--verbose>] [B<-l|--local>] [I] @@ -18,14 +18,16 @@ B [B<-h|--help|-v|--version>] =head1 DESCRIPTION The B command will write out the /etc/conserver.cf, using information from the nodehm table -and related tables (e.g. mp, ipmi, ppc). Normally, B will write all nodes to the conserver.cf -file. If a noderange is specified, it will write on those nodes to the file. In either case, if a node +and related tables (e.g. mp, ipmi, ppc). Normally, B will write all nodes to the /etc/conserver.cf +file. If a I is specified, it will write only those nodes to the file. In either case, if a node does not have nodehm.cons set, it will not be written to the file. +If B<-d> is specified, B will remove specified nodes from /etc/conserver.cf file. If I is not specified, all xCAT nodes will be removed from /etc/conserver.cf file. + In the case of a hierarchical cluster (i.e. one with service nodes) B will determine which nodes will have their consoles accessed from the management node and which from a service node (based on the nodehm.conserver attribute). The /etc/conserver.cf file will be created accordingly on -all relevant management/service nodes. If -l is specified, it will only create the local file. +all relevant management/service nodes. If B<-l> is specified, it will only create the local file. =head1 OPTIONS diff --git a/xCAT-server/lib/xcat/plugins/conserver.pm b/xCAT-server/lib/xcat/plugins/conserver.pm index 8fdc5dfec..24336d186 100644 --- a/xCAT-server/lib/xcat/plugins/conserver.pm +++ b/xCAT-server/lib/xcat/plugins/conserver.pm @@ -428,7 +428,7 @@ sub makeconservercf { # Now add into the file all the node entries that we kept my $node; - if ($node = donodeent(\%cfgenthash, \@filecontent)) { + if ($node = donodeent(\%cfgenthash, \@filecontent, $delmode)) { # donodeent will return the 1st node in error #$cb->({node=>[{name=>$node,error=>"Bad configuration, check attributes under the nodehm category",errorcode=>1}]}); From 34ab88985c58bf52ac90cd50d8bb2e5f92ac281b Mon Sep 17 00:00:00 2001 From: XuWei Date: Thu, 15 Dec 2016 20:57:53 -0500 Subject: [PATCH 224/292] modified depending on comments --- xCAT-probe/lib/perl/LogParse.pm | 14 ++++----- xCAT-probe/lib/perl/probe_global_constant.pm | 4 +++ xCAT-probe/subcmds/discovery | 4 +-- xCAT-probe/subcmds/osdeploy | 32 ++++++++++---------- xCAT-probe/xcatprobe | 5 ++- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/xCAT-probe/lib/perl/LogParse.pm b/xCAT-probe/lib/perl/LogParse.pm index 026c1adfe..3161703ac 100644 --- a/xCAT-probe/lib/perl/LogParse.pm +++ b/xCAT-probe/lib/perl/LogParse.pm @@ -23,6 +23,7 @@ use File::Basename; Arguments: Public attributes: $self->{verbose}:scalar, Offer verbose information, used for handling feature logic + $self->{load_type}:scalar, $::MONITOR or $::REPLAY, used for distinguishing monitor and replay. private attributes: $self->{log_open_info}: reference of a hash, used to save the log file operating information. $self->{current_ref_year}: scalar, the year information of current time. such as 2016. Used for log time parsing @@ -50,6 +51,7 @@ sub new { my $self = {}; my $class = shift; $self->{verbose} = shift; + $self->{load_type} = shift; my %log_open_info; $self->{log_open_info} = \%log_open_info; @@ -249,7 +251,7 @@ sub obtain_one_second_logs { while (<$fd>) { chomp; $self->debuglogger("[$loglabel]read: $_"); - my $log_content_ref = $self->obtain_log_content($self->{log_open_info}->{$loglabel}{filetype}, $_, 0); + my $log_content_ref = $self->obtain_log_content($self->{log_open_info}->{$loglabel}{filetype}, $_); #if read the log whoes time bigger than target time, stop to read $self->debuglogger("\t$log_content_ref->{time} $the_time_to_load"); @@ -472,7 +474,6 @@ sub obtain_log_content { my $self = shift; my $log_type = shift; my $original_log = shift; - my $is_monitor = shift; my %log_content = (); my @split_line = split(/\s+/, $original_log); @@ -480,7 +481,7 @@ sub obtain_log_content { if ($log_type == $::LOGTYPE_RSYSLOG) { if ($split_line[0] =~ /(\d+)-(\d+)-(\d+)T(\d+):(\d+):(\d+)(.+)-(.+)/) { $log_content{time_record} = "$4:$5:$6"; - $log_content{time} = $self->convert_to_epoch_seconds($split_line[0], $is_monitor); + $log_content{time} = $self->convert_to_epoch_seconds($split_line[0]); if (!xCAT::NetworkUtils->isIpaddr($split_line[1])) { my @sender_tmp = split(/\./, $split_line[1]); $log_content{sender} = $sender_tmp[0]; @@ -508,7 +509,7 @@ sub obtain_log_content { } else { my $timestamp = join(" ", @split_line[ 0 .. 2 ]); $log_content{time_record} = $split_line[2]; - $log_content{time} = $self->convert_to_epoch_seconds($timestamp, $is_monitor); + $log_content{time} = $self->convert_to_epoch_seconds($timestamp); if (!xCAT::NetworkUtils->isIpaddr($split_line[3])) { my @sender_tmp = split(/\./, $split_line[3]); $log_content{sender} = $sender_tmp[0]; @@ -539,7 +540,7 @@ sub obtain_log_content { if ($split_line[3] =~ /(\d+)\/(\w+)\/(\d+):(\d+):(\d+):(\d+)/) { $log_content{time_record} = "$4:$5:$6"; } - $log_content{time} = $self->convert_to_epoch_seconds($split_line[3], $is_monitor); + $log_content{time} = $self->convert_to_epoch_seconds($split_line[3]); if (!xCAT::NetworkUtils->isIpaddr($split_line[0])) { my @sender_tmp = split(/\./, $split_line[0]); $log_content{sender} = $sender_tmp[0]; @@ -567,7 +568,6 @@ sub obtain_log_content { sub convert_to_epoch_seconds { my $self = shift; my $timestr = shift; - my $is_monitor = shift; my $yday; my $mday; @@ -588,7 +588,7 @@ sub convert_to_epoch_seconds { ($mday, $dday, $h, $m, $s) = ($1, $2, $3, $4, $5); $yday = $self->{current_ref_year}; $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); - if ($is_monitor) { + if ($self->{load_type} == $::MONITOR) { if ($epoch_seconds < $self->{current_ref_time}) { ++$yday; $epoch_seconds = timelocal($s, $m, $h, $dday, $monthsmap{$mday}, $yday); diff --git a/xCAT-probe/lib/perl/probe_global_constant.pm b/xCAT-probe/lib/perl/probe_global_constant.pm index 44b683117..db83a833d 100644 --- a/xCAT-probe/lib/perl/probe_global_constant.pm +++ b/xCAT-probe/lib/perl/probe_global_constant.pm @@ -2,6 +2,10 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package probe_global_constant; +#The type of load log +$::MONITOR = 0; +$::REPLAY = 1; + #The type of log $::LOGTYPE_RSYSLOG = 0; #rsyslog $::LOGTYPE_HTTP = 1; #apache log diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 080d10ce0..258ab9829 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -914,7 +914,7 @@ sub do_monitor { my %fd_filetype_map; { #a very important brace to hold a code block - my $log_parse = LogParse->new($verbose); + my $log_parse = LogParse->new($verbose, $::MONITOR); my $candidate_log_ref = $log_parse->obtain_log_file_list(); #open candidate log file to obtain realtime log @@ -1071,7 +1071,7 @@ sub do_replay { print Dumper \%node_state; } - my $log_parse = LogParse->new($verbose); + my $log_parse = LogParse->new($verbose, $::REPLAY); my @candidate_mn_hostname_in_log = $log_parse->obtain_candidate_mn_hostname_in_log(); while ($start_time_of_replay < $end_time_of_replay) { diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index 4b64f67cd..b41ca4e1b 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -375,7 +375,7 @@ sub do_replay { print Dumper \%node_state; } - my $log_parse = LogParse->new($verbose); + my $log_parse = LogParse->new($verbose, $::REPLAY); my @candidate_mn_hostname_in_log = $log_parse->obtain_candidate_mn_hostname_in_log(); while ($start_time_of_replay < $end_time_of_replay) { @@ -455,7 +455,6 @@ sub conclusion_report { my $stop_stage = 0; my $start_rpower = 0; - my $power_on = 0; my $isntalling = 0; my $postbootscript = 0; @@ -468,12 +467,10 @@ sub conclusion_report { $postbootscript = 1 if ($_ == $::STATE_POSTBOOTSCRIPT); } - # Cover limited non-privision error - # 1 if xcatd receive reboot command to do provision (such like rpower, rnetboot, rinstall...) but the node status didn't change to "powering-on" - # that means reboot target node failed. - # 2 if power on target node successfully and there is 'running postbootscript' in node state history, but without "installing" state, + # Cover limited non-privision error + # 1 if power on target node successfully and there is 'running postbootscript' in node state history, but without "installing" state, # It is very possible to just do reboot process - # 3 There isn't reboot operation for target node during the rollback time window + # 2 When replay, if there isn't reboot operation for target node during the rollback time window # That means there isn't provision process happened if ($monitor) { @@ -491,11 +488,8 @@ sub conclusion_report { } } - if ($stop_stage != $::STATE_COMPLETED) { - $failed_node{$node}{provision_stop_point} = $stop_stage; - } - - if (@{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }) { + # if not completed or completed but with postscript error, add node to failed_node hash + if ($stop_stage != $::STATE_COMPLETED or @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }) { $failed_node{$node}{provision_stop_point} = $stop_stage; } } @@ -512,15 +506,19 @@ sub conclusion_report { if ($failed_node{$node}{non_provision_prediction}) { probe_utils->send_msg("stdout", "f", "$node : $failed_node{$node}{non_provision_prediction}"); } else { + my $node_length = length($node); + my $space_str = " " x ($length_node + 2); + # if stop at stage before postscript, means there is error at current stage, print error message probe_utils->send_msg("stdout", "f", "$node : stop at stage '$::STATE_DESC{$failed_node{$node}{provision_stop_point}}'"); if ($failed_node{$node}{provision_stop_point} < $::STATE_POSTSCRIPT) { foreach my $node_error (@{ $node_state_ref->{$node}{errors}{$failed_node{$node}{provision_stop_point}} }) { - probe_utils->send_msg("stdout", "d", "$node_error"); + probe_utils->send_msg("stdout", "d", "$space_str $node_error"); } } else { + # if stop at postscript or after postscript, check whether has error from postscript, if has print for (my $stage = $::STATE_POSTSCRIPT; $stage <= $::STATE_COMPLETED; $stage++) { foreach my $node_error (@{ $node_state_ref->{$node}{errors}{$stage} }) { - probe_utils->send_msg("stdout", "d", "$node_error"); + probe_utils->send_msg("stdout", "d", "$space_str $node_error"); } } } @@ -569,7 +567,7 @@ Start capturing every message during OS provision process.... my %fd_filetype_map; { #a very important brace to hold a code block - my $log_parse = LogParse->new($verbose); + my $log_parse = LogParse->new($verbose, $::MONITOR); my $candidate_log_ref = $log_parse->obtain_log_file_list(); #open candidate log file to obtain realtime log @@ -611,7 +609,7 @@ Start capturing every message during OS provision process.... foreach my $hdl (@hdls) { my $line = ""; chomp($line = <$hdl>); - my $log_content_ref = $log_parse->obtain_log_content($fd_filetype_map{$hdl}, $line, $monitor); + my $log_content_ref = $log_parse->obtain_log_content($fd_filetype_map{$hdl}, $line); dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); } } @@ -986,6 +984,7 @@ sub handle_compute_msg { my $return_code = $2; if ($return_code != 0) { my $error_str = "postscript $script_name return with $return_code"; + # when monitor, will show 2 same messages, so filter to show only one unless (grep {$_ eq $error_str} @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }) { push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTSCRIPT} }, $error_str; } @@ -997,6 +996,7 @@ sub handle_compute_msg { my $return_code = $2; if ($return_code != 0) { my $error_str = "postbootscript $script_name return with $return_code"; + # when monitor, will show 2 same messages, so filter to show only one unless (grep {$_ eq $error_str} @{ $node_state_ref->{$node}{errors}{$::STATE_POSTBOOTSCRIPT} }) { push @{ $node_state_ref->{$node}{errors}{$::STATE_POSTBOOTSCRIPT} }, $error_str; } diff --git a/xCAT-probe/xcatprobe b/xCAT-probe/xcatprobe index dae96b42a..ef7d0bef1 100755 --- a/xCAT-probe/xcatprobe +++ b/xCAT-probe/xcatprobe @@ -141,7 +141,10 @@ sub format_cmd_output { if ($flag) { my $leftspace = $maxlen - length($finalmsg[$i]); - my $spacenum = (($leftspace >= $flaglen) ? ($leftspace - $flaglen) : ($screenwidth - length($finalmsg[$i]) + $maxlen - $flaglen)); + my $spacenum = 0; + if($flag !~ /debug/i) { + $spacenum = (($leftspace >= $flaglen) ? ($leftspace - $flaglen) : ($screenwidth - length($finalmsg[$i]) + $maxlen - $flaglen)); + } my $spacestr = " " x $spacenum; print "$finalmsg[$i]$spacestr"; From 5381dcc58146f3df937994e4126bdb5dea3ab5c0 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 16 Dec 2016 08:27:20 -0500 Subject: [PATCH 225/292] modify ubuntu migration case --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index 1e473c166..c8fcfd50b 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index ad3bb7913..59747fd21 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index c30790aec..78660bd3d 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index f4cbc3f2b..f964f4e72 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install *xcat*" +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From 921213ea9e474b2be89d0149bf8e670bbe2cbfc3 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 16 Dec 2016 16:09:56 -0500 Subject: [PATCH 226/292] File /etc/sysconfig/ntpd doesn't exists in the SLES --- xCAT-server/lib/xcat/plugins/makentp.pm | 24 +++++++++++++++++++----- xCAT/postscripts/setupntp | 21 +++++++++++++++------ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index 9f404ae1c..f60a73c55 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -309,11 +309,15 @@ sub process_request { } } + #for sles, /var/lib/ntp/drift is a dir if (xCAT::Utils->isAIX()) { print CFGFILE "driftfile /etc/ntp.drift\n"; print CFGFILE "tracefile /etc/ntp.trace\n"; print CFGFILE "disable auth\n"; print CFGFILE "broadcastclient\n"; + } elsif ($os =~ /sles/) { + print CFGFILE "driftfile /etc/ntp.drift\n"; + print CFGFILE "disable auth\n"; } else { print CFGFILE "driftfile /var/lib/ntp/drift\n"; print CFGFILE "disable auth\n"; @@ -384,14 +388,20 @@ sub process_request { #setup the RTC is UTC format, which will be used by os if ($os =~ /sles/) { - `sed -i 's/.*HWCLOCK.*/HWCLOCK="-u"/' /etc/sysconfig/clock`; + $grep_cmd = "grep -i HWCLOCK /etc/sysconfig/clock"; + $rc = xCAT::Utils->runcmd($grep_cmd, 0); + if ($::RUNCMD_RC == 0) { + `sed -i 's/.*HWCLOCK.*/HWCLOCK=\"-u\"/' /etc/sysconfig/clock`; + } else { + `echo HWCLOCK=\"-u\" >> /etc/sysconfig/clock`; + } } elsif (-f "/etc/debian_version") { `sed -i "s/.*UTC.*/UTC=yes/" /etc/default/rcS`; } else { if (-f "/etc/sysconfig/clock") { $grep_cmd = "grep -i utc /etc/sysconfig/clock"; $rc = xCAT::Utils->runcmd($grep_cmd, 0); - if ($::RUNCMD_RC != 0) { + if ($::RUNCMD_RC == 0) { `sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock`; } else { `echo "UTC=yes" >> /etc/sysconfig/clock`; @@ -406,11 +416,15 @@ sub process_request { if (-f "/etc/sysconfig/ntpd") { $grep_cmd = "grep -i SYNC_HWCLOCK /etc/sysconfig/ntpd"; $rc = xCAT::Utils->runcmd($grep_cmd, 0); - if ($::RUNCMD_RC != 0) { - `sed -i "s/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=yes/" /etc/sysconfig/ntpd`; + if ($::RUNCMD_RC == 0) { + `sed -i 's/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=\"yes\"/' /etc/sysconfig/ntpd`; } else { - `echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpd`; + `echo SYNC_HWCLOCK=\"yes\" >> /etc/sysconfig/ntpd`; } + } elsif (-f "/etc/sysconfig/ntp") { + `sed -i "s/.*SYNC_HWCLOCK.*/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=yes/" /etc/sysconfig/ntp`; + `sed -i "s/^NTPD_FORCE_SYNC_ON.*/NTPD_FORCE_SYNC_ON_STARTUP=yes/" /etc/sysconfig/ntp`; + `sed -i "s/.*RUN_CHROOTED.*/NTPD_RUN_CHROOTED=yes/" /etc/sysconfig/ntp`; } else { my $cron_file = "/etc/cron.daily/xcatsethwclock"; if (!-f "$cron_file") { diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index b45372705..8e6c71e9c 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -99,9 +99,13 @@ OS_TYPE=`uname` if [ $OS_TYPE = Linux ]; then mkdir -p /var/lib/ntp chown ntp /var/lib/ntp - echo "driftfile /var/lib/ntp/drift -disable auth -restrict 127.0.0.1" >>$conf_file + if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then + echo "driftfile /etc/ntp.drift" >>$conf_file + else + echo "driftfile /var/lib/ntp/drift" >>$conf_file + fi + echo "disable auth" >>$conf_file + echo "restrict 127.0.0.1" >>$conf_file #ntpdate/sntp conflict with ntpd, stop the service first checkservicestatus ntpserver @@ -140,7 +144,12 @@ restrict 127.0.0.1" >>$conf_file #setup the RTC is UTC format, which will be used by os if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then - sed -i 's/.*HWCLOCK.*/HWCLOCK="-u"/' /etc/sysconfig/clock + grep -i "HWCLOCK" /etc/sysconfig/clock + if [ $? -eq 0 ];then + sed -i 's/.*HWCLOCK.*/HWCLOCK=\"-u\"/' /etc/sysconfig/clock + else + echo "HWCLOCK=\"-u\"" >> /etc/sysconfig/clock + fi elif [ -f "/etc/debian_version" ];then sed -i 's/.*UTC.*/UTC=yes/' /etc/default/rcS else @@ -160,9 +169,9 @@ restrict 127.0.0.1" >>$conf_file if [ -f "/etc/sysconfig/ntpd" ];then grep -i "SYNC_HWCLOCK" /etc/sysconfig/ntpd if [ $? -eq 0 ];then - sed -i 's/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=yes/' /etc/sysconfig/ntpd + sed -i 's/.*SYNC_HWCLOCK.*/SYNC_HWCLOCK=\"yes\"/' /etc/sysconfig/ntpd else - echo "SYNC_HWCLOCK=yes" >> /etc/sysconfig/ntpd + echo "SYNC_HWCLOCK=\"yes\"" >> /etc/sysconfig/ntpd fi elif [ -f /etc/sysconfig/ntp ];then grep -i "NTPD_FORCE_SYNC_ON_STARTUP" /etc/sysconfig/ntp From f08b804e7490f6d238f8fd744c25df99fc4f0a9c Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Fri, 16 Dec 2016 16:44:21 -0500 Subject: [PATCH 227/292] modifed --- xCAT-server/lib/xcat/plugins/makentp.pm | 15 ++++++++------- xCAT/postscripts/setupntp | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index f60a73c55..91afe08f8 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -309,6 +309,8 @@ sub process_request { } } + my $os = xCAT::Utils->osver("all"); + #for sles, /var/lib/ntp/drift is a dir if (xCAT::Utils->isAIX()) { print CFGFILE "driftfile /etc/ntp.drift\n"; @@ -329,7 +331,6 @@ sub process_request { close CFGFILE; - my $os = xCAT::Utils->osver("all"); my $ntp_service = "ntpserver"; #stop ntpd @@ -396,15 +397,15 @@ sub process_request { `echo HWCLOCK=\"-u\" >> /etc/sysconfig/clock`; } } elsif (-f "/etc/debian_version") { - `sed -i "s/.*UTC.*/UTC=yes/" /etc/default/rcS`; + `sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/default/rcS`; } else { if (-f "/etc/sysconfig/clock") { $grep_cmd = "grep -i utc /etc/sysconfig/clock"; $rc = xCAT::Utils->runcmd($grep_cmd, 0); if ($::RUNCMD_RC == 0) { - `sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock`; + `sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/sysconfig/clock`; } else { - `echo "UTC=yes" >> /etc/sysconfig/clock`; + `echo UTC=\"yes\" >> /etc/sysconfig/clock`; } } else { `type -P timedatectl >/dev/null 2>&1`; @@ -422,9 +423,9 @@ sub process_request { `echo SYNC_HWCLOCK=\"yes\" >> /etc/sysconfig/ntpd`; } } elsif (-f "/etc/sysconfig/ntp") { - `sed -i "s/.*SYNC_HWCLOCK.*/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=yes/" /etc/sysconfig/ntp`; - `sed -i "s/^NTPD_FORCE_SYNC_ON.*/NTPD_FORCE_SYNC_ON_STARTUP=yes/" /etc/sysconfig/ntp`; - `sed -i "s/.*RUN_CHROOTED.*/NTPD_RUN_CHROOTED=yes/" /etc/sysconfig/ntp`; + `sed -i 's/.*SYNC_HWCLOCK.*/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp`; + `sed -i 's/^NTPD_FORCE_SYNC_ON.*/NTPD_FORCE_SYNC_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp`; + `sed -i 's/.*RUN_CHROOTED.*/NTPD_RUN_CHROOTED=\"yes\"/' /etc/sysconfig/ntp`; } else { my $cron_file = "/etc/cron.daily/xcatsethwclock"; if (!-f "$cron_file") { diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index 8e6c71e9c..f2a95994e 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -148,17 +148,17 @@ if [ $OS_TYPE = Linux ]; then if [ $? -eq 0 ];then sed -i 's/.*HWCLOCK.*/HWCLOCK=\"-u\"/' /etc/sysconfig/clock else - echo "HWCLOCK=\"-u\"" >> /etc/sysconfig/clock + echo HWCLOCK=\"-u\" >> /etc/sysconfig/clock fi elif [ -f "/etc/debian_version" ];then - sed -i 's/.*UTC.*/UTC=yes/' /etc/default/rcS + sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/default/rcS else if [ -f "/etc/sysconfig/clock" ];then grep -i "utc" /etc/sysconfig/clock if [ $? -eq 0 ];then - sed -i 's/.*UTC.*/UTC=yes/' /etc/sysconfig/clock + sed -i 's/.*UTC.*/UTC=\"yes\"/' /etc/sysconfig/clock else - echo "UTC=yes" >> /etc/sysconfig/clock + echo UTC=\"yes\" >> /etc/sysconfig/clock fi elif type -P timedatectl >/dev/null 2>&1 ;then timedatectl set-local-rtc 0 @@ -176,11 +176,11 @@ if [ $OS_TYPE = Linux ]; then elif [ -f /etc/sysconfig/ntp ];then grep -i "NTPD_FORCE_SYNC_ON_STARTUP" /etc/sysconfig/ntp if [ $? -eq 0 ];then - sed -i 's/NTPD_FORCE_SYNC_ON_STARTUP="no"/NTPD_FORCE_SYNC_ON_STARTUP="yes"/' /etc/sysconfig/ntp + sed -i 's/NTPD_FORCE_SYNC_ON_STARTUP=\"no\"/NTPD_FORCE_SYNC_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp fi grep -i "NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP" /etc/sysconfig/ntp if [ $? -eq 0 ];then - sed -i 's/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP="no"/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP="yes"/' /etc/sysconfig/ntp + sed -i 's/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=\"no\"/NTPD_FORCE_SYNC_HWCLOCK_ON_STARTUP=\"yes\"/' /etc/sysconfig/ntp fi else cron_file="/etc/cron.daily/xcatsethwclock" From 3e09b29f506fa74519b21d8d756b628dd3d5ed94 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 19 Dec 2016 01:53:32 -0500 Subject: [PATCH 228/292] modify ubuntu migration case --- xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le | 2 +- xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le index c8fcfd50b..02d5d9d36 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat.*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm index 59747fd21..3c4e3aadc 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration1_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat.*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le index 78660bd3d..810adb134 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_p8le @@ -104,7 +104,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat.*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm index f964f4e72..866073f27 100644 --- a/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm +++ b/xCAT-test/autotest/testcase/migration/ubuntu_migration2_vm @@ -103,7 +103,7 @@ cmd:xdsh $$CN "apt-get clean all" check:rc==0 cmd:xdsh $$CN "apt-get update" check:rc==0 -cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat*." +cmd:xdsh $$CN "apt-get -y --only-upgrade install .*xcat.*" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v > /newxcat/new_version" check:rc==0 From ad9f2e4869043eefa3180b839c0e3c770de2a397 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Mon, 19 Dec 2016 02:28:42 -0500 Subject: [PATCH 229/292] modify ubuntu update xcat doc --- docs/source/guides/install-guides/apt/update_xcat.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/install-guides/apt/update_xcat.rst b/docs/source/guides/install-guides/apt/update_xcat.rst index bc1aa8cdf..650a03f8e 100644 --- a/docs/source/guides/install-guides/apt/update_xcat.rst +++ b/docs/source/guides/install-guides/apt/update_xcat.rst @@ -3,6 +3,6 @@ Updating xCAT If at a later date you want to update xCAT, first, update the software repositories and then run: :: apt-get update - apt-get -y --only-upgrade install *xcat* + apt-get -y --only-upgrade install .*xcat.* From 4a0c49769798ba0a3b0cab42c5e300e321c476a6 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Fri, 16 Dec 2016 03:28:21 -0500 Subject: [PATCH 230/292] enhance http service checking, offer more error message --- xCAT-probe/lib/perl/probe_utils.pm | 51 ++++++++++++++++++++++++++---- xCAT-probe/subcmds/xcatmn | 5 +-- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index db96fdc24..c6f1d3722 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -257,6 +257,7 @@ sub is_firewall_open { Test if http service is ready to use in current operating system Arguments: ip: http server's ip + errormsg_ref: (output attribute) if there is something wrong for HTTP service, this attribute save the possible reason. Returns: 1 : yes 0 : no @@ -266,20 +267,56 @@ sub is_firewall_open { sub is_http_ready { my $mnip = shift; $mnip = shift if (($mnip) && ($mnip =~ /probe_utils/)); + my $errormsg_ref = shift; + + my $http = "http://$mnip/install/postscripts/syslog"; + my %httperror = ( + "400" => "The request $http could not be understood by the server due to malformed syntax", + "401" => "The request requires user authentication.", + "403" => "The server understood the request, but is refusing to fulfill it.", + "404" => "The server has not found anything matching the test Request-URI $http.", + "405" => "The method specified in the Request-Line $http is not allowe.", + "406" => "The method specified in the Request-Line $http is not acceptable.", + "408" => "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.", + "409" => "The request could not be completed due to a conflict with the current state of the resource.", + "410" => "The requested resource $http is no longer available at the server and no forwarding address is known.", + "411" => "The server refuses to accept the request without a defined Content- Length.", + "412" => "The precondition given in one or more of the request-header fields evaluated to false when it was tested on the server.", + "413" => "The server is refusing to process a request because the request entity is larger than the server is willing or able to process.", + "414" => "The server is refusing to service the request because the Request-URI is longer than the server is willing to interpret.", + "415" => "The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method.", + "416" => "Requested Range Not Satisfiable", + "417" => "The expectation given in an Expect request-header field could not be met by this server", + "500" => "The server encountered an unexpected condition which prevented it from fulfilling the request.", + "501" => "The server does not recognize the request method and is not capable of supporting it for any resource.", + "502" => "The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the reques.", + "503" => "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server.", + "504" => "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access in attempting to complete the request.", + "505" => "The server does not support, or refuses to support, the HTTP protocol version that was used in the request message."); - my $http = "http://$mnip/install/postscripts/syslog"; rename("./syslog", "./syslog.org") if (-e "./syslog"); - - my $outputtmp = `wget $http 2>&1`; + my @outputtmp = `wget $http 2>&1`; my $rst = $?; - if (($outputtmp =~ /200 OK/) && (!$rst) && (-e "./syslog")) { + $rst = $rst >> 8; + + if ((!$rst) && (-e "./syslog")) { unlink("./syslog"); rename("./syslog.org", "./syslog") if (-e "./syslog.org"); return 1; - } else { - rename("./syslog.org", "./syslog") if (-e "./syslog.org"); - return 0; + } elsif ($rst == 4) { + $$errormsg_ref = "Network failure, the server refuse connection. Please check if httpd service is running first."; + } elsif ($rst == 5) { + $$errormsg_ref = "SSL verification failure, the server refuse connection"; + } elsif ($rst == 6) { + $$errormsg_ref = "Username/password authentication failure, the server refuse connection"; + } elsif ($rst == 8) { + my $returncode = $outputtmp[2]; + chomp($returncode); + $returncode =~ s/.+(\d\d\d).+/$1/g; + $$errormsg_ref = $httperror{$returncode}; } + rename("./syslog.org", "./syslog") if (-e "./syslog.org"); + return 0; } #------------------------------------------ diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 199262d19..540d2f543 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -566,8 +566,9 @@ sub check_http_service { push @$error_ref, "HTTP check need 'wget' tool, please install 'wget' tool and try again"; $rst = 1; } else { - if (!probe_utils->is_http_ready("$serverip")) { - push @$error_ref, "HTTP service isn't ready on $serverip"; + my $errormsg; + if (!probe_utils->is_http_ready("$serverip", \$errormsg)) { + push @$error_ref, "$errormsg"; $rst = 1; } } From 41f8c31ba12d3613abdd177c856e5d9503835f66 Mon Sep 17 00:00:00 2001 From: XuWei Date: Mon, 19 Dec 2016 01:23:42 -0500 Subject: [PATCH 231/292] add xcatprobe discovery time info when monitor --- xCAT-probe/subcmds/discovery | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/xCAT-probe/subcmds/discovery b/xCAT-probe/subcmds/discovery index 258ab9829..bd57ead93 100755 --- a/xCAT-probe/subcmds/discovery +++ b/xCAT-probe/subcmds/discovery @@ -1188,11 +1188,11 @@ sub handle_dhcp_msg { my $nic = $2; if ($3 =~ /no free leases/) { - probe_utils->send_msg("stdout", "d", "[$mac] Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } my $record = "Received DHCPDISCOVER from $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /DHCPOFFER\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/i) { my $ip = $1; @@ -1200,7 +1200,7 @@ sub handle_dhcp_msg { my $nic = $3; my $record = "Sent DHCPOFFER on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /DHCPREQUEST\s+for\s+(.+)\s+[\(\)0-9\.]*\s*from\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; @@ -1208,7 +1208,7 @@ sub handle_dhcp_msg { my $nic = $3; my $record = "Received DHCPREQUEST from $mac for $ip via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /DHCPACK\s+on\s+(.+)\s+to\s+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; @@ -1216,7 +1216,7 @@ sub handle_dhcp_msg { my $nic = $3; my $record = "Sent DHCPACK on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); $ipmacmap{$ip} = $mac; $node_state_ref->{$mac}{type} = "mac"; @@ -1225,11 +1225,11 @@ sub handle_dhcp_msg { my $mac = $1; my $nic = $2; if ($3 =~ /no dynamic leases/) { - probe_utils->send_msg("stdout", "d", "Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} Received DHCPDISCOVER from $mac via $nic, no free leases") if ($monitor); return 0; } my $record = "Received BOOTREQUEST from $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /BOOTREPLY\s+for\s+(.+)\s+to\s+.+(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w).+via\s+(.+)/) { my $ip = $1; @@ -1237,7 +1237,7 @@ sub handle_dhcp_msg { my $nic = $3; my $record = "Sent BOOTREPLY on $ip back to $mac via $nic"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); $ipmacmap{$ip} = $mac; $node_state_ref->{$mac}{type} = "mac"; @@ -1269,7 +1269,7 @@ sub handle_tftp_msg { if (exists($node_state_ref->{$mac})) { my $record = "Via TFTP $ip download $file"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); if ($file =~ /\/pxelinux.cfg\//i or $file =~ /\/xcat\/xnba\/nets\//i) { @@ -1309,7 +1309,7 @@ sub handle_http_msg { if ($file =~ /\/install\//i) { return; } - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); if ($file =~ /\/pxelinux.cfg\//i or $file =~ /\/xcat\/xnba\/nets\//i) { @@ -1349,13 +1349,13 @@ sub handle_cluster_msg { $node_state_ref->{$node}{id} = $mac; $node_state_ref->{$node}{discoverytype} = $type; my $record = "Start to update node information, discovery type is $type"; - probe_utils->send_msg("stdout", "d", "[$mac] $record") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} $record") if ($monitor); set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_UPDATE); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } elsif ($log_ref->{msg} =~ /xcat.discovery.$discovery_type: \((.+)\) Warning: Could not find any nodes using (.+) discovery/i) { my $mac = $1; my $type = $2; - probe_utils->send_msg("stdout", "w", "[$mac] Could not find any nodes using $type discovery") if ($monitor); + probe_utils->send_msg("stdout", "w", "[$mac] $log_ref->{time_record} Could not find any nodes using $type discovery") if ($monitor); set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_FAILED); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); } @@ -1381,7 +1381,7 @@ sub handle_compute_msg { my $mac = $ipmacmap{$ip}; if (exists $node_state_ref->{$mac}) { - probe_utils->send_msg("stdout", "d", "[$mac] ($ip) $log_ref->{msg}") if ($monitor); + probe_utils->send_msg("stdout", "d", "[$mac] $log_ref->{time_record} ($ip) $log_ref->{msg}") if ($monitor); push(@{ $node_state_ref->{$mac}{log} }, $log_ref->{msg}) if ($debug); if ($log_ref->{label} == $::LOGLABEL_DOXCAT) { @@ -1403,7 +1403,7 @@ sub handle_compute_msg { } if ($node ne "") { $node_state_ref->{$node}{done} = 1; - probe_utils->send_msg("stdout", "o", "[$mac] node $node discovery completed") if ($monitor); + probe_utils->send_msg("stdout", "o", "[$mac] $log_ref->{time_record} node $node discovery completed") if ($monitor); set_node_state($node_state_ref, $mac, $::STATE_DISCOVER_COMPLETED); } } From 375e43fcc58aa239ce33b4b5fa08407cbcc5866d Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Mon, 19 Dec 2016 02:56:26 -0500 Subject: [PATCH 232/292] update installation version --- xCAT-test/autotest/testcase/go-xcat/case1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/go-xcat/case1 b/xCAT-test/autotest/testcase/go-xcat/case1 index 2d2791199..157f249fe 100644 --- a/xCAT-test/autotest/testcase/go-xcat/case1 +++ b/xCAT-test/autotest/testcase/go-xcat/case1 @@ -47,10 +47,10 @@ cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "scp -r $$MN:/etc/resolv.conf /e check:rc==0 cmd:if grep Ubuntu /etc/*release;then xdsh $$CN "apt-get clean && apt-get update"; fi check:rc==0 -cmd:xdsh $$CN "cd /; ./go-xcat -x $$MIGRATION1_VERSION -y install" +cmd:xdsh $$CN "cd /; ./go-xcat -x $$MIGRATION2_VERSION -y install" check:rc==0 cmd:xdsh $$CN "source /etc/profile.d/xcat.sh;lsxcatd -v" -check:output=~Version $$MIGRATION1_VERSION +check:output=~Version $$MIGRATION2_VERSION cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running From 0ec39c2a57987aac871b22dc8f8c38d4329fc70d Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 20 Dec 2016 12:11:27 +0800 Subject: [PATCH 233/292] Fix the code of waiting for ntpd to synchronize in genessis --- xCAT-genesis-scripts/bin/doxcat | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 6a637fb91..0f39e1e89 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -266,18 +266,18 @@ ip addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|grep -v inet6| logger -s -t $log_label -p local4.info "Starting ntpd..." ntpd -g -x -if [ -e "/dev/rtc" ]; then - logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." - ( sleep 8 ; hwclock --systohc ) /dev/null 2>&1 & - disown +logger -s -t $log_label -p local4.info "Waiting for ntpd to synchronize..." +ntp-wait -n 1999 -s 1 -v +if [ $? -ne 0 ] +then + logger -s -t $log_label -p local4.info "... ntpd did not synchronize." fi -# rv 0 state does not work with the new ntp versions -logger -s -t $log_label -p local4.info "Checking ntpq for the offset values..." -while [ "`ntpq -c 'rv 0 offset' | awk -F '=' '/offset=/ { print $2 }' | awk -F '.' '{ print $1 }' | sed s/-//`" -ge 1000 ]; do - sleep 1 -done -logger -s -t $log_label -p local4.info "Checking ntpq for the offset values... Done" +if [ -e "/dev/rtc" ]; then + logger -s -t $log_label -p local4.info "Attempting to sync hardware clock..." + ( hwclock --systohc ) /dev/null 2>&1 & + disown +fi logger -s -t $log_label -p local4.info "Restarting syslog..." read -r RSYSLOG_PID /dev/null From 0044749f338965dbbc100519754cdcafdd5b0bbd Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Tue, 20 Dec 2016 12:54:15 +0800 Subject: [PATCH 234/292] Add command ntp-wait into package xCAT-genesis-base --- xCAT-genesis-builder/install | 2 +- xCAT-genesis-builder/install.ubuntu | 2 +- xCAT-genesis-builder/xCAT-genesis-base.spec | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/install b/xCAT-genesis-builder/install index 67e6950fa..2f1d0507f 100755 --- a/xCAT-genesis-builder/install +++ b/xCAT-genesis-builder/install @@ -9,7 +9,7 @@ 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 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 poweroff ntpq ntpd ntp-wait 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/whoami /usr/bin/head /usr/bin/tail 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 diff --git a/xCAT-genesis-builder/install.ubuntu b/xCAT-genesis-builder/install.ubuntu index 9ae3f5af2..f073efff0 100755 --- a/xCAT-genesis-builder/install.ubuntu +++ b/xCAT-genesis-builder/install.ubuntu @@ -10,7 +10,7 @@ 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 dracut_install lldptool -dracut_install poweroff ntpq ntpd hwclock date /usr/share/terminfo/x/xterms /etc/nsswitch.conf /etc/services +dracut_install poweroff ntpq ntp-wait ntpd hwclock date /usr/share/terminfo/x/xterms /etc/nsswitch.conf /etc/services dracut_install /usr/sbin/rsyslogd /etc/protocols umount /usr/bin/dpkg /usr/bin/rpm /usr/lib/rpm/rpmrc if [ -n $version12 ];then dracut_install /lib/x86_64-linux-gnu/libnss_dns-2.15.so /lib/x86_64-linux-gnu/libnss_dns.so.2 diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 989980591..9d8c7907f 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -31,6 +31,7 @@ URL: http://xcat.org Source1: xCAT-genesis-base-%{tarch}.tar.bz2 Buildroot: %{_localstatedir}/tmp/xCAT-genesis +BuildRequires: /usr/sbin/ntp-wait Packager: IBM Corp. %Description From e3cfd47466166056b65afff2cb52316cd8262f06 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 21 Dec 2016 02:09:02 -0500 Subject: [PATCH 235/292] add ntp check and modify http part depending on gongjie's comment --- xCAT-probe/lib/perl/probe_utils.pm | 84 +++++++++++++++++++++++++++--- xCAT-probe/subcmds/xcatmn | 26 +++++++++ 2 files changed, 103 insertions(+), 7 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index c6f1d3722..e97264796 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -277,6 +277,7 @@ sub is_http_ready { "404" => "The server has not found anything matching the test Request-URI $http.", "405" => "The method specified in the Request-Line $http is not allowe.", "406" => "The method specified in the Request-Line $http is not acceptable.", + "407" => "The wget client must first authenticate itself with the proxy.", "408" => "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time.", "409" => "The request could not be completed due to a conflict with the current state of the resource.", "410" => "The requested resource $http is no longer available at the server and no forwarding address is known.", @@ -294,14 +295,16 @@ sub is_http_ready { "504" => "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access in attempting to complete the request.", "505" => "The server does not support, or refuses to support, the HTTP protocol version that was used in the request message."); - rename("./syslog", "./syslog.org") if (-e "./syslog"); - my @outputtmp = `wget $http 2>&1`; + my $suffix = time(); + my $tmpdir = "/tmp/xcatprobe$suffix/"; + mkpath("$tmpdir"); + my @outputtmp = `cd $tmpdir && wget $http 2>&1`; my $rst = $?; $rst = $rst >> 8; - if ((!$rst) && (-e "./syslog")) { - unlink("./syslog"); - rename("./syslog.org", "./syslog") if (-e "./syslog.org"); + if ((!$rst) && (-e "$tmpdir/syslog")) { + unlink("$tmpdir/syslog"); + rmdir ("$tmpdir"); return 1; } elsif ($rst == 4) { $$errormsg_ref = "Network failure, the server refuse connection. Please check if httpd service is running first."; @@ -313,9 +316,14 @@ sub is_http_ready { my $returncode = $outputtmp[2]; chomp($returncode); $returncode =~ s/.+(\d\d\d).+/$1/g; - $$errormsg_ref = $httperror{$returncode}; + if(exists($httperror{$returncode})){ + $$errormsg_ref = $httperror{$returncode}; + }else{ + #should not hit this block normally + $$errormsg_ref = "Unexpected return code of wget <$returncode>."; + } } - rename("./syslog.org", "./syslog") if (-e "./syslog.org"); + rmdir ("$tmpdir"); return 0; } @@ -473,4 +481,66 @@ sub parse_node_range { chomp @nodeslist; return @nodeslist; } + +#------------------------------------------ + +=head3 + Description: + Test if ntp service is ready to use in current operating system + Arguments: + errormsg_ref: (output attribute) if there is something wrong for ntp service, this attribute save the possible reason. + Returns: + 1 : yes + 0 : no +=cut + +#------------------------------------------ +sub is_ntp_ready{ + my $errormsg_ref = shift; + $errormsg_ref= shift if (($errormsg_ref) && ($errormsg_ref =~ /probe_utils/)); + + my $cmd = 'ntpq -c "rv 0"'; + $| = 1; + + #wait 5 seconds for ntpd synchronize at most + for (my $i = 0; $i < 5; ++$i) { + if(!open(NTP, $cmd." 2>&1 |")){ + $$errormsg_ref = "Can't start ntpq: $!"; + return 0; + }else{ + while() { + chomp; + if (/^associd=0 status=(\S{4}) (\S+),/) { + my $leap=$2; + + last if ($leap =~ /(sync|leap)_alarm/); + + if ($leap =~ /leap_(none|((add|del)_sec))/){ + close(NTP); + return 1; + } + + #should not hit below 3 lines normally + $$errormsg_ref = "Unexpected ntpq output ('leap' status <$leap>), please contact xCAT team"; + close(NTP); + return 0; + }elsif(/Connection refused/) { + $$errormsg_ref = "ntpd service is not running! Please setup ntp in current node"; + close(NTP); + return 0; + }else{ + #should not hit this block normally + $$errormsg_ref = "Unexpected ntpq output <$_>, please contact xCAT team"; + close(NTP); + return 0; + } + } + } + close(NTP); + sleep 1; + } + $$errormsg_ref = "ntpd did not synchronize."; + return 0; +} + 1; diff --git a/xCAT-probe/subcmds/xcatmn b/xCAT-probe/subcmds/xcatmn index 540d2f543..9a1c212e5 100755 --- a/xCAT-probe/subcmds/xcatmn +++ b/xCAT-probe/subcmds/xcatmn @@ -125,6 +125,12 @@ sub do_main_job { print_check_result($checkpoint, "f", $rst, \@error); $rc |= $rst; + #check NTP service + $checkpoint = "NTP service works well"; + $rst = check_ntp_service(\@error); + print_check_result($checkpoint, "f", $rst, \@error); + $rc |= $rst; + #Below are the 'warning` level check points #check if firewall is close @@ -612,6 +618,26 @@ sub check_tftp_service { return $rst; } +sub check_ntp_service{ + my $error_ref = shift; + my $rst = 0; + @$error_ref = (); + + `which ntpq > /dev/null 2>&1`; + if($?){ + push @$error_ref, "ntp service check need 'ntpq' tool, please install 'ntpq' toll and try again"; + $rst = 1; + }else{ + my $error; + if(!probe_utils->is_ntp_ready(\$error)){ + push @$error_ref, "$error"; + $rst = 1; + } + } + + return $rst; +} + sub check_dns_service { my $sitetable_ref = shift; my $serverip = shift; From 3dfc10f1c5aab5371efaba4b076bbe4a9659cbd4 Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Wed, 21 Dec 2016 02:57:21 -0500 Subject: [PATCH 236/292] fix bug #2232, support ntp in statelite --- xCAT-test/autotest/testcase/installation/litefile_sles.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/litefile_sles.csv b/xCAT-test/autotest/testcase/installation/litefile_sles.csv index 09c02b082..e4a30153b 100644 --- a/xCAT-test/autotest/testcase/installation/litefile_sles.csv +++ b/xCAT-test/autotest/testcase/installation/litefile_sles.csv @@ -14,3 +14,5 @@ "ALL","/opt/xcat/","tmpfs",, "ALL","/xcatpost/","tmpfs",, "ALL","/root/.ssh/","tmpfs",, +"ALL","/etc/init.d/rc3.d/","tmpfs",, +"ALL","/etc/init.d/rc5.d/","tmpfs",, From 0d3beb67c97eca67effb28a620183a1b8d08c527 Mon Sep 17 00:00:00 2001 From: hu-weihua Date: Wed, 21 Dec 2016 03:07:46 -0500 Subject: [PATCH 237/292] modify depending on gongjie'comment --- xCAT-probe/lib/perl/probe_utils.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/xCAT-probe/lib/perl/probe_utils.pm b/xCAT-probe/lib/perl/probe_utils.pm index e97264796..b4df1e5f4 100644 --- a/xCAT-probe/lib/perl/probe_utils.pm +++ b/xCAT-probe/lib/perl/probe_utils.pm @@ -295,10 +295,12 @@ sub is_http_ready { "504" => "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI or some other auxiliary server it needed to access in attempting to complete the request.", "505" => "The server does not support, or refuses to support, the HTTP protocol version that was used in the request message."); - my $suffix = time(); - my $tmpdir = "/tmp/xcatprobe$suffix/"; - mkpath("$tmpdir"); - my @outputtmp = `cd $tmpdir && wget $http 2>&1`; + my $tmpdir = "/tmp/xcatprobe$$/"; + if(! mkpath("$tmpdir")){ + $$errormsg_ref = "Prepare test environment error: $!"; + return 0; + } + my @outputtmp = `wget -O $tmpdir/syslog $http 2>&1`; my $rst = $?; $rst = $rst >> 8; @@ -320,10 +322,13 @@ sub is_http_ready { $$errormsg_ref = $httperror{$returncode}; }else{ #should not hit this block normally - $$errormsg_ref = "Unexpected return code of wget <$returncode>."; + $$errormsg_ref = "Unknown return code of wget <$returncode>."; } } - rmdir ("$tmpdir"); + unlink("$tmpdir/syslog"); + if(! rmdir ("$tmpdir")){ + $$errormsg_ref .= " Clean test environment error(rmdir $tmpdir): $!"; + } return 0; } From 4a1247fbe95e8bb2ceaa111efaf58eb299703d81 Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 21 Dec 2016 03:36:22 -0500 Subject: [PATCH 238/292] fix [FVT]set xcatdebugmode=1 does not work after xcatdebugmode is set to 2 #2337; use symbol links instead of hard link while creating grub.cfg.xxxx --- xCAT-server/lib/xcat/plugins/grub2.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/grub2.pm b/xCAT-server/lib/xcat/plugins/grub2.pm index 34ddd9d8a..1d4abda32 100644 --- a/xCAT-server/lib/xcat/plugins/grub2.pm +++ b/xCAT-server/lib/xcat/plugins/grub2.pm @@ -185,8 +185,8 @@ sub setstate { my $cref = $chainhash{$node}->[0]; #$chaintab->getNodeAttribs($node,['currstate']); - # remove the old boot configuration file and create a new one, but only if not offline directive - unlink($tftpdir . "/boot/grub2/" . $node); + # remove the old boot configuration files and create a new one, but only if not offline directive + system("find . -inum \$(stat --printf \%i $tftpdir/boot/grub2/$node 2>/dev/null) -exec rm -f {} \\; 2>/dev/null"); if ($cref and $cref->{currstate} ne "offline") { open($pcfg, '>', $tftpdir . "/boot/grub2/" . $node); print $pcfg "#" . $cref->{currstate} . "\n"; @@ -334,7 +334,6 @@ sub setstate { } - if (! $nodemac and $macstring) { $nodemac = xCAT::Utils->parseMacTabEntry($macstring, $node); } From a1d590f85f8d61707deaf2bfcf4ffa025f0e9c67 Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 21 Dec 2016 03:32:20 -0500 Subject: [PATCH 239/292] fix issue 2296, get correct mtms for B&S --- xCAT-server/lib/xcat/plugins/bmcdiscover.pm | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 54d7ce8b7..18e3a09e2 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -910,19 +910,16 @@ sub bmcdiscovery_ipmi { if (($::RUNCMD_RC eq 0) && @fru_output_array) { my $fru_output = join(" ", @fru_output_array); - if ($fru_cmd_num == 0) { - if (($fru_output =~ /Product Part Number :\s*(\S*).*Product Serial :\s*(\S*)/)) { - $mtm = $1; - $serial = $2; - last; - } + if (($fru_output =~ /Chassis Part Number\s*:\s*(\S*).*Chassis Serial\s*:\s*(\S*)/)) { + $mtm = $1; + $serial = $2; + last; } - else { - if (($fru_output =~ /Chassis Part Number\s*:\s*(\S*).*Chassis Serial\s*:\s*(\S*)/)) { - $mtm = $1; - $serial = $2; - last; - } + + if (($fru_output =~ /Product Part Number :\s*(\S*).*Product Serial :\s*(\S*)/)) { + $mtm = $1; + $serial = $2; + last; } } } From 804fd4c4e581b469864d6b01c447c2687dd30d9d Mon Sep 17 00:00:00 2001 From: XuWei Date: Wed, 21 Dec 2016 02:58:53 -0500 Subject: [PATCH 240/292] fix issue 2336, get correct mac address --- xCAT-probe/subcmds/osdeploy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index b41ca4e1b..16a33f75c 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -293,6 +293,17 @@ sub check_noderange { $mac =~ s/\!\*NOIP\*//g; $macmap{$mac}{"ip"} = "NOIP"; $macmap{$mac}{"node"} = $node; + } elsif ($mac =~ /(\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2})\!(.+)/) { + $mac = $1; + my $tmp_node = $2; + $macmap{$mac}{"node"} = $node; + my $tmp_ip = xCAT::NetworkUtils->getipaddr($tmp_node); + if ($tmp_ip) { + $macmap{$mac}{"ip"} = $tmp_ip; + $ipnodemap{ $nodecheckrst{$node}{"ip"} } = $node; + } else { + $macmap{$mac}{"ip"} = "NOIP"; + } } else { $macmap{$mac}{"node"} = $node; $macmap{$mac}{"ip"} = $nodecheckrst{$node}{"ip"}; From 8be7f480801007cc342831f66114031e91c9abba Mon Sep 17 00:00:00 2001 From: junxiawang Date: Thu, 22 Dec 2016 07:30:26 -0500 Subject: [PATCH 241/292] set up vm environment --- .../Diskless_installation_flat_p8_le | 6 ------ .../testcase/installation/SN_setup_case | 6 ------ .../reg_linux_SN_installation_hierarchy | 4 ---- .../reg_linux_diskfull_installation_flat | 3 --- .../autotest/testcase/installation/setup_vm | 20 +++++++++++++++++++ .../ubuntu_full_installation_vm_docker | 5 ----- 6 files changed, 20 insertions(+), 24 deletions(-) create mode 100644 xCAT-test/autotest/testcase/installation/setup_vm diff --git a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le index 0c4459990..51d18d4ad 100644 --- a/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Diskless_installation_flat_p8_le @@ -3,12 +3,6 @@ os:Linux cmd:copycds $$ISO check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -#comment for vm debug -#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p ;mkvm $$CN -s 20G; fi;fi -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi -check:rc==0 cmd:makedns -n check:rc==0 cmd:makedhcp -n diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 9b6ea5490..0593d88ea 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -7,12 +7,6 @@ check:rc==0 cmd:chtab key=nameservers site.value="" check:rc==0 -#cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p && mkvm $$SN; else rmvm $$SN -f -p && mkvm $$SN -s 20G; fi;fi -#Add for debug rmvm issue -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p ;mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 20G; fi;fi -check:rc==0 cmd:makedns -n check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy index f9d36a595..8cb7b89d1 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_SN_installation_hierarchy @@ -3,10 +3,6 @@ os:Linux cmd:chtab key=nameservers site.value="" check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$SN kvm_nodedata; fi -check:rc==0 -#cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]];then rmvm $$SN -f -p && mkvm $$SN -s 40G; fi -cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$SN,vmstorage)__" =~ "phy" ]]; then rmvm $$SN -f -p; mkvm $$SN; else rmvm $$SN -f -p;mkvm $$SN;rmvm $$SN -f -p;mkvm $$SN -s 40G; fi;fi cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index c99eb4aa0..130503f00 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -5,9 +5,6 @@ cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/installation/setup_vm b/xCAT-test/autotest/testcase/installation/setup_vm new file mode 100644 index 000000000..743f801e9 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/setup_vm @@ -0,0 +1,20 @@ +start:setup_vm +description:set up vm environment +cmd:var=`expr substr "__GETNODEATTR($$CN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$CN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$CN ; rmvm $$CN -f -p ; mkvm $$CN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" -o "$var" = "nfs" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi +check:rc==0 +cmd:rpower $$CN on +check:rc==0 +cmd:rpower $$CN stat +check:output=~on +cmd:var=`expr substr "__GETNODEATTR($$SN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then rmvm $$SN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$SN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$SN ; rmvm $$SN -f -p ; mkvm $$SN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" -o "$var" = "nfs" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi +check:rc==0 +cmd:rpower $$SN on +check:rc==0 +cmd:rpower $$SN stat +check:output=~on +#Add for debug rmvm issue +cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]; then tabdump -w node==$$CN kvm_nodedata; fi +check:rc==0 +cmd:if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ]; then tabdump -w node==$$SN kvm_nodedata; fi +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker index e6d948e68..4ce2ba2f6 100644 --- a/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker +++ b/xCAT-test/autotest/testcase/installation/ubuntu_full_installation_vm_docker @@ -2,11 +2,6 @@ start:Full_installation_flat_docker os:Linux cmd:copycds $$ISO check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -#cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf From 5882a134c809f930a68da0679c6a7650e3c1dfef Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 23 Dec 2016 03:00:54 -0500 Subject: [PATCH 242/292] modify releating vm setup bundle and testcases --- xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles11.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12.1_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12.2_x86_64.bundle | 1 + xCAT-test/autotest/bundle/sles12_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/sles12_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle | 1 + xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle | 1 + .../autotest/testcase/get_install_disk/fresh_install_disk | 4 ---- xCAT-test/autotest/testcase/get_install_disk/reinstall_disk | 2 -- xCAT-test/autotest/testcase/installation/setup_vm | 4 ++-- xCAT-test/autotest/testcase/migration/redhat_migration | 6 ------ xCAT-test/autotest/testcase/migration/sles_migration | 6 ------ .../testcase/xcatdebugmode/rhels_xcatdebugmode_diskful | 6 ------ .../testcase/xcatdebugmode/sles_xcatdebugmode_diskful | 4 ---- 28 files changed, 23 insertions(+), 30 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle index 49377b612..a7b7767d1 100644 --- a/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.7_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat makehosts_h makehosts_help diff --git a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle index 15676669e..1efa04506 100644 --- a/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels6.8_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle index bfbec794d..b59fd61ce 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle index e5ff83cf1..60987c4ba 100644 --- a/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.2_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle index 27578b5ea..e5b2e18bf 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle index f858555ad..b06475ed0 100644 --- a/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/rhels7.3_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle index c4dbf5754..b0129f2f0 100644 --- a/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles11.4_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle index 469a3527c..8eba88837 100644 --- a/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle index 225f6cdad..3efef26d7 100644 --- a/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.1_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle index 469a3527c..8eba88837 100644 --- a/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle index 225f6cdad..3efef26d7 100644 --- a/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12.2_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat go_xcat_local_repo_case7 go_xcat_noinput diff --git a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle index e362196b8..31b05bf80 100644 --- a/xCAT-test/autotest/bundle/sles12_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/sles12_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le makehosts_h diff --git a/xCAT-test/autotest/bundle/sles12_x86_64.bundle b/xCAT-test/autotest/bundle/sles12_x86_64.bundle index 241612a0e..91afe00d7 100644 --- a/xCAT-test/autotest/bundle/sles12_x86_64.bundle +++ b/xCAT-test/autotest/bundle/sles12_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm reg_linux_diskfull_installation_flat makehosts_h makehosts_help diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle index 4c1d1b7bd..9aecea63a 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le makehosts_h diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle index 2bfb17f88..b714108f4 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.3_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm makehosts_h diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle index c49e45be8..714b7c4a4 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle index 9c4309d93..a260e16b7 100644 --- a/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu14.04.4_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle index 09b1af592..154fb92c9 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle index 5caa4de79..bbbfa0091 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04.1_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle index 6a8bad79a..db2beed03 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_ppc64le.bundle @@ -1,3 +1,4 @@ +setup_vm Diskless_installation_flat_p8_le Full_installation_flat_p8_le go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle index ec034a3af..07491602a 100644 --- a/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle +++ b/xCAT-test/autotest/bundle/ubuntu16.04_x86_64.bundle @@ -1,3 +1,4 @@ +setup_vm Ubuntu_diskless_installation_flat_x86_vm Ubuntu_full_installation_flat_x86_vm go_xcat_local_repo_case7 diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk index b79bab100..fd5726b35 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk @@ -3,10 +3,6 @@ os:Linux description:check fresh install disk, usded for x86 multi disk only, and not check RH7.2 for RH os wwn isue. cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" -cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata |grep -i $$CN; fi -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk b/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk index b9fb12825..e3772b453 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk +++ b/xCAT-test/autotest/testcase/get_install_disk/reinstall_disk @@ -4,8 +4,6 @@ description:check reinstall disk, usded for x86 multi disk only, and not check R cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/installation/setup_vm b/xCAT-test/autotest/testcase/installation/setup_vm index 743f801e9..7e02d8fb4 100644 --- a/xCAT-test/autotest/testcase/installation/setup_vm +++ b/xCAT-test/autotest/testcase/installation/setup_vm @@ -1,12 +1,12 @@ start:setup_vm description:set up vm environment -cmd:var=`expr substr "__GETNODEATTR($$CN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$CN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$CN ; rmvm $$CN -f -p ; mkvm $$CN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" -o "$var" = "nfs" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi +cmd:var=`expr substr "__GETNODEATTR($$CN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then rmvm $$CN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$CN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$CN ; rmvm $$CN -f -p ; mkvm $$CN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi check:rc==0 cmd:rpower $$CN on check:rc==0 cmd:rpower $$CN stat check:output=~on -cmd:var=`expr substr "__GETNODEATTR($$SN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then rmvm $$SN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$SN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$SN ; rmvm $$SN -f -p ; mkvm $$SN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" -o "$var" = "nfs" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi +cmd:var=`expr substr "__GETNODEATTR($$SN,vmstorage)__" 1 3`;echo $var;if [ "__GETNODEATTR($$SN,arch)__" != "ppc64" -a "__GETNODEATTR($$SN,mgt)__" != "ipmi" ];then rmvm $$SN -f -p;if [[ "$var" = "phy" ]]; then mkvm $$SN;exit $? ; elif [[ "$var" = "dir" ]];then mkvm $$SN ; rmvm $$SN -f -p ; mkvm $$SN -s 20G ;exit $? ;elif [ "$var" = "nfs" -o "$var" = "lvm" ];then echo "Need to fix me. ";exit 2;else echo "Could not surpport vmstorage.";exit 3;fi;fi check:rc==0 cmd:rpower $$SN on check:rc==0 diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index a5fad7718..58ffdfd42 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -5,9 +5,6 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n @@ -116,9 +113,6 @@ stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index a41e56828..1117af3a0 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -5,9 +5,6 @@ description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n @@ -118,9 +115,6 @@ description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN #check:rc==0 -cmd:if [[ "__GETNODEATTR($$CN,arch)__" != "ppc64" ]]; then tabdump -w node==$$CN kvm_nodedata; fi -check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p; mkvm $$CN; else rmvm $$CN -f -p;mkvm $$CN;rmvm $$CN -f -p;mkvm $$CN -s 20G; fi;fi cmd:rscan __GETNODEATTR($$CN,hcp)__ -w check:rc==0 cmd:makedns -n diff --git a/xCAT-test/autotest/testcase/xcatdebugmode/rhels_xcatdebugmode_diskful b/xCAT-test/autotest/testcase/xcatdebugmode/rhels_xcatdebugmode_diskful index 9e5bd01d9..5bd9dcfaf 100644 --- a/xCAT-test/autotest/testcase/xcatdebugmode/rhels_xcatdebugmode_diskful +++ b/xCAT-test/autotest/testcase/xcatdebugmode/rhels_xcatdebugmode_diskful @@ -4,8 +4,6 @@ description:site.xcatdebugmode value is 0, the following logs will be shown and cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf @@ -68,8 +66,6 @@ check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf @@ -161,8 +157,6 @@ check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf diff --git a/xCAT-test/autotest/testcase/xcatdebugmode/sles_xcatdebugmode_diskful b/xCAT-test/autotest/testcase/xcatdebugmode/sles_xcatdebugmode_diskful index 3ba3a5bca..91607411a 100644 --- a/xCAT-test/autotest/testcase/xcatdebugmode/sles_xcatdebugmode_diskful +++ b/xCAT-test/autotest/testcase/xcatdebugmode/sles_xcatdebugmode_diskful @@ -5,8 +5,6 @@ description:site.xcatdebugmode value is 0, the following logs will be shown and cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf @@ -78,8 +76,6 @@ check:rc==0 cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN check:rc==0 -cmd:if [ "__GETNODEATTR($$CN,arch)__" != "ppc64" -a "__GETNODEATTR($$CN,mgt)__" != "ipmi" ];then if [[ "__GETNODEATTR($$CN,vmstorage)__" =~ "phy" ]]; then rmvm $$CN -f -p && mkvm $$CN; else rmvm $$CN -f -p && mkvm $$CN -s 20G; fi;fi -check:rc=0 cmd:makedns -n check:rc==0 cmd:makeconservercf From bb0161da610607cea9701752eca1227e06d0c151 Mon Sep 17 00:00:00 2001 From: junxiawang Date: Fri, 23 Dec 2016 05:07:39 -0500 Subject: [PATCH 243/292] mistake for delete during update vm testcases --- xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk index fd5726b35..7252bf97f 100644 --- a/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk +++ b/xCAT-test/autotest/testcase/get_install_disk/fresh_install_disk @@ -3,6 +3,7 @@ os:Linux description:check fresh install disk, usded for x86 multi disk only, and not check RH7.2 for RH os wwn isue. cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=100" +cmd:xdsh $$CN "dd if=/dev/zero of=/dev/sdb bs=1048576 count=300 seek=60858" cmd:makedns -n check:rc==0 cmd:makeconservercf From 4f771e3dc3441bd763614987d8f873265667f390 Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 10 Nov 2016 22:34:56 -0500 Subject: [PATCH 244/292] refine the cumulus support doc --- .../edgecore_switches/edgecore_switches.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst index db9a3cc11..63b60c24c 100644 --- a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst +++ b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst @@ -1,7 +1,18 @@ Edgecore Switch =============== -The Edgecore switch from Mellanox is 1Gb top-of-rack switch. It's coming with ONIE installer. Open Network Install Environment (ONIE)is an open source initiative that defines an open "install environment" for bare metal network switches. For more information, see http://onie.opencompute.org/. Mellanox will ship the switch with Cumulus Network OS and along with a license file installed. In some case, user may get whitebox without OS and licenses. Since edgecore switch has different configuration than other switches that xCAT supports, xCAT handles edgecore switch differently. +The Edgecore switch from Mellanox is 1Gb top-of-rack switch. Usually, Mellanox ships the switch with Cumulus Network OS(https://cumulusnetworks.com) and along with a license file installed. In some case, user may get whitebox switch hardware without OS and license installed. Since edgecore switch is different from other traditional switches that xCAT supports, xCAT supports edgecore switch in a different way. Currently, the features provided by xCAT includes: :: + + 1) Cumulus Network OS provision + 2) switch discovery + 3) switch configuration: + (a) enable root-passwordless ssh + (b) install licence file + (c) enable snmp + 4) distribute files with ``xdcp`` + 5) invoke commands or scripts remotely with `xdsh`` + 6) + ONIE Mode From 2e1e2732670de8c8ad50981d6331d68ed82b8f42 Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 15 Nov 2016 02:27:58 -0500 Subject: [PATCH 245/292] refine cumulus support doc --- .../edgecore_switches/edgecore_switches.rst | 20 +++++++++++++++---- .../objects/node/cumulusswitch.stanza | 6 +++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst index 63b60c24c..31e1bd238 100644 --- a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst +++ b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst @@ -1,7 +1,9 @@ Edgecore Switch =============== -The Edgecore switch from Mellanox is 1Gb top-of-rack switch. Usually, Mellanox ships the switch with Cumulus Network OS(https://cumulusnetworks.com) and along with a license file installed. In some case, user may get whitebox switch hardware without OS and license installed. Since edgecore switch is different from other traditional switches that xCAT supports, xCAT supports edgecore switch in a different way. Currently, the features provided by xCAT includes: :: +The Edgecore switch from Mellanox is 1Gb top-of-rack switch. Usually, Mellanox ships the switch with Cumulus Network OS(https://cumulusnetworks.com) and along with a license file installed. In some case, user may get whitebox switch hardware without OS and license installed. + +Since edgecore switch is different from other traditional switches that xCAT supports, xCAT supports edgecore switch in a different way. Currently, the features provided by xCAT include: :: 1) Cumulus Network OS provision 2) switch discovery @@ -9,11 +11,21 @@ The Edgecore switch from Mellanox is 1Gb top-of-rack switch. Usually, Mellanox s (a) enable root-passwordless ssh (b) install licence file (c) enable snmp - 4) distribute files with ``xdcp`` - 5) invoke commands or scripts remotely with `xdsh`` - 6) + 4) distribute files to switches with ``xdcp`` + 5) invoke remote commands or scripts on switches with `xdsh`` + 6) configure switches with ``updatenode`` + +This documentation presents a typical workflow on how to setup a edgecore switch from white box, then configure and manage the switch with xCAT. +Create a edgecore switch object +------------------------------- + +If you have the information of the ip and mac information of the switch, the edgecore switch object definition can be created with the "cumulusswitch" template shipped in xCAT : :: + + mkdef edgecoresw1 --template cumulusswitch arch=armv71 ip=192.168.5.191 mac=8C:EA:1B:12:CA:40 + +Discover the switch ONIE Mode --------- diff --git a/xCAT/templates/objects/node/cumulusswitch.stanza b/xCAT/templates/objects/node/cumulusswitch.stanza index 48575c911..cff7d05ac 100644 --- a/xCAT/templates/objects/node/cumulusswitch.stanza +++ b/xCAT/templates/objects/node/cumulusswitch.stanza @@ -4,11 +4,11 @@ cumulusswitch: objtype=node arch="OPTIONAL: the arch of the switch management service processor, such as armv71" groups=switch - ip="MANDATORY:the ip address of the management interface" - mac="MANDATORY:the mac of the management interface" + ip="OPTIONAL:the ip address of the management interface" + mac="OPTIONAL:the mac of the management interface" mgt=switch netboot=onie nodetype=switch - switchtype="OPTIONAL: the manufacturer of switch" + switchtype=edgecore provmethod="OPTIONAL: the full path of the cumulus installer" usercomment="the template for cumulus switch definition" From 8ec1af2f0c07e09cad8644708b04a18d9c099e5d Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Fri, 23 Dec 2016 03:26:48 -0500 Subject: [PATCH 246/292] remove setupntp for sles12.1 ntpd doesn't synchronize to local clock anymore in version 4.2.8p4. see#2248 --- .../testcase/installation/Full_installation_flat_p8_le | 3 ++- .../testcase/installation/reg_linux_diskfull_installation_flat | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le index 0b7779db2..107da18b7 100644 --- a/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le +++ b/xCAT-test/autotest/testcase/installation/Full_installation_flat_p8_le @@ -24,7 +24,8 @@ cmd:makeconservercf $$CN check:rc==0 cmd:cat /etc/conserver.cf | grep $$CN check:output=~$$CN -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat index 130503f00..0800aa5d7 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -29,7 +29,8 @@ cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? check:rc==0 cmd:copycds $$ISO check:rc==0 -cmd:chdef -t node -o $$CN postscripts=setupntp +cmd:if [ "__GETNODEATTR($$CN,os)__" != "sles12.1" ];then chdef -t node -o $$CN postscripts=setupntp; fi +cmd:lsdef -l $$CN check:rc==0 cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 From 1ff745dbfef7ce7ed6a367ef08b3b50bf975e416 Mon Sep 17 00:00:00 2001 From: ypbj Date: Wed, 14 Dec 2016 02:48:10 -0500 Subject: [PATCH 247/292] fix copycds can't auto copycd centos iso --- xCAT-server/lib/xcat/plugins/anaconda.pm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 6decce701..4cdf82c10 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -2266,6 +2266,20 @@ sub copycd } close($dinfo); } + elsif ($desc =~ /^[\d\.]+$/) + { + open($dinfo, $mntpath . "/.treeinfo"); + while (<$dinfo>) { + chomp($_); + s/\s+$//; #remove trailing spaces + next if /^\s*$/; #-- skip empty lines + if ($_ =~ /family\s*=\s*CentOS/i) { + $distname = "centos" . $desc; + last; + } + } + close($dinfo); + } else { print "INFO - Could not auto-detect operating system.\n"; From a8522a97316871ef177362ab1a181186ae034dd8 Mon Sep 17 00:00:00 2001 From: ypbj Date: Mon, 26 Dec 2016 21:24:01 -0500 Subject: [PATCH 248/292] update man page for copycds --- docs/source/guides/admin-guides/references/man8/copycds.8.rst | 2 +- xCAT-client/pods/man8/copycds.8.pod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man8/copycds.8.rst b/docs/source/guides/admin-guides/references/man8/copycds.8.rst index a5ba210ec..37c399113 100644 --- a/docs/source/guides/admin-guides/references/man8/copycds.8.rst +++ b/docs/source/guides/admin-guides/references/man8/copycds.8.rst @@ -35,7 +35,7 @@ The \ **copycds**\ command copies all contents of Distribution DVDs/ISOs or Ser You can specify \ **-i**\ or \ **-**\ **-inspection**\ option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the \ **-n**\ and \ **-a**\ options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. -You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (\ **service xcatd reload**\ ). +You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm (the key of the hash is the first line of .discinfo) and reloading xcatd (\ **service xcatd reload**\ ). ******* diff --git a/xCAT-client/pods/man8/copycds.8.pod b/xCAT-client/pods/man8/copycds.8.pod index 234c1e375..23a6af93e 100644 --- a/xCAT-client/pods/man8/copycds.8.pod +++ b/xCAT-client/pods/man8/copycds.8.pod @@ -16,7 +16,7 @@ The B command copies all contents of Distribution DVDs/ISOs or Service You can specify B<-i> or B<--inspection> option to check whether the DVDs/ISOs can be recognized by xCAT. If recognized, the distribution name, architecture and the disc no (the disc sequence number of DVDs/ISOs in multi-disk distribution) of the DVD/ISO is displayed. If xCAT doesn't recognize the DVD/ISO, you must manually specify the distro name and architecture using the B<-n> and B<-a> options. This is sometimes the case for distros that have very recently been released, and the xCAT code hasn't been updated for it yet. -You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm and reloading xcatd (B). +You can get xCAT to recognize new DVDs/ISOs by adding them to /opt/xcat/lib/perl/xCAT/data/discinfo.pm (the key of the hash is the first line of .discinfo) and reloading xcatd (B). =head1 OPTIONS From addeeee5da7a29682e0b54ac480d8c16c83b5c2c Mon Sep 17 00:00:00 2001 From: "litingt@cn.ibm.com" Date: Thu, 29 Dec 2016 02:15:08 -0500 Subject: [PATCH 249/292] add makentp case to synchronize time with external ntp server --- xCAT-test/autotest/testcase/makentp/cases0 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/xCAT-test/autotest/testcase/makentp/cases0 b/xCAT-test/autotest/testcase/makentp/cases0 index b47ff3316..ec4c5dc2a 100644 --- a/xCAT-test/autotest/testcase/makentp/cases0 +++ b/xCAT-test/autotest/testcase/makentp/cases0 @@ -100,3 +100,25 @@ check:rc==0 cmd:rm -rf /tmp/postscript end + +start:makentp_initialize +descriptiop:start ntp service on management node and synchronize time with external ntp server +cmd:chtab key=extntpservers site.value="$$extntpserversip" +check:rc==0 +cmd:makentp -V +check:rc==0 +check:output=~configuring management node: $$MN +check:output=~checking if nptd is installed +check:output=~backing up the ntp configuration file /etc/ntp.conf +check:output=~ntp servers are: $$extntpserversip +check:output=~stopping ntpserver +check:output=~starting ntpserver +check:output=~enabling ntpserver +cmd:if [ -f "/usr/sbin/ntp-wait" ];then ntp-wait; else sleep 1200; fi +check:rc==0 +cmd:ntpq -p +check:output=~*$$extntpserversip +cmd:grep $$extntpserversip /etc/ntpd.conf +check:rc==0 +end + From 65c29118882236ae56fdb5b1aa95dc64dae92d93 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Wed, 23 Nov 2016 16:48:07 +0800 Subject: [PATCH 250/292] Make all the rpm packages have the exactly same version and release numbers --- Release | 1 + buildcore.sh | 117 +++++++++--------- perl-xCAT/perl-xCAT.spec | 4 +- xCAT-IBMhpc/xCAT-IBMhpc.spec | 8 +- .../xCAT-OpenStack-baremetal.spec | 2 +- xCAT-OpenStack/xCAT-OpenStack.spec | 12 +- xCAT-SoftLayer/xCAT-SoftLayer.spec | 2 +- xCAT-UI/xCAT-UI.spec | 6 +- xCAT-buildkit/xCAT-buildkit.spec | 13 +- xCAT-client/xCAT-client.spec | 9 +- xCAT-confluent/xCAT-confluent.spec | 2 +- xCAT-csm/xCAT-csm.spec | 2 +- xCAT-genesis-builder/xCAT-genesis-base.spec | 4 +- .../xCAT-genesis-builder.spec | 4 +- .../xCAT-genesis-scripts.spec | 13 +- xCAT-probe/xCAT-probe.spec | 8 +- xCAT-rmc/xCAT-rmc.spec | 31 ++--- xCAT-server/xCAT-server.spec | 23 ++-- xCAT-test/xCAT-test.spec | 4 +- xCAT-vlan/xCAT-vlan.spec | 14 +-- xCAT/xCAT.spec | 24 ++-- xCATsn/xCATsn.spec | 31 ++--- 22 files changed, 145 insertions(+), 189 deletions(-) create mode 100644 Release diff --git a/Release b/Release new file mode 100644 index 000000000..a33a0ed75 --- /dev/null +++ b/Release @@ -0,0 +1 @@ +snap000000000000 diff --git a/buildcore.sh b/buildcore.sh index 0343d0376..da51c3884 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -8,7 +8,7 @@ # - On AIX: Install openssl and openssh installp pkgs and run updtvpkg. Install from http://www.perzl.org/aix/ : # apr, apr-util, bash, bzip2, db4, expat, gdbm, gettext, glib2, gmp, info, libidn, neon, openssl (won't # conflict with the installp version - but i don't think you need this), pcre, perl-DBD-SQLite, perl-DBI, -# popt, python, readline, rsynce, sqlite, subversion, unixODBC, zlib. +# popt, python, readline, rsynce, sqlite, subversion, unixODBC, zlib. # Install wget from http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html # - Run this script from the xcat-core directory. It will create the other directories that are needed. # @@ -24,7 +24,7 @@ # (but the tarball file name will be like a released tarball, not a snap build). When you are ready to # release this build, use PROMOTE=1 without PREGA # BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release. -# UP=0 or UP=1 - override the default upload behavior +# UP=0 or UP=1 - override the default upload behavior # GITUP= - control which rpms get built by specifying a coregitup file # EMBED= - the environment for which a minimal version of xcat should be built, e.g. zvm or flex # VERBOSE=1 - to see lots of verbose output @@ -39,10 +39,10 @@ UPLOADUSER=litingt USER=xcat SERVER=xcat.org FILES_PATH="files" -FRS=/var/www/${SERVER}/${FILES_PATH} +FRS="/var/www/${SERVER}/${FILES_PATH}" RELEASE=github.com/xcat2/xcat-core/releases -YUMDIR=$FRS +YUMDIR="${FRS}" YUMREPOURL="http://${SERVER}/${FILES_PATH}/xcat/repos/yum" if [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then @@ -71,8 +71,8 @@ ALLBUILD="perl-xCAT xCAT-client xCAT-server xCAT-test xCAT-buildkit xCAT xCATsn ZVMBUILD="perl-xCAT xCAT-server xCAT-UI" ZVMLINK="xCAT-client xCAT xCATsn" # xCAT and xCATsn have PCM specific configuration - conserver-xcat, syslinux-xcat -# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON) -# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON) +# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON) +# xCAT-client has PCM specific configuration - getxcatdocs(perl-JSON) PCMBUILD="xCAT xCAT-server xCAT-client xCATsn" PCMLINK="perl-xCAT xCAT-buildkit xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 xCAT-vlan xCAT-probe" # Note: for FSM, the FlexCAT rpm is built separately from gsa/git @@ -103,7 +103,7 @@ OSNAME=$(uname) if [ "$OSNAME" != "AIX" ]; then GSA=http://pokgsa.ibm.com/projects/x/xcat/build/linux - + if [ "$(id -u)" == "0" ]; then # Get a lock, so can not do 2 builds at once exec 8>/var/lock/xcatbld-$REL.lock @@ -186,10 +186,11 @@ function setversionvars { BUILD_TIME=`date` BUILD_MACHINE=`hostname` COMMIT_ID=`git rev-parse --short HEAD` + XCAT_RELEASE="snap$(date '+%Y%m%d%H%M')" + echo "$XCAT_RELEASE" >Release } - -if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting +if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting ### @LINE460 ### # we are doing a snap build CORE="core-snap" if [ "$OSNAME" = "AIX" ]; then @@ -217,14 +218,14 @@ else #echo "source=$source" fi -# -# If no pre-defined update file is provided, do a "git pull" to try and detect +# +# If no pre-defined update file is provided, do a "git pull" to try and detect # if anything has changed in the source directories -# +# SOMETHINGCHANGED=0 if [ "$GIT" = "1" ]; then - # - # To enable local sandbox build, GITPULL is disabled by default. + # + # To enable local sandbox build, GITPULL is disabled by default. # if [ "$GITPULL" = "1" ] || [ ${PWD} == *"autobuild"* ]; then # TODO: This is really not necessary since the autobuild scripts @@ -339,7 +340,7 @@ if [ "$OSNAME" != "AIX" ]; then fi # Build the xCAT and xCATsn rpms for all platforms -for rpmname in xCAT xCATsn; do +for rpmname in xCAT xCATsn; do if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then UPLOAD=1 @@ -402,48 +403,49 @@ fi # Prepare the RPMs for pkging and upload WGET_CMD="wget" -if [ ! -z ${LOG} ]; then +if [ ! -z ${LOG} ]; then WGET_CMD="wget -o ${LOG}" fi # get gpg keys in place if [ "$OSNAME" != "AIX" ]; then if [ -z "$RPMSIGN" -o "$RPMSIGN" == "1" ]; then - mkdir -p $HOME/.gnupg - for i in pubring.gpg secring.gpg trustdb.gpg; do - if [ ! -f $HOME/.gnupg/$i ] || [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then - rm -f $HOME/.gnupg/$i - ${WGET_CMD} -P $HOME/.gnupg $GSA/keys/$i - chmod 600 $HOME/.gnupg/$i + mkdir -p $HOME/.gnupg + for i in pubring.gpg secring.gpg trustdb.gpg; do + if [ ! -f $HOME/.gnupg/$i ] || + [ `wc -c $HOME/.gnupg/$i|cut -f 1 -d' '` == 0 ]; then + rm -f $HOME/.gnupg/$i + ${WGET_CMD} -P $HOME/.gnupg $GSA/keys/$i + chmod 600 $HOME/.gnupg/$i + fi + done + # tell rpm to use gpg to sign + MACROS=$HOME/.rpmmacros + if ! $GREP '%_signature gpg' $MACROS 2>/dev/null; then + echo '%_signature gpg' >> $MACROS fi - done - # tell rpm to use gpg to sign - MACROS=$HOME/.rpmmacros - if ! $GREP '%_signature gpg' $MACROS 2>/dev/null; then - echo '%_signature gpg' >> $MACROS + if ! $GREP '%_gpg_name' $MACROS 2>/dev/null; then + echo '%_gpg_name xCAT Security Key' >> $MACROS + fi + echo "Signing RPMs..." + build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' + build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' + createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5 + createrepo --checksum sha $SRCDIR + rm -f $SRCDIR/repodata/repomd.xml.asc + rm -f $DESTDIR/repodata/repomd.xml.asc + gpg -a --detach-sign $DESTDIR/repodata/repomd.xml + gpg -a --detach-sign $SRCDIR/repodata/repomd.xml + if [ ! -f $DESTDIR/repodata/repomd.xml.key ]; then + ${WGET_CMD} -q -P $DESTDIR/repodata $GSA/keys/repomd.xml.key + fi + if [ ! -f $SRCDIR/repodata/repomd.xml.key ]; then + ${WGET_CMD} -P $SRCDIR/repodata $GSA/keys/repomd.xml.key + fi + else + createrepo --checksum sha $DESTDIR + createrepo --checksum sha $SRCDIR fi - if ! $GREP '%_gpg_name' $MACROS 2>/dev/null; then - echo '%_gpg_name xCAT Security Key' >> $MACROS - fi - echo "Signing RPMs..." - build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' - build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' - createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5 - createrepo --checksum sha $SRCDIR - rm -f $SRCDIR/repodata/repomd.xml.asc - rm -f $DESTDIR/repodata/repomd.xml.asc - gpg -a --detach-sign $DESTDIR/repodata/repomd.xml - gpg -a --detach-sign $SRCDIR/repodata/repomd.xml - if [ ! -f $DESTDIR/repodata/repomd.xml.key ]; then - ${WGET_CMD} -q -P $DESTDIR/repodata $GSA/keys/repomd.xml.key - fi - if [ ! -f $SRCDIR/repodata/repomd.xml.key ]; then - ${WGET_CMD} -P $SRCDIR/repodata $GSA/keys/repomd.xml.key - fi - else - createrepo --checksum sha $DESTDIR - createrepo --checksum sha $SRCDIR - fi fi # set group and permissions correctly on the built rpms @@ -455,7 +457,7 @@ chmod -R g+w $DESTDIR chgrp -R $SYSGRP $SRCDIR chmod -R g+w $SRCDIR -else # end of very long if-not-promote +else # end of very long if-not-promote ### @LINE193 ### # we are only promoting (not building) setversionvars setbranch @@ -490,7 +492,7 @@ EOF #!/bin/sh cd `dirname $0` REPOFILE=`basename xCAT-*.repo` -if [[ $REPOFILE == "xCAT-*.repo" ]]; then +if [ $REPOFILE = "xCAT-*.repo" ]; then echo "ERROR: For xcat-dep, please execute $0 in the correct / subdirectory" exit 1 fi @@ -498,10 +500,10 @@ fi # default to RHEL yum, if doesn't exist try Zypper # DIRECTORY="/etc/yum.repos.d" -if [[ ! -d ${DIRECTORY} ]]; then - DIRECTORY="/etc/zypp/repos.d" +if [ ! -d "$DIRECTORY" ]; then + DIRECTORY="/etc/zypp/repos.d" fi -sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > ${DIRECTORY}/$REPOFILE +sed -e 's|baseurl=.*|baseurl=file://'"`pwd`"'|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://'"`pwd`"'/repodata/repomd.xml.key|' > "$DIRECTORY/$REPOFILE" cd - EOF2 chmod 775 mklocalrepo.sh @@ -521,6 +523,7 @@ fi # BUILDINFO=$XCATCORE/buildinfo echo "VERSION=$VER" > $BUILDINFO +echo "RELEASE=$XCAT_RELEASE" >> $BUILDINFO echo "BUILD_TIME=$BUILD_TIME" >> $BUILDINFO echo "BUILD_MACHINE=$BUILD_MACHINE" >> $BUILDINFO echo "COMMIT_ID=$COMMIT_ID" >> $BUILDINFO @@ -545,7 +548,7 @@ if [ -n "$UP" ] && [ "$UP" == 0 ]; then fi #else we will continue -# Upload the individual RPMs to xcat.org +# Upload the individual RPMs to xcat.org if [ "$OSNAME" = "AIX" ]; then YUM=aix else @@ -561,13 +564,13 @@ if [ "$REL" = "devel" -o "$PREGA" != 1 ]; then do : ; done fi -# Upload the individual source RPMs to xcat.org +# Upload the individual source RPMs to xcat.org i=0 echo "Uploading src RPMs from $SRCD to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..." while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $SRCD $USER@$SERVER:$YUMDIR/$YUM/$REL$EMBEDDIR/ do : ; done -# Upload the tarball to xcat.org +# Upload the tarball to xcat.org if [ "$PROMOTE" = 1 -a "$REL" != "devel" -a "$PREGA" != 1 ]; then # upload tarball to FRS area i=0 diff --git a/perl-xCAT/perl-xCAT.spec b/perl-xCAT/perl-xCAT.spec index b1bb44274..86c15f41a 100644 --- a/perl-xCAT/perl-xCAT.spec +++ b/perl-xCAT/perl-xCAT.spec @@ -1,7 +1,7 @@ Summary: xCAT perl libraries Name: perl-xCAT Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: System Environment/Libraries @@ -17,8 +17,6 @@ BuildArch: noarch #Requires: perl-SOAP-Lite %endif -Provides: perl-xCAT = %{epoch}:%{version} - %description Provides perl xCAT libraries for core functionality. Required for all xCAT installations. Includes xCAT::Table, xCAT::NodeRange, among others. diff --git a/xCAT-IBMhpc/xCAT-IBMhpc.spec b/xCAT-IBMhpc/xCAT-IBMhpc.spec index 32ed7f3d8..52bddba3e 100644 --- a/xCAT-IBMhpc/xCAT-IBMhpc.spec +++ b/xCAT-IBMhpc/xCAT-IBMhpc.spec @@ -1,7 +1,7 @@ Summary: Install and configuration utilities for IBM HPC products in an xCAT cluster Name: xCAT-IBMhpc Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -20,7 +20,7 @@ AutoReqProv: no # also need to fix Requires for AIX %ifos linux BuildArch: noarch -#Requires: +#Requires: %endif Requires: perl-xCAT >= %{epoch}:%{version} @@ -85,7 +85,3 @@ fi %post %preun - - - - diff --git a/xCAT-OpenStack-baremetal/xCAT-OpenStack-baremetal.spec b/xCAT-OpenStack-baremetal/xCAT-OpenStack-baremetal.spec index c82d9b36e..ff45e5bd6 100644 --- a/xCAT-OpenStack-baremetal/xCAT-OpenStack-baremetal.spec +++ b/xCAT-OpenStack-baremetal/xCAT-OpenStack-baremetal.spec @@ -1,7 +1,7 @@ Summary: Executables and data of the xCAT baremetal driver for OpenStack Name: xCAT-OpenStack-baremetal Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: IBM Group: Applications/System diff --git a/xCAT-OpenStack/xCAT-OpenStack.spec b/xCAT-OpenStack/xCAT-OpenStack.spec index b1fae31be..a502b20d5 100644 --- a/xCAT-OpenStack/xCAT-OpenStack.spec +++ b/xCAT-OpenStack/xCAT-OpenStack.spec @@ -1,7 +1,7 @@ -Summary: Meta-Metapackage for a common, default xCAT management node setup with OpenStack +Summary: Meta-Metapackage for a common, default xCAT management node setup with OpenStack Name: xCAT-OpenStack Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} License: EPL Group: Applications/System Vendor: IBM Corp. @@ -16,8 +16,8 @@ Provides: xCAT-OpenStack = %{version} Requires: xCAT %description -xCAT-OpenStack is an xCAT management node package intended for at-scale -management with OpenStack, including hardware management and software +xCAT-OpenStack is an xCAT management node package intended for at-scale +management with OpenStack, including hardware management and software management. %prep @@ -28,7 +28,6 @@ management. # Then convert the pods to man pages and html pages. ./db2man - %install mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin @@ -89,9 +88,8 @@ rm -rf $RPM_BUILD_ROOT %ifos linux if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then - /etc/init.d/xcatd restart + /etc/init.d/xcatd restart fi fi %endif exit 0 - diff --git a/xCAT-SoftLayer/xCAT-SoftLayer.spec b/xCAT-SoftLayer/xCAT-SoftLayer.spec index 7166d1e9d..683b98ea8 100644 --- a/xCAT-SoftLayer/xCAT-SoftLayer.spec +++ b/xCAT-SoftLayer/xCAT-SoftLayer.spec @@ -1,7 +1,7 @@ Summary: Utilities to make xCAT work in a SoftLayer environment Name: xCAT-SoftLayer Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System diff --git a/xCAT-UI/xCAT-UI.spec b/xCAT-UI/xCAT-UI.spec index 0881b8f8a..15b714315 100644 --- a/xCAT-UI/xCAT-UI.spec +++ b/xCAT-UI/xCAT-UI.spec @@ -1,12 +1,12 @@ Summary: Web Client for xCAT 2 Name: xCAT-UI Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} License: EPL Group: Applications/System -URL: http://xcat.org +URL: https://xcat.org/ Packager: IBM -Vendor: IBM +Vendor: IBM Corp. Source: xCAT-UI-%{version}.tar.gz BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root diff --git a/xCAT-buildkit/xCAT-buildkit.spec b/xCAT-buildkit/xCAT-buildkit.spec index 6809507c7..0d91f6d07 100644 --- a/xCAT-buildkit/xCAT-buildkit.spec +++ b/xCAT-buildkit/xCAT-buildkit.spec @@ -1,7 +1,7 @@ Summary: xCAT buildkit tools and sample kit Name: xCAT-buildkit Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -20,15 +20,13 @@ AutoReqProv: no # also need to fix Requires for AIX %ifos linux BuildArch: noarch -#Requires: +#Requires: %endif # No dependencies on any other xCAT rpms # so that this rpm can be installed in a separate build server Requires: /usr/bin/rpmbuild -Provides: xCAT-buildkit = %{epoch}:%{version} - %description xCAT-buildkit provides the buildkit tool and sample kit files to build an xCAT kit. @@ -41,8 +39,6 @@ mkdir -p share/doc/man1 pod2man pods/man1/buildkit.1.pod > share/man/man1/buildkit.1 pod2html pods/man1/buildkit.1.pod > share/doc/man1/buildkit.1.html - - %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits @@ -57,7 +53,6 @@ chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/* cp share/doc/man1/* $RPM_BUILD_ROOT/%{prefix}/share/doc/man1 chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/man1/* - %ifos linux cp -aR share/xcat/kits/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/ #chmod -R 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/kits/* @@ -110,7 +105,3 @@ fi %post %preun - - - - diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index d44961f2a..44235d213 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -1,7 +1,7 @@ Summary: Core executables and data of the xCAT management project Name: xCAT-client Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -21,15 +21,13 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root BuildArch: noarch %endif -Provides: xCAT-client = %{epoch}:%{version} - -Requires: perl-xCAT >= %{epoch}:%{version} +Requires: perl-xCAT = 4:%{version}-%{release} # fping or nmap is needed by pping (in case xCAT-client is installed by itself on a remote client) %ifos linux Requires: nmap perl-XML-Simple perl-XML-Parser %else -Requires: expat +Requires: expat %endif %description @@ -355,4 +353,3 @@ if [ $1 == 0 ]; then #This means only on -e rm -f /etc/profile.d/xcat.* fi %endif - diff --git a/xCAT-confluent/xCAT-confluent.spec b/xCAT-confluent/xCAT-confluent.spec index 44111fb73..8b3dc9e1f 100644 --- a/xCAT-confluent/xCAT-confluent.spec +++ b/xCAT-confluent/xCAT-confluent.spec @@ -1,7 +1,7 @@ Summary: xCAT integration with confluent systems management server Name: xCAT-confluent Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System diff --git a/xCAT-csm/xCAT-csm.spec b/xCAT-csm/xCAT-csm.spec index e0d993026..b173e3043 100644 --- a/xCAT-csm/xCAT-csm.spec +++ b/xCAT-csm/xCAT-csm.spec @@ -1,7 +1,7 @@ Summary: Packages for installation of CSM nodes Name: xCAT-csm Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: IBM Group: Applications/System diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 989980591..d891671bd 100755 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,6 +1,6 @@ %define version %%REPLACE_CURRENT_VERSION%% Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} %ifarch i386 i586 i686 x86 %define tarch x86 %endif @@ -27,7 +27,7 @@ Group: System/Utilities License: Various (see individual packages for details) Vendor: IBM Corp. Summary: xCAT Genesis netboot image -URL: http://xcat.org +URL: https://xcat.org/ Source1: xCAT-genesis-base-%{tarch}.tar.bz2 Buildroot: %{_localstatedir}/tmp/xCAT-genesis diff --git a/xCAT-genesis-builder/xCAT-genesis-builder.spec b/xCAT-genesis-builder/xCAT-genesis-builder.spec index 91d301d44..4f85cde25 100644 --- a/xCAT-genesis-builder/xCAT-genesis-builder.spec +++ b/xCAT-genesis-builder/xCAT-genesis-builder.spec @@ -1,7 +1,7 @@ BuildArch: noarch %define name xCAT-genesis-builder Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 1 AutoReq: false Requires: ipmitool screen btrfs-progs lldpad rpm-build compat-libstdc++-33 mstflint xfsprogs nc reiserfs-utils @@ -15,7 +15,7 @@ Group: System/Utilities License: EPL Vendor: IBM Corp. Summary: Tooling to create xCAT's discovery/maintenance/debugging environment -URL: http://xcat.org +URL: https://xcat.org/ Source1: xCAT-genesis-builder.tar.bz2 Buildroot: %{_localstatedir}/tmp/xCAT-genesis-builder diff --git a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec index 2dcd33925..e0e7c7f0e 100755 --- a/xCAT-genesis-scripts/xCAT-genesis-scripts.spec +++ b/xCAT-genesis-scripts/xCAT-genesis-scripts.spec @@ -13,8 +13,8 @@ BuildArch: noarch %define __spec_install_post : %define debug_package %{nil} %define __prelink_undo_cmd %{nil} -Version: %{?version:%{version}}%{!?version:%{version}} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Version: %{?version:%{version}}%{!?version:%(cat Version)} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 1 AutoReq: false Prefix: /opt/xcat @@ -22,14 +22,12 @@ AutoProv: false Obsoletes: xCAT-genesis-%{tarch} Provides: xCAT-genesis-%{tarch} - - Name: %{name} Group: System/Utilities License: EPL Vendor: IBM Corp Summary: xCAT Genesis netboot image - Core content -URL: http://xcat.org +URL: https://xcat.org/ Source1: xCAT-genesis-scripts.tar.bz2 Requires: xCAT-genesis-base-%{tarch} >= 2:2.13.0 @@ -41,7 +39,6 @@ xCAT genesis (Genesis Enhanced Netboot Environment for System Information and Se This package reperesents the EPL content that is more tightly bound to specific xcat-core versions %Prep - %Build %Install @@ -55,7 +52,6 @@ rm opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/*.spec rm opt/xcat/share/xcat/netboot/genesis/%{tarch}/fs/LICENSE.html cd - - # Since this rpm is being installed/updated, we need to run mknb to combine it with # xCAT-genesis-base-x86_64, but mknb will not work during an initial install of xcat # until the xCAT meta pkg has run xcatconfig or xCATsn has started xcatd. Use of a trigger @@ -72,7 +68,6 @@ echo "If you are installing/updating xCAT-genesis-base separately, not as part o mkdir -p /etc/xcat touch /etc/xcat/genesis-scripts-updated - %Files %defattr(-,root,root) #%dir %attr(-,root,root) %{rpminstallroot} @@ -103,5 +98,5 @@ touch /etc/xcat/genesis-scripts-updated %{rpminstallroot}/etc/udev/rules.d/99-imm.rules %{rpminstallroot}/etc/udev/rules.d/98-mlx.rules %{rpminstallroot}/sbin/setupimmnic -%{rpminstallroot}/sbin/loadmlxeth +%{rpminstallroot}/sbin/loadmlxeth %exclude %{rpminstallroot}/debian/* diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 26e5d5404..8a1fda11b 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -1,7 +1,7 @@ -Summary: xCAT diagnostic tool +Summary: xCAT diagnostic tool Name: xCAT-probe Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -17,14 +17,12 @@ BuildArch: noarch %endif %ifos linux -#Below tools are required by sub-command 'xcatmn' +#Below tools are required by sub-command 'xcatmn' Requires: /usr/bin/nslookup Requires: /usr/bin/tftp Requires: /usr/bin/wget %endif -Provides: xCAT-probe = %{version} - %description xCAT-probe provides a toolkits to probe potential issues with the xCAT cluster. diff --git a/xCAT-rmc/xCAT-rmc.spec b/xCAT-rmc/xCAT-rmc.spec index 56f57d6fd..235d0d2da 100644 --- a/xCAT-rmc/xCAT-rmc.spec +++ b/xCAT-rmc/xCAT-rmc.spec @@ -1,7 +1,7 @@ Summary: RMC monitoring plug-in for xCAT Name: xCAT-rmc Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: System Environment/Libraries @@ -15,10 +15,8 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root BuildArch: noarch %endif -Requires: perl-xCAT >= %{epoch}:%{version} -Requires: xCAT-server >= %{epoch}:%{version} - -Provides: xCAT-rmc = %{version} +Requires: perl-xCAT = 4:%{version}-%{release} +Requires: xCAT-server = 4:%{version}-%{release} %description Provides RMC monitoring plug-in module for xCAT, configuration scripts, predefined conditions, responses and sensors. @@ -42,7 +40,6 @@ chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/rmcmon/* cp lib/perl/TEAL/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/TEAL - %clean rm -rf $RPM_BUILD_ROOT @@ -82,7 +79,7 @@ else needCopyFiles=1; fi fi - + if [ $needCopyFiles -eq 1 ]; then echo "Copying files to /install/postscripts directory..." mkdir -p /install/postscripts @@ -90,23 +87,23 @@ if [ $needCopyFiles -eq 1 ]; then mkdir -p /install/postscripts/rmcmon/scripts cp $RPM_INSTALL_PREFIX0/sbin/rmcmon/configrmcnode /install/postscripts chmod 755 /install/postscripts/configrmcnode - - FILES_TO_COPY=`cat $RPM_INSTALL_PREFIX0/sbin/rmcmon/scripts_to_node|tr '\n' ' '` + + FILES_TO_COPY=`cat $RPM_INSTALL_PREFIX0/sbin/rmcmon/scripts_to_node|tr '\n' ' '` for file in $FILES_TO_COPY do #echo "file=$file" cp $RPM_INSTALL_PREFIX0/sbin/rmcmon/$file /install/postscripts/rmcmon/scripts done chmod 755 /install/postscripts/rmcmon/scripts/* - + cp -r $RPM_INSTALL_PREFIX0/lib/perl/xCAT_monitoring/rmc/resources/node/* /install/postscripts/rmcmon/resources/node -fi - +fi + %ifos linux if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image if [ -f $RPM_INSTALL_PREFIX0/sbin/xcatd ]; then - /etc/init.d/xcatd restart + /etc/init.d/xcatd restart fi fi %else @@ -117,13 +114,7 @@ fi echo "Do not restartxcatd in not running system" else XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd -r - fi + fi fi %endif exit 0 - - - - - - diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index a3670db9d..f4fb5acb9 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -1,7 +1,7 @@ Summary: Server and configuration utilities of the xCAT management project Name: xCAT-server Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -47,11 +47,8 @@ Requires: perl-IO-Tty perl-Crypt-SSLeay make %endif %endif - -Requires: perl-xCAT >= %{epoch}:%{version} -Requires: xCAT-client >= %{epoch}:%{version} - -Provides: xCAT-server = %{epoch}:%{version} +Requires: perl-xCAT = 4:%{version}-%{release} +Requires: xCAT-client = 4:%{version}-%{release} %description xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server @@ -349,8 +346,8 @@ echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/xcat/c cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache22 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache24 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24 #install lower version(<2.4) apache/httpd conf files by default -cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf -cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf +cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf +cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf %endif @@ -401,7 +398,7 @@ fi %endif # The Juniper directory is switched to Jun and a sylink is created -if [ -d $RPM_INSTALL_PREFIX0/share/xcat/devicetype/EthSwitch/Juniper ]; then +if [ -d $RPM_INSTALL_PREFIX0/share/xcat/devicetype/EthSwitch/Juniper ]; then # need to remove the old directory otherwise the symlink won't get creatd correctly rm -rf $RPM_INSTALL_PREFIX0/share/xcat/devicetype/EthSwitch/Juniper fi @@ -428,17 +425,16 @@ fi %else if [ "$1" -gt "1" ]; then #only on upgrade for AIX... #migration issue for monitoring - XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d + XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d -fi +fi %endif - #Apply the correct httpd/apache configuration file according to the httpd/apache version if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] then rm -rf /etc/httpd/conf.d/xcat-ws.conf - cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/httpd/conf.d/xcat-ws.conf + cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/httpd/conf.d/xcat-ws.conf fi if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] @@ -453,7 +449,6 @@ then cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/apache2/conf.d/xcat-ws.conf fi - exit 0 %preun diff --git a/xCAT-test/xCAT-test.spec b/xCAT-test/xCAT-test.spec index f5aca2460..6906896da 100644 --- a/xCAT-test/xCAT-test.spec +++ b/xCAT-test/xCAT-test.spec @@ -1,7 +1,7 @@ Summary: xCAT automated test tool Name: xCAT-test Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -17,8 +17,6 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root BuildArch: noarch %endif -Provides: xCAT-test = %{version} - %description Provides automated test tool and buckets to help test xCAT commands automatically. diff --git a/xCAT-vlan/xCAT-vlan.spec b/xCAT-vlan/xCAT-vlan.spec index 6e46f2ebe..487dbcb12 100755 --- a/xCAT-vlan/xCAT-vlan.spec +++ b/xCAT-vlan/xCAT-vlan.spec @@ -1,7 +1,7 @@ Summary: Executables and data of the xCAT vlan management project Name: xCAT-vlan Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: IBM Group: Applications/System @@ -16,11 +16,7 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root BuildArch: noarch %endif - -Provides: xCAT-vlan = %{epoch}:%{version} - - -Requires: xCAT-client +Requires: xCAT-client = 4:%{version}-%{release} %description xCAT-vlan provides the xCAT vlan confiuration. @@ -45,14 +41,12 @@ mkdir -p $RPM_BUILD_ROOT/install/postscripts mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1 mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/man1 - set +x cp xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT cp -R xCAT_plugin/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin cp install/postscripts/* $RPM_BUILD_ROOT/install/postscripts - # These were built dynamically in the build phase cp share/man/man1/* $RPM_BUILD_ROOT/%{prefix}/share/man/man1 chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/* @@ -68,7 +62,6 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rmvlan ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/lsvlan ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/chvlanports - %clean # This step does not happen until *after* the %files packaging below rm -rf $RPM_BUILD_ROOT @@ -80,7 +73,6 @@ rm -rf $RPM_BUILD_ROOT %{prefix} /install/postscripts - %changelog %post @@ -104,5 +96,3 @@ rm -rf $RPM_BUILD_ROOT exit 0 %preun - - diff --git a/xCAT/xCAT.spec b/xCAT/xCAT.spec index d1d935e3f..7944f6108 100644 --- a/xCAT/xCAT.spec +++ b/xCAT/xCAT.spec @@ -1,9 +1,10 @@ Summary: Meta-package for a common, default xCAT setup Name: xCAT Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} License: EPL Group: Applications/System +URL: https://xcat.org/ Vendor: IBM Corp. Packager: IBM Corp. Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} @@ -13,7 +14,7 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root Source1: xcat.conf Source2: postscripts.tar.gz Source3: templates.tar.gz -Source5: xCATMN +Source5: xCATMN %ifos linux Source4: prescripts.tar.gz @@ -25,7 +26,12 @@ Source7: xcat.conf.apach24 Provides: xCAT = %{version} Conflicts: xCATsn -Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-probe >= 2.12.1 xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 +Requires: perl-DBD-SQLite +Requires: xCAT-client = 4:%{version}-%{release} +Requires: xCAT-server = 4:%{version}-%{release} +Requires: xCAT-probe = 4:%{version}-%{release} +Requires: xCAT-genesis-scripts-x86_64 = 1:%{version}-%{release} +Requires: xCAT-genesis-scripts-ppc64 = 1:%{version}-%{release} %define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi) %define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi) @@ -34,7 +40,7 @@ Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-probe >= 2.12.1 xCAT-gene Requires: httpd nfs-utils nmap bind perl(CGI) # on RHEL7, need to specify it explicitly Requires: net-tools -Requires: /usr/bin/killall +Requires: /usr/bin/killall # On RHEL this pulls in dhcp, on SLES it pulls in dhcp-server Requires: /usr/sbin/dhcpd # On RHEL this pulls in openssh-server, on SLES it pulls in openssh @@ -101,7 +107,7 @@ tar -xf postscripts.tar # this is now handled by requiring /usr/sbin/dhcpd #if [ -e "/etc/SuSE-release" ]; then # In SuSE, dhcp-server provides the dhcp server, which is different from the RedHat. - # When building the package, we cannot add "dhcp-server" into the "Requires", because RedHat doesn't + # When building the package, we cannot add "dhcp-server" into the "Requires", because RedHat doesn't # have such one package. # so there's only one solution, Yes, it looks ugly. #rpm -q dhcp-server >/dev/null @@ -190,13 +196,13 @@ then fi if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] -then +then rm -rf /etc/apache2/conf.d/xcat.conf cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf fi if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] -then +then rm -rf /etc/apache2/conf.d/xcat.conf cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf fi @@ -237,7 +243,6 @@ exit 0 %clean - %files %{prefix} # one for sles, one for rhel. yes, it's ugly... @@ -259,10 +264,8 @@ exit 0 %postun - if [ "$1" = "0" ]; then - %ifnos linux if grep "^xcatd" /etc/inittab >/dev/null then @@ -271,4 +274,3 @@ fi %endif true # so on aix we do not end up with an empty if stmt fi - diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index ed793aee6..db20b979f 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -1,7 +1,7 @@ Summary: Metapackage for a common, default xCAT service node setup Name: xCATsn Version: %{?version:%{version}}%{!?version:%(cat Version)} -Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} +Release: %{?release:%{release}}%{!?release:%(cat Release)} Epoch: 4 License: EPL Group: Applications/System @@ -13,11 +13,15 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root #BuildArch: noarch Source1: xcat.conf Source2: license.tar.gz -Source3: xCATSN +Source3: xCATSN Source5: templates.tar.gz Source6: xcat.conf.apach24 -Provides: xCATsn = %{version} -Requires: xCAT-server xCAT-client perl-DBD-SQLite xCAT-genesis-scripts-x86_64 xCAT-genesis-scripts-ppc64 xCAT-probe >= 2.12.2 +Requires: perl-DBD-SQLite +Requires: xCAT-client = 4:%{version}-%{release} +Requires: xCAT-server = 4:%{version}-%{release} +Requires: xCAT-probe = 4:%{version}-%{release} +Requires: xCAT-genesis-scripts-x86_64 = 1:%{version}-%{release} +Requires: xCAT-genesis-scripts-ppc64 = 1:%{version}-%{release} Conflicts: xCAT @@ -38,7 +42,7 @@ Requires: /usr/bin/ssh %ifnarch s390x Requires: /etc/xinetd.d/tftp # yaboot-xcat is pulled in so any MN can manage ppc nodes -#Requires: yaboot-xcat +#Requires: yaboot-xcat # Stty is only needed for rcons on ppc64 nodes, but for mixed clusters require it on both x and p Requires: perl-IO-Stty %endif @@ -74,7 +78,7 @@ Requires: syslinux-xcat %description xCATsn is a service node management package intended for at-scale management, -including hardware management and software management. +including hardware management and software management. %prep @@ -181,9 +185,9 @@ if [ "$1" = "1" ]; then #Only if installing for the first time.. # setup sqlite if no other database -%ifos linux -if [ -f "/proc/cmdline" ]; then #check to make sure this is not image install - if [ ! -s /etc/xcat/cfgloc ]; then # database is sqlite +%ifos linux +if [ -f "/proc/cmdline" ]; then #check to make sure this is not image install + if [ ! -s /etc/xcat/cfgloc ]; then # database is sqlite $RPM_INSTALL_PREFIX0/sbin/xcatconfig -d fi fi @@ -207,16 +211,16 @@ else # SuSE fi # start xcatd on linux [ -e "/etc/init.d/$apachedaemon" ] && chkconfig $apachedaemon on -[ -e "/usr/lib/systemd/system/$apacheserviceunit" ] && systemctl enable $apacheserviceunit +[ -e "/usr/lib/systemd/system/$apacheserviceunit" ] && systemctl enable $apacheserviceunit if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image XCATROOT=$RPM_INSTALL_PREFIX0 /etc/init.d/xcatd restart - [ -e "/etc/init.d/$apachedaemon" ] && /etc/init.d/$apachedaemon reload - [ -e "/usr/lib/systemd/system/$apacheserviceunit" ] && systemctl reload $apacheserviceunit + [ -e "/etc/init.d/$apachedaemon" ] && /etc/init.d/$apachedaemon reload + [ -e "/usr/lib/systemd/system/$apacheserviceunit" ] && systemctl reload $apacheserviceunit fi echo "xCATsn is now installed" %else # start xcatd on AIX - XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd + XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/restartxcatd echo "xCATsn is now installed" %endif @@ -237,7 +241,6 @@ if [ -f "/proc/cmdline" -a -f "/etc/xcat/genesis-scripts-updated" ]; then fi %endif - %clean %files From 327db76f9e49b3bb0136b19f94e2e20815489868 Mon Sep 17 00:00:00 2001 From: neo954 Date: Wed, 23 Nov 2016 00:36:08 -0600 Subject: [PATCH 251/292] Make all the deb packages have the exactly same version and release numbers --- build-ubunturepo | 64 ++++++++++++--------- perl-xCAT/debian/compat | 2 +- perl-xCAT/debian/control | 7 ++- perl-xCAT/debian/rules | 6 +- xCAT-IBMhpc/debian/compat | 2 +- xCAT-IBMhpc/debian/control | 14 ++--- xCAT-IBMhpc/debian/rules | 6 +- xCAT-OpenStack-baremetal/debian/compat | 2 +- xCAT-OpenStack-baremetal/debian/control | 8 +-- xCAT-OpenStack/debian/compat | 2 +- xCAT-OpenStack/debian/control | 12 ++-- xCAT-UI/debian/compat | 2 +- xCAT-UI/debian/control | 11 ++-- xCAT-UI/debian/rules | 5 +- xCAT-buildkit/debian/compat | 2 +- xCAT-buildkit/debian/control | 8 +-- xCAT-buildkit/debian/rules | 4 -- xCAT-client/debian/compat | 2 +- xCAT-client/debian/control | 12 ++-- xCAT-client/debian/rules | 6 +- xCAT-genesis-builder/debian/compat | 2 +- xCAT-genesis-builder/debian/control | 8 +-- xCAT-genesis-scripts/debian/compat | 2 +- xCAT-genesis-scripts/debian/control-amd64 | 19 +++--- xCAT-genesis-scripts/debian/control-ppc64el | 13 +++-- xCAT-probe/debian/compat | 2 +- xCAT-probe/debian/control | 6 +- xCAT-probe/debian/rules | 6 +- xCAT-rmc/debian/compat | 2 +- xCAT-rmc/debian/control | 6 +- xCAT-rmc/debian/rules | 6 +- xCAT-server/debian/compat | 2 +- xCAT-server/debian/control | 14 +++-- xCAT-server/debian/install | 1 - xCAT-server/debian/rules | 3 +- xCAT-test/debian/compat | 2 +- xCAT-test/debian/control | 9 ++- xCAT-test/debian/rules | 6 +- xCAT-vlan/debian/compat | 2 +- xCAT-vlan/debian/control | 9 ++- xCAT-vlan/debian/rules | 2 + xCAT/debian/compat | 2 +- xCAT/debian/control | 28 +++++++-- xCAT/debian/rules | 6 +- xCATsn/debian/compat | 2 +- xCATsn/debian/control | 13 +++-- xCATsn/debian/rules | 6 +- 47 files changed, 181 insertions(+), 175 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index b4220b4a6..8379d8201 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -4,7 +4,7 @@ # Author: Leonardo Tonetto (tonetto@linux.vnet.ibm.com) # Revisor: Arif Ali (aali@ocf.co.uk) # -# +# # Getting Started: # - Clone the xcat-core git repository int a directory called /src/xcat-core, where # is the same name as the release dir it is uploaded to xcat.org (e.g devel, 2.9, 2.10) @@ -15,21 +15,21 @@ # PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. This does not # actually build xcat, just uploads the most recent snap build to http://xcat.org/files/xcat/ . # If not specified, a snap build is assumed, which uploads to https://xcat.org/files/xcat/ -# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this -# build is a GA candidate build, not to be released yet. This will result in the tarball +# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this +# build is a GA candidate build, not to be released yet. This will result in the tarball # being uploaded to http://xcat.org/files/xcat/repos/apt -# (but the tarball file name will be like a released tarball, not a snap build). +# (but the tarball file name will be like a released tarball, not a snap build). # When you are ready to release this build, use PROMOTE=1 without PREGA -# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in +# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in # prep for a release. # UP=0 or UP=1 - override the default upload behavior # LOG= - provide an LOG file option to redirect some output into log file # -# For the dependency packages 1. All the xcat dependency deb packages should be uploaded to +# For the dependency packages 1. All the xcat dependency deb packages should be uploaded to # "pokgsa/projects/x/xcat/build/ubuntu/xcat-dep/debs/" on GSA # 2. run ./build-ubunturepo -d # -# 3. the built xcat-dep deb packages tarball can be found in "../../xcat-dep" +# 3. the built xcat-dep deb packages tarball can be found in "../../xcat-dep" # related to the path of this script ############################ printusage() @@ -39,10 +39,10 @@ printusage() echo " -d : Create the xcat-dep repo." } # For the purpose of getting the distribution name -if [[ ! -f /etc/lsb-release ]]; then +if [[ ! -f /etc/lsb-release ]]; then echo "ERROR: Could not find /etc/lsb-release, is this script executed on a Ubuntu machine?" exit 1 -fi +fi . /etc/lsb-release # Check the necessary packages before starting the build @@ -84,7 +84,7 @@ do r) r_flag=1 genesis_rpm_path="$OPTARG" ;; - ?) printusage + ?) printusage exit 2 ;; esac @@ -129,7 +129,7 @@ fi export HOME=/root WGET_CMD="wget" -if [ ! -z ${LOG} ]; then +if [ ! -z ${LOG} ]; then WGET_CMD="wget -o ${LOG}" fi @@ -211,13 +211,13 @@ then build_string="Snap_Build" cur_date=`date +%Y%m%d%H%M` pkg_version="${ver}-${pkg_type}${cur_date}" - + if [ ! -d ../../$package_dir_name ];then mkdir -p "../../$package_dir_name" fi packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT xCATsn xCAT-test xCAT-buildkit xCAT-vlan xCAT-confluent xCAT-probe" target_archs=(amd64 ppc64el) - for file in `echo $packages` + for file in $packages do file_low=`echo $file | tr '[A-Z]' '[a-z]'` if [ "$file" = "xCAT" -o "$file" = "xCAT-genesis-scripts" ]; then @@ -225,7 +225,7 @@ then else target_archs="all" fi - for target_arch in `echo $target_archs` + for target_arch in $target_archs do if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then rm -f ../../$package_dir_name/${file_low}_*.$target_arch.deb @@ -245,18 +245,28 @@ then cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/ServiceNodeUtils.pm ${CURDIR}/lib/perl/xCAT/ fi - dpkg-buildpackage -uc -us + CURDIR=$(pwd) + cp ${CURDIR}/debian/control ${CURDIR}/debian/control.save.998 + # Magic string used here + sed -i -e "s#>= 2.13-snap000000000000#= ${pkg_version}#g" ${CURDIR}/debian/control + dpkg-buildpackage -rfakeroot -uc -us + mv ${CURDIR}/debian/control.save.998 ${CURDIR}/debian/control else if [ "$file" = "xCAT-genesis-scripts" ]; then CURDIR=$(pwd) - echo "Rename control file to build pkg: mv ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control" - mv ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control + echo "Rename control file to build pkg: cp ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control" + cp ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control fi - dpkg-buildpackage -uc -us -a$target_arch + CURDIR=$(pwd) + cp ${CURDIR}/debian/control ${CURDIR}/debian/control.save.998 + # Magic string used here + sed -i -e "s#>= 2.13-snap000000000000#= ${pkg_version}#g" ${CURDIR}/debian/control + dpkg-buildpackage -rfakeroot -uc -us -a$target_arch + mv ${CURDIR}/debian/control.save.998 ${CURDIR}/debian/control if [ "$file" = "xCAT-genesis-scripts" ]; then CURDIR=$(pwd) echo "Move control file back: mv ${CURDIR}/debian/control ${CURDIR}/debian/control-${target_arch}" - mv ${CURDIR}/debian/control ${CURDIR}/debian/control-${target_arch} + rm ${CURDIR}/debian/control fi fi rc=$? @@ -317,7 +327,7 @@ Label: xcat-core bazaar repository Codename: $dist Architectures: $tmp_out_arch Components: main -Description: Repository automatically genereted conf +Description: Repository automatically genereted conf SignWith: yes __EOF__ @@ -357,12 +367,12 @@ __EOF__ chmod 775 mklocalrepo.sh - #create the xcat-core.list file + #create the xcat-core.list file cd ../ if ! grep xcat /etc/group ; then groupadd xcat - fi + fi chgrp -R root xcat-core chmod -R g+w xcat-core @@ -388,7 +398,7 @@ then #the path of ubuntu xcat-dep deb packages on GSA GSA="/gsa/pokgsa/projects/x/xcat/build/ubuntu/xcat-dep" - + if [ ! -d $GSA ]; then echo "build-ubunturepo: It appears that you do not have gsa installed to access the xcat-dep pkgs." exit 1; @@ -400,10 +410,10 @@ then echo "Syncing RPMs from $GSA/ to $local_dep_repo_path/../ ..." rsync -ilrtpu --delete $GSA/ $local_dep_repo_path/../ - if [ $? -ne 0 ]; then + if [ $? -ne 0 ]; then echo "Error from rsync, cannot continue!" exit 1 - fi + fi #clean all old files if [ -e $local_dep_repo_path ];then @@ -427,7 +437,7 @@ Label: xcat-dep bazaar repository Codename: $dist Architectures: $tmp_out_arch Components: main -Description: Repository automatically genereted conf +Description: Repository automatically genereted conf SignWith: yes __EOF__ @@ -482,7 +492,7 @@ __EOF__ chmod g+w $dep_tar_name # Decide whether to upload or not (default NOT to upload) - if [ "$UP" != "1" ]; then + if [ "$UP" != "1" ]; then echo "Upload not specified, Done! (rerun with UP=1, to upload)" cd $old_pwd exit 0 diff --git a/perl-xCAT/debian/compat b/perl-xCAT/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/perl-xCAT/debian/compat +++ b/perl-xCAT/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/perl-xCAT/debian/control b/perl-xCAT/debian/control index 5222978b0..cd7877d24 100644 --- a/perl-xCAT/debian/control +++ b/perl-xCAT/debian/control @@ -2,12 +2,13 @@ Source: perl-xcat Section: libs Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5), libsoap-lite-perl, libdbi-perl -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9), libsoap-lite-perl, libdbi-perl +Standards-Version: 3.9.4 +Homepage: https://xcat.org/ Package: perl-xcat Architecture: all -Depends: ${perl:Depends} +Depends: ${perl:Depends} Description: xCAT perl libraries Provides perl xCAT libraries for core functionality. Required for all xCAT installations. Includes xCAT::Table, xCAT::NodeRange, among others. diff --git a/perl-xCAT/debian/rules b/perl-xCAT/debian/rules index e5a0aa6fd..763812bba 100755 --- a/perl-xCAT/debian/rules +++ b/perl-xCAT/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: dh_testdir ./db2man @@ -27,7 +24,6 @@ install: dh_installdirs dh_install -X".svn" - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -36,7 +32,7 @@ binary-indep: build install binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-IBMhpc/debian/compat b/xCAT-IBMhpc/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-IBMhpc/debian/compat +++ b/xCAT-IBMhpc/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-IBMhpc/debian/control b/xCAT-IBMhpc/debian/control index 38a06c9af..2bdffb1be 100644 --- a/xCAT-IBMhpc/debian/control +++ b/xCAT-IBMhpc/debian/control @@ -2,14 +2,14 @@ Source: xcat-ibmhpc Section: admin Priority: extra Maintainer: Arif Ali -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-ibmhpc Architecture: all -Depends: ${perl:Depends}, perl-xcat (>= 2.8.0), xcat-client (>= 2.8.0) -Description: Install and configuration utilities for IBM HPC products in an xCAT cluster - xCAT-IBMhpc provides sample installation and configuration scripts for running - the IBM HPC software stack in an xCAT cluser. Support for the following IBM - products is provided: GPFS, LoadLeveler, Parallel Environment, ESSL and Parallel +Depends: ${perl:Depends}, perl-xcat (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000) +Description: Utilities for manage IBM HPC products in an xCAT cluster + xCAT-IBMhpc provides sample installation and configuration scripts for running + the IBM HPC software stack in an xCAT cluser. Support for the following IBM + products is provided: GPFS, LoadLeveler, Parallel Environment, ESSL and Parallel ESSL libraries, some compilers (vac, xlC, xlf). diff --git a/xCAT-IBMhpc/debian/rules b/xCAT-IBMhpc/debian/rules index 659821bd5..1bd639730 100755 --- a/xCAT-IBMhpc/debian/rules +++ b/xCAT-IBMhpc/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd dh_quilt_patch @@ -29,7 +26,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -39,7 +35,7 @@ binary-arch: pwd dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-OpenStack-baremetal/debian/compat b/xCAT-OpenStack-baremetal/debian/compat index 45a4fb75d..ec635144f 100644 --- a/xCAT-OpenStack-baremetal/debian/compat +++ b/xCAT-OpenStack-baremetal/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/xCAT-OpenStack-baremetal/debian/control b/xCAT-OpenStack-baremetal/debian/control index 61ad678eb..b62fc34bb 100644 --- a/xCAT-OpenStack-baremetal/debian/control +++ b/xCAT-OpenStack-baremetal/debian/control @@ -2,13 +2,11 @@ Source: xcat-openstack-baremetal Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 8.0.0) +Build-Depends: debhelper (>= 9) Standards-Version: 3.9.4 -Homepage: http://xcat.org -#Vcs-Git: git://git.debian.org/collab-maint/xcat-openstack-baremetal.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-openstack-baremetal.git;a=summary +Homepage: https://xcat.org/ Package: xcat-openstack-baremetal Architecture: all Depends: xcat-client -Description: Executables and data of the xCAT baremetal driver for OpenStack +Description: Executables and data of xCAT baremetal driver for OpenStack diff --git a/xCAT-OpenStack/debian/compat b/xCAT-OpenStack/debian/compat index 45a4fb75d..ec635144f 100644 --- a/xCAT-OpenStack/debian/compat +++ b/xCAT-OpenStack/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/xCAT-OpenStack/debian/control b/xCAT-OpenStack/debian/control index 04cff6ab9..9f6ac5661 100644 --- a/xCAT-OpenStack/debian/control +++ b/xCAT-OpenStack/debian/control @@ -2,13 +2,13 @@ Source: xcat-openstack Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.2 -#Vcs-Git: git://git.debian.org/collab-maint/xcat-openstack.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-openstack.git;a=summary +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-openstack Architecture: all Depends: xcat -Description: Meta-Metapackage for a common, default xCAT management node setup with OpenStack - xCAT-OpenStack is an xCAT management node package intended for at-scale management with OpenStack, including hardware management and software management. +Description: Metapackage for a xCAT management node setup with OpenStack + xCAT-OpenStack is an xCAT management node package intended for at-scale + management with OpenStack, including hardware management and software + management. diff --git a/xCAT-UI/debian/compat b/xCAT-UI/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-UI/debian/compat +++ b/xCAT-UI/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-UI/debian/control b/xCAT-UI/debian/control index 4e91971ef..f9fe95278 100644 --- a/xCAT-UI/debian/control +++ b/xCAT-UI/debian/control @@ -2,11 +2,12 @@ Source: xcat-ui Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-ui Architecture: all -Depends: ${perl:Depends}, python (>= 2.3), apache2, libapache2-mod-php5 -Description: Provides a browser-based interface for xCAT (extreme Cluster Administration Tool). - Provides a browser-based interface for xCAT (extreme Cluster Administration Tool). +Depends: ${perl:Depends}, python (>= 2.3), apache2, libapache2-mod-php +Description: Provides a browser-based interface for xCAT + Provides a browser-based interface for xCAT (extreme Cluster Administration + Tool). diff --git a/xCAT-UI/debian/rules b/xCAT-UI/debian/rules index ce79be57f..1cf265aa1 100755 --- a/xCAT-UI/debian/rules +++ b/xCAT-UI/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd @@ -38,7 +35,7 @@ binary-arch: pwd dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-buildkit/debian/compat b/xCAT-buildkit/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-buildkit/debian/compat +++ b/xCAT-buildkit/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-buildkit/debian/control b/xCAT-buildkit/debian/control index dfe2c644d..ee045d41e 100644 --- a/xCAT-buildkit/debian/control +++ b/xCAT-buildkit/debian/control @@ -1,11 +1,11 @@ Source: xcat-buildkit Section: admin Priority: extra -Maintainer: xu qing -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Maintainer: Xu Qing +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-buildkit Architecture: all Depends: dpkg-dev, devscripts, debhelper -Description: xCAT-buildkit provides the buildkit tool and sample kit files to build an xCAT kit. +Description: Provides build tools and sample files to build an xCAT kit diff --git a/xCAT-buildkit/debian/rules b/xCAT-buildkit/debian/rules index b5e90c11b..c792c4f31 100755 --- a/xCAT-buildkit/debian/rules +++ b/xCAT-buildkit/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd mkdir -p share/man/man1 @@ -40,7 +37,6 @@ install: find debian/xcat-buildkit/opt/xcat/share/doc/packages/xCAT-buildkit -type f -exec chmod 644 {} \; dh_link - # Build architecture-independent files here. binary-indep: build install dh_installchangelogs diff --git a/xCAT-client/debian/compat b/xCAT-client/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-client/debian/compat +++ b/xCAT-client/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-client/debian/control b/xCAT-client/debian/control index 032f70438..db9b62fe4 100644 --- a/xCAT-client/debian/control +++ b/xCAT-client/debian/control @@ -2,12 +2,14 @@ Source: xcat-client Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-client Architecture: all -Depends: ${perl:Depends}, nmap, perl-xcat -Recommends: libsort-versions-perl +Depends: ${perl:Depends}, perl-xcat (>= 2.13-snap000000000000) +Recommends: libsort-versions-perl, nmap Description: Core executables and data of the xCAT management project - xCAT-client provides the fundamental xCAT commands (chtab, chnode, rpower, etc) helpful in administrating systems at scale, with particular attention paid to large HPC clusters. + xCAT-client provides the fundamental xCAT commands (chtab, chnode, rpower, + etc) helpful in administrating systems at scale, with particular attention + paid to large HPC clusters. diff --git a/xCAT-client/debian/rules b/xCAT-client/debian/rules index 5beff8b73..17e87fad6 100755 --- a/xCAT-client/debian/rules +++ b/xCAT-client/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd ./xpod2man @@ -29,7 +26,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -39,7 +35,7 @@ binary-arch: pwd dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-genesis-builder/debian/compat b/xCAT-genesis-builder/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-genesis-builder/debian/compat +++ b/xCAT-genesis-builder/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-genesis-builder/debian/control b/xCAT-genesis-builder/debian/control index b107a09ab..ebb738dcf 100644 --- a/xCAT-genesis-builder/debian/control +++ b/xCAT-genesis-builder/debian/control @@ -2,15 +2,15 @@ Source: xcat-genesis-base-amd64 Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-genesis-base-amd64 Architecture: all -Depends: +Depends: Replaces: xcat-genesis-amd64 Breaks: xcat-genesis-amd64 Description: xCAT Genesis netboot image 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. + discovery and management actions when interaction with an OS is infeasible. diff --git a/xCAT-genesis-scripts/debian/compat b/xCAT-genesis-scripts/debian/compat index 45a4fb75d..ec635144f 100644 --- a/xCAT-genesis-scripts/debian/compat +++ b/xCAT-genesis-scripts/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/xCAT-genesis-scripts/debian/control-amd64 b/xCAT-genesis-scripts/debian/control-amd64 index ada257a83..8c4de338e 100644 --- a/xCAT-genesis-scripts/debian/control-amd64 +++ b/xCAT-genesis-scripts/debian/control-amd64 @@ -2,14 +2,17 @@ Source: xcat-genesis-scripts Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-genesis-scripts-amd64 -Architecture: all +Architecture: all Depends: xcat-genesis-base-amd64 (>=2.13.0) -Conflicts: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 -Replaces: xcat-genesis-scripts,xcat-genesis-scripts-x86-64 -Description: xCAT genesis - (Genesis Enhanced Netboot Environment for System Information and Servicing) is a small, embedded-like environment for xCAT's use in discovery and management actions when interaction with an OS is infeasible. This package reperesents the EPL content that is more tightly bound to specific xcat-core versions - +Conflicts: xcat-genesis-scripts, xcat-genesis-scripts-x86-64 +Replaces: xcat-genesis-scripts, xcat-genesis-scripts-x86-64 +Description: xCAT genesis + (Genesis Enhanced Netboot Environment for System Information and Servicing) + is a small, embedded-like environment for xCAT's use in discovery and + management actions when interaction with an OS is infeasible. This package + reperesents the EPL content that is more tightly bound to specific xcat-core + versions. diff --git a/xCAT-genesis-scripts/debian/control-ppc64el b/xCAT-genesis-scripts/debian/control-ppc64el index 825592d88..2165376c7 100644 --- a/xCAT-genesis-scripts/debian/control-ppc64el +++ b/xCAT-genesis-scripts/debian/control-ppc64el @@ -2,14 +2,17 @@ Source: xcat-genesis-scripts Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-genesis-scripts-ppc64 Architecture: all Depends: xcat-genesis-base-ppc64 (>=2.13.0) Conflicts: xcat-genesis-scripts Replaces: xcat-genesis-scripts -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 - +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-probe/debian/compat b/xCAT-probe/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-probe/debian/compat +++ b/xCAT-probe/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-probe/debian/control b/xCAT-probe/debian/control index f0b56bb3f..2a7549362 100644 --- a/xCAT-probe/debian/control +++ b/xCAT-probe/debian/control @@ -2,11 +2,11 @@ Source: xcat-probe Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-probe Architecture: all Depends: ${perl:Depends} Recommends: wget, dnsutils, tftp-hpa -Description: Provides a toolkit to help probe all the possible issues in xCAT +Description: Provides a toolkit to probe possible issues in xCAT diff --git a/xCAT-probe/debian/rules b/xCAT-probe/debian/rules index cb48348a6..bb1842ebe 100755 --- a/xCAT-probe/debian/rules +++ b/xCAT-probe/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: dh_testdir pwd @@ -29,7 +26,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -40,7 +36,7 @@ binary-arch: export dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-rmc/debian/compat b/xCAT-rmc/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-rmc/debian/compat +++ b/xCAT-rmc/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-rmc/debian/control b/xCAT-rmc/debian/control index 33f8bc9cd..e8e97d82d 100644 --- a/xCAT-rmc/debian/control +++ b/xCAT-rmc/debian/control @@ -2,11 +2,11 @@ Source: xcat-rmc Section: admin Priority: extra Maintainer: Arif Ali -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 Package: xcat-rmc Architecture: all -Depends: ${perl:Depends}, perl-xcat, xcat-server +Depends: ${perl:Depends}, perl-xcat (>= 2.13-snap000000000000), xcat-server (>= 2.13-snap000000000000) Description: RMC monitoring plug-in for xCAT Provides RMC monitoring plug-in module for xCAT, configuration scripts, predefined conditions, responses and sensors diff --git a/xCAT-rmc/debian/rules b/xCAT-rmc/debian/rules index 5099b8b4b..d880b083b 100755 --- a/xCAT-rmc/debian/rules +++ b/xCAT-rmc/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd @@ -28,7 +25,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -39,7 +35,7 @@ binary-arch: export dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-server/debian/compat b/xCAT-server/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-server/debian/compat +++ b/xCAT-server/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-server/debian/control b/xCAT-server/debian/control index 83eb791fb..ae2306ed9 100644 --- a/xCAT-server/debian/control +++ b/xCAT-server/debian/control @@ -2,11 +2,15 @@ Source: xcat-server Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: https://xcat.org/ Package: xcat-server Architecture: all -Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.5.0-1), xcat-client (>= 2.5.0-1), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl, libnet-https-nb-perl, libhttp-async-perl -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 +Depends: ${perl:Depends}, grub2-xcat, perl-xcat (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libsys-syslog-perl, libio-socket-ssl-perl, libxml-simple-perl, make, libdbd-sqlite3-perl, libexpect-perl, libnet-dns-perl, libsoap-lite-perl, libxml-libxml-perl, libsnmp-perl, debootstrap, libdigest-sha-perl,libcrypt-rijndael-perl,libcrypt-cbc-perl,libjson-perl, libnet-https-nb-perl, libhttp-async-perl +Description: Server and configuration utilities of xCAT + xCAT-server provides the core server and configuration management components + of xCAT. + . + This package should be installed on the xCAT management node. diff --git a/xCAT-server/debian/install b/xCAT-server/debian/install index 7941d95c2..ec21c731e 100644 --- a/xCAT-server/debian/install +++ b/xCAT-server/debian/install @@ -19,7 +19,6 @@ share/xcat/devicetype/* opt/xcat/share/xcat/devicetype share/xcat/ib/netboot/sles/* opt/xcat/share/xcat/ib/netboot/sles share/xcat/ib/netboot/rh/* opt/xcat/share/xcat/ib/netboot/rh - lib/perl/xCAT/* opt/xcat/lib/perl/xCAT/ lib/xcat/plugins/* opt/xcat/lib/perl/xCAT_plugin/ lib/xcat/schema/* opt/xcat/lib/perl/xCAT_schema/ diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index 027559171..72d780fc1 100755 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -9,7 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 export buildroot=$(PWD)/debian/xcat-server export prefix=/opt/xcat export rootdir=$(buildroot)/$(prefix) @@ -41,7 +40,7 @@ binary-arch: pwd dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-test/debian/compat b/xCAT-test/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT-test/debian/compat +++ b/xCAT-test/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT-test/debian/control b/xCAT-test/debian/control index 10e475fb5..fa073a669 100644 --- a/xCAT-test/debian/control +++ b/xCAT-test/debian/control @@ -2,10 +2,13 @@ Source: xcat-test Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: https://xcat.org/ Package: xcat-test Architecture: all Depends: ${perl:Depends} -Description: Provides automated test tool and buckets to help test xCAT commands automatically +Description: xCAT automated test tool + Provides automated test tool and buckets to help test xCAT commands + automatically. diff --git a/xCAT-test/debian/rules b/xCAT-test/debian/rules index 2d65f3a62..ad419b385 100755 --- a/xCAT-test/debian/rules +++ b/xCAT-test/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: dh_testdir mkdir -p share/man/man1 @@ -33,7 +30,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -44,7 +40,7 @@ binary-arch: export dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCAT-vlan/debian/compat b/xCAT-vlan/debian/compat index 45a4fb75d..ec635144f 100755 --- a/xCAT-vlan/debian/compat +++ b/xCAT-vlan/debian/compat @@ -1 +1 @@ -8 +9 diff --git a/xCAT-vlan/debian/control b/xCAT-vlan/debian/control index b6d89e310..5eddaa6e8 100755 --- a/xCAT-vlan/debian/control +++ b/xCAT-vlan/debian/control @@ -2,12 +2,11 @@ Source: xcat-vlan Section: admin Priority: extra Maintainer: root -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.2 -#Vcs-Git: git://git.debian.org/collab-maint/xcat-vlan.git -#Vcs-Browser: http://git.debian.org/?p=collab-maint/xcat-vlan.git;a=summary +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: https://xcat.org/ Package: xcat-vlan Architecture: all -Depends: xcat-client +Depends: xcat-client (>= 2.13-snap000000000000) Description: xCAT-vlan provides the xCAT vlan confiuration. diff --git a/xCAT-vlan/debian/rules b/xCAT-vlan/debian/rules index 4ab16dbff..2ab51a5dd 100755 --- a/xCAT-vlan/debian/rules +++ b/xCAT-vlan/debian/rules @@ -11,10 +11,12 @@ build: ./xpod2man + clean: dh_testdir dh_testroot dh_clean -d + install: pwd dh_installdirs diff --git a/xCAT/debian/compat b/xCAT/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCAT/debian/compat +++ b/xCAT/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCAT/debian/control b/xCAT/debian/control index 913d00c94..fae5030f6 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -2,11 +2,29 @@ Source: xcat Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Vcs-browser: https://github.com/xcat2/xcat-core.git +Homepage: https://xcat.org/ 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.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat, xcat-buildkit, xcat-probe (>=2.12) -Description: Server and configuration utilities of the xCAT management project - xcat-server provides the core server and configuration management components of xCAT. This package should be installed on your management server +Depends: ${perl:Depends}, xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, libxml-parser-perl, xinetd, tftpd-hpa, conserver-xcat, libnet-telnet-perl, xcat-genesis-scripts-ppc64 (>= 2.13-snap000000000000), xcat-genesis-scripts-amd64 (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) +Suggests: yaboot-xcat +Description: Metapackage for a common, default xCAT setup + xCAT is Extreme Cluster/Cloud Administration Toolkit. xCAT offers complete + management for HPC clusters, RenderFarms, Grids, WebFarms, Online Gaming + Infrastructure, Clouds, Datacenters, and whatever tomorrow's buzzwords may + be. It is agile, extensible, and based on years of system administration best + practices and experience. + . + It enables you to: + . + * Provision Operating Systems on physical or virtual machines: RHEL, CentOS, + Fedora, SLES, Ubuntu, AIX, Windows, VMWare, KVM, PowerVM, PowerKVM, zVM. + * Provision using scripted install, stateless, statelite, iSCSI, or cloning + * Remotely manage systems: lights-out management, remote console, and + distributed shell support + * Quickly configure and control management node services: DNS, HTTP, DHCP, + TFTP, NFS diff --git a/xCAT/debian/rules b/xCAT/debian/rules index b45ba65a7..14d8be8b1 100755 --- a/xCAT/debian/rules +++ b/xCAT/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd @@ -28,7 +25,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -39,7 +35,7 @@ binary-arch: export dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" diff --git a/xCATsn/debian/compat b/xCATsn/debian/compat index 7ed6ff82d..ec635144f 100644 --- a/xCATsn/debian/compat +++ b/xCATsn/debian/compat @@ -1 +1 @@ -5 +9 diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 7ed6120d9..250449a81 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -2,12 +2,15 @@ Source: xcatsn Section: admin Priority: extra Maintainer: xCAT -Build-Depends: debhelper (>= 5) -Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.4 +Homepage: https://xcat.org/ Package: xcatsn Architecture: all -Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.17-1), syslinux-xcat, xnba-undi, xcat-genesis-scripts-ppc64, xcat-genesis-scripts-amd64, elilo-xcat,libsys-virt-perl, xcat-probe (>=2.12) -Recommends: yaboot-xcat +Depends: ${perl:Depends}, xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, conserver-xcat, libnet-telnet-perl, isc-dhcp-server, apache2, nfs-kernel-server, xcat-genesis-scripts-ppc64 (>= 2.13-snap000000000000), xcat-genesis-scripts-amd64 (>= 2.13-snap000000000000) +Recommends: bind9, nmap, tftp-hpa, ipmitool-xcat (>= 1.8.17-1), syslinux[any-amd64], libsys-virt-perl, syslinux-xcat, xnba-undi, elilo-xcat, xcat-buildkit (>= 2.13-snap000000000000), xcat-probe (>= 2.13-snap000000000000) +Suggests: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup - xCATsn is a service node management package intended for at-scale management, including hardware management and software management. + xCATsn is a service node management package intended for at-scale + management, including hardware management and software management. diff --git a/xCATsn/debian/rules b/xCATsn/debian/rules index ce79be57f..38689173d 100755 --- a/xCATsn/debian/rules +++ b/xCATsn/debian/rules @@ -9,9 +9,6 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 -export DH_COMPAT=5 - - build: pwd @@ -28,7 +25,6 @@ install: dh_install -X".svn" dh_link - # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. @@ -38,7 +34,7 @@ binary-arch: pwd dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs # dh_installexamples dh_install -X".svn" From a2c05045b39ab17274c06a5106b99cd14dcd1ca3 Mon Sep 17 00:00:00 2001 From: caomengmeng Date: Tue, 3 Jan 2017 01:22:04 -0500 Subject: [PATCH 252/292] complete --- xCAT-test/autotest/testcase/migration/redhat_migration | 10 ++++------ xCAT-test/autotest/testcase/migration/sles_migration | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/xCAT-test/autotest/testcase/migration/redhat_migration b/xCAT-test/autotest/testcase/migration/redhat_migration index 58ffdfd42..652121f03 100644 --- a/xCAT-test/autotest/testcase/migration/redhat_migration +++ b/xCAT-test/autotest/testcase/migration/redhat_migration @@ -1,6 +1,6 @@ start:redhat_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -100,14 +100,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:redhat_migration2 os:Linux -description:update xCAT from $$MIGRATION2_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION2_VERSION to latest version, these two global parameter defined in config file stop:yes #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi @@ -208,8 +207,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end diff --git a/xCAT-test/autotest/testcase/migration/sles_migration b/xCAT-test/autotest/testcase/migration/sles_migration index 1117af3a0..474a42adc 100644 --- a/xCAT-test/autotest/testcase/migration/sles_migration +++ b/xCAT-test/autotest/testcase/migration/sles_migration @@ -1,6 +1,6 @@ start:sles_migration1 os:Linux -description:update xCAT from $$MIGRATION1_VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION1_VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -103,14 +103,13 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end start:sles_migration2 os:Linux -description:update xCAT from $$MIGRATION22VERSION to $$LATEST_VERSION, these two global parameter defined in config file +description:update xCAT from $$MIGRATION22VERSION to latest version, these two global parameter defined in config file #cmd:if ping -c 1 $$SN > /dev/null;then rpower $$SN off > /dev/null;fi #cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -213,8 +212,7 @@ cmd:xdsh $$CN "lsdef" check:output=~node0001 cmd:xdsh $$CN "noderm node0001" check:rc==0 -cmd:xdsh $$CN "lsxcatd -v" +cmd:latest_version_info=`lsxcatd -v`;xdsh $$CN "lsxcatd -v" | grep "$latest_version_info" check:rc==0 -check:output=~$$LATEST_VERSION end From 6ebfd712bb3e8b45e0658c196395575a24d3adea Mon Sep 17 00:00:00 2001 From: chenglch Date: Tue, 3 Jan 2017 16:10:24 +0800 Subject: [PATCH 253/292] return error code when updatenode command completed close-issue: #2281 --- xCAT-server/lib/xcat/plugins/updatenode.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 2b9c9e6af..a81388bbc 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -2252,6 +2252,9 @@ s/Running of postscripts has completed/Redeliver security files has completed/; } } } + if($response->{errorcode}) { + $rsp->{errorcode} = $response->{errorcode}; + } $CALLBACK->($rsp); } From 64400321119d1395aba2ec3f0304dfdba3d0a5ae Mon Sep 17 00:00:00 2001 From: ertaozh Date: Thu, 22 Dec 2016 02:39:54 -0500 Subject: [PATCH 254/292] modify getipmi and bmcsetup works also as a post/postboot script for diskful or diskless installation --- build-ubunturepo | 10 +++++++--- makerpm | 9 ++++++++- xCAT-genesis-scripts/bin/bmcsetup | 16 ++++++++++++++-- xCAT-genesis-scripts/bin/getipmi | 9 ++++++++- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index b4220b4a6..797b4941a 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -232,6 +232,7 @@ then #genesis scripts package, don't remove genesis amd64 files #rm -f ../../$package_dir_name/${file_low}-amd64_*.deb cd $file + CURDIR=$(pwd) dch -v $pkg_version -b -c debian/changelog $build_string if [ "$target_arch" = "all" ]; then #xcat probe use some functions shipped by xCAT, for below reasons we need to copy files to xCAT-probe directory @@ -239,7 +240,6 @@ then #2 don't maintain two files for each script #3 symbolic link can't work during package if [ $file_low = "xcat-probe" ]; then - CURDIR=$(pwd) mkdir -p ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/NetworkUtils.pm ${CURDIR}/lib/perl/xCAT/ cp -f ${CURDIR}/../perl-xCAT/xCAT/GlobalDef.pm ${CURDIR}/lib/perl/xCAT/ @@ -248,15 +248,19 @@ then dpkg-buildpackage -uc -us else if [ "$file" = "xCAT-genesis-scripts" ]; then - CURDIR=$(pwd) echo "Rename control file to build pkg: mv ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control" mv ${CURDIR}/debian/control-${target_arch} ${CURDIR}/debian/control + elif [ "$file" = "xCAT" ]; then + cp ${CURDIR}/../xCAT-genesis-scripts/bin/bmcsetup ${CURDIR}/postscripts/ + cp ${CURDIR}/../xCAT-genesis-scripts/bin/getipmi ${CURDIR}/postscripts/ fi dpkg-buildpackage -uc -us -a$target_arch if [ "$file" = "xCAT-genesis-scripts" ]; then - CURDIR=$(pwd) echo "Move control file back: mv ${CURDIR}/debian/control ${CURDIR}/debian/control-${target_arch}" mv ${CURDIR}/debian/control ${CURDIR}/debian/control-${target_arch} + elif [ "$file" = "xCAT" ]; then + rm -f ${CURDIR}/postscripts/bmcsetup + rm -f ${CURDIR}/postscripts/getipmi fi fi rc=$? diff --git a/makerpm b/makerpm index c80ed0edf..2042f1bbf 100755 --- a/makerpm +++ b/makerpm @@ -107,7 +107,10 @@ function makexcat { TARGET="--target $ARCH" if [ "$RPMNAME" = "xCAT" ]; then - cd `dirname $0`/$RPMNAME + cd `dirname $0`/ + cp xCAT-genesis-scripts/bin/bmcsetup $RPMNAME/postscripts + cp xCAT-genesis-scripts/bin/getipmi $RPMNAME/postscripts + cd $RPMNAME tar --exclude .svn --exclude upflag -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates @@ -139,6 +142,10 @@ function makexcat { echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec $TARGET --define "version $VER" $REL "$EASE" RC=$? + if [ "$RPMNAME" = "xCAT" ]; then + rm -f `dirname $0`/$RPMNAME/postscripts/bmcsetup + rm -f `dirname $0`/$RPMNAME/postscripts/getipmi + fi fi } diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 1be072fcd..27d82281c 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -13,7 +13,7 @@ # 0x08 0x00 0x49 0x4e 0x54 0x45 0x4c # 0x08 0x04 # -log_label="xcat.genesis.bmcsetup" +log_label="bmcsetup" TIMEOUT=15 @@ -29,6 +29,7 @@ TIMEOUT=15 function cold_reset_bmc() { if [ -z $XPROD ]; then logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}" + rm -f /tmp/ipmicfg.xml exit 1 fi if [ "$XPROD" = "43707" -a "$IPMIMFG" != '0' ]; then @@ -87,6 +88,7 @@ function cold_reset_bmc() { function snooze() { if [ -z $XPROD ]; then logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}" + rm -f /tmp/ipmicfg.xml exit 1 fi if [ "$XPROD" = "43707" -a "$IPMIMFG" != '0' ]; then @@ -100,7 +102,15 @@ function snooze() { logger -s -t $log_label -p local4.debug "snooze for 1 second..." sleep 1 fi -} +} + +if which ipmitool 2>&1 | grep no; then + echo "No ipmitool find, please install it first"; + exit 1; +fi + +# Add ipmi_devintf module to allow the ipmitool operation in-band +modprobe ipmi_devintf allowcred.awk & CREDPID=$! @@ -605,3 +615,5 @@ while [ $idev -gt 0 ]; do fi done +# remove the bmc configuration information before exit +rm -f /tmp/ipmicfg.xml diff --git a/xCAT-genesis-scripts/bin/getipmi b/xCAT-genesis-scripts/bin/getipmi index f129cb382..5ec67b7c6 100755 --- a/xCAT-genesis-scripts/bin/getipmi +++ b/xCAT-genesis-scripts/bin/getipmi @@ -1,11 +1,12 @@ #!/bin/bash -log_label="xcat.genesis.getipmi" allowcred.awk & CREDPID=$! if [ -z "$XCATDEST" ]; then XCATDEST=$1 fi + +# This section only works in genesis if [ -z "$XCATDEST" ]; then for parm in `cat /proc/cmdline` ; do if echo $parm |grep xcatd= > /dev/null; then @@ -13,6 +14,12 @@ if [ -z "$XCATDEST" ]; then fi done fi +# This section works in diskless/diskful +# The environment MASTER_IP and XCATDPORT is exported by mypostscript +if [ -z "$XCATDEST" ]; then + XCATDEST=$MASTER_IP:$XCATDPORT +fi + for LANCHAN in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16; do if ipmitool channel info $LANCHAN 2> /dev/null | grep 802.3 > /dev/null 2>&1 && ipmitool raw 0xc 2 $LANCHAN 5 0 0 > /dev/null 2>&1; then break; From 179f8211e373c0fb028dadc5f940cf97b880b826 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Tue, 3 Jan 2017 14:50:00 -0500 Subject: [PATCH 255/292] change drift file to /var/lib/ntp/drift/ntp.drift --- xCAT-server/lib/xcat/plugins/makentp.pm | 2 +- xCAT/postscripts/setupntp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/makentp.pm b/xCAT-server/lib/xcat/plugins/makentp.pm index 91afe08f8..7d7466f8b 100755 --- a/xCAT-server/lib/xcat/plugins/makentp.pm +++ b/xCAT-server/lib/xcat/plugins/makentp.pm @@ -318,7 +318,7 @@ sub process_request { print CFGFILE "disable auth\n"; print CFGFILE "broadcastclient\n"; } elsif ($os =~ /sles/) { - print CFGFILE "driftfile /etc/ntp.drift\n"; + print CFGFILE "driftfile /var/lib/ntp/drift/ntp.drift\n"; print CFGFILE "disable auth\n"; } else { print CFGFILE "driftfile /var/lib/ntp/drift\n"; diff --git a/xCAT/postscripts/setupntp b/xCAT/postscripts/setupntp index f2a95994e..882a6161a 100755 --- a/xCAT/postscripts/setupntp +++ b/xCAT/postscripts/setupntp @@ -100,7 +100,7 @@ if [ $OS_TYPE = Linux ]; then mkdir -p /var/lib/ntp chown ntp /var/lib/ntp if ( pmatch $OSVER "sles*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then - echo "driftfile /etc/ntp.drift" >>$conf_file + echo "driftfile /var/lib/ntp/drift/ntp.drift" >>$conf_file else echo "driftfile /var/lib/ntp/drift" >>$conf_file fi From 5c9a3624d6800a79a160aeccb02ddcb8a55950d3 Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 16 Dec 2016 09:42:50 -0500 Subject: [PATCH 256/292] refine the doc on cumulus switch --- .../edgecore_switches/edgecore_switches.rst | 152 ------------------ .../networks/edgecore_switches/index.rst | 6 +- .../edgecore_switches/onie_switches.rst | 135 ++++++++++++++++ xCAT/postscripts/enablesnmp | 26 +++ ...cumulusswitch.stanza => onieswitch.stanza} | 6 +- 5 files changed, 167 insertions(+), 158 deletions(-) delete mode 100644 docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst create mode 100644 docs/source/advanced/networks/edgecore_switches/onie_switches.rst create mode 100755 xCAT/postscripts/enablesnmp rename xCAT/templates/objects/node/{cumulusswitch.stanza => onieswitch.stanza} (82%) diff --git a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst b/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst deleted file mode 100644 index 31e1bd238..000000000 --- a/docs/source/advanced/networks/edgecore_switches/edgecore_switches.rst +++ /dev/null @@ -1,152 +0,0 @@ -Edgecore Switch -=============== - -The Edgecore switch from Mellanox is 1Gb top-of-rack switch. Usually, Mellanox ships the switch with Cumulus Network OS(https://cumulusnetworks.com) and along with a license file installed. In some case, user may get whitebox switch hardware without OS and license installed. - -Since edgecore switch is different from other traditional switches that xCAT supports, xCAT supports edgecore switch in a different way. Currently, the features provided by xCAT include: :: - - 1) Cumulus Network OS provision - 2) switch discovery - 3) switch configuration: - (a) enable root-passwordless ssh - (b) install licence file - (c) enable snmp - 4) distribute files to switches with ``xdcp`` - 5) invoke remote commands or scripts on switches with `xdsh`` - 6) configure switches with ``updatenode`` - -This documentation presents a typical workflow on how to setup a edgecore switch from white box, then configure and manage the switch with xCAT. - - -Create a edgecore switch object -------------------------------- - -If you have the information of the ip and mac information of the switch, the edgecore switch object definition can be created with the "cumulusswitch" template shipped in xCAT : :: - - mkdef edgecoresw1 --template cumulusswitch arch=armv71 ip=192.168.5.191 mac=8C:EA:1B:12:CA:40 - -Discover the switch - -ONIE Mode ---------- - -If the switch arrives without an OS pre-loaded, the ONIE installer and management port is the only thing enabled on the switch. Once the switch connects to the xCAT network, the switch should get a dynamic IP address. The xCAT DHCP server will get requests from the onie-installer from the switch and attempt to find an OS binary file to execute. The following messages will be logged in /var/log/messages on the management node. :: - - Info: Fetching http://172.1.0.1/onie-installer-arm-accton_as4610_54-r0 ... - Info: Fetching http://172.1.0.1/onie-installer-arm-accton_as4610_54 ... - Info: Fetching http://172.1.0.1/onie-installer-accton_as4610_54 ... - Info: Fetching http://172.1.0.1/onie-installer-arm ... - Info: Fetching http://172.1.0.1/onie-installer . - - -To remove the installed Cumulus Linux OS to boot back to ONIE mode, connect to the switch via serial-port or ssh and execute the following commands: :: - - ssh cumulus@172.1.0.1 - #clean up all the configuration - sudo onie-select -k - sudo reboot - #boot back to onie mode - sudo onie-select -i - sudo reboot - - -After switch reboots, it will enter ONIE mode and send DHCP request to attempt to fetch the OS binary file. - - -Discover Edgecore Switch ------------------------- - -ONIE supports a number of methods for locating OS binary file. xCAT choose to use a DHCP server to provide specific information to the switch. - -* IP address of the switch -* URL of the OS binary file on the Web server - -With the xCAT DHCP configuration, ONIE picks up an IP address and downloads the URL specified by the user and start to install of the OS. The steps take to discover the edgecore switch and process request from ONIE installer as follows: - -#. Pre-define switch object into xCAT db, make sure ip adress, netboot and provemethod are set, also define core switch and port number where edgecore switch connect to. :: - - - #lsdef edgecoresw1 - Object name: edgecoresw1 - groups=switch - ip=192.168.23.1 - mgt=switch - netboot=onie - nodetype=switch - postbootscripts=otherpkgs - postscripts=syslog,remoteshell,syncfiles - provmethod=/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin - switch=switch-10-5-23-1 - switchport=1 - - #makehosts edgecoresw1 - - -#. Run ``switchdiscover`` command, it will find edgecore switch and update mac address on pre-defined switch node definition. :: - - #switchdiscover --range 192.168.5.170-190 -s nmap - #lsdef edgecoresw1 - Object name: edgecoresw1 - groups=switch - ip=192.168.23.1 - mac=8C:EA:1B:12:CA:40 - mgt=switch - netboot=onie - nodetype=switch - postbootscripts=otherpkgs - postscripts=syslog,remoteshell,syncfiles - provmethod=/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin - status=Matched - switch=switch-10-5-23-1 - switchport=1 - switchtype=cumulus - usercomment=Edgecore switch - - -#. Run ``makedhcp`` after edgecore switch discovered, it will update ``dhcpd.conf`` and response the DHCP request from the onie-installer. :: - - #makedhcp -n - #makedhcp -a edgecoresw1 - - -#. Installation of the Cumulus Linux OS takes about 50 minutes. Monitor the /var/log/messages to check the status of the installation. :: - - - Oct 27 15:28:08 fs4 dhcpd: DHCPDISCOVER from 8c:ea:1b:12:ca:40 via enP4p1s0f2 - Oct 27 15:28:08 fs4 dhcpd: DHCPOFFER on 192.168.23.1 to 8c:ea:1b:12:ca:40 via enP4p1s0f2 - Oct 27 15:28:08 fs4 dhcpd: DHCPREQUEST for 192.168.23.1 (192.168.3.25) from 8c:ea:1b:12:ca:40 via enP4p1s0f2 - Oct 27 15:28:08 fs4 dhcpd: DHCPACK on 192.168.23.1 to 8c:ea:1b:12:ca:40 via enP4p1s0f2 - - -#. Once installation finished, the pre-defined switch name and IP address will be configured on edgecore switch. :: - - cumulus@edgecoresw1:~$ ifconfig - eth0 Link encap:Ethernet HWaddr 8c:ea:1b:12:ca:40 - inet addr:192.168.23.1 Bcast:192.168.255.255 Mask:255.255.0.0 - inet6 addr: fe80::8eea:1bff:fe12:ca40/64 Scope:Link - UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 - cumulus@edgecoresw1:~$ hostname - edgecoresw1 - - -Configure Edgecore Switch -------------------------- - -xCAT provides a script ``/opt/xcat/share/xcat/script/configcumulus`` to configure attributes in the Cumulus Switch. Use the ``--help`` option to see more details. :: - - #configcumulus --help - Usage: - configcumulus [-?│-h│--help] - configcumulus [--switches switchnames] [--all] - configcumulus [--switches switchnames] [--ssh] - configcumulus [--switches switchnames] [--license filename ] - configcumulus [--switches switchnames] [--snmp] [--user snmp_user] [--password snmp_password] - configcumulus [--switches switchnames] [--ntp] - - - - - - - - diff --git a/docs/source/advanced/networks/edgecore_switches/index.rst b/docs/source/advanced/networks/edgecore_switches/index.rst index 6d3bdf038..0c897d340 100644 --- a/docs/source/advanced/networks/edgecore_switches/index.rst +++ b/docs/source/advanced/networks/edgecore_switches/index.rst @@ -1,7 +1,7 @@ -Edgecore Switches -================= +ONIE Compatible Bare Metal Switches +=================================== .. toctree:: :maxdepth: 2 - edgecore_switches.rst + onie_switches.rst diff --git a/docs/source/advanced/networks/edgecore_switches/onie_switches.rst b/docs/source/advanced/networks/edgecore_switches/onie_switches.rst new file mode 100644 index 000000000..dd41a8c71 --- /dev/null +++ b/docs/source/advanced/networks/edgecore_switches/onie_switches.rst @@ -0,0 +1,135 @@ +ONIE compatible bare metal switch +================================= + +The ONIE [1]_. compatible bare metal switches(abbreviated as "ONIE switch") from vendors such as Mellanox or Edgecore are often used as top-of-rack switches in the cluster. Usually, the switches are shipped with a Cumulus Network OS(https://cumulusnetworks.com) and a license pre-installed. In some cases, user may get whitebox switch hardware with a standalone Cumulus installer and license file. This documentation presents a typical workflow on how to setup ONIE switch from white box, then configure and manage the switch with xCAT. + +.. [1] Open Network Install Environment: Created by Cumulus Networks, Inc. in 2012, the Open Network Install Environment (ONIE) Project is a small operating system, pre-installed as firmware on bare metal network switches, that provides an environment for automated operating system provisioning. + +Create an ONIE switch object +------------------------------- + +The ONIE switch object can be created with the "onieswitch" template shipped in xCAT, the ip address and mac of the switch management ethernet port should be specified : :: + + mkdef edgecoresw1 --template onieswitch arch=armv71 ip=192.168.5.191 mac=8C:EA:1B:12:CA:40 + +Provision the Cumulus OS on ONIE switch +--------------------------------------- + +To provision Cumulus OS, the Cumulus installation file, a binary shipped with the switch, should be saved in a directory exported in the http server. + +Run ``chdef`` to specify the "provmethod" attribute of the switch object to the full path of the installation file: :: + + chdef edgecoresw1 netboot=onie provmethod="/install/custom/sw/edgecore/cumulus-linux-3.1.0-bcm-armel-1471981017.dc7e2adzfb43f6b.bin" + +Run ``makedhcp`` to prepare the DHCP/BOOTP lease. :: + + makedhcp -a edgecoresw1 + +The command or operation to start the provision dependes on the status of switch: + +1. If the switch is a white box without Cumulus OS installed, simply connect the management ethernet port of the switch to xCAT management node, then power on the switch. + +2. If a Cumulus OS has been installed on the switch, you need to login to the switch(the default user is ``cumulus`` and the password is ``CumulusLinux!``) and run a batch of commands: :: + + sudo onie-select -i + sudo reboot + +If the passwordless-ssh of "root" has been enabled, the commands can be issued with: :: + + xdsh edgecoresw1 "/usr/cumulus/bin/onie-select -i -f;reboot" + +After reboot, the switch will enter ONIE install mode and begin the installation. The provision might take about 50 minutes. + + +Switch Configuration +-------------------- + +Enable the passwordless ssh for "root" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In a newly installed Cumulus OS, a default user ``cumulus`` will be created, the switch can be accessed via ssh with the default password ``CumulusLinux!``. + +The passwordless ssh access of "root" should be enabled with the script ``/opt/xcat/share/xcat/scripts/configcumulus`` :: + + /opt/xcat/share/xcat/scripts/configcumulus --switches edgecoresw1 --ssh + +After the passwordless access for "root" is setup successfully, the switch can be managed with the node management commands such as ``xdsh``, ``xdcp`` and ``updatenode``, etc. + +Licence file installation +~~~~~~~~~~~~~~~~~~~~~~~~~ + +On the newly installed switch, only the serial console and the management ethernet port are enabled. To activate the data ports, the licence file shipped with the switch should be installed: :: + + xdcp edgecoresw1 /install/custom/sw/edgecore/licensefile.txt /tmp + xdsh edgecoresw1 "/usr/cumulus/bin/cl-license -i /tmp/licensefile.txt" + +To check whether the license file is installed successfully: :: + + ~: xdsh edgecoresw1 /usr/cumulus/bin/cl-license + edgecoresw1: xxx@xx.com|xxxxxxxxxxxxxxx + +Reboot the switch to apply the licence file: :: + + xdsh edgecoresw1 reboot + +Enable SNMP +~~~~~~~~~~~ + +The snmpd in the switch is not enabled by default, xCAT ships a postscript to enable it: :: + + updatenode edgecoresw1 -P enablesnmp + + +Switch Discovery +---------------- + +The ONIE switch can be scaned and discovered with ``switchdiscover`` :: + + ~: switchdiscover --range 192.168.23.1-10 + Discovering switches using nmap for 192.168.23.1-10. It may take long time... + ip name vendor mac + ------------ ------------ ------------ ------------ + 192.168.23.1 edgecoresw1 Edgecore switch 8C:EA:1B:12:CA:40 + Switch discovered: edgecoresw1 + +Once SNMP on the ONIE switch is enabled, the ONIE switch can be discovered with "snmp" method: :: + + ~: switchdiscover --range 192.168.23.1-10 -s snmp + Discovering switches using snmpwalk for 192.168.23.1-10 .... + ip name vendor mac + ------------ ------------ ------------ ------------ + 192.168.23.1 edgecoresw1 Linux edgecoresw1 4.1.0-cl-2-iproc #1 SMP Debian 4.1.25-1+cl3u4 (2016-08-13) armv7l 8c:ea:1b:12:ca:40 + Switch discovered: edgecoresw1 + + +Switch Management +----------------- + +File Dispatch +~~~~~~~~~~~~~ + +The files can be dispatched to ONIE switches with ``xdcp`` :: + + xdcp edgecoresw1 + +Refer to :doc:`xdcp manpage ` for details. + +Remote Commands +~~~~~~~~~~~~~~~ + +Commands can be run on ONIE switches remotely with ``xdsh`` :: + + xdsh edgecoresw1 + +Refer to :doc:`xdsh manpage ` for details. + +Run scripts remotely +~~~~~~~~~~~~~~~~~~~~ + +The scripts under "/install/postscripts" can be run on ONIE switches with ``updatenode -P`` :: + + updatenode edgecoresw1 -P