From be8297e4c9b09c828f23ed530802d2e9ca446523 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Wed, 18 May 2022 11:54:57 +0200 Subject: [PATCH 001/188] Fix warnings of newer dracut versions dracut: WARNING: +=" ": should have surrounding white spaces! dracut: WARNING: This will lead to unwanted side effects! Please fix the configuration file. dracut commit: https://github.com/dracutdevs/dracut/commit/dfe2247a43d6a216d9af533825c9a103e3b056cd --- xCAT-server/share/xcat/netboot/rh/genimage | 10 +++++----- xCAT-server/share/xcat/netboot/sles/genimage | 14 +++++++------- xCAT-server/share/xcat/netboot/ubuntu/genimage | 10 +++++----- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 09ee04210b..8273ae87e6 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1103,9 +1103,9 @@ sub mkinitrd_dracut { } } - print $DRACUTCONF qq{dracutmodules+="$dracutmodulelist"\n}; - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; - print $DRACUTCONF qq{filesystems+="nfs"\n}; + print $DRACUTCONF qq{dracutmodules+=" $dracutmodulelist "\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; + print $DRACUTCONF qq{filesystems+=" nfs "\n}; close $DRACUTCONF; } elsif ($mode eq "stateless") { cp("$fullpath/$dracutdir/install.netboot", "$dracutmpath/install"); @@ -1146,8 +1146,8 @@ sub mkinitrd_dracut { # update etc/dracut.conf open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf"); - print $DRACUTCONF qq{dracutmodules+="$dracutmodulelist"\n}; - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; + print $DRACUTCONF qq{dracutmodules+=" $dracutmodulelist "\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; close $DRACUTCONF; } else { xdie "the mode: $mode is not supported by genimage"; diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 22cf71e69d..07c31f3af0 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1097,13 +1097,13 @@ sub mkinitrd_dracut { #update etc/dracut.conf open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf"); if (-d glob($dracutmoduledir . "[0-9]*fadump")) { - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules lvm fadump"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules lvm fadump "\n}; } else { - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules lvm"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules lvm "\n}; } - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; - print $DRACUTCONF qq{filesystems+="nfs"\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; + print $DRACUTCONF qq{filesystems+=" nfs "\n}; close $DRACUTCONF; } elsif ($mode eq "stateless") { cp("$fullpath/$dracutdir/install.netboot", "$dracutmpath/install"); @@ -1135,12 +1135,12 @@ sub mkinitrd_dracut { # update etc/dracut.conf open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf"); if (-d glob($dracutmoduledir . "[0-9]*fadump")) { - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules lvm fadump syslog"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules lvm fadump syslog "\n}; } else { - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules lvm syslog"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules lvm syslog "\n}; } - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; close $DRACUTCONF; } else { xdie "the mode: $mode is not supported by genimage"; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 32163e7848..98b8fe146d 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -947,9 +947,9 @@ sub mkinitrd_dracut { # update etc/dracut.conf open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf"); - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules"\n}; - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; - print $DRACUTCONF qq{filesystems+="nfs"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules "\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; + print $DRACUTCONF qq{filesystems+=" nfs "\n}; close $DRACUTCONF; } elsif ($mode eq "stateless") { cp("$fullpath/$dracutdir/install.netboot", "$dracutmpath/install"); @@ -977,8 +977,8 @@ sub mkinitrd_dracut { # update etc/dracut.conf open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf"); - print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules"\n}; - print $DRACUTCONF qq{add_drivers+="$add_drivers"\n}; + print $DRACUTCONF qq{dracutmodules+=" xcat nfs base network kernel-modules "\n}; + print $DRACUTCONF qq{add_drivers+=" $add_drivers "\n}; close $DRACUTCONF; } else { xdie "the mode: $mode is not supported by genimage"; From 972798f22a9b59cdab0818301df5ba8f5ff9542a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 14 Jun 2022 15:11:12 -0400 Subject: [PATCH 002/188] Adding 2.16.4 release information(2) --- docs/source/overview/_files/2.16.x.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/overview/_files/2.16.x.csv b/docs/source/overview/_files/2.16.x.csv index 2b4cdca169..1bf645c7c1 100644 --- a/docs/source/overview/_files/2.16.x.csv +++ b/docs/source/overview/_files/2.16.x.csv @@ -1,5 +1,5 @@ Version,Release Date,New OS Supported,Release Notes -2.16.4,2022-06-07,"RHEL 8.5,SLES15.3",`2.16.4 Release Notes `_ +2.16.4,2022-06-20,"RHEL 8.5,SLES15.3",`2.16.4 Release Notes `_ 2.16.3,2021-11-17,"RHEL 8.4",`2.16.3 Release Notes `_ 2.16.2,2021-05-25,"RHEL 8.3",`2.16.2 Release Notes `_ 2.16.1,2020-11-06,"RHEL 8.2",`2.16.1 Release Notes `_ From 8ef1e86735d2e43c837c5d023ed6c35050dbd580 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 20 Jun 2022 10:53:28 -0400 Subject: [PATCH 003/188] Update Version --- Version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Version b/Version index 99e60c056f..ffa5fee55a 100644 --- a/Version +++ b/Version @@ -1 +1 @@ -2.16.4 +2.16.5 From 2b9f6451c73a1f763beb244dd4ebe42f47a36e71 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 20 Jun 2022 10:57:46 -0400 Subject: [PATCH 004/188] Update version number --- docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index c7a309a9b0..be07c1aa73 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -49,7 +49,7 @@ # General information about the project. project = u'xCAT' -copyright = u'2015-2021, IBM Corporation' +copyright = u'2015-2022, IBM Corporation' author = u'IBM Corporation' # The version info for the project you're documenting, acts as replacement for @@ -59,7 +59,7 @@ # The short X.Y version. version = '2' # The full version, including alpha/beta/rc tags. -release = '2.16.4' +release = '2.16.5' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. From b73d7e140b9cd5a7b862e2d974caa24dad10902a Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Mon, 20 Jun 2022 17:27:19 -0400 Subject: [PATCH 005/188] Improve PR 7193: Check host keys supported by the operating system and report new ones if any --- .../autotest/testcase/install_xCAT/case0 | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/xCAT-test/autotest/testcase/install_xCAT/case0 b/xCAT-test/autotest/testcase/install_xCAT/case0 index c39f5cfd24..e5d309f9e6 100644 --- a/xCAT-test/autotest/testcase/install_xCAT/case0 +++ b/xCAT-test/autotest/testcase/install_xCAT/case0 @@ -21,6 +21,16 @@ check:rc==0 check:output=~running cmd:rm -rf /install_xCAT_xcat-core.tar.bz2 /install_xCAT_xcat-dep.tar.bz2 +# Check host keys supported by the operating system and report new ones, if any. +cmd:echo -e "dsa\necdsa\ned25519\nrsa\nrsa1" > /tmp/known_host_keys +check:rc==0 +cmd:ssh-keygen --help 2>&1 | grep "\[-t" | sed -E 's/.*(\[\-t.*)/\1/' | cut -d "[" -f2 | cut -d "]" -f1 | sed 's/-t//' | sed 's/|//g' | xargs -n 1 | grep -v '\-sk' > /tmp/current_os_host_keys +check:rc==0 +cmd:diff /tmp/known_host_keys /tmp/current_os_host_keys +check:output!~> +cmd:rm -f /tmp/known_host_keys /tmp/current_os_host_keys +check:rc==0 + # Obtain the highest version of TLS supported by OpenSSL/TLS. cmd:openssl s_client --help 2>&1 | grep "\-tls1" | awk '{print $1}' | sort | tail -1 check:rc==0 @@ -61,6 +71,16 @@ cmd:sleep 5 cmd:service goconserver status cmd:service conserver status +# Check host keys supported by the operating system and report new ones, if any. +cmd:echo -e "dsa\necdsa\ned25519\nrsa\nrsa1" > /tmp/known_host_keys +check:rc==0 +cmd:ssh-keygen --help 2>&1 | grep "\[-t" | sed -E 's/.*(\[\-t.*)/\1/' | cut -d "[" -f2 | cut -d "]" -f1 | sed 's/-t//' | sed 's/|//g' | xargs -n 1 | grep -v '\-sk' > /tmp/current_os_host_keys +check:rc==0 +cmd:diff /tmp/known_host_keys /tmp/current_os_host_keys +check:output!~> +cmd:rm -f /tmp/known_host_keys /tmp/current_os_host_keys +check:rc==0 + # Obtain the highest version of TLS supported by OpenSSL/TLS. cmd:openssl s_client --help 2>&1 | grep "\-tls1" | awk '{print $1}' | sort | tail -1 check:rc==0 From ae5dea34b46469b4de04a814c19120485d4d789a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 28 Jun 2022 11:46:41 -0400 Subject: [PATCH 006/188] Improve SLES15 copycds for Media2 iso --- xCAT-server/lib/xcat/plugins/sles.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index dea6643b75..9bfbb92385 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1770,6 +1770,15 @@ sub copycd $distname = "sle15"; } }; + } elsif ($dsc =~ /SLE-15/ and $dsc =~ /SOURCE/) { + $discnumber = 2; + unless ($distname) { + if ($dsc =~ /SLE-15-SP(\d)/) { + $distname = "sle15.$1"; + } else { + $distname = "sle15"; + } + }; } elsif ($dsc =~ /SLE-15/ and $dsc =~ /Full/) { $discnumber = 1; $linktwo = 1; From 788570905e57eee9c06505d8839a53756ac29ca9 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 10:53:56 -0400 Subject: [PATCH 007/188] Trigger github action to rebuild xCAT --- .github/workflows/xcat_test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/workflows/xcat_test.yml diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml new file mode 100644 index 0000000000..e66f00260a --- /dev/null +++ b/.github/workflows/xcat_test.yml @@ -0,0 +1,8 @@ +name: xcat_test +on: [push] +jobs: + xcat_build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 From 66d1baff13733dd50b374dc5cd9e55fb38a286f9 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 11:22:53 -0400 Subject: [PATCH 008/188] Fix indentation in GitHub action to rebuild xCAT --- .github/workflows/xcat_test.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index e66f00260a..dfcaea1a14 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -2,7 +2,7 @@ name: xcat_test on: [push] jobs: xcat_build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 From 211c3d5c96a757048570ee96b5313bd4b92913cf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 13:37:02 -0400 Subject: [PATCH 009/188] Add installs to GitHub action to rebuild xCAT --- .github/workflows/xcat_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index dfcaea1a14..c5999d7eb5 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -5,4 +5,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 + - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common + - run: sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 From e000659379f7fbec7c16a6dd2ced091b636c0f37 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 15:15:29 -0400 Subject: [PATCH 010/188] GitHub action to install and test xCAT --- .github/workflows/xcat_test.yml | 6 +- github_action_xcat_test.pl | 646 ++++++++++++++++++++++++++++++++ 2 files changed, 650 insertions(+), 2 deletions(-) create mode 100644 github_action_xcat_test.pl diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index c5999d7eb5..8e391cc1d9 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -1,9 +1,11 @@ name: xcat_test -on: [push] +on: + pull_request: + types: [review_requested] jobs: xcat_build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common - - run: sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0 + - run: perl github_action_xcat_test.pl diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl new file mode 100644 index 0000000000..d6fac91dcf --- /dev/null +++ b/github_action_xcat_test.pl @@ -0,0 +1,646 @@ +# IBM(c) 2022 EPL license http://www.eclipse.org/legal/epl-v10.html + +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; +use Time::Local; +use File::Basename; +use File::Path; +use File::Find; +use LWP::UserAgent; +use HTTP::Request; +use Encode; +use Encode::CN; +use JSON; +use URI::Escape; +use LWP::Simple; + +use Term::ANSIColor qw(:constants); +$Term::ANSIColor::AUTORESET = 1; + +#---Global attributes--- +my $rst = 0; +my $retries = 5; # Try this many times to get response +my $check_result_str="``CI CHECK RESULT`` : "; +my $last_func_start = timelocal(localtime()); +my $GITHUB_API = "https://api.github.com"; + +#-------------------------------------------------------- +# Fuction name: runcmd +# Description: run a command after 'cmd' label in one case +# Attributes: +# Return code: +# $::RUNCMD_RC : the return code of command +# @$outref : the output of command +#-------------------------------------------------------- +sub runcmd +{ + my ($cmd) = @_; + my $rc = 0; + $::RUNCMD_RC = 0; + my $outref = []; + @$outref = `$cmd 2>&1`; + if ($?) + { + $rc = $?; + $rc = $rc >> 8; + $::RUNCMD_RC = $rc; + } + chomp(@$outref); + return @$outref; + +} + +#-------------------------------------------------------- +# Fuction name: get_files_recursive +# Description: Search all file in one directory recursively +# Attributes: +# $dir (input attribute) +# The target scan directory +# $files_path_ref (output attribute) +# the reference of array where save all vaild files under $dir +# Return code: +#-------------------------------------------------------- +sub get_files_recursive +{ + my $dir = shift; + my $files_path_ref = shift; + + my $fd = undef; + if(!opendir($fd, $dir)){ + print "[get_files_recursive]: failed to open $dir :$!\n"; + return 1; + } + + for (; ;) + { + my $direntry = readdir($fd); + last unless (defined($direntry)); + next if ($direntry =~ m/^\.\w*/); + next if ($direntry eq '..'); + my $target = "$dir/$direntry"; + if (-d $target) { + get_files_recursive($target, $files_path_ref); + } else { + push(@{$files_path_ref}, glob("$target\n")); + } + } + closedir($fd); + return 0; +} + +#-------------------------------------------------------- +# Fuction name: check_pr_format +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub check_pr_format{ + if($ENV{'TRAVIS_EVENT_TYPE'} eq "pull_request"){ + my $pr_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}"; + my $pr_url_resp; + my $counter = 1; + while($counter <= $retries) { + $pr_url_resp = get($pr_url); + if ($pr_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[check_pr_format] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } + } + unless ($pr_url_resp) { + print "[check_pr_format] After $retries retries, not able to get response from $pr_url \n"; + # Failed after trying a few times, return error + return $counter; + } + my $pr_content = decode_json($pr_url_resp); + my $pr_title = $pr_content->{title}; + my $pr_body = $pr_content->{body}; + my $pr_milestone = $pr_content->{milestone}; + my $pr_labels_len = @{$pr_content->{labels}}; + + #print "[check_pr_format] Dumper pr_content:\n"; + #print Dumper $pr_content; + print "[check_pr_format] pr title = $pr_title\n"; + print "[check_pr_format] pr body = $pr_body \n"; + + my $checkrst=""; + if(! $pr_title){ + $checkrst.="Missing title."; + } + if(! $pr_body){ + $checkrst.="Missing description."; + } + + if(! $pr_milestone){ + $checkrst.="Missing milestone."; + } + + if(! $pr_labels_len){ + $checkrst.="Missing labels."; + } + + # Guard against root user making commits + $checkrst.=check_commit_owner('root'); + + if(length($checkrst) == 0){ + $check_result_str .= "> **PR FORMAT CORRECT**"; + #send_back_comment("$check_result_str"); + }else{ + # Warning if missing milestone or labels, others are errors + if($checkrst =~ /milestone/ || $checkrst =~ /labels/){ + $check_result_str .= "> **PR FORMAT WARNING** : $checkrst"; + #send_back_comment("$check_result_str"); + }else{ + $check_result_str .= "> **PR FORMAT ERROR** : $checkrst"; + #send_back_comment("$check_result_str"); + return 1; + } + } + } + return 0; +} + +#-------------------------------------------------------- +# Fuction name: check_commit_owner +# Description: Verify commits are not done by specified user +# Attributes: user login to reject +# Return: +# Error string -User rejected, +# Empty string -User not rejected +#-------------------------------------------------------- +sub check_commit_owner{ + my $invalid_user = shift; + if($ENV{'TRAVIS_EVENT_TYPE'} eq "pull_request"){ + my $commits_content; + my $commits_len = 0; + my $json = new JSON; + my $commits_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/pulls/$ENV{'TRAVIS_PULL_REQUEST'}/commits"; + my $commits_url_resp; + my $counter = 1; + while($counter <= $retries) { + $commits_url_resp = get($commits_url); + if ($commits_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[check_commit_owner] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } + } + if ($commits_url_resp) { + $commits_content = $json->decode($commits_url_resp); + $commits_len = @$commits_content; + } else { + print "[check_commit_owner] After $retries retries, not able to get response from $commits_url \n"; + return "Unable to verify login of committer."; + } + + if($commits_len > 0) { + foreach my $commit (@{$commits_content}){ + my $committer = $commit->{committer}; + my $committer_login = $committer->{login}; + print "[check_commit_owner] Committer login $committer_login \n"; + if($committer_login =~ /^$invalid_user$/) { + # Committer logins matches + return "Commits by $invalid_user not allowed"; + } + } + } + } + return ""; +} +#-------------------------------------------------------- +# Fuction name: send_back_comment +# Description: Append to comment of the PR passed $message +# Attributes: Message to append to PR +# Return code: +#-------------------------------------------------------- +sub send_back_comment{ + my $message = shift; + + my $comment_url = "$GITHUB_API/repos/$ENV{'TRAVIS_REPO_SLUG'}/issues/$ENV{'TRAVIS_PULL_REQUEST'}/comments"; + my $json = new JSON; + my $comment_len = 0; + my $comment_content; + my $comment_url_resp; + my $counter = 1; + while($counter <= $retries) { + $comment_url_resp = get($comment_url); + if ($comment_url_resp) { + last; # Got response, no more retries + } else { + sleep($counter*2); # Sleep and try again + print "[send_back_comment] $counter Did not get response, sleeping ". $counter*2 . "\n"; + $counter++; + } + } + unless ($comment_url_resp) { + print "[send_back_comment] After $retries retries, not able to get response from $comment_url \n"; + # Failed after trying a few times, return + return; + } + print "\n\n>>>>>Dumper comment_url_resp:\n"; + print Dumper $comment_url_resp; + + $comment_content = $json->decode($comment_url_resp); + $comment_len = @$comment_content; + + my $post_url = $comment_url; + my $post_method = "POST"; + if($comment_len > 0){ + foreach my $comment (@{$comment_content}){ + if($comment->{'body'} =~ /CI CHECK RESULT/) { + $post_url = $comment->{'url'}; + $post_method = "PATCH"; + } + } + } + + print "[send_back_comment] method = $post_method to $post_url. Message = $message\n"; + if ( $ENV{'xcatbotuser'} and $ENV{'xcatbotpw'}) { + `curl -u "$ENV{'xcatbotuser'}:$ENV{'xcatbotpw'}" -X $post_method -d '{"body":"$message"}' $post_url`; + } + else { + print "Not able to update pull request with message: $message\n"; + } +} + +#-------------------------------------------------------- +# Fuction name: build_xcat_core +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub build_xcat_core{ + my @output; + #my @cmds = ("gpg --list-keys", + # "sed -i '/SignWith: /d' $ENV{'PWD'}/build-ubunturepo"); + #foreach my $cmd (@cmds){ + # print "[build_xcat_core] running $cmd\n"; + # @output = runcmd("$cmd"); + # if($::RUNCMD_RC){ + # print "[build_xcat_core] $cmd ....[Failed]\n"; + # send_back_comment("> **BUILD ERROR** : $cmd failed. Please click ``Details`` label in ``Merge pull request`` box for detailed information"); + # return 1; + # } + #} + + my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0"; + @output = runcmd("$cmd"); + print ">>>>>Dumper the output of '$cmd'\n"; + print Dumper \@output; + if($::RUNCMD_RC){ + my $lastline = $output[-1]; + $lastline =~ s/[\r\n\t\\"']*//g; + print "[build_xcat_core] $cmd ....[Failed]\n"; + #print ">>>>>Dumper the output of '$cmd'\n"; + #print Dumper \@output; + $check_result_str .= "> **BUILD ERROR**, Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + #send_back_comment("$check_result_str"); + return 1; + }else{ + print "[build_xcat_core] $cmd ....[Pass]\n"; + $check_result_str .= "> **BUILD SUCCESSFUL** "; + #send_back_comment("$check_result_str"); + } + +# my $buildpath ="/home/travis/build/xcat-core/"; +# my @buildfils = (); +# get_files_recursive("$buildpath", \@buildfils); +# print "\n-----------Dumper build files-----------\n"; +# print Dumper \@buildfils; + + return 0; +} + +#-------------------------------------------------------- +# Fuction name: install_xcat +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub install_xcat{ + + my @cmds = ("cd ./../../xcat-core && sudo ./mklocalrepo.sh", + "sudo chmod 777 /etc/apt/sources.list", + "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", + "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", + "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", + "sudo apt-get -qq --allow-insecure-repositories update"); + my @output; + foreach my $cmd (@cmds){ + print "[install_xcat] running $cmd\n"; + @output = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[install_xcat] $cmd. ...[Failed]\n"; + print "[install_xcat] error message:\n"; + print Dumper \@output; + $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information "; + #send_back_comment("$check_result_str"); + return 1; + } + } + + my $cmd = "sudo apt-get install xcat --allow-remove-essential --allow-unauthenticated"; + @output = runcmd("$cmd"); + #print ">>>>>Dumper the output of '$cmd'\n"; + #print Dumper \@output; + if($::RUNCMD_RC){ + my $lastline = $output[-1]; + $lastline =~ s/[\r\n\t\\"']*//g; + print "[install_xcat] $cmd ....[Failed]\n"; + print ">>>>>Dumper the output of '$cmd'\n"; + print Dumper \@output; + $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + #send_back_comment("$check_result_str"); + return 1; + }else{ + print "[install_xcat] $cmd ....[Pass]\n"; + + print "\n------Config xcat and verify xcat is working correctly-----\n"; + @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", + "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", + ". /etc/profile.d/xcat.sh && tabdump policy", + ". /etc/profile.d/xcat.sh && tabdump site", + ". /etc/profile.d/xcat.sh && lsxcatd -a", + "ls /opt/xcat/sbin", + "service xcatd status"); + my $ret = 0; + foreach my $cmd (@cmds){ + print "\n[install_xcat] running $cmd.....\n"; + @output = runcmd("$cmd"); + print Dumper \@output; + if($::RUNCMD_RC){ + print RED "[install_xcat] $cmd. ...[Failed]\n"; + #print Dumper \@output; + $ret = 1; + }else{ + print "[install_xcat] $cmd....[Pass]\n"; + } + } + $cmd = "sudo apt-get install xcat-probe --allow-remove-essential --allow-unauthenticated"; + @output = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[install_xcat] $cmd ....[Failed]\n"; + print Dumper \@output; + $ret = 1; + }else{ + print "[install_xcat] $cmd ....[Pass]:\n"; + } + + if($ret){ + $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + #send_back_comment("$check_result_str"); + return 1; + } + + $check_result_str .= "> **INSTALL XCAT SUCCESSFUL**"; + #send_back_comment("$check_result_str"); + } + return 0; +} + + +#-------------------------------------------------------- +# Fuction name: check_syntax +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub check_syntax{ + my @output; + my @syntax_err; + my $ret = 0; + + my @target_dirs=("/opt/xcat", + "/install"); + foreach my $dir (@target_dirs){ + my @files = (); + get_files_recursive("$dir", \@files); + + foreach my $file (@files) { + next if($file =~ /\/opt\/xcat\/share\/xcat\/netboot\/genesis\//); + next if($file =~ /\/opt\/xcat\/probe\//); + + @output = runcmd("file $file"); + if($output[0] =~ /perl /i){ + @output = runcmd("sudo bash -c '. /etc/profile.d/xcat.sh && perl -I /opt/xcat/lib/perl -I /opt/xcat/lib -I /usr/lib/perl5 -I /usr/share/perl -c $file'"); + if($::RUNCMD_RC){ + push @syntax_err, @output; + $ret = 1; + } + #}elsif($output[0] =~ /shell/i){ + # @output = runcmd("sudo bash -c '. /etc/profile.d/xcat.sh && sh -n $file'"); + # if($::RUNCMD_RC){ + # push @syntax_err, @output; + # $ret = 1; + # } + } + } + } + + if(@syntax_err){ + print "[check_syntax] syntax checking ....[Failed]\n"; + print "[check_syntax] Dumper error message:\n"; + print Dumper @syntax_err; + $check_result_str .= "> **CODE SYNTAX ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + #send_back_comment("$check_result_str"); + }else{ + print "[check_syntax] syntax checking ....[Pass]\n"; + $check_result_str .= "> **CODE SYNTAX CORRECT**"; + #send_back_comment("$check_result_str"); + } + + return $ret; +} + +#-------------------------------------------------------- +# Fuction name: run_fast_regression_test +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub run_fast_regression_test{ + my $cmd = "sudo apt-get install xcat-test --allow-remove-essential --allow-unauthenticated"; + my @output = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; + print Dumper \@output; + return 1; + }else{ + print "[run_fast_regression_test] $cmd .....:\n"; + print Dumper \@output; + } + + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -h'"; + @output = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; + print "[run_fast_regression_test] error dumper:\n"; + print Dumper \@output; + return 1; + }else{ + print "[run_fast_regression_test] $cmd .....:\n"; + print Dumper \@output; + } + + my $hostname = `hostname`; + chomp($hostname); + print "hostname = $hostname\n"; + my $conf_file = "$ENV{'PWD'}/regression.conf"; + $cmd = "echo '[System]' > $conf_file; echo 'MN=$hostname' >> $conf_file; echo '[Table_site]' >> $conf_file; echo 'key=domain' >>$conf_file; echo 'value=pok.stglabs.ibm.com' >> $conf_file"; + @output = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[run_fast_regression_test] $cmd ....[Failed]"; + print "[run_fast_regression_test] error dumper:\n"; + print Dumper \@output; + return 1; + } + + print "Dumper regression conf file:\n"; + @output = runcmd("cat $conf_file"); + print Dumper \@output; + + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -s \"ci_test\" -l'"; + my @caseslist = runcmd("$cmd"); + if($::RUNCMD_RC){ + print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; + print "[run_fast_regression_test] error dumper:\n"; + print Dumper \@caseslist; + return 1; + }else{ + print "[run_fast_regression_test] $cmd .....:\n"; + print Dumper \@caseslist; + } + + + #my @caseslist = runcmd("sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -l caselist -b MN_basic.bundle'"); + my $casenum = @caseslist; + my $x = 0; + my @failcase; + my $passnum = 0; + my $failnum = 0; + foreach my $case (@caseslist){ + ++$x; + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -f $conf_file -t $case'"; + print "[run_fast_regression_test] run $x: $cmd\n"; + @output = runcmd("$cmd"); + #print Dumper \@output; + for(my $i = $#output; $i>-1; --$i){ + if($output[$i] =~ /------END::(.+)::Failed/){ + push @failcase, $1; + ++$failnum; + print Dumper \@output; + last; + }elsif ($output[$i] =~ /------END::(.+)::Passed/){ + ++$passnum; + last; + } + } + } + + if($failnum){ + my $log_str = join (",", @failcase ); + $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + #send_back_comment("$check_result_str"); + return 1; + }else{ + $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum"; + #send_back_comment("$check_result_str"); + } + + return 0; +} + +#-------------------------------------------------------- +# Fuction name: mark_time +# Description: +# Attributes: +# Return code: +#-------------------------------------------------------- +sub mark_time{ + my $func_name=shift; + my $nowtime = timelocal(localtime()); + my $nowtime_str = scalar(localtime()); + my $duration = $nowtime - $last_func_start; + $last_func_start = $nowtime; + print "[mark_time] $nowtime_str, ElapsedTime of $func_name is $duration s\n"; +} + +#===============Main Process============================= + +my @os_info = runcmd("cat /etc/os-release"); +print "Current OS information:\n"; +print Dumper \@os_info; + +my @perl_vserion = runcmd("perl -v"); +print "Current perl information:\n"; +print Dumper \@perl_vserion; + +my @disk = runcmd("df -h"); +print "Disk information:\n"; +print Dumper \@disk; + +# Hacking the netmask. Not sure if we need to recover it after finish xcattest +# Note: Here has an assumption from Travis VM: only 1 UP Ethernet interface available (CHANGEME if it not as is) +my @intfinfo = runcmd("ip -o link |grep 'link/ether'|grep 'state UP' |awk -F ':' '{print \$2}'|head -1"); +foreach my $nic (@intfinfo) { + print "Hacking the netmask length to 16 if it is 32: $nic\n"; + runcmd("ip -4 addr show $nic|grep 'inet'|grep -q '/32' && sudo ip addr add \$(hostname -I|awk '{print \$1}')/16 dev $nic"); +} +my @ipinfo = runcmd("ip addr"); +print "Networking information:\n"; +print Dumper \@ipinfo; + +#Start to build xcat core + +print GREEN "\n------ Building xCAT core package ------\n"; +$rst = build_xcat_core(); +if($rst){ + print RED "Build of xCAT core package failed\n"; + exit $rst; +} +mark_time("build_xcat_core"); + +#Start to install xcat +print GREEN "\n------Installing xCAT ------\n"; +$rst = install_xcat(); +if($rst){ + print RED "Install of xCAT failed\n"; + exit $rst; +} +mark_time("install_xcat"); + +#Check the syntax of changing code +print GREEN "\n------ Checking the syntax of changed code------\n"; +$rst = check_syntax(); +if($rst){ + print RED "Check syntax of changed code failed\n"; + exit $rst; +} +mark_time("check_syntax"); + +#run fast regression +print GREEN "\n------Running fast regression test ------\n"; +$rst = run_fast_regression_test(); +if($rst){ + print RED "Run of fast regression test failed\n"; + exit $rst; +} +mark_time("run_fast_regression_test"); + +if ($redo_check_pr) { + print GREEN "\n------ Checking Pull Request Format ------\n"; + $rst = check_pr_format(); + if($rst){ + print RED "Check of pull request format failed\n"; + exit $rst; + } + mark_time("check_pr_format"); +} + +exit 0; From 07fc726380c9b9421975f7d61fe6ad14af45d2b3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 15:29:17 -0400 Subject: [PATCH 011/188] Fix syntax error in GitHub Action script --- .github/workflows/xcat_test.yml | 2 +- github_action_xcat_test.pl | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 8e391cc1d9..35411e1f10 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -3,7 +3,7 @@ on: pull_request: types: [review_requested] jobs: - xcat_build: + xcat_pr_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index d6fac91dcf..4b4151e7ea 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -633,14 +633,4 @@ sub mark_time{ } mark_time("run_fast_regression_test"); -if ($redo_check_pr) { - print GREEN "\n------ Checking Pull Request Format ------\n"; - $rst = check_pr_format(); - if($rst){ - print RED "Check of pull request format failed\n"; - exit $rst; - } - mark_time("check_pr_format"); -} - exit 0; From aed6e4e58ed674ae304cd7fa62bb6690b3ae63a4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 29 Jun 2022 16:30:30 -0400 Subject: [PATCH 012/188] Add some debugging --- github_action_xcat_test.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 4b4151e7ea..0f46d850b1 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -325,7 +325,8 @@ sub build_xcat_core{ #-------------------------------------------------------- sub install_xcat{ - my @cmds = ("cd ./../../xcat-core && sudo ./mklocalrepo.sh", + my @cmds = ("pwd", + "cd ./../../xcat-core && sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", @@ -343,6 +344,10 @@ sub install_xcat{ #send_back_comment("$check_result_str"); return 1; } + else { + print "[install_xcat] Command success:\n"; + print Dumper \@output; + } } my $cmd = "sudo apt-get install xcat --allow-remove-essential --allow-unauthenticated"; From 48698d3eebcae605c34b9406e263a1cf91d1dad6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 09:04:04 -0400 Subject: [PATCH 013/188] More debuggin in GitHub actions script --- github_action_xcat_test.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 0f46d850b1..c0526a07bd 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -336,11 +336,12 @@ sub install_xcat{ foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); + print "[install_xcat] RC was $::RUNCMD_RC\n"; if($::RUNCMD_RC){ print RED "[install_xcat] $cmd. ...[Failed]\n"; print "[install_xcat] error message:\n"; print Dumper \@output; - $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information "; + #$check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information "; #send_back_comment("$check_result_str"); return 1; } From dd190a1d93871417b58f07f96fa1fe3e474a35ce Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 09:39:08 -0400 Subject: [PATCH 014/188] Get GitHub action script directory referencei2 --- .github/workflows/xcat_test.yml | 3 +-- github_action_xcat_test.pl | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 35411e1f10..c807cc4598 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -1,7 +1,6 @@ name: xcat_test on: - pull_request: - types: [review_requested] + push jobs: xcat_pr_test: runs-on: ubuntu-latest diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index c0526a07bd..5aa62aa513 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -15,6 +15,7 @@ use JSON; use URI::Escape; use LWP::Simple; +use Cwd; use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; @@ -333,6 +334,14 @@ sub install_xcat{ "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq --allow-insecure-repositories update"); my @output; + my $dir = cwd; + print "[MG] Current working dir $dir"; + @output = runcmd("cd $dir"); + if($::RUNCMD_RC){ + print RED "[MG] cd to $dir ...[Failed]\n"; + print "[MG] error message:\n"; + print Dumper \@output; + } foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); From c71df6f8e02574d407202912e400810ea673edff Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 09:56:01 -0400 Subject: [PATCH 015/188] Get GitHub action script directory reference3 --- github_action_xcat_test.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 5aa62aa513..2c95e1d794 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -334,8 +334,16 @@ sub install_xcat{ "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq --allow-insecure-repositories update"); my @output; - my $dir = cwd; - print "[MG] Current working dir $dir"; + my $dir = cwd(); + print "[MG] {1} Current working dir $dir\n"; + @output = runcmd("cd $dir"); + if($::RUNCMD_RC){ + print RED "[MG] cd to $dir ...[Failed]\n"; + print "[MG] error message:\n"; + print Dumper \@output; + } + $dir = "/home/runner/work"; + print "[MG] {2} Current working dir $dir\n"; @output = runcmd("cd $dir"); if($::RUNCMD_RC){ print RED "[MG] cd to $dir ...[Failed]\n"; From 79f4d04277d2c1da34f373463e28c71048024af4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 10:38:15 -0400 Subject: [PATCH 016/188] Get GitHub action script directory reference4 --- github_action_xcat_test.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 2c95e1d794..696d7f1f86 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -350,6 +350,11 @@ sub install_xcat{ print "[MG] error message:\n"; print Dumper \@output; } + @output = runcmd("env"); + print "[MG] running env\n"; + print "[MG] env output:\n"; + print Dumper \@output; + foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); From 635fd0b0be90a839ea5d8c46dbbcc05137cfc749 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 10:51:59 -0400 Subject: [PATCH 017/188] Get GitHub action script directory reference5 --- github_action_xcat_test.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 696d7f1f86..ac5866ed8b 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -41,6 +41,7 @@ sub runcmd my $rc = 0; $::RUNCMD_RC = 0; my $outref = []; + print "[[MG]] About to execute $cmd"; @$outref = `$cmd 2>&1`; if ($?) { @@ -351,10 +352,17 @@ sub install_xcat{ print Dumper \@output; } @output = runcmd("env"); - print "[MG] running env\n"; + print "[MG] {3} running env\n"; print "[MG] env output:\n"; print Dumper \@output; + my $workspace = $ENV{RUNNER_WORKSPACE}; + @output = runcmd("cd $workspace"); + print "[MG] {4} running cd $workspace\n"; + print "[MG] cd output:\n"; + print Dumper \@output; + + print "[MG] RUNNER_WORKSPACE=$workspace\n"; foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); From 7929c2791e6342add3a70ea03dbe8119246ed399 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 11:05:39 -0400 Subject: [PATCH 018/188] Get GitHub action script directory reference6 --- github_action_xcat_test.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index ac5866ed8b..77f5e145b0 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -41,7 +41,7 @@ sub runcmd my $rc = 0; $::RUNCMD_RC = 0; my $outref = []; - print "[[MG]] About to execute $cmd"; + print " [[MG]] About to execute $cmd\n"; @$outref = `$cmd 2>&1`; if ($?) { @@ -327,8 +327,8 @@ sub build_xcat_core{ #-------------------------------------------------------- sub install_xcat{ - my @cmds = ("pwd", - "cd ./../../xcat-core && sudo ./mklocalrepo.sh", + my @cmds = ("sudo pwd", + "sudo cd ./../../xcat-core && sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", @@ -340,6 +340,7 @@ sub install_xcat{ @output = runcmd("cd $dir"); if($::RUNCMD_RC){ print RED "[MG] cd to $dir ...[Failed]\n"; + print "[MG] RC was $::RUNCMD_RC\n"; print "[MG] error message:\n"; print Dumper \@output; } @@ -348,6 +349,7 @@ sub install_xcat{ @output = runcmd("cd $dir"); if($::RUNCMD_RC){ print RED "[MG] cd to $dir ...[Failed]\n"; + print "[MG] RC was $::RUNCMD_RC\n"; print "[MG] error message:\n"; print Dumper \@output; } @@ -358,11 +360,11 @@ sub install_xcat{ my $workspace = $ENV{RUNNER_WORKSPACE}; @output = runcmd("cd $workspace"); - print "[MG] {4} running cd $workspace\n"; + print "[MG] {4} RUNNER_WORKSPACE running cd $workspace\n"; + print "[MG] RC was $::RUNCMD_RC\n"; print "[MG] cd output:\n"; print Dumper \@output; - print "[MG] RUNNER_WORKSPACE=$workspace\n"; foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); From 21f37d53c58b98dc4d09bdd4ed6c6cdbbb234caf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 11:42:19 -0400 Subject: [PATCH 019/188] Get GitHub action script directory reference7 --- github_action_xcat_test.pl | 41 +++++++++++++------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 77f5e145b0..56be7f9d3a 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -293,8 +293,8 @@ sub build_xcat_core{ my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0"; @output = runcmd("$cmd"); - print ">>>>>Dumper the output of '$cmd'\n"; - print Dumper \@output; + #print ">>>>>Dumper the output of '$cmd'\n"; + #print Dumper \@output; if($::RUNCMD_RC){ my $lastline = $output[-1]; $lastline =~ s/[\r\n\t\\"']*//g; @@ -327,8 +327,7 @@ sub build_xcat_core{ #-------------------------------------------------------- sub install_xcat{ - my @cmds = ("sudo pwd", - "sudo cd ./../../xcat-core && sudo ./mklocalrepo.sh", + my @cmds = ("sudo cd ./../../xcat-core && sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", @@ -337,33 +336,21 @@ sub install_xcat{ my @output; my $dir = cwd(); print "[MG] {1} Current working dir $dir\n"; - @output = runcmd("cd $dir"); - if($::RUNCMD_RC){ - print RED "[MG] cd to $dir ...[Failed]\n"; - print "[MG] RC was $::RUNCMD_RC\n"; - print "[MG] error message:\n"; - print Dumper \@output; - } $dir = "/home/runner/work"; print "[MG] {2} Current working dir $dir\n"; - @output = runcmd("cd $dir"); - if($::RUNCMD_RC){ - print RED "[MG] cd to $dir ...[Failed]\n"; - print "[MG] RC was $::RUNCMD_RC\n"; - print "[MG] error message:\n"; - print Dumper \@output; - } - @output = runcmd("env"); - print "[MG] {3} running env\n"; - print "[MG] env output:\n"; - print Dumper \@output; + chdir $dir; + print getcwd(); + system 'pwd'; + #@output = runcmd("env"); + #print "[MG] {3} running env\n"; + #print "[MG] env output:\n"; + #print Dumper \@output; my $workspace = $ENV{RUNNER_WORKSPACE}; - @output = runcmd("cd $workspace"); - print "[MG] {4} RUNNER_WORKSPACE running cd $workspace\n"; - print "[MG] RC was $::RUNCMD_RC\n"; - print "[MG] cd output:\n"; - print Dumper \@output; + print "[MG] {4} RUNNER_WORKSPACE running chdir $workspace\n"; + chdir $workspace; + print getcwd(); + system 'pwd'; foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; From 838f128e9e48164ed7c01a1221f78e98649dd7f6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 12:16:17 -0400 Subject: [PATCH 020/188] Get GitHub action script directory reference8 --- github_action_xcat_test.pl | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 56be7f9d3a..79d3c04b8c 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -334,22 +334,10 @@ sub install_xcat{ "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq --allow-insecure-repositories update"); my @output; - my $dir = cwd(); - print "[MG] {1} Current working dir $dir\n"; - $dir = "/home/runner/work"; - print "[MG] {2} Current working dir $dir\n"; - chdir $dir; - print getcwd(); - system 'pwd'; - #@output = runcmd("env"); - #print "[MG] {3} running env\n"; - #print "[MG] env output:\n"; - #print Dumper \@output; - - my $workspace = $ENV{RUNNER_WORKSPACE}; - print "[MG] {4} RUNNER_WORKSPACE running chdir $workspace\n"; - chdir $workspace; + chdir $ENV{RUNNER_WORKSPACE};; + print "[MG] getcwd()"; print getcwd(); + print "[MG] system pwd"; system 'pwd'; foreach my $cmd (@cmds){ From ad3f6faacf8931911e1de2b9f2ad7d913d8c37cd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 12:34:56 -0400 Subject: [PATCH 021/188] Get GitHub action script directory reference9 --- github_action_xcat_test.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 79d3c04b8c..efd98c1235 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -327,7 +327,7 @@ sub build_xcat_core{ #-------------------------------------------------------- sub install_xcat{ - my @cmds = ("sudo cd ./../../xcat-core && sudo ./mklocalrepo.sh", + my @cmds = ("sudo ./mklocalrepo.sh", "sudo chmod 777 /etc/apt/sources.list", "sudo echo \"deb [arch=amd64 allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", @@ -335,9 +335,9 @@ sub install_xcat{ "sudo apt-get -qq --allow-insecure-repositories update"); my @output; chdir $ENV{RUNNER_WORKSPACE};; - print "[MG] getcwd()"; + print "[MG] getcwd(): "; print getcwd(); - print "[MG] system pwd"; + print "\n[MG] system pwd: "; system 'pwd'; foreach my $cmd (@cmds){ From 11100153a2bc96c55857fc99bd3686bda73d6168 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 13:17:44 -0400 Subject: [PATCH 022/188] Get GitHub action script directory reference10 --- .github/workflows/xcat_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index c807cc4598..a5c9131df4 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -3,7 +3,7 @@ on: push jobs: xcat_pr_test: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common From 0e6b24dbc7a04d0aea63a2d28cf971e163d7e44f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 13:45:18 -0400 Subject: [PATCH 023/188] Get GitHub action script directory reference11 --- github_action_xcat_test.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index efd98c1235..c27f33c8d3 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -377,11 +377,11 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", - ". /etc/profile.d/xcat.sh && tabdump policy", - ". /etc/profile.d/xcat.sh && tabdump site", - ". /etc/profile.d/xcat.sh && lsxcatd -a", + "sudo . /etc/profile.d/xcat.sh && sudo tabdump policy", + "sudo . /etc/profile.d/xcat.sh && sudo tabdump site", + "sudo . /etc/profile.d/xcat.sh && sudo lsxcatd -a", "ls /opt/xcat/sbin", - "service xcatd status"); + "sudo service xcatd status"); my $ret = 0; foreach my $cmd (@cmds){ print "\n[install_xcat] running $cmd.....\n"; From a82b08f65bd7b753a41f343c7788342e381e6bcc Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 13:56:25 -0400 Subject: [PATCH 024/188] Get GitHub action script directory reference12 --- github_action_xcat_test.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index c27f33c8d3..3526df9e16 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -377,9 +377,9 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", - "sudo . /etc/profile.d/xcat.sh && sudo tabdump policy", - "sudo . /etc/profile.d/xcat.sh && sudo tabdump site", - "sudo . /etc/profile.d/xcat.sh && sudo lsxcatd -a", + "sudo /etc/profile.d/xcat.sh && sudo tabdump policy", + "sudo /etc/profile.d/xcat.sh && sudo tabdump site", + "sudo /etc/profile.d/xcat.sh && sudo lsxcatd -a", "ls /opt/xcat/sbin", "sudo service xcatd status"); my $ret = 0; From 99329bcc09b86da477eb70d96469c05ca9d67ab7 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 14:16:28 -0400 Subject: [PATCH 025/188] Get GitHub action script directory reference13 --- github_action_xcat_test.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 3526df9e16..f0d7ffc21d 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -377,9 +377,11 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", - "sudo /etc/profile.d/xcat.sh && sudo tabdump policy", - "sudo /etc/profile.d/xcat.sh && sudo tabdump site", - "sudo /etc/profile.d/xcat.sh && sudo lsxcatd -a", + "sudo cat /etc/profile.d/xcat.sh", + "/etc/profile.d/xcat.sh ", + "sudo /opt/xcat/sbin/tabdump policy", + "sudo /opt/xcat/sbin/tabdump site", + "sudo /opt/xcat/bin/lsxcatd -a", "ls /opt/xcat/sbin", "sudo service xcatd status"); my $ret = 0; From cf7544259331b7badf609d3aae68858ff75c3a54 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 14:36:00 -0400 Subject: [PATCH 026/188] Get GitHub action script directory reference14 --- github_action_xcat_test.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index f0d7ffc21d..824cdcc048 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -41,7 +41,6 @@ sub runcmd my $rc = 0; $::RUNCMD_RC = 0; my $outref = []; - print " [[MG]] About to execute $cmd\n"; @$outref = `$cmd 2>&1`; if ($?) { @@ -507,10 +506,10 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - $cmd = "echo '[System]' > $conf_file; echo 'MN=$hostname' >> $conf_file; echo '[Table_site]' >> $conf_file; echo 'key=domain' >>$conf_file; echo 'value=pok.stglabs.ibm.com' >> $conf_file"; + $cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; @output = runcmd("$cmd"); if($::RUNCMD_RC){ - print RED "[run_fast_regression_test] $cmd ....[Failed]"; + print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; print "[run_fast_regression_test] error dumper:\n"; print Dumper \@output; return 1; @@ -520,7 +519,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -s \"ci_test\" -l'"; + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && sudo xcattest -s \"ci_test\" -l'"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; @@ -541,7 +540,7 @@ sub run_fast_regression_test{ my $failnum = 0; foreach my $case (@caseslist){ ++$x; - $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -f $conf_file -t $case'"; + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && sudo xcattest -f $conf_file -t $case'"; print "[run_fast_regression_test] run $x: $cmd\n"; @output = runcmd("$cmd"); #print Dumper \@output; From 8073737d20ffb2c9c04bc00287a7d89bcb38dd52 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 14:54:34 -0400 Subject: [PATCH 027/188] Get GitHub action script directory reference15 --- github_action_xcat_test.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 824cdcc048..1b6a359729 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -376,7 +376,6 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", - "sudo cat /etc/profile.d/xcat.sh", "/etc/profile.d/xcat.sh ", "sudo /opt/xcat/sbin/tabdump policy", "sudo /opt/xcat/sbin/tabdump site", @@ -512,7 +511,7 @@ sub run_fast_regression_test{ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; print "[run_fast_regression_test] error dumper:\n"; print Dumper \@output; - return 1; + #return 1; } print "Dumper regression conf file:\n"; From 07f5a653e65570886c97f944745dc3c35a50822e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 15:24:59 -0400 Subject: [PATCH 028/188] Get GitHub action script directory reference16 --- github_action_xcat_test.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 1b6a359729..fb4c76838f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,7 +505,8 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - $cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; + #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; + $cmd = "sudo echo '[System]' > $conf_file"; @output = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; From 1d82acb887ab9c75d9a8dd24bee1f760470956e6 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 15:46:12 -0400 Subject: [PATCH 029/188] Get GitHub action script directory reference17 --- github_action_xcat_test.pl | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index fb4c76838f..d86a90a55f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,15 +505,17 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; + open(my $FH, '>', $conf_file) or die "Could not open test configuration file '$conf_file' $!i"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; - $cmd = "sudo echo '[System]' > $conf_file"; - @output = runcmd("$cmd"); - if($::RUNCMD_RC){ - print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; - print "[run_fast_regression_test] error dumper:\n"; - print Dumper \@output; - #return 1; - } + print $FH "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; + close($FH); + #@output = runcmd("$cmd"); + #if($::RUNCMD_RC){ + # print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; + # print "[run_fast_regression_test] error dumper:\n"; + # print Dumper \@output; + # #return 1; + #} print "Dumper regression conf file:\n"; @output = runcmd("cat $conf_file"); From 084b0dafa1c75242d46934755570eaea3d636aba Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 16:01:28 -0400 Subject: [PATCH 030/188] Get GitHub action script directory reference18 --- github_action_xcat_test.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index d86a90a55f..c6a6fcba90 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,10 +505,13 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - open(my $FH, '>', $conf_file) or die "Could not open test configuration file '$conf_file' $!i"; + open(my $fh, '>', $conf_file) or die "Could not open test configuration file '$conf_file' $!"; + print "MG file opened"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; - print $FH "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; - close($FH); + print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; + print "MG file written"; + close($fh); + print "MG file closed"; #@output = runcmd("$cmd"); #if($::RUNCMD_RC){ # print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; From bfd0c563392a6658759c6fd06434b4b1ec267b0e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 16:15:32 -0400 Subject: [PATCH 031/188] Get GitHub action script directory reference19 --- github_action_xcat_test.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index c6a6fcba90..7f126e10db 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,7 +505,8 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - open(my $fh, '>', $conf_file) or die "Could not open test configuration file '$conf_file' $!"; + print "MG about to open file $conf_file"; + open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print "MG file opened"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; From b30c81c6da977cf4735ff8a3e9bad4c2236713b8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 16:29:38 -0400 Subject: [PATCH 032/188] Get GitHub action script directory reference2- --- github_action_xcat_test.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 7f126e10db..a2f2dbb4b8 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,6 +505,8 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; + print "MG about to chmod 0777 file $conf_file"; + chmod 0777, $conf_file; print "MG about to open file $conf_file"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print "MG file opened"; From 2042e1980110f42dd73752f2c16072d7b9015abf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 16:42:49 -0400 Subject: [PATCH 033/188] Get GitHub action script directory reference21 --- github_action_xcat_test.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index a2f2dbb4b8..8291577151 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,16 +505,17 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - print "MG about to chmod 0777 file $conf_file"; - chmod 0777, $conf_file; - print "MG about to open file $conf_file"; + print "MG about to chmod 0777 file $conf_file\n"; + #chmod 0777, $conf_file; + system "sudo chmod 777 $conf_file"; + print "MG about to open file $conf_file\n"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; - print "MG file opened"; + print "MG file opened\n"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; - print "MG file written"; + print "MG file written\n"; close($fh); - print "MG file closed"; + print "MG file closed\n"; #@output = runcmd("$cmd"); #if($::RUNCMD_RC){ # print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; From 3789b2f6e4369af21caa9896006cd81a90b6b57d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 16:53:05 -0400 Subject: [PATCH 034/188] Get GitHub action script directory reference22 --- github_action_xcat_test.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 8291577151..4b25e8f760 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,11 +505,11 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - print "MG about to chmod 0777 file $conf_file\n"; + #print "MG about to chmod 0777 file $conf_file\n"; #chmod 0777, $conf_file; system "sudo chmod 777 $conf_file"; - print "MG about to open file $conf_file\n"; - open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; + #print "MG about to open file $conf_file\n"; + open(my $fh, '+>', $conf_file) or die "Could not open test configuration file $!"; print "MG file opened\n"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; From e52c04a4a1d7cf550c5b20aa91ca4b9245aa8f9f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 30 Jun 2022 17:03:17 -0400 Subject: [PATCH 035/188] Get GitHub action script directory reference23 --- github_action_xcat_test.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 4b25e8f760..25a7e63a62 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -505,11 +505,13 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - #print "MG about to chmod 0777 file $conf_file\n"; + print "MG about to touch file $conf_file\n"; + system "sudo touch $conf_file"; + print "MG about to chmod 0777 file $conf_file\n"; #chmod 0777, $conf_file; system "sudo chmod 777 $conf_file"; #print "MG about to open file $conf_file\n"; - open(my $fh, '+>', $conf_file) or die "Could not open test configuration file $!"; + open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print "MG file opened\n"; #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; From 56ec6ea8fbb3f5fd1e29ab004a796b85423f10f2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 09:09:26 -0400 Subject: [PATCH 036/188] Get GitHub action script directory reference24 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 25a7e63a62..fc995a9646 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -530,7 +530,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && sudo xcattest -s \"ci_test\" -l'"; + $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l'"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; @@ -551,7 +551,7 @@ sub run_fast_regression_test{ my $failnum = 0; foreach my $case (@caseslist){ ++$x; - $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && sudo xcattest -f $conf_file -t $case'"; + $cmd = "sudo /opt/xcat/bin/xcattest -f $conf_file -t $case'"; print "[run_fast_regression_test] run $x: $cmd\n"; @output = runcmd("$cmd"); #print Dumper \@output; From db7abfd40d6b9864b0114d476ab099427ad9084e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 09:20:46 -0400 Subject: [PATCH 037/188] Get GitHub action script directory reference25 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index fc995a9646..6b772b14eb 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -530,7 +530,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l'"; + $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; From 46c5fe518b8f4f7c420b975cb64ae7c169a9904e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 09:31:12 -0400 Subject: [PATCH 038/188] Get GitHub action script directory reference26 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 6b772b14eb..ff4baa4639 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -551,7 +551,7 @@ sub run_fast_regression_test{ my $failnum = 0; foreach my $case (@caseslist){ ++$x; - $cmd = "sudo /opt/xcat/bin/xcattest -f $conf_file -t $case'"; + $cmd = "sudo /opt/xcat/bin/xcattest -f $conf_file -t $case"; print "[run_fast_regression_test] run $x: $cmd\n"; @output = runcmd("$cmd"); #print Dumper \@output; From cbbbbe43be7808729ebc796fcbd8594bc4cd230e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 09:47:49 -0400 Subject: [PATCH 039/188] Get GitHub action script directory reference27 --- github_action_xcat_test.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index ff4baa4639..b1b40081ae 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -507,17 +507,12 @@ sub run_fast_regression_test{ my $conf_file = "$ENV{'PWD'}/regression.conf"; print "MG about to touch file $conf_file\n"; system "sudo touch $conf_file"; - print "MG about to chmod 0777 file $conf_file\n"; + #print "MG about to chmod 0777 file $conf_file\n"; #chmod 0777, $conf_file; - system "sudo chmod 777 $conf_file"; - #print "MG about to open file $conf_file\n"; + #system "sudo chmod 777 $conf_file"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; - print "MG file opened\n"; - #$cmd = "sudo echo '[System]' > $conf_file; sudo echo 'MN=$hostname' >> $conf_file; sudo echo '[Table_site]' >> $conf_file; sudo echo 'key=domain' >>$conf_file; sudo echo 'value=pok.stglabs.ibm.com' >> $conf_file"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; - print "MG file written\n"; close($fh); - print "MG file closed\n"; #@output = runcmd("$cmd"); #if($::RUNCMD_RC){ # print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; @@ -571,10 +566,12 @@ sub run_fast_regression_test{ if($failnum){ my $log_str = join (",", @failcase ); $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + print $check_result_str; #send_back_comment("$check_result_str"); return 1; }else{ $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum"; + print $check_result_str; #send_back_comment("$check_result_str"); } From 95b63483b4a8db32846cfe1cc04cf8b98ff34699 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 09:57:51 -0400 Subject: [PATCH 040/188] Get GitHub action script directory reference28 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index b1b40081ae..daa3cd670f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -507,8 +507,8 @@ sub run_fast_regression_test{ my $conf_file = "$ENV{'PWD'}/regression.conf"; print "MG about to touch file $conf_file\n"; system "sudo touch $conf_file"; - #print "MG about to chmod 0777 file $conf_file\n"; - #chmod 0777, $conf_file; + print "MG about to chmod 0777 file $conf_file\n"; + chmod 0777, $conf_file; #system "sudo chmod 777 $conf_file"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; From 4868dc46dd2cdc9eaa68d1c55afcc7fd49f16451 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 1 Jul 2022 10:08:01 -0400 Subject: [PATCH 041/188] Get GitHub action script directory reference29 --- github_action_xcat_test.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index daa3cd670f..f5da735d64 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -508,8 +508,7 @@ sub run_fast_regression_test{ print "MG about to touch file $conf_file\n"; system "sudo touch $conf_file"; print "MG about to chmod 0777 file $conf_file\n"; - chmod 0777, $conf_file; - #system "sudo chmod 777 $conf_file"; + system "sudo chmod 777 $conf_file"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; close($fh); From 8876bbdaa21ff30f6c386a43b9f5e88fd602ef75 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 5 Jul 2022 11:27:27 -0400 Subject: [PATCH 042/188] Get GitHub action script directory reference30 --- github_action_xcat_test.pl | 71 ++++++-------------------------------- 1 file changed, 10 insertions(+), 61 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index f5da735d64..c736f7acaa 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -278,43 +278,22 @@ sub send_back_comment{ #-------------------------------------------------------- sub build_xcat_core{ my @output; - #my @cmds = ("gpg --list-keys", - # "sed -i '/SignWith: /d' $ENV{'PWD'}/build-ubunturepo"); - #foreach my $cmd (@cmds){ - # print "[build_xcat_core] running $cmd\n"; - # @output = runcmd("$cmd"); - # if($::RUNCMD_RC){ - # print "[build_xcat_core] $cmd ....[Failed]\n"; - # send_back_comment("> **BUILD ERROR** : $cmd failed. Please click ``Details`` label in ``Merge pull request`` box for detailed information"); - # return 1; - # } - #} my $cmd = "sudo ./build-ubunturepo -c UP=0 BUILDALL=1 GPGSIGN=0"; @output = runcmd("$cmd"); - #print ">>>>>Dumper the output of '$cmd'\n"; - #print Dumper \@output; if($::RUNCMD_RC){ my $lastline = $output[-1]; $lastline =~ s/[\r\n\t\\"']*//g; print "[build_xcat_core] $cmd ....[Failed]\n"; - #print ">>>>>Dumper the output of '$cmd'\n"; - #print Dumper \@output; $check_result_str .= "> **BUILD ERROR**, Please click ``Details`` label in ``Merge pull request`` box for detailed information"; - #send_back_comment("$check_result_str"); + print $check_result_str; return 1; }else{ print "[build_xcat_core] $cmd ....[Pass]\n"; $check_result_str .= "> **BUILD SUCCESSFUL** "; - #send_back_comment("$check_result_str"); + print $check_result_str; } -# my $buildpath ="/home/travis/build/xcat-core/"; -# my @buildfils = (); -# get_files_recursive("$buildpath", \@buildfils); -# print "\n-----------Dumper build files-----------\n"; -# print Dumper \@buildfils; - return 0; } @@ -332,35 +311,24 @@ sub install_xcat{ "sudo echo \"deb [arch=ppc64el allow-insecure=yes] http://xcat.org/files/xcat/repos/apt/devel/xcat-dep bionic main\" >> /etc/apt/sources.list", "sudo wget -q -O - \"http://xcat.org/files/xcat/repos/apt/apt.key\" | sudo apt-key add -", "sudo apt-get -qq --allow-insecure-repositories update"); - my @output; chdir $ENV{RUNNER_WORKSPACE};; - print "[MG] getcwd(): "; - print getcwd(); - print "\n[MG] system pwd: "; - system 'pwd'; + my @output; foreach my $cmd (@cmds){ print "[install_xcat] running $cmd\n"; @output = runcmd("$cmd"); - print "[install_xcat] RC was $::RUNCMD_RC\n"; if($::RUNCMD_RC){ print RED "[install_xcat] $cmd. ...[Failed]\n"; print "[install_xcat] error message:\n"; print Dumper \@output; - #$check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information "; - #send_back_comment("$check_result_str"); + $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information "; + print $check_result_str; return 1; } - else { - print "[install_xcat] Command success:\n"; - print Dumper \@output; - } } my $cmd = "sudo apt-get install xcat --allow-remove-essential --allow-unauthenticated"; @output = runcmd("$cmd"); - #print ">>>>>Dumper the output of '$cmd'\n"; - #print Dumper \@output; if($::RUNCMD_RC){ my $lastline = $output[-1]; $lastline =~ s/[\r\n\t\\"']*//g; @@ -368,7 +336,7 @@ sub install_xcat{ print ">>>>>Dumper the output of '$cmd'\n"; print Dumper \@output; $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; - #send_back_comment("$check_result_str"); + print $check_result_str; return 1; }else{ print "[install_xcat] $cmd ....[Pass]\n"; @@ -407,12 +375,12 @@ sub install_xcat{ if($ret){ $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; - #send_back_comment("$check_result_str"); + print $check_result_str; return 1; } $check_result_str .= "> **INSTALL XCAT SUCCESSFUL**"; - #send_back_comment("$check_result_str"); + print $check_result_str; } return 0; } @@ -446,12 +414,6 @@ sub check_syntax{ push @syntax_err, @output; $ret = 1; } - #}elsif($output[0] =~ /shell/i){ - # @output = runcmd("sudo bash -c '. /etc/profile.d/xcat.sh && sh -n $file'"); - # if($::RUNCMD_RC){ - # push @syntax_err, @output; - # $ret = 1; - # } } } } @@ -461,11 +423,11 @@ sub check_syntax{ print "[check_syntax] Dumper error message:\n"; print Dumper @syntax_err; $check_result_str .= "> **CODE SYNTAX ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; - #send_back_comment("$check_result_str"); + print $check_result_str; }else{ print "[check_syntax] syntax checking ....[Pass]\n"; $check_result_str .= "> **CODE SYNTAX CORRECT**"; - #send_back_comment("$check_result_str"); + print $check_result_str; } return $ret; @@ -505,20 +467,11 @@ sub run_fast_regression_test{ chomp($hostname); print "hostname = $hostname\n"; my $conf_file = "$ENV{'PWD'}/regression.conf"; - print "MG about to touch file $conf_file\n"; system "sudo touch $conf_file"; - print "MG about to chmod 0777 file $conf_file\n"; system "sudo chmod 777 $conf_file"; open(my $fh, '>', $conf_file) or die "Could not open test configuration file $!"; print $fh "[System]\nMN=$hostname\n[Table_site]\nkey=domain\nvalue=pok.stglabs.ibm.com\n"; close($fh); - #@output = runcmd("$cmd"); - #if($::RUNCMD_RC){ - # print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; - # print "[run_fast_regression_test] error dumper:\n"; - # print Dumper \@output; - # #return 1; - #} print "Dumper regression conf file:\n"; @output = runcmd("cat $conf_file"); @@ -536,8 +489,6 @@ sub run_fast_regression_test{ print Dumper \@caseslist; } - - #my @caseslist = runcmd("sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -l caselist -b MN_basic.bundle'"); my $casenum = @caseslist; my $x = 0; my @failcase; @@ -566,12 +517,10 @@ sub run_fast_regression_test{ my $log_str = join (",", @failcase ); $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; print $check_result_str; - #send_back_comment("$check_result_str"); return 1; }else{ $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum"; print $check_result_str; - #send_back_comment("$check_result_str"); } return 0; From c55930f5916ab1c275566a263ddfe28676d8c583 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 5 Jul 2022 12:01:52 -0400 Subject: [PATCH 043/188] Get GitHub action script directory reference31 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index c736f7acaa..9c23e02075 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -342,8 +342,8 @@ sub install_xcat{ print "[install_xcat] $cmd ....[Pass]\n"; print "\n------Config xcat and verify xcat is working correctly-----\n"; - @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f travis", - "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=travis policy.rule=allow", + @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", + "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", "/etc/profile.d/xcat.sh ", "sudo /opt/xcat/sbin/tabdump policy", "sudo /opt/xcat/sbin/tabdump site", From f3098a2f6c7d66fca436d87c0358901619a996ad Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 6 Jul 2022 11:36:21 -0400 Subject: [PATCH 044/188] Testecase to detect genimage WARNING --- xCAT-test/autotest/testcase/xdsh/cases0 | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-test/autotest/testcase/xdsh/cases0 b/xCAT-test/autotest/testcase/xdsh/cases0 index 767c79d44e..a0c4b933e9 100644 --- a/xCAT-test/autotest/testcase/xdsh/cases0 +++ b/xCAT-test/autotest/testcase/xdsh/cases0 @@ -89,6 +89,7 @@ cmd: copycds $$ISO check:rc==0 cmd: genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 +check:output!~WARNING cmd: xdsh -i /install/netboot/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/compute/rootimg "rpm -qa|grep uuid" check:rc==0 check:output=~libuuid From 4594a2014a516dbf42f60cc5fa06b1eeb6e97c0c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 6 Jul 2022 14:18:10 -0400 Subject: [PATCH 045/188] Test pull_request action instead of push --- .github/workflows/xcat_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index a5c9131df4..781934c5e2 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -1,6 +1,6 @@ name: xcat_test on: - push + pull_request jobs: xcat_pr_test: runs-on: ubuntu-18.04 From 26e52388376dc0a81a89470fb78880975f590756 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 10:27:34 -0400 Subject: [PATCH 046/188] Fix mkvm man page formatting --- .../guides/admin-guides/references/man1/mkvm.1.rst | 10 +++++----- xCAT-client/pods/man1/mkvm.1.pod | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/mkvm.1.rst b/docs/source/guides/admin-guides/references/man1/mkvm.1.rst index 66884c9b1f..0c72964c39 100644 --- a/docs/source/guides/admin-guides/references/man1/mkvm.1.rst +++ b/docs/source/guides/admin-guides/references/man1/mkvm.1.rst @@ -81,7 +81,7 @@ For PPC (with HMC) specific: ============================ -The first form of \ **mkvm**\ command creates new partition(s) with the same profile/resources as the partition specified by \ *singlenode*\ . The -i and \ *noderange*\ specify the starting numeric partition number and the \ *noderange*\ for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition. +The first form of \ **mkvm**\ command creates new partition(s) with the same profile/resources as the partition specified by \ *singlenode*\ . The \ **-i**\ and \ *noderange*\ specify the starting numeric partition number and the \ *noderange*\ for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition. The second form of this command duplicates all the partitions from the source specified by \ *profile*\ to the destination specified by \ *destcec*\ . The source and destination CECs can be managed by different HMCs. @@ -94,9 +94,9 @@ For PPC (using Direct FSP Management) specific: =============================================== -With option \ *full*\ , a partition using all the resources on a normal power machine will be created. +With option \ **-**\ **-full**\ , a partition using all the resources on a normal power machine will be created. -If no option is specified, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmemory', 'vmphyslots', 'vmothersetting', 'vmnics', 'vmstorage' will be created. Those attributes can either be specified with '\*def' commands running before or be specified with this command. +If no option is specified, a partition using the parameters specified with attributes such as \ **vmcpus**\ , \ **vmmemory**\ , \ **vmphyslots**\ , \ **vmothersetting**\ , \ **vmnics**\ , \ **vmstorage**\ will be created. Those attributes can either be specified with '\*def' commands running before or be specified with this command. For KVM and VMware: @@ -148,9 +148,9 @@ OPTIONS \ **vmcpus=**\ \ *value*\ \ **vmmemory=**\ \ *value*\ \ **vmphyslots=**\ \ *value*\ \ **vmothersetting=**\ \ *value*\ \ **vmnics=**\ \ *value*\ \ **vmstorage=**\ \ *value*\ [\ **-**\ **-vios**\ ] - To specify the parameters which are used to create a partition. The \ *vmcpus*\ , \ *vmmemory*\ are necessary, and the value specified with this command have a more high priority. If the value of any of the three options is not specified, the corresponding value specified for the node object will be used. If any of the three attributes is neither specified with this command nor specified with the node object, error information will be returned. To reference to lsvm(1)|lsvm.1 for more information about 'drc_index' for \ *vmphyslots*\ . + To specify the parameters which are used to create a partition. The \ **vmcpus**\ , \ **vmmemory**\ are necessary, and the value specified with this command have a more high priority. If the value of any of the three options is not specified, the corresponding value specified for the node object will be used. If any of the three attributes is neither specified with this command nor specified with the node object, error information will be returned. To reference to lsvm(1)|lsvm.1 for more information about 'drc_index' for \ *vmphyslots*\ . - The option \ *vios*\ is used to specify the partition that will be created is a VIOS partition. If specified, the value for \ *vmstorage*\ shall be number which indicate the number of vSCSI server adapter will be created, and if no value specified for \ *vmphyslots*\ , all the physical slot of the power machine will be assigned to VIOS partition. If not specified, it shall be in form of \ *vios_name:server_slotid*\ to specify the vios and the virtual slot id of the vSCSI server adapter that will be connected from the Logical partition. + The option \ **vios**\ is used to specify the partition that will be created is a VIOS partition. If specified, the value for \ **vmstorage**\ shall be number which indicate the number of vSCSI server adapter will be created, and if no value specified for \ **vmphyslots**\ , all the physical slot of the power machine will be assigned to VIOS partition. If not specified, it shall be in form of \ **vios_name:server_slotid**\ to specify the vios and the virtual slot id of the vSCSI server adapter that will be connected from the Logical partition. diff --git a/xCAT-client/pods/man1/mkvm.1.pod b/xCAT-client/pods/man1/mkvm.1.pod index 6c3d47cc81..59e3cb6908 100644 --- a/xCAT-client/pods/man1/mkvm.1.pod +++ b/xCAT-client/pods/man1/mkvm.1.pod @@ -42,7 +42,7 @@ B I [I] [B I] =head2 For PPC (with HMC) specific: -The first form of B command creates new partition(s) with the same profile/resources as the partition specified by I. The -i and I specify the starting numeric partition number and the I for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition. +The first form of B command creates new partition(s) with the same profile/resources as the partition specified by I. The B<-i> and I specify the starting numeric partition number and the I for the newly created partitions, respectively. The LHEA port numbers and the HCA index numbers will be automatically increased if they are defined in the source partition. The second form of this command duplicates all the partitions from the source specified by I to the destination specified by I. The source and destination CECs can be managed by different HMCs. @@ -52,9 +52,9 @@ Note that the B command currently only supports creating standard LPARs, n =head2 For PPC (using Direct FSP Management) specific: -With option I, a partition using all the resources on a normal power machine will be created. +With option B<--full>, a partition using all the resources on a normal power machine will be created. -If no option is specified, a partition using the parameters specified with attributes such as 'vmcpus', 'vmmemory', 'vmphyslots', 'vmothersetting', 'vmnics', 'vmstorage' will be created. Those attributes can either be specified with '*def' commands running before or be specified with this command. +If no option is specified, a partition using the parameters specified with attributes such as B, B, B, B, B, B will be created. Those attributes can either be specified with '*def' commands running before or be specified with this command. =head2 For KVM and VMware: @@ -88,9 +88,9 @@ Request to create a new full system partition for each CEC. =item B I B I B I B I B I B I [B<--vios>] -To specify the parameters which are used to create a partition. The I, I are necessary, and the value specified with this command have a more high priority. If the value of any of the three options is not specified, the corresponding value specified for the node object will be used. If any of the three attributes is neither specified with this command nor specified with the node object, error information will be returned. To reference to L for more information about 'drc_index' for I. +To specify the parameters which are used to create a partition. The B, B are necessary, and the value specified with this command have a more high priority. If the value of any of the three options is not specified, the corresponding value specified for the node object will be used. If any of the three attributes is neither specified with this command nor specified with the node object, error information will be returned. To reference to L for more information about 'drc_index' for I. -The option I is used to specify the partition that will be created is a VIOS partition. If specified, the value for I shall be number which indicate the number of vSCSI server adapter will be created, and if no value specified for I, all the physical slot of the power machine will be assigned to VIOS partition. If not specified, it shall be in form of I to specify the vios and the virtual slot id of the vSCSI server adapter that will be connected from the Logical partition. +The option B is used to specify the partition that will be created is a VIOS partition. If specified, the value for B shall be number which indicate the number of vSCSI server adapter will be created, and if no value specified for B, all the physical slot of the power machine will be assigned to VIOS partition. If not specified, it shall be in form of B to specify the vios and the virtual slot id of the vSCSI server adapter that will be connected from the Logical partition. =item B<-f|--force> From d08312bebdcca29f1214029cfd24f5969bef9766 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 10:44:23 -0400 Subject: [PATCH 047/188] Debug passed testcase count --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 9c23e02075..1ef292f3c8 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -499,7 +499,7 @@ sub run_fast_regression_test{ $cmd = "sudo /opt/xcat/bin/xcattest -f $conf_file -t $case"; print "[run_fast_regression_test] run $x: $cmd\n"; @output = runcmd("$cmd"); - #print Dumper \@output; + print Dumper \@output; for(my $i = $#output; $i>-1; --$i){ if($output[$i] =~ /------END::(.+)::Failed/){ push @failcase, $1; From 72ee3d9ac9b8b2049750972a842959df558ae426 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 11:12:07 -0400 Subject: [PATCH 048/188] Debug command output --- xCAT-test/xcattest | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index f6b55c3c07..bb4f7a1e4e 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1565,9 +1565,11 @@ sub setup_env_by_configure_file { my $cmd = undef; foreach $cmd (@{ $$config_ref{script_prev} }) { log_this($running_log_fd, "$cmd"); - &runcmd($cmd); + #MG + my @output = &runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Fail to run $cmd"; + $$error_ref = "Failed to run $cmd OUTPUT: @output"; + log_this($running_log_fd, "$cmd", "OUTPUT ", @output); return 1; } } From 359c7b349e961cab7f7443c2d9fe59d565fdd121 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 11:27:26 -0400 Subject: [PATCH 049/188] Debug command output3 --- xCAT-test/xcattest | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index bb4f7a1e4e..2735f37a67 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1568,7 +1568,7 @@ sub setup_env_by_configure_file { #MG my @output = &runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Failed to run $cmd OUTPUT: @output"; + $$error_ref = "Failed1 to run $cmd OUTPUT: @output"; log_this($running_log_fd, "$cmd", "OUTPUT ", @output); return 1; } @@ -1582,9 +1582,9 @@ sub setup_env_by_configure_file { $cmd = $cmd . " $attr=$$config_ref{object}{$type}{$name}{$attr}"; } log_this($running_log_fd, "$cmd"); - runcmd($cmd); + my @output = runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Fail to run $cmd"; + $$error_ref = "Failed2 to run $cmd"; return 1; } } @@ -1601,9 +1601,9 @@ sub setup_env_by_configure_file { } } log_this($running_log_fd, "$cmd"); - &runcmd($cmd); + my @output = &runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Fail to run $cmd"; + $$error_ref = "Failed3 to run $cmd OUTPUT: @output"; return 1; } } From 344cf05f9c2ea14e559513834c61e4f0029c8eb3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 11:40:31 -0400 Subject: [PATCH 050/188] Debug command output4 --- xCAT-test/xcattest | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 2735f37a67..3d0a8019f9 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -178,7 +178,7 @@ if($search_expression){ print "------The total labels are:---------\n"; print Dumper \@total_label_set; print "------The case and its labels:-------\n"; - print Dumper \%case_label_map + print Dumper \%case_label_map; } } @@ -258,7 +258,7 @@ if (defined $list) { print "------The total labels are:---------\n"; print Dumper \@total_label_set; print "------The case and its labels:-------\n"; - print Dumper \%case_label_map + print Dumper \%case_label_map; } my %label_conut; my %case_label_str_map; @@ -1604,6 +1604,7 @@ sub setup_env_by_configure_file { my @output = &runcmd($cmd); if ($::RUNCMD_RC != 0) { $$error_ref = "Failed3 to run $cmd OUTPUT: @output"; + print Dumper \@output; return 1; } } From 40e024975dec097e71bb0227ab6786493be14875 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 12:00:19 -0400 Subject: [PATCH 051/188] Debug command output5 --- xCAT-test/xcattest | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 3d0a8019f9..f6335de417 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1689,9 +1689,14 @@ sub runcmd if ($?) { $rc = $?; + print "MG rc=" $rc; $rc = $rc >> 8; $::RUNCMD_RC = $rc; + print "MG RUNCMD_RC=" $::RUNCMD_RC; } + print Dumper \@$outref; + print Dumper \@outref; + print Dumper \$outref; chomp(@$outref); return @$outref; From 6eb9b5ef60d4b75ff37df8493fc32a536be0248a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 13:15:41 -0400 Subject: [PATCH 052/188] Debug command output6 --- xCAT-test/xcattest | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index f6335de417..f64ed76004 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1689,10 +1689,10 @@ sub runcmd if ($?) { $rc = $?; - print "MG rc=" $rc; + print "MG rc=$rc"; $rc = $rc >> 8; $::RUNCMD_RC = $rc; - print "MG RUNCMD_RC=" $::RUNCMD_RC; + print "MG RUNCMD_RC=$::RUNCMD_RC"; } print Dumper \@$outref; print Dumper \@outref; From d3cbfa2b92a3bc3f5ea6c6322df85e17d9119fed Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 13:29:37 -0400 Subject: [PATCH 053/188] Debug command output7 --- xCAT-test/xcattest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index f64ed76004..d4545f398b 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1694,9 +1694,9 @@ sub runcmd $::RUNCMD_RC = $rc; print "MG RUNCMD_RC=$::RUNCMD_RC"; } - print Dumper \@$outref; - print Dumper \@outref; - print Dumper \$outref; + print "MG1 " . Dumper \@$outref; + print "MG2 " . Dumper @outref; + print "MG3 " . Dumper $outref; chomp(@$outref); return @$outref; From a07deab1ab1dd3df39c18dece47bd43cb4380939 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 13:41:23 -0400 Subject: [PATCH 054/188] Debug command output8 --- xCAT-test/xcattest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index d4545f398b..e40dd12f6d 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1695,7 +1695,7 @@ sub runcmd print "MG RUNCMD_RC=$::RUNCMD_RC"; } print "MG1 " . Dumper \@$outref; - print "MG2 " . Dumper @outref; + print "MG2 " . Dumper @$outref; print "MG3 " . Dumper $outref; chomp(@$outref); return @$outref; From 25de4415eb0fa3c3fcc7aa45a8e17ba1f4afb0ab Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 14:11:33 -0400 Subject: [PATCH 055/188] Debug command output9 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 1ef292f3c8..90840e977f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -477,7 +477,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l"; + $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l | grep restorexcatdb_p"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; From 96392c2785faafe3ffd6a180cb2622978e43bda0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 14:23:21 -0400 Subject: [PATCH 056/188] Debug command output10 --- xCAT-test/xcattest | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index e40dd12f6d..e226b747a4 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1692,10 +1692,8 @@ sub runcmd print "MG rc=$rc"; $rc = $rc >> 8; $::RUNCMD_RC = $rc; - print "MG RUNCMD_RC=$::RUNCMD_RC"; + print " RUNCMD_RC=$::RUNCMD_RC\n"; } - print "MG1 " . Dumper \@$outref; - print "MG2 " . Dumper @$outref; print "MG3 " . Dumper $outref; chomp(@$outref); return @$outref; From b2e74483c7c7ba873b0ff4a132d70c7465b8288f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 14:50:12 -0400 Subject: [PATCH 057/188] Debug command output11 --- github_action_xcat_test.pl | 4 ++-- xCAT-test/xcattest | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 90840e977f..6403d9e71f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -515,11 +515,11 @@ sub run_fast_regression_test{ if($failnum){ my $log_str = join (",", @failcase ); - $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + $check_result_str .= "> **FAST REGRESSION TEST Failed**: Totalcase $casenum Passed $passnum Failed $failnum FailedCases: $log_str. Please click ``Details`` label in ``Merge pull request`` box for detailed information\n"; print $check_result_str; return 1; }else{ - $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum"; + $check_result_str .= "> **FAST REGRESSION TEST Successful**: Totalcase $casenum Passed $passnum Failed $failnum\n"; print $check_result_str; } diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index e226b747a4..56847b57e4 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1605,6 +1605,8 @@ sub setup_env_by_configure_file { if ($::RUNCMD_RC != 0) { $$error_ref = "Failed3 to run $cmd OUTPUT: @output"; print Dumper \@output; + my @output2 = &runcmd("lsdef -t site clustersite -i domain -c"); + print "MG_LSDEF:\n " . Dumper \@output2; return 1; } } From 313244045ae30e6408e32941a43fcfc74d5341e8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 15:15:54 -0400 Subject: [PATCH 058/188] Debug command output12 --- github_action_xcat_test.pl | 2 +- xCAT-test/xcattest | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 6403d9e71f..6187f5d9b2 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -477,7 +477,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l | grep restorexcatdb_p"; + $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l | grep chdef_t"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 56847b57e4..18557ae697 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1594,7 +1594,7 @@ sub setup_env_by_configure_file { if (exists $$config_ref{table}) { foreach my $type (keys %{ $$config_ref{table} }) { foreach my $name (keys %{ $$config_ref{table}{$type} }) { - $cmd = "chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; + $cmd = "sudo chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; foreach my $attr (keys %{ $$config_ref{table}{$type}{$name} }) { if ($attr ne '__KEY__') { $cmd = $cmd . " $type.$attr=$$config_ref{table}{$type}{$name}{$attr}"; @@ -1605,7 +1605,11 @@ sub setup_env_by_configure_file { if ($::RUNCMD_RC != 0) { $$error_ref = "Failed3 to run $cmd OUTPUT: @output"; print Dumper \@output; - my @output2 = &runcmd("lsdef -t site clustersite -i domain -c"); + print "MG Running verification lsdef"; + my @output2 = &runcmd("sudo lsdef -t site clustersite -i domain -c"); + print "MG_LSDEF:\n " . Dumper \@output2; + print "MG Running verification tabdump"; + my @output2 = &runcmd("sudo tabdump site"); print "MG_LSDEF:\n " . Dumper \@output2; return 1; } From 7a103ad705d24da13bc5b6c33b4f36889174809b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 15:46:51 -0400 Subject: [PATCH 059/188] Debug command output13 --- xCAT-test/xcattest | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 18557ae697..571172a521 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -174,12 +174,12 @@ if($search_expression){ log_this($running_log_fd, "$error"); to_exit(1); } - if($xcatdebug){ + #if($xcatdebug){ print "------The total labels are:---------\n"; print Dumper \@total_label_set; print "------The case and its labels:-------\n"; print Dumper \%case_label_map; - } + #} } $rst = calculate_cases_to_be_run(\@cases_to_be_run, \$error); @@ -1577,7 +1577,7 @@ sub setup_env_by_configure_file { if (exists $$config_ref{object}) { foreach my $type (keys %{ $$config_ref{object} }) { foreach my $name (keys %{ $$config_ref{object}{$type} }) { - $cmd = "chdef -t $type -o $name"; + $cmd = "sudo /opt/xcat/bin/chdef -t $type -o $name"; foreach my $attr (keys %{ $$config_ref{object}{$type}{$name} }) { $cmd = $cmd . " $attr=$$config_ref{object}{$type}{$name}{$attr}"; } @@ -1594,7 +1594,7 @@ sub setup_env_by_configure_file { if (exists $$config_ref{table}) { foreach my $type (keys %{ $$config_ref{table} }) { foreach my $name (keys %{ $$config_ref{table}{$type} }) { - $cmd = "sudo chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; + $cmd = "sudo /opt/xcat/sbin/chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; foreach my $attr (keys %{ $$config_ref{table}{$type}{$name} }) { if ($attr ne '__KEY__') { $cmd = $cmd . " $type.$attr=$$config_ref{table}{$type}{$name}{$attr}"; @@ -2128,7 +2128,7 @@ sub scan_existed_labels { my @labels = (); if ($line =~ /^start\s*:\s*(.*)/) { - $current_case_name = $1; + $current_case_name = $1; if ($cmd_cases_belong_to){ $case_label_map_ref->{$current_case_name}->{labels} = [$cmd_cases_belong_to]; push @$total_label_set_ref, $cmd_cases_belong_to unless(inarray($total_label_set_ref, $cmd_cases_belong_to)); From 802567ad52b9843a7f47307caac96412f882ae18 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 16:28:26 -0400 Subject: [PATCH 060/188] Debug command output14 --- github_action_xcat_test.pl | 4 +++- xCAT-test/xcattest | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 6187f5d9b2..a04e660755 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,6 +344,8 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", + "sed -i '1i set -x' /etc/profile.d/xcat.sh ", + "cat /etc/profile.d/xcat.sh ", "/etc/profile.d/xcat.sh ", "sudo /opt/xcat/sbin/tabdump policy", "sudo /opt/xcat/sbin/tabdump site", @@ -477,7 +479,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l | grep chdef_t"; + $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 571172a521..3bc142d8de 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1609,8 +1609,8 @@ sub setup_env_by_configure_file { my @output2 = &runcmd("sudo lsdef -t site clustersite -i domain -c"); print "MG_LSDEF:\n " . Dumper \@output2; print "MG Running verification tabdump"; - my @output2 = &runcmd("sudo tabdump site"); - print "MG_LSDEF:\n " . Dumper \@output2; + my @output3 = &runcmd("sudo tabdump site"); + print "MG_LSDEF:\n " . Dumper \@output3; return 1; } } From f5ac1fece8aac652b40c1f32668ccb89a70c7edb Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 13 Jul 2022 16:43:38 -0400 Subject: [PATCH 061/188] Debug command output15 --- github_action_xcat_test.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index a04e660755..b0040cc887 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,9 +344,10 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", - "sed -i '1i set -x' /etc/profile.d/xcat.sh ", + "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh ", "/etc/profile.d/xcat.sh ", + "echo \$PATH", "sudo /opt/xcat/sbin/tabdump policy", "sudo /opt/xcat/sbin/tabdump site", "sudo /opt/xcat/bin/lsxcatd -a", @@ -376,7 +377,7 @@ sub install_xcat{ } if($ret){ - $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information"; + $check_result_str .= "> **INSTALL XCAT ERROR** : Please click ``Details`` label in ``Merge pull request`` box for detailed information\n"; print $check_result_str; return 1; } From f5ee7934c7829815725da81065fbd863677973af Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 09:33:07 -0400 Subject: [PATCH 062/188] Debug command output16 --- github_action_xcat_test.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index b0040cc887..eff43cce36 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -346,11 +346,12 @@ sub install_xcat{ "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh ", - "/etc/profile.d/xcat.sh ", "echo \$PATH", - "sudo /opt/xcat/sbin/tabdump policy", - "sudo /opt/xcat/sbin/tabdump site", - "sudo /opt/xcat/bin/lsxcatd -a", + "source /etc/profile.d/xcat.sh ", + "echo \$PATH", + "sudo tabdump policy", + "sudo tabdump site", + "sudo lsxcatd -a", "ls /opt/xcat/sbin", "sudo service xcatd status"); my $ret = 0; @@ -385,7 +386,9 @@ sub install_xcat{ $check_result_str .= "> **INSTALL XCAT SUCCESSFUL**"; print $check_result_str; } - return 0; + # MG + return 1; + # return 0; } From 4cde750b3f85f277d108fcceaf9959178303f798 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 09:45:05 -0400 Subject: [PATCH 063/188] Debug command output17 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index eff43cce36..824009dee8 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -347,7 +347,7 @@ sub install_xcat{ "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh ", "echo \$PATH", - "source /etc/profile.d/xcat.sh ", + "sudo source /etc/profile.d/xcat.sh ", "echo \$PATH", "sudo tabdump policy", "sudo tabdump site", From d316e205cf5602fb9583fd78a13720f6e7ff2ef3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 10:02:52 -0400 Subject: [PATCH 064/188] Debug command output18 --- github_action_xcat_test.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 824009dee8..466bda32a9 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,10 +344,11 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", + "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", - "cat /etc/profile.d/xcat.sh ", + "cat /etc/profile.d/xcat.sh", "echo \$PATH", - "sudo source /etc/profile.d/xcat.sh ", + "/etc/profile.d/xcat.sh", "echo \$PATH", "sudo tabdump policy", "sudo tabdump site", From b0a32dd87e0573e5290074e7df95ff11d3a80a17 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 10:18:33 -0400 Subject: [PATCH 065/188] Debug command output19 --- github_action_xcat_test.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 466bda32a9..9aadd0903d 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,8 +344,9 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", - "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", + "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", + "sudo echo 'export PATH' >> /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh", "echo \$PATH", "/etc/profile.d/xcat.sh", From 8af1d7a302428b2808ef3d0f03961c0609c61694 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 10:31:57 -0400 Subject: [PATCH 066/188] Debug command output20 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 9aadd0903d..b8af79ea5d 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -346,7 +346,7 @@ sub install_xcat{ "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", - "sudo echo 'export PATH' >> /etc/profile.d/xcat.sh ", + "sudo sed -i '\$aexport PATH' /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh", "echo \$PATH", "/etc/profile.d/xcat.sh", From 676d8dad4c34881bbf2993203ecd9071ffd28398 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 10:49:36 -0400 Subject: [PATCH 067/188] Debug command output21 --- github_action_xcat_test.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index b8af79ea5d..8b1fe5b5cb 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -346,10 +346,9 @@ sub install_xcat{ "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", - "sudo sed -i '\$aexport PATH' /etc/profile.d/xcat.sh ", "cat /etc/profile.d/xcat.sh", "echo \$PATH", - "/etc/profile.d/xcat.sh", + "/etc/profile.d/xcat.sh && export PATH", "echo \$PATH", "sudo tabdump policy", "sudo tabdump site", From 1a004cc223ad03d7f4dd0c12025f12142882d0ba Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 11:11:35 -0400 Subject: [PATCH 068/188] Debug command output22 --- github_action_xcat_test.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 8b1fe5b5cb..de239c54e3 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -350,6 +350,8 @@ sub install_xcat{ "echo \$PATH", "/etc/profile.d/xcat.sh && export PATH", "echo \$PATH", + "export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH" + "echo \$PATH", "sudo tabdump policy", "sudo tabdump site", "sudo lsxcatd -a", From d7566f900e43ee9cb2e1376fac9c011f5eb27ffe Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 11:31:05 -0400 Subject: [PATCH 069/188] Debug command output23 --- github_action_xcat_test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index de239c54e3..ce185015ae 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -350,7 +350,7 @@ sub install_xcat{ "echo \$PATH", "/etc/profile.d/xcat.sh && export PATH", "echo \$PATH", - "export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH" + "export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", "sudo tabdump policy", "sudo tabdump site", From 663bd294f9ea06d4dfd311544e0c208c825fd87e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 11:49:40 -0400 Subject: [PATCH 070/188] Debug command output24 --- .github/workflows/xcat_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 781934c5e2..2fed8e6730 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -7,4 +7,5 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common + - run: echo "/opt/xcat/bin:/opt/xcat/sbin" >> $GITHUB_PATH - run: perl github_action_xcat_test.pl From 29c85cf0994df779f62a7ccc3e6ab5372b20cc58 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 12:05:22 -0400 Subject: [PATCH 071/188] Debug command output25 --- .github/workflows/xcat_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 2fed8e6730..0c151ae906 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -7,5 +7,5 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common - - run: echo "/opt/xcat/bin:/opt/xcat/sbin" >> $GITHUB_PATH + - run: echo "$GITHUB_WORKSPACE/opt/xcat/bin:$GITHUB_WORKSPACE/opt/xcat/sbin" >> $GITHUB_PATH - run: perl github_action_xcat_test.pl From 2029ce38f2c63475c2a883c8029fdab953a0da0b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 12:31:21 -0400 Subject: [PATCH 072/188] Debug command output26 --- .github/workflows/xcat_test.yml | 1 + github_action_xcat_test.pl | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 0c151ae906..573ec75fa6 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -8,4 +8,5 @@ jobs: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common - run: echo "$GITHUB_WORKSPACE/opt/xcat/bin:$GITHUB_WORKSPACE/opt/xcat/sbin" >> $GITHUB_PATH + - run: echo "/opt/xcat/bin:/opt/xcat/sbin" >> $GITHUB_PATH - run: perl github_action_xcat_test.pl diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index ce185015ae..22b2589c0f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,17 +344,17 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", - "sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", - "sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", - "cat /etc/profile.d/xcat.sh", + #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", + #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", + #"cat /etc/profile.d/xcat.sh", + #"echo \$PATH", + #"/etc/profile.d/xcat.sh && export PATH", + #"echo \$PATH", + #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", - "/etc/profile.d/xcat.sh && export PATH", - "echo \$PATH", - "export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", - "echo \$PATH", - "sudo tabdump policy", + "tabdump policy", "sudo tabdump site", - "sudo lsxcatd -a", + "lsxcatd -a", "ls /opt/xcat/sbin", "sudo service xcatd status"); my $ret = 0; From 8953e4ab862991c87dd98124189ea71018d5c47a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 12:48:24 -0400 Subject: [PATCH 073/188] Debug command output27 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 22b2589c0f..f3d818aa59 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -342,8 +342,8 @@ sub install_xcat{ print "[install_xcat] $cmd ....[Pass]\n"; print "\n------Config xcat and verify xcat is working correctly-----\n"; - @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", - "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", + @cmds = (#"sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", + #"sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", #"cat /etc/profile.d/xcat.sh", From 8832ae6c9df729316ecc4e774f8c97624cae9b76 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:05:56 -0400 Subject: [PATCH 074/188] Debug command output28 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index f3d818aa59..d4abb8bc53 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -342,7 +342,7 @@ sub install_xcat{ print "[install_xcat] $cmd ....[Pass]\n"; print "\n------Config xcat and verify xcat is working correctly-----\n"; - @cmds = (#"sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f githubaction", + @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f", #"sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", @@ -352,7 +352,7 @@ sub install_xcat{ #"echo \$PATH", #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", - "tabdump policy", + ". /etc/profile.d/xcat.sh && tabdump policy", "sudo tabdump site", "lsxcatd -a", "ls /opt/xcat/sbin", From 1e1aeff63b8abc890d8fc8386d1182c58a9f4032 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:17:11 -0400 Subject: [PATCH 075/188] Debug command output29 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index d4abb8bc53..e5a3f7676d 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -342,7 +342,7 @@ sub install_xcat{ print "[install_xcat] $cmd ....[Pass]\n"; print "\n------Config xcat and verify xcat is working correctly-----\n"; - @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f", + @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh", #"sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", @@ -352,7 +352,7 @@ sub install_xcat{ #"echo \$PATH", #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", - ". /etc/profile.d/xcat.sh && tabdump policy", + ". /etc/profile.d/xcat.sh && sudo tabdump policy", "sudo tabdump site", "lsxcatd -a", "ls /opt/xcat/sbin", From 778294254aaab899990964ed84bda3975415ae2e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:18:30 -0400 Subject: [PATCH 076/188] Debug command output30 --- github_action_xcat_test.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index e5a3f7676d..6879d5eb01 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -343,6 +343,7 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh", + "cat /etc/passwd", #"sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", From c1a059ac907203de0c7575af2d33e6ddc2665954 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:30:35 -0400 Subject: [PATCH 077/188] Debug command output31 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 6879d5eb01..846ea2f994 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -342,9 +342,9 @@ sub install_xcat{ print "[install_xcat] $cmd ....[Pass]\n"; print "\n------Config xcat and verify xcat is working correctly-----\n"; - @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh", + @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f runner", "cat /etc/passwd", - #"sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=githubaction policy.rule=allow", + "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=runner policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", #"cat /etc/profile.d/xcat.sh", From e47f12a833894c795ff6e4e81d858bdbed6be41a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:44:31 -0400 Subject: [PATCH 078/188] Debug command output32 --- github_action_xcat_test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 846ea2f994..6550da50bb 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -353,11 +353,11 @@ sub install_xcat{ #"echo \$PATH", #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", - ". /etc/profile.d/xcat.sh && sudo tabdump policy", + ". /etc/profile.d/xcat.sh && tabdump policy", "sudo tabdump site", "lsxcatd -a", "ls /opt/xcat/sbin", - "sudo service xcatd status"); + "service xcatd status"); my $ret = 0; foreach my $cmd (@cmds){ print "\n[install_xcat] running $cmd.....\n"; From c5990db071d6963b6d6710c69a78ca98ca5b2fce Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 13:55:45 -0400 Subject: [PATCH 079/188] Debug command output33 --- github_action_xcat_test.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 6550da50bb..ae699cbf39 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -343,7 +343,6 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f runner", - "cat /etc/passwd", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=runner policy.rule=allow", #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", @@ -354,7 +353,7 @@ sub install_xcat{ #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", ". /etc/profile.d/xcat.sh && tabdump policy", - "sudo tabdump site", + ". /etc/profile.d/xcat.sh && sudo tabdump site", "lsxcatd -a", "ls /opt/xcat/sbin", "service xcatd status"); From 59ce93159300439224d734e796c77f1c534fbf8e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 14:06:05 -0400 Subject: [PATCH 080/188] Debug command output34 --- .github/workflows/xcat_test.yml | 2 -- github_action_xcat_test.pl | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 573ec75fa6..781934c5e2 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -7,6 +7,4 @@ jobs: steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common - - run: echo "$GITHUB_WORKSPACE/opt/xcat/bin:$GITHUB_WORKSPACE/opt/xcat/sbin" >> $GITHUB_PATH - - run: echo "/opt/xcat/bin:/opt/xcat/sbin" >> $GITHUB_PATH - run: perl github_action_xcat_test.pl diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index ae699cbf39..01a27fa77f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -353,7 +353,7 @@ sub install_xcat{ #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", "echo \$PATH", ". /etc/profile.d/xcat.sh && tabdump policy", - ". /etc/profile.d/xcat.sh && sudo tabdump site", + ". /etc/profile.d/xcat.sh && tabdump site", "lsxcatd -a", "ls /opt/xcat/sbin", "service xcatd status"); From 4764457cf291fd1feb6476726065ed5dd18ed7bf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 14:20:41 -0400 Subject: [PATCH 081/188] Debug command output35 --- github_action_xcat_test.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 01a27fa77f..9cdb18282f 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -354,7 +354,7 @@ sub install_xcat{ "echo \$PATH", ". /etc/profile.d/xcat.sh && tabdump policy", ". /etc/profile.d/xcat.sh && tabdump site", - "lsxcatd -a", + ". /etc/profile.d/xcat.sh && lsxcatd -a", "ls /opt/xcat/sbin", "service xcatd status"); my $ret = 0; @@ -389,9 +389,7 @@ sub install_xcat{ $check_result_str .= "> **INSTALL XCAT SUCCESSFUL**"; print $check_result_str; } - # MG - return 1; - # return 0; + return 0; } @@ -486,7 +484,7 @@ sub run_fast_regression_test{ @output = runcmd("cat $conf_file"); print Dumper \@output; - $cmd = "sudo /opt/xcat/bin/xcattest -s \"ci_test\" -l"; + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -s \"ci_test\" -l'"; my @caseslist = runcmd("$cmd"); if($::RUNCMD_RC){ print RED "[run_fast_regression_test] $cmd ....[Failed]\n"; @@ -505,10 +503,10 @@ sub run_fast_regression_test{ my $failnum = 0; foreach my $case (@caseslist){ ++$x; - $cmd = "sudo /opt/xcat/bin/xcattest -f $conf_file -t $case"; + $cmd = "sudo bash -c '. /etc/profile.d/xcat.sh && xcattest -f $conf_file -t $case'"; print "[run_fast_regression_test] run $x: $cmd\n"; @output = runcmd("$cmd"); - print Dumper \@output; + #print Dumper \@output; for(my $i = $#output; $i>-1; --$i){ if($output[$i] =~ /------END::(.+)::Failed/){ push @failcase, $1; From f2627be5d3acd13a573e2e0d2cdaccf060fb3f83 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 15:13:53 -0400 Subject: [PATCH 082/188] Debug command output36 --- github_action_xcat_test.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 9cdb18282f..3601fbde25 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -494,6 +494,7 @@ sub run_fast_regression_test{ }else{ print "[run_fast_regression_test] $cmd .....:\n"; print Dumper \@caseslist; + return 1; } my $casenum = @caseslist; From 67be19e97d6066d4ea4096949f850e9bcde4b1e5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 15:31:16 -0400 Subject: [PATCH 083/188] Debug command output37 --- xCAT-test/xcattest | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index 3bc142d8de..d3469fdf2c 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -1577,7 +1577,7 @@ sub setup_env_by_configure_file { if (exists $$config_ref{object}) { foreach my $type (keys %{ $$config_ref{object} }) { foreach my $name (keys %{ $$config_ref{object}{$type} }) { - $cmd = "sudo /opt/xcat/bin/chdef -t $type -o $name"; + $cmd = "chdef -t $type -o $name"; foreach my $attr (keys %{ $$config_ref{object}{$type}{$name} }) { $cmd = $cmd . " $attr=$$config_ref{object}{$type}{$name}{$attr}"; } @@ -1594,23 +1594,18 @@ sub setup_env_by_configure_file { if (exists $$config_ref{table}) { foreach my $type (keys %{ $$config_ref{table} }) { foreach my $name (keys %{ $$config_ref{table}{$type} }) { - $cmd = "sudo /opt/xcat/sbin/chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; + $cmd = "chtab $$config_ref{table}{$type}{$name}{__KEY__}=$name"; foreach my $attr (keys %{ $$config_ref{table}{$type}{$name} }) { if ($attr ne '__KEY__') { $cmd = $cmd . " $type.$attr=$$config_ref{table}{$type}{$name}{$attr}"; } } log_this($running_log_fd, "$cmd"); - my @output = &runcmd($cmd); + #my @output = &runcmd($cmd); + &runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Failed3 to run $cmd OUTPUT: @output"; - print Dumper \@output; - print "MG Running verification lsdef"; - my @output2 = &runcmd("sudo lsdef -t site clustersite -i domain -c"); - print "MG_LSDEF:\n " . Dumper \@output2; - print "MG Running verification tabdump"; - my @output3 = &runcmd("sudo tabdump site"); - print "MG_LSDEF:\n " . Dumper \@output3; + #$$error_ref = "MG Failed3 to run $cmd OUTPUT: @output"; + $$error_ref = "Failed to run $cmd"; return 1; } } @@ -1700,7 +1695,7 @@ sub runcmd $::RUNCMD_RC = $rc; print " RUNCMD_RC=$::RUNCMD_RC\n"; } - print "MG3 " . Dumper $outref; + #print "MG3 " . Dumper $outref; chomp(@$outref); return @$outref; From 47ed0d3650811e3d96f4fa493d7288b1036cf990 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 15:47:11 -0400 Subject: [PATCH 084/188] Debug command output38 --- xCAT-test/xcattest | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index d3469fdf2c..cac3ed4ad0 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -174,12 +174,12 @@ if($search_expression){ log_this($running_log_fd, "$error"); to_exit(1); } - #if($xcatdebug){ + if($xcatdebug){ print "------The total labels are:---------\n"; print Dumper \@total_label_set; print "------The case and its labels:-------\n"; print Dumper \%case_label_map; - #} + } } $rst = calculate_cases_to_be_run(\@cases_to_be_run, \$error); @@ -1565,11 +1565,9 @@ sub setup_env_by_configure_file { my $cmd = undef; foreach $cmd (@{ $$config_ref{script_prev} }) { log_this($running_log_fd, "$cmd"); - #MG - my @output = &runcmd($cmd); + &runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Failed1 to run $cmd OUTPUT: @output"; - log_this($running_log_fd, "$cmd", "OUTPUT ", @output); + $$error_ref = "Failed to run $cmd"; return 1; } } @@ -1582,9 +1580,9 @@ sub setup_env_by_configure_file { $cmd = $cmd . " $attr=$$config_ref{object}{$type}{$name}{$attr}"; } log_this($running_log_fd, "$cmd"); - my @output = runcmd($cmd); + runcmd($cmd); if ($::RUNCMD_RC != 0) { - $$error_ref = "Failed2 to run $cmd"; + $$error_ref = "Failed to run $cmd"; return 1; } } @@ -1601,10 +1599,8 @@ sub setup_env_by_configure_file { } } log_this($running_log_fd, "$cmd"); - #my @output = &runcmd($cmd); &runcmd($cmd); if ($::RUNCMD_RC != 0) { - #$$error_ref = "MG Failed3 to run $cmd OUTPUT: @output"; $$error_ref = "Failed to run $cmd"; return 1; } @@ -1690,12 +1686,9 @@ sub runcmd if ($?) { $rc = $?; - print "MG rc=$rc"; $rc = $rc >> 8; $::RUNCMD_RC = $rc; - print " RUNCMD_RC=$::RUNCMD_RC\n"; } - #print "MG3 " . Dumper $outref; chomp(@$outref); return @$outref; From 071c6f1c2af4a4d9f09bd8ccc9c2c0a4c9cf154a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 14 Jul 2022 16:13:42 -0400 Subject: [PATCH 085/188] Debug command output39 --- github_action_xcat_test.pl | 9 --------- 1 file changed, 9 deletions(-) diff --git a/github_action_xcat_test.pl b/github_action_xcat_test.pl index 3601fbde25..e0b53e2731 100644 --- a/github_action_xcat_test.pl +++ b/github_action_xcat_test.pl @@ -344,14 +344,6 @@ sub install_xcat{ print "\n------Config xcat and verify xcat is working correctly-----\n"; @cmds = ("sudo -s /opt/xcat/share/xcat/scripts/setup-local-client.sh -f runner", "sudo -s /opt/xcat/sbin/chtab priority=1.1 policy.name=runner policy.rule=allow", - #"sudo sed -i '1i set -x' /etc/profile.d/xcat.sh ", - #"sudo sed -i '1i #!/bin/bash' /etc/profile.d/xcat.sh ", - #"cat /etc/profile.d/xcat.sh", - #"echo \$PATH", - #"/etc/profile.d/xcat.sh && export PATH", - #"echo \$PATH", - #"export PATH=/opt/xcat/bin:/opt/xcat/sbin/:\$PATH", - "echo \$PATH", ". /etc/profile.d/xcat.sh && tabdump policy", ". /etc/profile.d/xcat.sh && tabdump site", ". /etc/profile.d/xcat.sh && lsxcatd -a", @@ -494,7 +486,6 @@ sub run_fast_regression_test{ }else{ print "[run_fast_regression_test] $cmd .....:\n"; print Dumper \@caseslist; - return 1; } my $casenum = @caseslist; From 7e5632ace6ba13a24b51b86f858c3653393bf572 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 15 Jul 2022 10:27:14 -0400 Subject: [PATCH 086/188] Fix rmvm man page formatting --- .../admin-guides/references/man1/rmvm.1.rst | 47 +++++++++++++++---- xCAT-client/pods/man1/rmvm.1.pod | 35 ++++++++++---- 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rmvm.1.rst b/docs/source/guides/admin-guides/references/man1/rmvm.1.rst index 304d32dc0b..f0ff04598a 100644 --- a/docs/source/guides/admin-guides/references/man1/rmvm.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rmvm.1.rst @@ -47,7 +47,7 @@ DESCRIPTION The \ **rmvm**\ command removes the partitions specified in \ *noderange*\ . If \ *noderange*\ is an CEC, all the partitions associated with that CEC will be removed. Note that removed partitions are automatically removed from the xCAT database. For IVM-managed systems, care must be taken to not remove the VIOS partition, or all the associated partitions will be removed as well. -For DFM-managed (short For Direct FSP Management mode) normal power machines, only partitions can be removed. No options is needed. +For DFM-managed (short For Direct FSP Management mode) normal Power machines, only partitions can be removed. No options are needed. ******* @@ -55,23 +55,50 @@ OPTIONS ******* -\ **-h|-**\ **-help**\ Display usage message. -\ **-v|-**\ **-version**\ Command Version. +\ **-h|-**\ **-help**\ + + Display usage message. + -\ **-V|-**\ **-verbose**\ Verbose output. -\ **-r**\ Retain the data object definitions of the nodes. +\ **-v|-**\ **-version**\ + + Command Version. + + + +\ **-V|-**\ **-verbose**\ + + Verbose output. + + + +\ **-r**\ + + Retain the data object definitions of the nodes. + + + +\ **-**\ **-service**\ + + Remove the service partitions of the specified CECs. + -\ **-**\ **-service**\ Remove the service partitions of the specified CECs. \ **-p**\ + + KVM: Purge the existence of the VM from persistent storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration. Storage devices of "raw" or "block" type are not removed. + + PPC: Remove the specified partition on normal Power machine. + -KVM: Purge the existence of the VM from persistent storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration. Storage devices of "raw" or "block" type are not removed. -PPC: Remove the specified partition on normal power machine. +\ **-f**\ + + Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. + -\ **-f**\ Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. ************ @@ -172,7 +199,7 @@ Output is similar to: gpok4: Deleting virtual server LNX4... Done -6. To remove a DFM-managed partition on normal power machine: +6. To remove a DFM-managed partition on normal Power machine: .. code-block:: perl diff --git a/xCAT-client/pods/man1/rmvm.1.pod b/xCAT-client/pods/man1/rmvm.1.pod index a649b5ac55..5b29d03e62 100644 --- a/xCAT-client/pods/man1/rmvm.1.pod +++ b/xCAT-client/pods/man1/rmvm.1.pod @@ -22,28 +22,43 @@ B I The B command removes the partitions specified in I. If I is an CEC, all the partitions associated with that CEC will be removed. Note that removed partitions are automatically removed from the xCAT database. For IVM-managed systems, care must be taken to not remove the VIOS partition, or all the associated partitions will be removed as well. -For DFM-managed (short For Direct FSP Management mode) normal power machines, only partitions can be removed. No options is needed. +For DFM-managed (short For Direct FSP Management mode) normal Power machines, only partitions can be removed. No options are needed. =head1 OPTIONS +=over 10 -B<-h|--help> Display usage message. +=item B<-h|--help> -B<-v|--version> Command Version. +Display usage message. -B<-V|--verbose> Verbose output. +=item B<-v|--version> -B<-r> Retain the data object definitions of the nodes. +Command Version. -B<--service> Remove the service partitions of the specified CECs. +=item B<-V|--verbose> -B<-p> +Verbose output. + +=item B<-r> + +Retain the data object definitions of the nodes. + +=item B<--service> + +Remove the service partitions of the specified CECs. + +=item B<-p> KVM: Purge the existence of the VM from persistent storage. This will erase all storage related to the VM in addition to removing it from the active virtualization configuration. Storage devices of "raw" or "block" type are not removed. -PPC: Remove the specified partition on normal power machine. +PPC: Remove the specified partition on normal Power machine. + +=item B<-f> + +Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. -B<-f> Force remove the VM, even if the VM appears to be online. This will bring down a live VM if requested. +=back =head1 RETURN VALUE @@ -97,7 +112,7 @@ Output is similar to: gpok4: Deleting virtual server LNX4... Done -6. To remove a DFM-managed partition on normal power machine: +6. To remove a DFM-managed partition on normal Power machine: rmvm lpar1 From 8c8567f7d0b6ccc59dd452b35294643b0d18ac31 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 3 Aug 2022 16:13:22 -0400 Subject: [PATCH 087/188] Add perl packages for building on CentOS8 (5) --- xCAT-client/xCAT-client.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index cd64489bda..ac6d2bcc8c 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -30,6 +30,7 @@ Requires: cpio # 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 +Recommends: perl-Sys-Syslog perl-Text-Balanced perl-JSON perl-Expect %else Requires: expat %endif From 83ffef8f94e4465446f7d49d54795b7b8f8821a7 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 5 Aug 2022 11:04:38 -0400 Subject: [PATCH 088/188] Add force option to update_mlnx_adapter_firmware script --- xCAT/postscripts/update_mlnx_adapter_firmware | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/update_mlnx_adapter_firmware b/xCAT/postscripts/update_mlnx_adapter_firmware index faa6189639..bc8f51913d 100755 --- a/xCAT/postscripts/update_mlnx_adapter_firmware +++ b/xCAT/postscripts/update_mlnx_adapter_firmware @@ -3,7 +3,8 @@ # Sample postscript that can be executed to help update the firmware level on # Mellanox hardware adapters on the target nodes # -# This script requires passing in the path of the Mellanox OFED ISO +# This script requires passing in an optional force (-f) flag and +# the path of the Mellanox OFED ISO # located on the xCAT Management node under the /install directory. # # If OFED file is located here: @@ -11,10 +12,24 @@ # # Call the script as follows: # updatenode -P "update_mlnx_adapter_firmware /install/mlnxofed/MLNX_OFED_LINUX-4.1-4.0.7.1-rhel7.4alternate-ppc64le.iso" +# or +# updatenode -P "update_mlnx_adapter_firmware -f /install/mlnxofed/MLNX_OFED_LINUX-4.1-4.0.7.1-rhel7.4alternate-ppc64le.iso" # + +FORCE="" +while getopts "f" option +do + case "${option}" in + f) FORCE="--force-fw-update" + shift;; + *) echo "Usage: ${0} [-f] " + exit 1;; + esac +done + MLNX_OFED_PATH=${1} -if [[ -z ${1} ]]; then +if [[ -z ${MLNX_OFED_PATH} ]]; then echo "Error: you must provide the path of the MLNX OFED ISO file" exit 1 fi @@ -41,7 +56,7 @@ mkdir -p ${MOUNT_DIR} mount -o ro,loop ${TARGET_ISO_FILE} ${MOUNT_DIR} ls -ltr ${MOUNT_DIR} -${MOUNT_DIR}/mlnxofedinstall --fw-update-only +${MOUNT_DIR}/mlnxofedinstall --fw-update-only ${FORCE} # # Clean up From 4c18f63eb58788eec4cfa282da61a860bae21b51 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 9 Aug 2022 16:01:33 -0400 Subject: [PATCH 089/188] Add perl packages for building on CentOS8 (6) --- xCAT-client/xCAT-client.spec | 2 +- xCAT-server/xCAT-server.spec | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index ac6d2bcc8c..f7d6b88a70 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -29,8 +29,8 @@ Requires: cpio # fping or nmap is needed by pping (in case xCAT-client is installed by itself on a remote client) %ifos linux +BuildRequires: perl-generators Requires: nmap perl-XML-Simple perl-XML-Parser -Recommends: perl-Sys-Syslog perl-Text-Balanced perl-JSON perl-Expect %else Requires: expat %endif diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 912796a0bd..e95b0b69da 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -37,6 +37,7 @@ BuildArch: noarch %if %s390x Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser %else +BuildRequires: perl-generators Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(LWP::Protocol::https) perl-XML-LibXML %endif Obsoletes: atftp-xcat From 05bceac0728bd30594ea78258f693a7a89d7a790 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 11 Aug 2022 13:38:26 -0400 Subject: [PATCH 090/188] Prevent rpmbuild from checking and modifying interpreter directives --- xCAT-server/xCAT-server.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index e95b0b69da..0823f2a1fe 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -28,6 +28,9 @@ AutoReqProv: no # Define a different location for various httpd configs in s390x mode %define httpconfigdir %(if [ "$s390x" = "1" ];then echo "xcathttpdsave"; else echo "xcat"; fi) +# Disable shebang mangling of python scripts +%undefine __brp_mangle_shebangs + # AIX will build with an arch of "ppc" # also need to fix Requires for AIX %ifos linux From 17d5912d24bc7a42aaa5f47d44aec7ad7baa8152 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 11 Aug 2022 14:10:01 -0400 Subject: [PATCH 091/188] Prevent rpmbuild from checking and modifying interpreter directives2 --- xCAT-openbmc-py/xCAT-openbmc-py.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-openbmc-py/xCAT-openbmc-py.spec b/xCAT-openbmc-py/xCAT-openbmc-py.spec index 563b34a2aa..a323b5d8af 100644 --- a/xCAT-openbmc-py/xCAT-openbmc-py.spec +++ b/xCAT-openbmc-py/xCAT-openbmc-py.spec @@ -12,6 +12,9 @@ Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} Prefix: /opt/xcat BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root +# Disable shebang mangling of python scripts +%undefine __brp_mangle_shebangs + %ifnos linux AutoReqProv: no %endif From 6f12483b79553dbc76dd49afa17c5b675f2015dc Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 12 Aug 2022 08:38:29 -0400 Subject: [PATCH 092/188] Prevent rpmbuild from checking and modifying interpreter directives(2) --- xCAT-probe/xCAT-probe.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xCAT-probe/xCAT-probe.spec b/xCAT-probe/xCAT-probe.spec index 847f8a4ab7..108774e7d7 100644 --- a/xCAT-probe/xCAT-probe.spec +++ b/xCAT-probe/xCAT-probe.spec @@ -13,6 +13,9 @@ Prefix: /opt/xcat BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root Requires: xCAT-client = 4:%{version}-%{release} +# Disable shebang mangling of python scripts +%undefine __brp_mangle_shebangs + %ifos linux BuildArch: noarch %endif From 71d3b76881b000b79ce552697aec6da1270a4c62 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 15 Aug 2022 10:16:22 -0400 Subject: [PATCH 093/188] Check SUSE-brand file on SLES --- xCAT-server/lib/xcat/plugins/updatenode.pm | 13 ++++++++++++- .../xcat/ib/scripts/Mellanox/mlnxofed_ib_install | 2 +- xCAT-server/share/xcat/ib/scripts/configiba.1port | 2 +- xCAT-server/share/xcat/ib/scripts/configiba.2ports | 4 ++-- .../share/xcat/netboot/add-on/torque/add_torque | 2 +- xCAT-server/share/xcat/netboot/suse/genimage | 2 +- xCAT-server/share/xcat/scripts/xHRM | 2 +- xCAT-server/share/xcat/tools/go-xcat | 3 +++ xCAT-server/share/xcat/tools/mktoolscenter | 2 ++ xCAT-server/xCAT-wsapi/xcatws.cgi | 2 +- xCAT-test/autotest/testcase/probe/detect_dhcpd | 2 +- xCAT-vlan/install/postscripts/configvlan | 4 ++-- xCAT-vlan/install/postscripts/deconfigvlan | 4 ++-- xCAT/postscripts/configfirewall | 2 +- xCAT/postscripts/configib | 2 +- xCAT/postscripts/enablekdump | 4 ++-- xCAT/postscripts/killsyslog | 2 +- xCAT/postscripts/routeop | 6 +++--- xCAT/postscripts/setupntp.traditional | 4 ++-- xCAT/postscripts/syslog | 2 +- xCAT/postscripts/xcatdsklspost | 6 +++++- 21 files changed, 46 insertions(+), 26 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 60f8403ed2..6ee068cb7b 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -3352,7 +3352,7 @@ sub updateOS $version =~ s/[^0-9]*([0-9]+).*/$1/; } - # SUSE Linux + # SUSE Linux 12 and earlier elsif ( `ssh -o ConnectTimeout=5 $node "test -f /etc/SuSE-release && echo 'SuSE'"` ) @@ -3363,6 +3363,17 @@ sub updateOS $version =~ s/[^0-9]*([0-9]+).*/$1/; } + # SUSE Linux 15 and later + elsif ( +`ssh -o ConnectTimeout=5 $node "test -f /etc/SUSE-brand && echo 'SuSE'"` + ) + { + $installOS = "sles"; + chomp($version = + `ssh $node "tr -d '.' < /etc/SUSE-brand" | grep VERSION`); + $version =~ s/[^0-9]*([0-9]+).*/$1/; + } + # Everything else else { diff --git a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install index 58a2a4ac69..69c03da1f7 100755 --- a/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install +++ b/xCAT-server/share/xcat/ib/scripts/Mellanox/mlnxofed_ib_install @@ -376,7 +376,7 @@ EOF # Being called from .postinstall script # Assume we are on the same machine - if [ -f /etc/SuSE-release ]; then + if [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then chroot "$IMGROOTPATH" rpm -e --noscripts --allmatches mlnx-ofa_kernel-kmp-default 2>/dev/null chroot "$IMGROOTPATH" rpm -e --nodeps --allmatches libibverbs 2>/dev/null elif grep -q Ubuntu /etc/os-release 2>/dev/null; then diff --git a/xCAT-server/share/xcat/ib/scripts/configiba.1port b/xCAT-server/share/xcat/ib/scripts/configiba.1port index 108e4e5ebd..69e3917299 100755 --- a/xCAT-server/share/xcat/ib/scripts/configiba.1port +++ b/xCAT-server/share/xcat/ib/scripts/configiba.1port @@ -64,7 +64,7 @@ then if [ -f /etc/redhat-release ] then OS_name="redhat" - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="suse" else diff --git a/xCAT-server/share/xcat/ib/scripts/configiba.2ports b/xCAT-server/share/xcat/ib/scripts/configiba.2ports index 91b44f0246..964972c22d 100755 --- a/xCAT-server/share/xcat/ib/scripts/configiba.2ports +++ b/xCAT-server/share/xcat/ib/scripts/configiba.2ports @@ -57,7 +57,7 @@ then if [ -f /etc/redhat-release ] then OS_name="redhat" - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="suse" else @@ -142,7 +142,7 @@ do if [ -f /etc/redhat-release ] then OS_name="redhat" - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="suse" else diff --git a/xCAT-server/share/xcat/netboot/add-on/torque/add_torque b/xCAT-server/share/xcat/netboot/add-on/torque/add_torque index 6180b7be45..32f0112375 100755 --- a/xCAT-server/share/xcat/netboot/add-on/torque/add_torque +++ b/xCAT-server/share/xcat/netboot/add-on/torque/add_torque @@ -101,7 +101,7 @@ echo "export PATH=\$PATH:$TORQUEDIR/\$XARCH/bin:$TORQUEDIR/\$XARCH/sbin" >>etc/p echo "export PBS_DEFAULT=$TORQUESERVER" >>etc/profile.d/torque.sh chmod 755 etc/profile.d/torque.* -if [ -r /etc/SuSE-release ] +if [ -r /etc/SuSE-release ] || [ -r /etc/SUSE-brand ] then cp $XCATROOT/share/xcat/netboot/add-on/torque/pbs_mom.suse etc/init.d/pbs_mom cp $XCATROOT/share/xcat/netboot/add-on/torque/pbs_mom.suse sbin/rcpbs_mom diff --git a/xCAT-server/share/xcat/netboot/suse/genimage b/xCAT-server/share/xcat/netboot/suse/genimage index ffd157a3ca..cbe4ef13bb 100755 --- a/xCAT-server/share/xcat/netboot/suse/genimage +++ b/xCAT-server/share/xcat/netboot/suse/genimage @@ -212,7 +212,7 @@ unless (grep /af_packet/, @ndrivers) { } my $osver_host; -if (`grep VERSION /etc/SuSE-release` =~ /VERSION = (\d+)/) { +if (`grep VERSION /etc/SUSE-brand` =~ /VERSION = (\d+)/) { $osver_host = $1; } else { $osver_host = 11; diff --git a/xCAT-server/share/xcat/scripts/xHRM b/xCAT-server/share/xcat/scripts/xHRM index 4770c7e1ed..03960cad63 100755 --- a/xCAT-server/share/xcat/scripts/xHRM +++ b/xCAT-server/share/xcat/scripts/xHRM @@ -246,7 +246,7 @@ elif [ "bridgeprereq" = "$1" ]; then fi #now save the settings into the config files so that they will be persistent among reboots - if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]]; then + if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]] || [[ -f /etc/SUSE-brand ]]; then nwdir="/etc/sysconfig/network" isSLES=1 elif [ -f "/etc/debian_version" ];then diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index e6d384ce1d..c85c921dba 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -515,6 +515,7 @@ function check_linux_distro() echo "${ID}")" [[ -z "${distro}" && -f /etc/redhat-release ]] && distro="rhel" [[ -z "${distro}" && -f /etc/SuSE-release ]] && distro="sles" + [[ -z "${distro}" && -f /etc/SUSE-brand ]] && distro="sles" echo "${distro}" } @@ -528,6 +529,8 @@ function check_linux_version() /etc/redhat-release)" [[ -z "${ver}" && -f /etc/SuSE-release ]] && ver="$(awk '/VERSION/ { print $NF }' /etc/SuSE-release)" + [[ -z "${ver}" && -f /etc/SUSE-brand ]] && + ver="$(awk '/VERSION/ { print $NF }' /etc/SUSE-brand)" echo "${ver}" } diff --git a/xCAT-server/share/xcat/tools/mktoolscenter b/xCAT-server/share/xcat/tools/mktoolscenter index cd633a785c..7066d97ed4 100755 --- a/xCAT-server/share/xcat/tools/mktoolscenter +++ b/xCAT-server/share/xcat/tools/mktoolscenter @@ -191,6 +191,8 @@ my $OSVER = "unknown"; if (-e '/etc/SuSE-release') { $OSVER = `grep -h VERSION /etc/SuSE-release |awk '{print $3}'` +} elsif (-e '/etc/SUSE-brand') { + $OSVER = `grep -h VERSION /etc/SUSE-brand |awk '{print $3}'` } elsif (-e '/etc/redhat-release') { $OSVER = "rhels" . `cat /etc/redhat-release |cut -f7 -d' '`; chomp($OSVER); diff --git a/xCAT-server/xCAT-wsapi/xcatws.cgi b/xCAT-server/xCAT-wsapi/xcatws.cgi index bd07681372..ac5fbc976c 100755 --- a/xCAT-server/xCAT-wsapi/xcatws.cgi +++ b/xCAT-server/xCAT-wsapi/xcatws.cgi @@ -3449,7 +3449,7 @@ sub fetchParameters { # in the sles 11.x, the 'PUTDATA' param is not supported for PUT method # so we have to work around it by getting it by myself unless ($pdata) { - if (-f "/etc/SuSE-release") { # SUSE os + if ((-f "/etc/SuSE-release") || (-f "/etc/SUSE-brand")) { # SUSE os if ($ENV{'CONTENT_TYPE'} =~ /json/) { $q->read_from_client(\$pdata, $ENV{'CONTENT_LENGTH'}); } diff --git a/xCAT-test/autotest/testcase/probe/detect_dhcpd b/xCAT-test/autotest/testcase/probe/detect_dhcpd index 213f6ab0da..773f25a60e 100644 --- a/xCAT-test/autotest/testcase/probe/detect_dhcpd +++ b/xCAT-test/autotest/testcase/probe/detect_dhcpd @@ -12,7 +12,7 @@ if [ -e "/etc/redhat-release" ]; then if [ "$?" != "0" ] ;then yum install -y tcpdump fi -elif [ -e "/etc/SuSE-release" ]; then +elif [ -e "/etc/SuSE-release" ] || [ -e "/etc/SUSE-brand" ]; then rpm -qa |grep tcpdump if [ "$?" != "0" ] ;then zypper -n install tcpdump diff --git a/xCAT-vlan/install/postscripts/configvlan b/xCAT-vlan/install/postscripts/configvlan index ec7bd025ce..b0a88bc6e7 100755 --- a/xCAT-vlan/install/postscripts/configvlan +++ b/xCAT-vlan/install/postscripts/configvlan @@ -21,7 +21,7 @@ if [[ -z $VLANMAXINDEX ]] || [[ $VLANMAXINDEX -eq 0 ]]; then fi if [[ $OSTYPE = linux* ]]; then - if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]]; then + if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]] || [[ -f /etc/SUSE-base ]]; then nwdir="/etc/sysconfig/network" isSLES=1 else @@ -260,7 +260,7 @@ EOF hostname $VLANHOSTNAME #change the hostname permanently - if [ -f /etc/SuSE-release ] + if [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then #SLES x echo $VLANHOSTNAME > /etc/HOSTNAME diff --git a/xCAT-vlan/install/postscripts/deconfigvlan b/xCAT-vlan/install/postscripts/deconfigvlan index 062ce2b512..11458c85f6 100755 --- a/xCAT-vlan/install/postscripts/deconfigvlan +++ b/xCAT-vlan/install/postscripts/deconfigvlan @@ -15,7 +15,7 @@ if [[ -z $VLANMAXINDEX ]] || [[ $VLANMAXINDEX -eq 0 ]]; then fi if [[ $OSTYPE = linux* ]]; then - if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]]; then + if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]] || [[ -f /etc/SUSE-brand ]]; then nwdir="/etc/sysconfig/network" isSLES=1 else @@ -206,7 +206,7 @@ while [ $index -le $VLANMAXINDEX ]; do hostname $NODE #change the hostname permanently - if [ -f /etc/SuSE-release ] + if [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then #SLES x echo $NODE > /etc/HOSTNAME diff --git a/xCAT/postscripts/configfirewall b/xCAT/postscripts/configfirewall index 800127378a..5da659efc9 100755 --- a/xCAT/postscripts/configfirewall +++ b/xCAT/postscripts/configfirewall @@ -143,7 +143,7 @@ if (-f "/etc/redhat-release") #system($cmd); xCAT::Utils->enableservice("iptables"); } -elsif (-f "/etc/SuSE-release") +elsif ((-f "/etc/SuSE-release") || (-f "/etc/SUSE-brand")) { my $conffile; my $conf; diff --git a/xCAT/postscripts/configib b/xCAT/postscripts/configib index 9f06b47690..b6ecac289f 100755 --- a/xCAT/postscripts/configib +++ b/xCAT/postscripts/configib @@ -165,7 +165,7 @@ then if [ -f /etc/redhat-release ] then OS_name="redhat" - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="suse" elif [ -f /etc/os-release ] && cat /etc/os-release |grep NAME|grep Ubuntu>/dev/null diff --git a/xCAT/postscripts/enablekdump b/xCAT/postscripts/enablekdump index 7c12822407..55ca75d7d9 100755 --- a/xCAT/postscripts/enablekdump +++ b/xCAT/postscripts/enablekdump @@ -40,7 +40,7 @@ for i in `/bin/cat /proc/cmdline`; do done if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then - if (pmatch $OSVER "sle*") || (pmatch $OSVER "suse*") || [ -f /etc/SuSE-release ]; then + if (pmatch $OSVER "sle*") || (pmatch $OSVER "suse*") || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then CONFFILE=$MNTDIR/etc/sysconfig/network/ifcfg-$ETHX fi if (pmatch $OSVER "fedora*") || (pmatch $OSVER "rhel6*") || (pmatch $OSVER "rhels6*") || [ -f /etc/fedora-release ] || [ -f /etc/redhat-release ];then @@ -104,7 +104,7 @@ if [ ! -z "$DUMP" ]; then fi if [ "$KDPROTO" = "nfs" ]; then - if (pmatch $OSVER "sle*") || (pmatch $OSVER "suse*") || [ -f /etc/SuSE-release ]; then + if (pmatch $OSVER "sle*") || (pmatch $OSVER "suse*") || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then if (pmatch $OSVER "*10*"); then #run mkinitrd to generater the kdump-init base if (pmatch $ARCH "x86*"); then diff --git a/xCAT/postscripts/killsyslog b/xCAT/postscripts/killsyslog index e6f6d45458..5be4710e3d 100755 --- a/xCAT/postscripts/killsyslog +++ b/xCAT/postscripts/killsyslog @@ -5,7 +5,7 @@ # (so /a can be umounted cleanly) # SI post-install scripts run in a chroot environment of the final OS image -if [ -f "/etc/SuSE-release" ];then +if [ -f "/etc/SuSE-release" ] || [ -f "/etc/SUSE-brand" ] ;then str_out=`ps -ef | grep -v grep | grep syslog-ng` if [ $? -eq 0 ];then str_id=`echo $str_out | awk '{print $2}'` diff --git a/xCAT/postscripts/routeop b/xCAT/postscripts/routeop index fbded3f97f..1ce7592e69 100755 --- a/xCAT/postscripts/routeop +++ b/xCAT/postscripts/routeop @@ -206,7 +206,7 @@ replace_persistent_route() if [ -f /etc/redhat-release ] then OS_name="redhat" #it can be RedHatFerdora or CentOS - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="sles" else @@ -407,7 +407,7 @@ add_persistent_route() if [ -f /etc/redhat-release ] then OS_name="redhat" #it can be RedHatFerdora or CentOS - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="sles" else @@ -647,7 +647,7 @@ rm_persistent_route() if [ -f /etc/redhat-release ] then OS_name="redhat" #it can be RedHatFerdora or CentOS - elif [ -f /etc/SuSE-release ] + elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ] then OS_name="sles" else diff --git a/xCAT/postscripts/setupntp.traditional b/xCAT/postscripts/setupntp.traditional index 51fb23e731..4f756df325 100755 --- a/xCAT/postscripts/setupntp.traditional +++ b/xCAT/postscripts/setupntp.traditional @@ -94,7 +94,7 @@ if [ $OS_TYPE = Linux ]; then mkdir -p /var/lib/ntp chown ntp /var/lib/ntp - if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then + if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ];then echo "driftfile /var/lib/ntp/drift/ntp.drift" >>$conf_file else echo "driftfile /var/lib/ntp/drift" >>$conf_file @@ -135,7 +135,7 @@ if [ $OS_TYPE = Linux ]; then hwclock --systohc --utc #setup the RTC is UTC format, which will be used by os - if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ];then + if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ];then grep -i -q "HWCLOCK" /etc/sysconfig/clock if [ $? -eq 0 ];then sed -i 's/.*HWCLOCK.*/HWCLOCK=\"-u\"/' /etc/sysconfig/clock diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 69be5579b9..eaa08ff738 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -336,7 +336,7 @@ if [ "$(uname -s)" = "Linux" ]; then fi fi else - if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ]; then + if ( pmatch $OSVER "sle*" ) || ( pmatch $OSVER "suse*" ) || [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then #find out which syslog is used for SLES, syslog or syslog-ng result=`grep "^SYSLOG_DAEMON=" $sysconfig 2>&1` if ( pmatch $result "*syslog-ng*" ); then diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index 98abeff804..4ffb02f771 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -537,10 +537,14 @@ else # for common mode MODE=1,2,3,5 (updatenode,moncfg,node deployment) # download poscripts has not worked yet #try the dhcp server, this is used for initial boot for the node. if [ $downloaded -eq 0 ]; then - #setup $OSVER ,for SLES11 + #setup $OSVER ,for SLES12 and earlier if [ -e '/etc/SuSE-release' ]; then OSVER=`grep -h VERSION /etc/SuSE-release |awk '{print $3}'` fi + #setup $OSVER ,for SLES15 and later + if [ -e '/etc/SUSE-brand' ]; then + OSVER=`grep -h VERSION /etc/SUSE-brand |awk '{print $3}'` + fi SIPS=`grep -h dhcp-server-identifier /var/lib/dhclient/dhclient*eth*.leases 2> /dev/null|awk '{print $3}'|sed -e 's/;//'` if [ -z "$SIPS" ]; then SIPS=`grep -h dhcp-server-identifier /var/lib/dhclient/dhclient*hf*.leases 2> /dev/null|awk '{print $3}'|sed -e 's/;//'` From 23df8f07f77385a5c029b510627514e23757cb33 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 16 Aug 2022 15:35:09 -0400 Subject: [PATCH 094/188] Fixes suggested in review --- xCAT-server/share/xcat/netboot/suse/genimage | 4 +++- xCAT-vlan/install/postscripts/configvlan | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/suse/genimage b/xCAT-server/share/xcat/netboot/suse/genimage index cbe4ef13bb..3bc683a901 100755 --- a/xCAT-server/share/xcat/netboot/suse/genimage +++ b/xCAT-server/share/xcat/netboot/suse/genimage @@ -211,8 +211,10 @@ unless (grep /af_packet/, @ndrivers) { unshift(@ndrivers, "af_packet.ko"); } +# Check both possible SLES files for version number. +# "--no-messages" suppresses "grep: : No such file or directory" my $osver_host; -if (`grep VERSION /etc/SUSE-brand` =~ /VERSION = (\d+)/) { +if (`grep --no-messages VERSION /etc/SuSE-release /etc/SUSE-brand` =~ /VERSION = (\d+)/) { $osver_host = $1; } else { $osver_host = 11; diff --git a/xCAT-vlan/install/postscripts/configvlan b/xCAT-vlan/install/postscripts/configvlan index b0a88bc6e7..76ac1117f4 100755 --- a/xCAT-vlan/install/postscripts/configvlan +++ b/xCAT-vlan/install/postscripts/configvlan @@ -21,7 +21,7 @@ if [[ -z $VLANMAXINDEX ]] || [[ $VLANMAXINDEX -eq 0 ]]; then fi if [[ $OSTYPE = linux* ]]; then - if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]] || [[ -f /etc/SUSE-base ]]; then + if [[ $OSVER = sles* ]] || [[ $OSVER = suse* ]] || [[ -f /etc/SuSE-release ]] || [[ -f /etc/SUSE-brand ]]; then nwdir="/etc/sysconfig/network" isSLES=1 else From 45cfcdd893555f6ae44a8e449b6f291f58608169 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Thu, 18 Aug 2022 22:51:05 -0400 Subject: [PATCH 095/188] Remove invalid default gateway on RHEL 8.x systems --- xCAT/postscripts/configeth | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 6644600e74..48bc72ac39 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -715,7 +715,7 @@ elif [ "$1" = "-s" ];then tmp_con_name=${str_inst_nic}"-tmp" nmcli con modify $con_name connection.id $tmp_con_name fi - nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix} connection.autoconnect-priority 9 + nmcli con add type ethernet con-name $con_name ifname ${str_inst_nic} ipv4.method manual ipv4.addresses ${str_inst_ip}/${str_inst_prefix} connection.autoconnect-priority 9 gw4 ${str_inst_gateway} str_conf_file_1="/etc/sysconfig/network-scripts/ifcfg-xcat-${str_inst_nic}-1" if [ -f $str_conf_file_1 ]; then grep $con_name $str_conf_file_1 >/dev/null 2>/dev/null @@ -732,6 +732,7 @@ elif [ "$1" = "-s" ];then echo "ONBOOT=yes" >> $str_conf_file echo "NAME=${con_name}" >> $str_conf_file echo "HWADDR=${str_inst_mac}" >> $str_conf_file + echo "GATEWAY=${str_inst_gateway}" >> $str_conf_file fi if [ $networkmanager_active -eq 2 ]; then echo "AUTOCONNECT_PRIORITY=9" >> $str_conf_file @@ -747,14 +748,6 @@ elif [ "$1" = "-s" ];then else echo "MTU=${str_inst_mtu}" >> $str_conf_file fi - fi - if [ -n "$str_inst_gateway" ];then - grep -i "GATEWAY" /etc/sysconfig/network - if [ $? -eq 0 ];then - sed -i "s/.*GATEWAY.*/GATEWAY=${str_inst_gateway}/i" /etc/sysconfig/network - else - echo "GATEWAY=${str_inst_gateway}" >> /etc/sysconfig/network - fi fi #add extra params i=0 From f5cc2631bf6c1dd73c0f470792cda1e2a05ce36a Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Tue, 23 Aug 2022 08:27:07 -0700 Subject: [PATCH 096/188] Update xCAT-genesis-base.spec Automatically get xCAT version from installed package, rather than having to manually replace the `%%REPLACE_CURRENT_VERSION%%` string. --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 831008d411..a45c08cb0e 100644 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%define version %%REPLACE_CURRENT_VERSION%% +%define version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null) Version: %{?version:%{version}}%{!?version:%(cat Version)} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 From f52c2aa7df8a958a67a2d7aee6e77b09b823ab1d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 23 Aug 2022 16:31:56 -0400 Subject: [PATCH 097/188] Support module installation on RHEL8 --- .../additionalpkg/nonubuntu_os_pkg.rst | 22 ++++---- .../autotest/bundle/rhels_ppcle_weekly.bundle | 1 + .../autotest/bundle/rhels_x86_weekly.bundle | 1 + ...kfull_installation_flat_modules_and_groups | 39 ++++++++++++++ ...kless_installation_flat_modules_and_groups | 52 +++++++++++++++++++ xCAT/postscripts/ospkgs | 11 ++-- 6 files changed, 111 insertions(+), 15 deletions(-) create mode 100644 xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups create mode 100644 xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/nonubuntu_os_pkg.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/nonubuntu_os_pkg.rst index 7380332a98..1968f5b7f9 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/nonubuntu_os_pkg.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/additionalpkg/nonubuntu_os_pkg.rst @@ -77,31 +77,33 @@ where **/install/post/custom//myotherlist** is another package list file Note: the trailing **"#"** character at the end of the line. It is important to specify this character for correct pkglist parsing. -Group/Pattern Names -''''''''''''''''''' +Module/Group/Pattern Names +'''''''''''''''''''''''''' -It is only supported for stateful deployment. +.. note:: On SLES pattern names are not supported for diskless deployment -In Linux, a groups of rpms can be packaged together into one package. It is called a group on RedHat, CentOS, Fedora and Scientific Linux. To get the list of available groups, run +On Linux, groups of rpms can be packaged together into one package. It can be a module or a group on RedHat, CentOS, Fedora and Scientific Linux. To get the list of available groups, run * **[RHEL]** :: - yum grouplist + yum group list + yum module list * **[SLES]** :: zypper se -t pattern -You can specify in this file the group/pattern names by adding a **'@'** and a space before the group/pattern names. For example: :: +You can specify module/group/pattern names by adding a **'@'** before the module/group/pattern names. For example: :: - @ base + @base + @Security Tools + @ruby:2.6 Remove RPMs After Installing '''''''''''''''''''''''''''' -It is only supported for stateful deployment. - -You can specify in this file that certain rpms to be removed after installing the new software. This is done by adding **'-'** before the rpm names you want to remove. For example: :: +You can specify that certain rpms to be removed after installing the new software. This is done by adding **'-'** before the rpm names you want to remove. For example: :: -ntp + -@ruby:2.6 diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index 55a98b8275..5226c43d6b 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -28,6 +28,7 @@ compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs +reg_linux_diskless_installation_flat_modules_and_groups reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 5cb54620a4..7e8f489dfd 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -28,6 +28,7 @@ compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs +reg_linux_diskless_installation_flat_modules_and_groups reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups new file mode 100644 index 0000000000..13c886ef56 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups @@ -0,0 +1,39 @@ +start:reg_linux_diskfull_installation_flat_modules_and_groups +description:Test provision and updatenode with yum groups and modules. Runs only on RH8 +os:Linux +label:flat_cn_diskful,provision +cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "@ruby:2.6" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:cat /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +check:output=~Provision node\(s\)\: $$CN +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +# Verify group and module were installed +cmd:xdsh $$CN yum group list installed +check:output=~Security Tools +cmd:xdsh $$CN yum module list --installed +check:output=~ruby 2.6 +# Verify group and module can be removed +cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "-@ruby:2.6" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:updatenode $$CN -P ospkgs +check:rc==0 +cmd:xdsh $$CN yum group list installed +check:output!~Security Tools +cmd:xdsh $$CN yum module list --installed +check:output!~ruby 2.6 +# Cleanup +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist +cmd:rm /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups new file mode 100644 index 0000000000..246267db27 --- /dev/null +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups @@ -0,0 +1,52 @@ +start:reg_linux_diskless_installation_flat_modules_and_groups +description:Test provision and updatenode with yum groups and modules. Runs only on RH7 and RH8 +os:Linux +label:flat_cn_diskless,provision +cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "yum" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +check:rc==0 +cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +check:output=~Provision node\(s\)\: $$CN +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +# Verify group and module (on RH8) were installed. Can not use "yum group" +# since .repo files are not setup at this point +cmd:xdsh $$CN rpm -q xml-common +check:rc==0 +check:output=~xml-common +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo "ruby 2.6"; fi +check:output=~ruby +check:output=~2.6 + +# Verify group and module (on RH8) can be removed +cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "-@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi +cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:updatenode $$CN -P ospkgs +check:rc==0 +cmd:xdsh $$CN yum group list installed +check:output!~Security Tools +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo ""; fi +check:output!~ruby +# Cleanup +cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist +cmd:rm /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +end diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index 83451061c5..f18c404f3d 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -436,9 +436,9 @@ do #categorize the groups according to the action(install/remove) if [ $remove -eq 0 ]; then - groups="$groups $tmp" + groups="$groups @$tmp" else - groups_d="$groups_d $tmp" + groups_d="$groups_d @$tmp" fi else if ( pmatch "$x" "cuda*" ); then @@ -945,8 +945,8 @@ else #install new groups if any if [ -n "$groups" ]; then - #cmd="echo $groups| $ENVLIST xargs yum -y groupinstall" - cmd="$ENVLIST yum -y groupinstall $groups" + #cmd="$ENVLIST yum -y groupinstall $groups" + cmd="$ENVLIST yum -y install $groups" result=`eval $cmd 2>&1` R=$? if [ $R -ne 0 ]; then @@ -1005,7 +1005,8 @@ else #remove some groups if specified if [ -n "$groups_d" ]; then - cmd="$ENVLIST yum -y groupremove $groups_d" + #cmd="$ENVLIST yum -y groupremove $groups_d" + cmd="$ENVLIST yum -y remove $groups_d" result=`eval $cmd 2>&1` R=$? if [ $R -ne 0 ]; then From 1508bff83cd793cef6e7978022ca26cf87989707 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Fri, 26 Aug 2022 09:12:17 -0700 Subject: [PATCH 098/188] Fall back to the repository Version file when xCAT RPM is not installed --- xCAT-genesis-builder/xCAT-genesis-base.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index a45c08cb0e..8dc2d7a3ab 100644 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,5 +1,5 @@ -%define version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null) -Version: %{?version:%{version}}%{!?version:%(cat Version)} +%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po '[0-9\.]+' || cat ../Version) +Version: %{version} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 %define tarch x86 From 9d1e473d2cde391fc2b9e56238d8287f2e4ae0e4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 26 Aug 2022 14:01:31 -0400 Subject: [PATCH 099/188] Allow os: testcase tag to specify rhels version --- .../references/man1/xcattest.1.rst | 16 ++--- .../autotest/bundle/rhels_ppcle_weekly.bundle | 4 +- .../autotest/bundle/rhels_x86_weekly.bundle | 4 +- ...kfull_installation_flat_modules_and_groups | 45 +++++++++++- ...kless_installation_flat_modules_and_groups | 70 ++++++++++++++---- xCAT-test/pods/man1/xcattest.1.pod | 16 ++--- xCAT-test/xcattest | 71 ++++++++++--------- 7 files changed, 162 insertions(+), 64 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 f24f6f324a..a2762fa6f0 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -128,15 +128,15 @@ The xCAT-test test cases are in flat text format, the testing framework will par #optional, description of the test case description: what the test case is for? #optional, environment requirements - os:AIX/Linux + os:AIX/Linux/sles/ubuntu/rhels/rhels7/rhels8 #optional, environment requirements - arch:ppc/x86 + arch:ppc/ppc64/ppc64le/x86_64 #optional, environment requirements - hcp:hmc/mm/bmc/fsp + hcp:hmc/mm/bmc/fsp/ipmi/openbmc #optional, label label:label1 #required, command need to run - cmd:comand + cmd:command #optional, check return code of last executed command check:rc == or != return code #optional, check output of last executed command @@ -155,7 +155,7 @@ EXAMPLES 1. - To run all test cases related command rpower: + To run all test cases related to command \ **rpower**\ : .. code-block:: perl @@ -167,7 +167,7 @@ EXAMPLES 2. - To run customized bundle with /tmp/config file: + To run customized bundle with \ */tmp/config*\ file: .. code-block:: perl @@ -181,7 +181,7 @@ EXAMPLES 3. - To run specified test cases with /tmp/config file: + To run specified test cases with \ */tmp/config*\ file: .. code-block:: perl @@ -193,7 +193,7 @@ EXAMPLES 4. - To add a new case to test \ **chvm**\ . In the example, we assume that the min_mem should not be equal to 16 in the lpar profile of computenode. The case name is chvm_custom. It create a test lpar named testnode firstly, that change the min_mem of the lpar to 16 using chvm, then check if min_mem have changed correctly. At last, the testnode be remove to ensure no garbage produced in the cases. + To add a new test case to test \ **chvm**\ . In this example, we assume that the \ **min_mem**\ should not be equal to 16 in the lpar profile of computenode. The case name is \ **chvm_customi**\ . It creates a test lpar named \ **testnode**\ first, then changes the \ **min_mem**\ of the lpar to 16 using \ **chvm**\ , then checks if \ **min_mem**\ have changed correctly. Finally, the \ **testnode**\ is removed. .. code-block:: perl diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index 5226c43d6b..a86cc9f29f 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -24,11 +24,13 @@ nodeset_cmdline nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat +reg_linux_diskfull_installation_flat_groups_rh7 +reg_linux_diskfull_installation_flat_modules_and_groups_rh8 compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs -reg_linux_diskless_installation_flat_modules_and_groups +reg_linux_diskless_installation_flat_modules_and_groups_rh reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 7e8f489dfd..85c0504bd4 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -24,11 +24,13 @@ nodeset_cmdline nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat +reg_linux_diskfull_installation_flat_groups_rh7 +reg_linux_diskfull_installation_flat_modules_and_groups_rh8 compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs -reg_linux_diskless_installation_flat_modules_and_groups +reg_linux_diskless_installation_flat_modules_and_groups_rh reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups index 13c886ef56..21cfa2feb4 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat_modules_and_groups @@ -1,6 +1,6 @@ -start:reg_linux_diskfull_installation_flat_modules_and_groups +start:reg_linux_diskfull_installation_flat_modules_and_groups_rh8 description:Test provision and updatenode with yum groups and modules. Runs only on RH8 -os:Linux +os:rhels8 label:flat_cn_diskful,provision cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules @@ -37,3 +37,44 @@ check:output!~ruby 2.6 cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels8.pkglist cmd:rm /opt/xcat/share/xcat/install/rh/compute.pkglist.modules end + +start:reg_linux_diskfull_installation_flat_groups_rh7 +description:Test provision and updatenode with yum groups. Runs only on RH7 +os:rhels7 +label:flat_cn_diskful,provision +cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:cat /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute +check:rc==0 +check:output=~Provision node\(s\)\: $$CN +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +# Verify group was installed by cheking individual RPMs +cmd:xdsh $$CN rpm -q xml-common openscap-scanner openscap scap-security-guide +check:output=~xml-common- +check:output=~openscap-scanner- +check:output=~openscap- +check:output=~scap-security-guide- +# Verify group can be removed (manually install, then remove using updatenode) +cmd:xdsh $$CN yum group install -y compat-libraries +check:rc==0 +cmd:xdsh $$CN yum group list installed +check:output=~Compatibility Libraries +cmd:cp /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:echo "-@Compatibility Libraries" >> /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +cmd:updatenode $$CN -P ospkgs +check:rc==0 +cmd:xdsh $$CN yum group list installed +check:output!~Compatibility Libraries +# Cleanup +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist +cmd:rm /opt/xcat/share/xcat/install/rh/compute.pkglist.modules +end diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups index 246267db27..5821e409c1 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups @@ -1,11 +1,11 @@ -start:reg_linux_diskless_installation_flat_modules_and_groups -description:Test provision and updatenode with yum groups and modules. Runs only on RH7 and RH8 -os:Linux +start:reg_linux_diskless_installation_flat_modules_and_groups_rh8 +description:Test provision and updatenode with yum groups and modules. Runs only on RH8 +os:rhels8 label:flat_cn_diskless,provision -cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:echo "yum" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi +cmd:echo "@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules check:rc==0 cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules @@ -26,27 +26,73 @@ check:rc==0 check:output=~booted cmd:xdsh $$CN date check:rc==0 -# Verify group and module (on RH8) were installed. Can not use "yum group" +# Verify group and module were installed. Can not use "yum group" # since .repo files are not setup at this point cmd:xdsh $$CN rpm -q xml-common check:rc==0 check:output=~xml-common -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo "ruby 2.6"; fi +cmd:xdsh $$CN yum module list --installed check:output=~ruby check:output=~2.6 -# Verify group and module (on RH8) can be removed -cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; cp /opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +# Verify group and module can be removed +cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then echo "-@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules; fi +cmd:echo "-@ruby:2.6" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules cmd:updatenode $$CN -P ospkgs check:rc==0 cmd:xdsh $$CN yum group list installed check:output!~Security Tools -cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhels8" ]] ; then xdsh $$CN yum module list --installed; else echo ""; fi +cmd:xdsh $$CN yum module list --installed check:output!~ruby # Cleanup -cmd:a=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute -i osvers -c | cut -d":" -f2 | cut -d"=" -f2 | cut -d"." -f1`; chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.$a.__GETNODEATTR($$CN,arch)__.pkglist +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist +cmd:rm /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +end + +start:reg_linux_diskless_installation_flat_groups_rh7 +description:Test provision and updatenode with yum groups. Runs only on RH7 +os:rhels7 +label:flat_cn_diskless,provision +cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "yum" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +check:rc==0 +cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:rmimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:packimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute +check:rc==0 +check:output=~Provision node\(s\)\: $$CN +cmd:ping $$CN -c 3 +check:rc==0 +check:output=~64 bytes from $$CN +cmd:lsdef -l $$CN | grep status +check:rc==0 +check:output=~booted +cmd:xdsh $$CN date +check:rc==0 +# Verify group was installed. Can not use "yum group" +# since .repo files are not setup at this point +cmd:xdsh $$CN rpm -q xml-common +check:rc==0 +check:output=~xml-common + +# Verify group can be removed +cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:echo "-@Security Tools" >> /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:cat /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules +cmd:updatenode $$CN -P ospkgs +check:rc==0 +cmd:xdsh $$CN yum group list installed +check:output!~Security Tools +# Cleanup +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute pkglist=/opt/xcat/share/xcat/netboot/rh/compute.rhels7.__GETNODEATTR($$CN,arch)__.pkglist cmd:rm /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules end diff --git a/xCAT-test/pods/man1/xcattest.1.pod b/xCAT-test/pods/man1/xcattest.1.pod index ce3bf1401b..d54afcd33d 100644 --- a/xCAT-test/pods/man1/xcattest.1.pod +++ b/xCAT-test/pods/man1/xcattest.1.pod @@ -80,15 +80,15 @@ The xCAT-test test cases are in flat text format, the testing framework will par #optional, description of the test case description: what the test case is for? #optional, environment requirements - os:AIX/Linux + os:AIX/Linux/sles/ubuntu/rhels/rhels7/rhels8 #optional, environment requirements - arch:ppc/x86 + arch:ppc/ppc64/ppc64le/x86_64 #optional, environment requirements - hcp:hmc/mm/bmc/fsp + hcp:hmc/mm/bmc/fsp/ipmi/openbmc #optional, label label:label1 #required, command need to run - cmd:comand + cmd:command #optional, check return code of last executed command check:rc == or != return code #optional, check output of last executed command @@ -103,13 +103,13 @@ B: Each test case can have more than one I sections and each I s =item 1. -To run all test cases related command rpower: +To run all test cases related to command B: xcattest -f /tmp/config -c rpower =item 2. -To run customized bundle with /tmp/config file: +To run customized bundle with I file: xcattest -c lsdef -l > /opt/xcat/share/xcat/tools/autotest/bundle/custom.bundle Modify custom.bundle @@ -117,13 +117,13 @@ To run customized bundle with /tmp/config file: =item 3. -To run specified test cases with /tmp/config file: +To run specified test cases with I file: xcattest -f /tmp/config -t lsdef_t_o_l_z =item 4. -To add a new case to test B. In the example, we assume that the min_mem should not be equal to 16 in the lpar profile of computenode. The case name is chvm_custom. It create a test lpar named testnode firstly, that change the min_mem of the lpar to 16 using chvm, then check if min_mem have changed correctly. At last, the testnode be remove to ensure no garbage produced in the cases. +To add a new test case to test B. In this example, we assume that the B should not be equal to 16 in the lpar profile of computenode. The case name is B. It creates a test lpar named B first, then changes the B of the lpar to 16 using B, then checks if B have changed correctly. Finally, the B is removed. add a new test case file in /opt/xcat/share/xcat/tools/autotest/chvm edit filename diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index cac3ed4ad0..cae71da3b6 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -205,7 +205,7 @@ if (defined $list) { log_this($running_log_fd, "$_"); } } elsif (!@cases_to_be_run && $search_expression){ - log_this($running_log_fd, "There is no cases match search expression $search_expression"); + log_this($running_log_fd, "There are no cases match search expression $search_expression"); } else { #list the cases shipped by xcat test package @@ -219,7 +219,7 @@ if (defined $list) { } } elsif ($list eq "caseinfo") { if (!@cases_to_be_run && $search_expression){ - log_this($running_log_fd, "There is no cases match search expression $search_expression"); + log_this($running_log_fd, "There are no cases match search expression $search_expression"); } else { $rst = show_case_info(\@cases_to_be_run, \$error); if ($rst) { @@ -436,7 +436,7 @@ if ($stop_to_keep_env) { # Description: print message to log file and STDOUT. # Set '-q' option in command line, just print message to log file # Atrributes: $logdf: the file description of openning log file -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub log_this { my $logdf = shift; @@ -463,7 +463,7 @@ sub log_this { # Fuction name: pro_init # Description: Do program initialization # Atrributes: -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub pro_init { mkpath("$resultdir") unless (-d "$resultdir"); @@ -489,7 +489,7 @@ sub pro_init { # The reference of array to save the cases to be handled # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #------------------------------------------------------- sub calculate_cases_to_be_run { my $cases_to_be_run_ref = shift; @@ -596,7 +596,7 @@ sub calculate_cases_to_be_run { # Fuction name: expend_include_file # Description: To support '#INCLUDE" label in bundle file, to expend the include file # Atrributes: $bundle (input attribute): the name of bundle -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub expend_include_file { my $bundle = shift; @@ -629,7 +629,7 @@ sub expend_include_file { # Fuction name: to_exit # Description: customize exit function, include clean up environment # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub to_exit { my $exit_code = shift; @@ -645,7 +645,7 @@ sub to_exit { # Atrributes: # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub check_option_validity { my $error_ref = shift; @@ -675,7 +675,7 @@ sub check_option_validity { # The reference of array to save the cases to be handled # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub show_case_info { my $cases_to_be_run_ref = shift; @@ -715,7 +715,7 @@ sub show_case_info { # Atrributes: # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub show_bundle_info { my $error_ref = shift; @@ -775,7 +775,7 @@ sub show_bundle_info { # config{var}{varname} # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub load_config_file { my $configfile = shift; @@ -932,7 +932,7 @@ sub load_config_file { # The flag of whether run these case nex. # 0 means no, just load case basic information, used by "searching informaiotn funtion of xcattest" # 1 means yes, load case basic information and parse the attribure at the sametime. used by "run case funtion of xcattest" -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub load_case { my $cases_to_be_run_ref = shift; @@ -1280,7 +1280,7 @@ sub load_case { } } if (@unexisted_cases) { - log_this($running_log_fd, "Not existed:", @unexisted_cases); + log_this($running_log_fd, "Does not exist:", @unexisted_cases); push @wrong_cases, @unexisted_cases; $caseerror = 2; } @@ -1310,7 +1310,7 @@ sub load_case { # Atrributes: # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub bakup_current_env { my $error_ref = shift; @@ -1330,7 +1330,7 @@ sub bakup_current_env { # Atrributes: # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub restore_current_env { my $error_ref = shift; @@ -1354,7 +1354,7 @@ sub restore_current_env { # Due to there maybe is more than one implementation for one case # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub run_case { my $cases_to_be_run_ref = shift; @@ -1556,7 +1556,7 @@ sub run_case { # The structure of %config please refer to the comment of function load_config_file # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub setup_env_by_configure_file { my $config_ref = shift; @@ -1620,7 +1620,7 @@ sub setup_env_by_configure_file { # The structure of %config please refer to the comment of function load_config_file # $error_ref (output attribe) # The reference of scalar to save the error message generated during running current function -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub detect_current_env { my $config_ref = shift; @@ -1672,7 +1672,7 @@ sub detect_current_env { # Fuction name: runcmd # Description: run a command after 'cmd' label in one case # Atrributes: -# Retrun code: +# Return code: # $::RUNCMD_RC : the return code of command # @$outref : the output of command #-------------------------------------------------------- @@ -1701,7 +1701,7 @@ sub runcmd # Atrributes: # $script_ref (input attribute) # the reference of array where save every line of script -# Retrun code: +# Return code: # $::RUNCMD_RC : the return code of command # @$outref : the output of command #-------------------------------------------------------- @@ -1730,7 +1730,7 @@ sub runscript { # Fuction name: getnodeattr # Description: get the value of node attribute from current environment # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub getnodeattr { my $node = shift; @@ -1743,7 +1743,7 @@ sub getnodeattr { # Fuction name: getobjectattr # Description: get the value of object attribute from current DB # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub getobjectattr { my $objtype = shift; @@ -1772,7 +1772,7 @@ sub getobjectattr { # The target scan directory # $files_path_ref (output attribute) # the reference of array where save all vaild files under $dir -# Retrun code: +# Return code: #-------------------------------------------------------- sub get_files_recursive { @@ -1804,7 +1804,7 @@ sub get_files_recursive # Fuction name: is_valid_case_name # Description: to check if a case name is valid # Atrributes: $casename (input atrribute): the target case name -# Retrun code: 0 Success 1 Failed +# Return code: 0 Success 1 Failed #-------------------------------------------------------- sub is_valid_case_name { my $casename = shift; @@ -1817,13 +1817,20 @@ sub is_valid_case_name { #------------------------------------------------------- # Fuction name: get_current_os -# Description: +# Description: Return name of current OS. For rhels, also return major number # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub get_current_os { if (-f "/etc/redhat-release") { - return "rhels"; + # Try to return "rhels" + major version, if can not get it, just return "rhels" + my $major_version = ""; + my @output = &runcmd("cat /etc/redhat-release"); + my $out_line = $output[0]; + if ($out_line =~ (/(\d+)\.(\d*)/)) { + $major_version = $1; + } + return "rhels".$major_version; } elsif (-f "/etc/lsb-release") { return "ubuntu"; } elsif (-f "/etc/os-release") { @@ -1844,7 +1851,7 @@ sub get_current_os { # Fuction name: generate_performance_report # Description: # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub generate_performance_report { my $runninglog = shift; @@ -1889,7 +1896,7 @@ sub generate_performance_report { # Fuction name: getvar # Description: replace specific attribute in case definition by the value set in config file # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub getvar { @@ -1913,7 +1920,7 @@ sub getvar # Fuction name: getfunc # Description: replace specific funciton in case definition # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub getfunc { @@ -1952,7 +1959,7 @@ sub getfunc # Fuction name: gettablevalue # Description: get specific table value from current environment # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub gettablevalue { @@ -1965,7 +1972,7 @@ sub gettablevalue # Fuction name: print_table # Description: print a hash table in good format # Atrributes: -# Retrun code: +# Return code: #-------------------------------------------------------- sub print_table { my $msg_ref = shift; From c86b3977bd143c961b3d7ef004395ad035a78ac9 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 26 Aug 2022 14:05:20 -0400 Subject: [PATCH 100/188] Add testcases to bundles --- xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle | 3 ++- xCAT-test/autotest/bundle/rhels_x86_weekly.bundle | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index a86cc9f29f..2263bd1dd8 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -30,7 +30,8 @@ compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs -reg_linux_diskless_installation_flat_modules_and_groups_rh +reg_linux_diskless_installation_flat_groups_rh7 +reg_linux_diskless_installation_flat_modules_and_groups_rh8 reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 85c0504bd4..5a3fa34489 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -30,7 +30,8 @@ compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs -reg_linux_diskless_installation_flat_modules_and_groups_rh +reg_linux_diskless_installation_flat_groups_rh7 +reg_linux_diskless_installation_flat_modules_and_groups_rh8 reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless From d3a23d48dd61f560114809a2de782eef2a95b327 Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Tue, 30 Aug 2022 08:07:03 -0700 Subject: [PATCH 101/188] hard-code latest xCAT version, in case this RPM is built outside of the xcat-core repo --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 8dc2d7a3ab..5237147b27 100644 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po '[0-9\.]+' || cat ../Version) +%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po %%'[0-9\.]+' || echo "2.16.5") Version: %{version} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 From 08a8d4215a784807b6ef04098b98338156f81a50 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Tue, 30 Aug 2022 13:12:54 -0400 Subject: [PATCH 102/188] Add conditions to the GATEWAY changes --- xCAT/postscripts/configeth | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 48bc72ac39..47a2c6714e 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -702,6 +702,15 @@ elif [ "$1" = "-s" ];then hostname $NODE echo $NODE > /etc/HOSTNAME else + # Extract the first numeric part of the VERSION_ID, ignoring any non-numeric characters. + os_major_version=`cat /etc/os* | grep VERSION_ID | cut -d '=' -f2 | sed s/\"//g | cut -d "." -f1` + + if [[ -z "${os_major_version}" ]] ; then + logger -t xcat -p local4.err "configeth: Could not determine the OS version, defaulting to the RHEL 7 behavior" + log_warn "configeth on $NODE: Could not determine the OS version, defaulting to the RHEL 7 behavior" + os_major_version=7 + fi + #write ifcfg-* file for redhat con_name="xcat-"${str_inst_nic} str_inst_prefix=$(v4mask2prefix ${str_inst_mask}) @@ -732,7 +741,11 @@ elif [ "$1" = "-s" ];then echo "ONBOOT=yes" >> $str_conf_file echo "NAME=${con_name}" >> $str_conf_file echo "HWADDR=${str_inst_mac}" >> $str_conf_file - echo "GATEWAY=${str_inst_gateway}" >> $str_conf_file + + # Add GATEWAY to $str_conf_file only if the OS version is above RHEL 7.x. + if (( $os_major_version > 7 )) ; then + echo "GATEWAY=${str_inst_gateway}" >> $str_conf_file + fi fi if [ $networkmanager_active -eq 2 ]; then echo "AUTOCONNECT_PRIORITY=9" >> $str_conf_file @@ -749,6 +762,18 @@ elif [ "$1" = "-s" ];then echo "MTU=${str_inst_mtu}" >> $str_conf_file fi fi + + # Add GATEWAY to the network file only if the OS version is RHEL 7.x or below. + if (( $os_major_version < 8 )) ; then + if [ -n "$str_inst_gateway" ];then + grep -i "GATEWAY" /etc/sysconfig/network + if [ $? -eq 0 ];then + sed -i "s/.*GATEWAY.*/GATEWAY=${str_inst_gateway}/i" /etc/sysconfig/network + else + echo "GATEWAY=${str_inst_gateway}" >> /etc/sysconfig/network + fi + fi + fi #add extra params i=0 while [ $i -lt ${#array_extra_param_names[@]} ] From f3ba47ef2ebef55a102ff5d7acc42a6e2222beee Mon Sep 17 00:00:00 2001 From: Kilian Cavalotti Date: Tue, 30 Aug 2022 13:39:33 -0700 Subject: [PATCH 103/188] fix typo --- xCAT-genesis-builder/xCAT-genesis-base.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-builder/xCAT-genesis-base.spec b/xCAT-genesis-builder/xCAT-genesis-base.spec index 5237147b27..3bc288fb2a 100644 --- a/xCAT-genesis-builder/xCAT-genesis-base.spec +++ b/xCAT-genesis-builder/xCAT-genesis-base.spec @@ -1,4 +1,4 @@ -%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po %%'[0-9\.]+' || echo "2.16.5") +%global version %(rpm -q xCAT --qf "%{VERSION}" 2>/dev/null | grep -Po '[0-9\.]+' || echo "2.16.5") Version: %{version} Release: %{?release:%{release}}%{!?release:snap%(date +"%Y%m%d%H%M")} %ifarch i386 i586 i686 x86 From 272f9c17d779bccdda3a2f9ac35f0b8233b8d466 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 1 Sep 2022 17:03:40 -0400 Subject: [PATCH 104/188] Update README.md --- xCAT-genesis-builder/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-genesis-builder/README.md b/xCAT-genesis-builder/README.md index b454cf9dda..8f593280af 100644 --- a/xCAT-genesis-builder/README.md +++ b/xCAT-genesis-builder/README.md @@ -48,8 +48,12 @@ do the following (assuming 2.16.10 is your xCAT version): ```sh cd xcat-core/xCAT-genesis-builder -sed -i 's/%%REPLACE_CURRENT_VERSION%%/2.16.10/g' xCAT-genesis-base.spec -buildrpm +``` + +If needed, update version number inside `xCAT-genesis-base.spec` + +``` +./buildrpm ``` If this command is successful, runs error free, it will generate a `xCAT-genesis-base` RPM that you can transfer From 1efc0f400dff76605cbebc1217e0457586506a48 Mon Sep 17 00:00:00 2001 From: peterwywong <46875219+peterwywong@users.noreply.github.com> Date: Fri, 2 Sep 2022 15:25:17 -0700 Subject: [PATCH 105/188] Revert "Provide an error message when a new node name is an existing group name" --- perl-xCAT/xCAT/NodeRange.pm | 4 ---- .../autotest/bundle/rhels_ppcle_daily.bundle | 1 - .../autotest/bundle/rhels_x86_daily.bundle | 1 - .../autotest/bundle/sles_ppcle_daily.bundle | 1 - .../autotest/bundle/sles_x86_daily.bundle | 1 - .../autotest/bundle/ubuntu_ppcle_daily.bundle | 1 - .../autotest/bundle/ubuntu_x86_daily.bundle | 1 - xCAT-test/autotest/testcase/mkdef/cases1 | 21 ------------------- 8 files changed, 31 deletions(-) diff --git a/perl-xCAT/xCAT/NodeRange.pm b/perl-xCAT/xCAT/NodeRange.pm index 46be7a3953..e28bac0352 100644 --- a/perl-xCAT/xCAT/NodeRange.pm +++ b/perl-xCAT/xCAT/NodeRange.pm @@ -4,7 +4,6 @@ use Text::Balanced qw/extract_bracketed/; require xCAT::Table; require Exporter; use strict; -use xCAT::MsgUtils; #Perl implementation of noderange our @ISA = qw(Exporter); @@ -294,9 +293,6 @@ sub expandatom { #my @grouplist = $grptab->getAllAttribs('groupname'); for my $row (@grplist) { if ($row->{groupname} eq $atom) { - my $rsp; - $rsp->{data}->[0] = "Could not create an object named \'$atom\' of type 'node'. A definition for a group object with the same name already exists."; - xCAT::MsgUtils->message("E", $rsp, $::callback); return (); } } diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle index d1ef3de1eb..a39991440b 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_daily.bundle @@ -151,7 +151,6 @@ mkdef_regex_nicsip mkdef_rhels73 mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/rhels_x86_daily.bundle b/xCAT-test/autotest/bundle/rhels_x86_daily.bundle index e4f8869924..608e862ee1 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_daily.bundle @@ -151,7 +151,6 @@ mkdef_regex_nicsip mkdef_rhels73 mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle b/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle index dd1b0bad01..db5fb3832f 100644 --- a/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/sles_ppcle_daily.bundle @@ -110,7 +110,6 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/sles_x86_daily.bundle b/xCAT-test/autotest/bundle/sles_x86_daily.bundle index dbe30b6e32..33c28f32a2 100644 --- a/xCAT-test/autotest/bundle/sles_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/sles_x86_daily.bundle @@ -110,7 +110,6 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle index 41ed0bcc51..b0182265c8 100644 --- a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle @@ -79,7 +79,6 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle index c2f8b10d3d..154c660252 100644 --- a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle @@ -81,7 +81,6 @@ mkdef_regex_kvm mkdef_regex_nicsip mkdef_t_o_error mkdef_z -mkdef_nodename_hit_groupname nodeadd_err_symbol nodeadd_h nodeadd_noderange diff --git a/xCAT-test/autotest/testcase/mkdef/cases1 b/xCAT-test/autotest/testcase/mkdef/cases1 index e0264c909c..41c4b93c76 100644 --- a/xCAT-test/autotest/testcase/mkdef/cases1 +++ b/xCAT-test/autotest/testcase/mkdef/cases1 @@ -150,24 +150,3 @@ check:rc==0 cmd:rmdef -t group -o xcattest_tmp_group_regex check:rc==0 end - -start:mkdef_nodename_hit_groupname -cmd:mkdef -t group -o tempgroup13579 -check:rc==0 -cmd:mkdef -t node -o tempgroup13579 groups=tempgroup13579 -check:rc==1 -check:output=~A definition for a group object with the same name already exists. -check:output=~No object names were provided -cmd:mkdef -t node -o tempgroup13579 groups=all -check:rc==1 -check:output=~A definition for a group object with the same name already exists. -check:output=~No object names were provided -cmd:mkdef -t node -o tempnode02468,tempgroup13579 groups=tempgroup13579 -check:rc==1 -check:output=~A definition for a group object with the same name already exists. -check:output=~1 object definitions have been created -cmd:rmdef -t node -o tempnode02468 -check:rc==0 -cmd:rmdef -t group -o tempgroup13579 -check:rc==0 -end From 85149c37f49dbca7bd85f1f586960315604fc024 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 9 Sep 2022 12:59:37 -0400 Subject: [PATCH 106/188] Have server enforce SSH zone separation When a client requests a zone's ssh credentials, make sure the client is consistent with the specified zone. Per github user salben21 --- xCAT-server/lib/xcat/plugins/credentials.pm | 26 +++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 0e9a2b0e77..52e5a6c7a4 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -133,18 +133,34 @@ sub process_request my $sshrootkeydir = "$root/.ssh"; # old default if ((($parm =~ /^ssh_root_key/) || ($parm =~ /^ssh_root_pub_key/)) && ($foundkeys == 0)) { my ($rootkeyparm, $zonename) = split(/:/, $parm); + my $client_zonename = xCAT::Zone->getmyzonename($client); + my $default_zonename = xCAT::Zone->getdefaultzone(); + if ($zonename) { $parm = $rootkeyparm; # take the zone off xCAT::MsgUtils->trace(0, 'I', "credentials: The node ($client) is asking for sshkeys of zone: $zonename."); - $sshrootkeydir = xCAT::Zone->getzonekeydir($zonename); - if ($sshrootkeydir == 1) { # error return - xCAT::MsgUtils->trace(0, 'W', "credentials: The zone: $zonename is not defined."); + if ($client_zonename eq $zonename) { + my $sshbetweenodes_allowed = xCAT::Zone->enableSSHbetweennodes($client); + if (($sshbetweenodes_allowed == 1) || ($parm =~ /^ssh_root_pub_key/)) { # check if sshbetweennodes is allowed or pub key is requested + $sshrootkeydir = xCAT::Zone->getzonekeydir($zonename); + if ($sshrootkeydir == 1) { # error return + xCAT::MsgUtils->trace(0, 'W', "credentials: The zone: $zonename is not defined."); + } else { + $foundkeys = 1; # don't want to read the zone data twice + } + } else { + xCAT::MsgUtils->trace(0, 'E', "credentials: Not allowed to read root's private ssh key because sshbetweennodes is disabled."); + $sshrootkeydir = 1; + } } else { - $foundkeys = 1; # don't want to read the zone data twice + xCAT::MsgUtils->trace(0, 'E', "credentials: Not allowed to read root's private ssh key of different zone."); + $sshrootkeydir = 1; } + } elsif ($client_zonename ne $default_zonename) { # check if no zonename is submitted but node is not in default zone + xCAT::MsgUtils->trace(0, 'E', "credentials: Not allowed to read root's private ssh key of default zone."); + $sshrootkeydir = 1; } } - if ($parm =~ /ssh_root_key/) { unless (-r "$sshrootkeydir/id_rsa") { push @{ $rsp->{'error'} }, "Unable to read root's private ssh key"; From a495f729390f157601451262da2fbc04b5d3e351 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 9 Sep 2022 13:38:37 -0400 Subject: [PATCH 107/188] Import/Export image documentation update --- .../common/deployment/generate_img.rst | 77 ++++++++----------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst index ad459e7a50..0beb1abc17 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst @@ -1,32 +1,31 @@ Generate Diskless Image ======================= -The ``copycds`` command copies the contents of the Linux media to ``/install//`` so that it will be available for installing nodes or creating diskless images. After executing ``copycds``, there are several ``osimage`` definitions created by default. Run ``tabdump osimage`` to view these images: :: +The ``copycds`` command copies the contents of the Linux media to ``/install//`` so that it will be available for installing nodes or creating diskless images. After executing ``copycds``, there are several ``osimage`` definitions created by default. Run ``lsdef -t osimage`` to view these images: :: - tabdump osimage + lsdef -t osimage The output should be similar to the following: :: - "rhels7.1-ppc64le-install-compute",,"compute","linux",,"install",,"rhels7.1-ppc64le",,,"Linux","rhels7.1","ppc64le",,,,,,,, - "rhels7.1-ppc64le-install-service",,"service","linux",,"install",,"rhels7.1-ppc64le",,,"Linux","rhels7.1","ppc64le",,,,,,,, - "rhels7.1-ppc64le-stateful-mgmtnode",,"compute","linux",,"install",,"rhels7.1-ppc64le",,,"Linux","rhels7.1","ppc64le",,,,,,,, - "rhels7.1-ppc64le-netboot-compute",,"compute","linux",,"netboot",,"rhels7.1-ppc64le",,,"Linux","rhels7.1","ppc64le",,,,,,,, + rhels8.5.0-ppc64le-install-compute (osimage) + rhels8.5.0-ppc64le-install-service (osimage) + rhels8.5.0-ppc64le-netboot-compute (osimage) -The ``netboot-compute`` is the default **diskless** osimage created rhels7.1 ppc64le. Run ``genimage`` to generate a diskless image based on the "rhels7.1-ppc64le-netboot-compute" definition: :: +The ``netboot-compute`` is the default **diskless** osimage created for rhels8.5 ppc64le. Run ``genimage`` to generate a diskless image based on the `rhels8.5.0-ppc64le-netboot-compute` definition: :: - genimage rhels7.1-ppc64le-netboot-compute + genimage rhels8.5.0-ppc64le-netboot-compute Before packing the diskless image, you have the opportunity to change any files in the image by changing to the ``rootimgdir`` and making modifications. (e.g. ``/install/netboot/rhels7.1/ppc64le/compute/rootimg``). -However it's recommended that all changes to the image are made via post install scripts so that it's easily repeatable. Although, instead, we recommend that you make all changes to the image via your postinstall script, so that it is repeatable. Refer to :doc:`/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script` for more details. +However it's recommended that all changes to the image are made via post install scripts so that it's easily repeatable. Refer to :doc:`/guides/admin-guides/manage_clusters/ppc64le/diskless/customize_image/pre_post_script` for more details. Pack Diskless Image =================== -After you run ``genimage`` to create the image, you can go ahead to pack the image to create the ramdisk: :: +After runing ``genimage`` to create the image, run ``packimage`` to create the ramdisk: :: - packimage rhels7.1-ppc64le-netboot-compute + packimage rhels8.5.0-ppc64le-netboot-compute Export and Import Image ======================= @@ -34,18 +33,17 @@ Export and Import Image Overview -------- -Note: There is a current restriction that exported 2.7 xCAT images cannot be imported on 2.8 xCAT ``_. This is no longer a restrictions, if you are running xCAT 2.8.3 or later. +.. note:: There is a current restriction that exported 2.7 xCAT images cannot be imported on 2.8 xCAT ``_. We want to create a system of making xCAT images more portable so that they can be shared and prevent people from reinventing the wheel. While every install is unique there are some things that can be shared among different sites to make images more portable. In addition, creating a method like this allows us to create snap shots of images we may find useful to revert to in different situations. -Image exporting and importing are supported for stateful (diskful) and stateless (diskless) clusters. The following documentation will show how to use :doc:`imgexport ` to export images and :doc:`imgimport ` to import images. +Image exporting and importing is supported for stateful (diskful) and stateless (diskless) clusters. The following documentation will show how to use :doc:`imgexport ` to export images and :doc:`imgimport ` to import images. Exporting an image ------------------ -1, The user has a working image and the image is defined in the osimage table and linuximage table. - example: :: +Working image:: lsdef -t osimage myimage Object name: myimage @@ -64,34 +62,28 @@ Exporting an image provmethod=netboot rootimgdir=/install/netboot/sles12/ppc64le/compute1 synclists=/install/custom/netboot/sles/compute1.list -2, The user runs the imgexport command. - example: :: + +Run the ``imgexport`` command:: imgexport myimage -p node1 -e /install/postscripts/myscript1 -e /install/postscripts/myscript2 - (-p and -e are optional) -A bundle file called myimage.tgz will be created under the current directory. The bundle file contains the ramdisk, boot kernel, the root image and all the configuration files for generating the image for a diskless cluster. For diskful, it contains the kickstart/autoyast configuration file. (see appendix). The -p flag puts the names of the postscripts for node1 into the image bundle. The -e flags put additional files into the bundle. In this case two postscripts myscript1 and myscript2 are included. +A bundle file called `myimage.tgz` will be created under the current directory. The bundle file contains the ramdisk, boot kernel, the root image and all the configuration files for generating the image for a diskless node. For diskful, it contains the kickstart/autoyast configuration file. (see appendix). The optional **-p** flag puts the names of the postscripts for node1 into the image bundle. The optional **-e** flags put additional files into the bundle. In this case two postscripts `myscript1` and `myscript2` are included. This image can now be used on other systems. Importing an image ------------------ -#. User downloads a image bundle file from somewhere. (Sumavi.com will be hosting many of these). -#. User runs the imgimport command. - - example: :: +#. Download the image bundle file generated by the ``imgexport``. +#. Run the ``imgimport`` command.:: imgimport myimage.tgz -p group1 - (-p is optional) -This command fills out the osimage and linuximage tables, and populates file directories with appropriate files from the image bundle file such as ramdisk, boot kernel, root image, configuration files for diskless. Any additional files that come with the bundle file will also be put into the appropriate directories. If -p flag is specified, the postscript names that come with the image will be put the into the postscripts table for the given node or group. +This command fills out the osimage and linuximage tables, and populates file directories with appropriate files from the image bundle file such as ramdisk, boot kernel, root image, configuration files for diskless. Any additional files that come with the bundle file will also be put into the appropriate directories. If optional **-p** flag is specified, the postscript names that come with the image will be put the into the postscripts table for the given node or group. Copy an image to a new image name on the MN ------------------------------------------- -Very often, the user wants to make a copy of an existing image on the same xCAT mn as a start point to make modifications. In this case, you can run imgexport first as described on chapter 2, then run imgimport with -f flag to change the profile name of the image. That way the image will be copied into a different directory on the same xCAT mn. - - example: :: +Very often, the user wants to make a copy of an existing image on the same xCAT MN as a start point to make modifications. In this case, you can run ``imgexport`` first as described above, then run imgimport with **-f** flag to change the profile name of the image. That way the image will be copied into a different directory on the same xCAT MN.:: imgimport myimage.tgz -p group1 -f compute2 @@ -100,37 +92,34 @@ Modify an image (optional) Skip this section if you want to use the image as is. -1, The use can modify the image to fit his/her own need. The following can be modified. +1. You can modify the image to fit your needs. The following can be modified. -* Modify .pkglist file to add or remove packages that are from the os distro + * ``.pkglist`` file to add or remove packages that are from the os distro -* Modify .otherpkgs.pkglist to add or remove packages from other sources. Refer to ``Using_Updatenode`` for details + * ``.otherpkgs.pkglist`` to add or remove packages from other sources. Refer to :doc:`Using updatenode ` for details -* For diskful, modify the .tmpl file to change the kickstart/autoyast configuration + * For diskful, ``.tmpl`` file to change the kickstart/autoyast configuration -* Modify .synclist file to change the files that are going to be synchronized to the nodes + * ``.synclist`` file to change the files that are going to be synchronized to the nodes -* Modify the postscripts table for the nodes to be deployed + * postscripts table for the nodes to be deployed -* Modify the osimage and/or linuximage tables for the location of the source rpms and the rootimage location + * the osimage and/or linuximage tables for the location of the source rpms and the rootimage location -2, Run genimage: :: +2. Run ``genimage``: :: genimage image_name -3, Run packimage: :: +3. Run ``packimage``: :: packimage image_name Deploying nodes --------------- -You can change the provmethod of the node to the new image_name if different: :: - - chdef provmethod= - nodeset osimage= +You can now deploy the node with the new `` :: -and the node is ready to deploy. + rinstall osimage= Appendix -------- @@ -144,7 +133,7 @@ You can only export/import one image at a time. Each tarball will have the follo manifest.xml ~~~~~~~~~~~~ -The manifest.xml will be analogous to an autoyast or windows unattend.xml file where it tells xCAT how to store the items. The following is an example for a diskless cluster: :: +The ``manifest.xml`` will be analogous to an autoyast or windows ``unattend.xml`` file where it tells xCAT how to store the items. The following is an example for a diskless cluster: :: manifest.xml: @@ -207,5 +196,5 @@ For diskless: :: x.exlist -Note: Although the postscripts names can be exported by using the -p flag. The postscripts themselves are not included in the bundle file by default. The use has to use -e flag to get them included one by one if needed. +.. note:: Although the postscripts names can be exported by using the **-p** flag, the postscripts themselves are not included in the bundle file by default. Use **-e** flag to get them included one by one if needed. From a0990e551d693695374fd301b47fa4c69f5385bd Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 9 Sep 2022 13:46:43 -0400 Subject: [PATCH 108/188] SPelling fix --- .../manage_clusters/common/deployment/generate_img.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst b/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst index 0beb1abc17..2284dc84db 100644 --- a/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst +++ b/docs/source/guides/admin-guides/manage_clusters/common/deployment/generate_img.rst @@ -23,7 +23,7 @@ However it's recommended that all changes to the image are made via post install Pack Diskless Image =================== -After runing ``genimage`` to create the image, run ``packimage`` to create the ramdisk: :: +After running ``genimage`` to create the image, run ``packimage`` to create the ramdisk: :: packimage rhels8.5.0-ppc64le-netboot-compute From 85a9e0abba3d4f420cce59d667553d5b4df1b10c Mon Sep 17 00:00:00 2001 From: Simon Fowler Date: Mon, 12 Sep 2022 12:42:17 +1000 Subject: [PATCH 109/188] Correctly specify initrd file for all netboot configs. Previously the code which created the netboot config files was incorrectly specifying the initrd file name in a number of places, particularly in the xcat/xnba/nets/* files, using a hard-coded `.gz` suffix even when a `.lzma` file had been created. This change ensures that the initrd file name determined earlier in the code (either when the image is created, or in the configonly case by checking the filesystem) is used correctly when creating the netboot config files. --- xCAT-server/lib/xcat/plugins/mknb.pm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 435cede47b..4ac84df6e7 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -300,14 +300,10 @@ sub process_request { print $cfg "#!gpxe\n"; if ($invisibletouch) { print $cfg 'imgfetch -n kernel http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.kernel.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/machyp}' . "\n"; - if ($lzma_exit_value) { - print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.fs.' . "$arch.gz\n"; - } else { - print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.fs.' . "$arch.lzma\n"; - } + print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport . "$initrd_file\n"; } else { print $cfg 'imgfetch -n kernel http://${next-server}:'.$httpport.'/tftpboot/xcat/nbk.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline\n"; - print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/nbfs.' . "$arch.gz\n"; + print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport . "$initrd_file\n"; } print $cfg "imgload kernel\n"; print $cfg "imgexec kernel\n"; @@ -318,18 +314,14 @@ sub process_request { print $cfg " delay=5\n"; print $cfg ' image=/tftpboot/xcat/genesis.kernel.' . "$arch\n"; print $cfg " label=\"xCAT Genesis (" . $normnets->{$_} . ")\"\n"; - if ($lzma_exit_value) { - print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.gz\n"; - } else { - print $cfg " initrd=/tftpboot/xcat/genesis.fs.$arch.lzma\n"; - } + print $cfg " initrd=$initrd_file\n"; print $cfg " append=\"quiet xcatd=" . $normnets->{$_} . ":$xcatdport destiny=discover $consolecmdline BOOTIF=%B\"\n"; close($cfg); open($cfg, ">", "$tftpdir/xcat/xnba/nets/$net.uefi"); print $cfg "#!gpxe\n"; print $cfg 'imgfetch -n kernel http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.kernel.' . "$arch\nimgload kernel\n"; print $cfg "imgargs kernel quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/mac:hexhyp}' . " destiny=discover initrd=initrd\n"; - print $cfg 'imgfetch -n initrd http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.fs.' . "$arch.gz\nimgexec kernel\n"; + print $cfg 'imgfetch -n initrd http://${next-server}:'.$httpport . "$initrd_file\nimgexec kernel\n"; close($cfg); } } elsif ($arch =~ /ppc/) { @@ -364,11 +356,12 @@ sub process_request { } } if ($dopxe) { + my ($ignored, $tftp_initrd) = split /\/tftpboot\//, $initrd_file, 2; open($cfgfile, ">", "$tftpdir/pxelinux.cfg/" . uc($_)); print $cfgfile "DEFAULT xCAT\n"; print $cfgfile " LABEL xCAT\n"; print $cfgfile " KERNEL xcat/nbk.$arch\n"; - print $cfgfile " APPEND initrd=xcat/nbfs.$arch.gz quiet xcatd=" . $hexnets->{$_} . ":$xcatdport $consolecmdline\n"; + print $cfgfile " APPEND initrd=$tftp_initrd quiet xcatd=" . $hexnets->{$_} . ":$xcatdport $consolecmdline\n"; close($cfgfile); } elsif ($arch =~ /ppc/) { open($cfgfile, ">", "$tftpdir/etc/" . lc($_)); From 471fd4d7c01a429abc121c53e9a7f19819fd0ae1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 14 Sep 2022 14:47:04 -0400 Subject: [PATCH 110/188] Support for Ubuntu20.04 legacy OS image --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 3 ++- xCAT-server/lib/xcat/plugins/debian.pm | 25 ++++++++++++------- .../share/xcat/install/ubuntu/compute.tmpl | 4 ++- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 817eac405e..561706ef1c 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -691,6 +691,7 @@ sub update_tables_with_templates my $arch = shift; #like ppc64, x86, x86_64 my $ospkgdir = shift; my $osdistroname = shift; + my $legacyUB20 = shift; my %args = @_; my $osname = $osver;; #like sles, rh, centos, windows @@ -722,7 +723,7 @@ sub update_tables_with_templates # for Focal and later Ubuntu we repurpose genos to indicate the use # of the subiquity installer if ($osver =~ /ubuntu(\d+\.\d+)/) { - if ($1 >= 20.04) { + if (($1 >= 20.04) and ($legacyUB20 !~ /legacy/)) { $genos = "subiquity"; } } diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 02b93ff1d5..80b3079615 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -168,8 +168,9 @@ sub using_dracut sub using_subiquity { my $os = shift; + my $tmplfile = shift; if ($os =~ /ubuntu(\d+\.\d+)/) { - if ($1 >= 20.04) { + if (($1 >= 20.04) and ($tmplfile =~ /subiquity/)) { return 1; } } @@ -258,6 +259,7 @@ sub copycd close($dinfo); my $isnetinst = 0; + my $legacyUB20 = ""; # Is this a Ubuntu20.04.1 legacy ISO my $prod = $line2[0]; # The product should be the first word my $ver = $line2[1]; # The version should be the second word my $darch = $line2[6]; # The architecture should be the seventh word @@ -339,11 +341,16 @@ sub copycd return; } } + if ((-r $path . "/install/vmlinuz") and ($distname =~ /ubuntu20.04/)) + { + # Presence of /install/vmlinuz file on Ubuntu20.04 iso indicates + # a legacy (non subiquity installer) image + $legacyUB20 = "(legacy)"; + } if ($inspection) { $callback->( { - info => -"DISTNAME:$distname\n" . "ARCH:$debarch\n" . "DISCNO:$discno\n" + info => "DISTNAME:$distname" . "$legacyUB20" ." \n" . "ARCH:$debarch\n" . "DISCNO:$discno\n" } ); return; @@ -440,7 +447,7 @@ sub copycd $callback->({ data => "Media copy operation successful" }); unless ($noosimage) { - my @ret = xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $temppath, $osdistroname); + my @ret = xCAT::SvrUtils->update_tables_with_templates($distname, $arch, $temppath, $osdistroname, $legacyUB20); if ($ret[0] != 0) { $callback->({ data => "Error when updating the osimage tables: " . $ret[1] }); } @@ -580,7 +587,7 @@ sub mkinstall { my $pltfrm = getplatform($ref->{'osvers'}); my $tmplfile = xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm", $ref->{'profile'}, $ref->{'osvers'}, $ref->{'osarch'}, $ref->{'osvers'}); - if (using_subiquity($os)) { + if (using_subiquity($os,$tmplfile)) { # in this context we use the genos parameter to search for the subiquity template $tmplfile = xCAT::SvrUtils::get_tmpl_file_name("$installroot/custom/install/$pltfrm", @@ -738,7 +745,7 @@ sub mkinstall { my $autoinstfile = "$installroot/autoinst/" . $node; # handle nocloud-net datasource for ubuntu 20.04+ - if (using_subiquity($os)) { + if (using_subiquity($os,$tmplfile)) { # clean up existing files to make way for the new directory if (-f $autoinstfile) { @@ -767,7 +774,7 @@ sub mkinstall { # maybe Debian will decide to use subiquity at some point? my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform"; - if (using_subiquity($os)) { + if (using_subiquity($os,$tmplfile)) { $prescript = $prescript . ".subiquity"; } my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform"; @@ -896,7 +903,7 @@ sub mkinstall { mkpath("$tftppath"); copy($kernpath, "$tftppath/vmlinuz"); # we don't want to customise the subiquity initrd - if (using_subiquity($os)) { + if (using_subiquity($os,$tmplfile)) { copy($initrdpath, "$tftppath/initrd.img"); } else { copyAndAddCustomizations($initrdpath, "$tftppath/initrd.img"); @@ -927,7 +934,7 @@ sub mkinstall { my $kcmdline = "nofb utf8 auto xcatd=" . $instserver; - if (using_subiquity($os)) { + if (using_subiquity($os,$tmplfile)) { $kcmdline .= " autoinstall ip=dhcp netboot=nfs nfsroot=${instserver}:${pkgdir}"; $kcmdline .= " ds=nocloud-net;s=http://${instserver}:${httpport}/install/autoinst/${node}/"; } else { diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index e784e01acc..086b1c4551 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -143,6 +143,8 @@ d-i preseed/late_command string \ mount -o bind /dev/pts /target/dev/pts -t devpts; \ mount -o bind /sys /target/sys; \ chroot /target /root/post.script; \ - cp /target/etc/network/interfaces /etc/network/interfaces; \ + if [ -f /target/etc/network/interfaces ]; then \ + cp /target/etc/network/interfaces /etc/network/interfaces; \ + fi; \ } >>/target/var/log/xcat/xcat.log 2>&1 From 3b0442797c074a3cd90e958c5ef01b60a93e0414 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 21 Sep 2022 10:02:27 -0400 Subject: [PATCH 111/188] Support for xCAT installation on Ubuntu20 --- build-ubunturepo | 2 +- .../xcat/netboot/ubuntu/compute.ubuntu20.04.x86_64.pkglist | 2 -- xCAT/debian/control | 2 +- xCATsn/debian/control | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/build-ubunturepo b/build-ubunturepo index 94afcaff97..dd30b3a9f8 100755 --- a/build-ubunturepo +++ b/build-ubunturepo @@ -105,7 +105,7 @@ for package in ${packages[@]}; do done # Supported distributions -dists="saucy trusty utopic xenial bionic" +dists="saucy trusty utopic xenial bionic focal" c_flag= # xcat-core (trunk-delvel) path d_flag= # xcat-dep (trunk) path diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu20.04.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu20.04.x86_64.pkglist index b83d5ffdb2..dcdfb53a10 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu20.04.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu20.04.x86_64.pkglist @@ -1,5 +1,4 @@ bash -ifupdown nfs-common openssl isc-dhcp-client @@ -8,7 +7,6 @@ linux-image-generic openssh-server openssh-client wget -vim rsync busybox-static gawk diff --git a/xCAT/debian/control b/xCAT/debian/control index 8df6baa780..3e614d2105 100644 --- a/xCAT/debian/control +++ b/xCAT/debian/control @@ -10,7 +10,7 @@ Homepage: https://xcat.org/ Package: xcat Architecture: amd64 ppc64el Depends: ${perl:Depends}, goconserver(>= 0.3.3-snap000000000000), xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, isc-dhcp-server, apache2, nfs-kernel-server, libxml-parser-perl, rsync, tftpd-hpa, 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) +Recommends: bind9, net-tools, 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 diff --git a/xCATsn/debian/control b/xCATsn/debian/control index f93b9ac197..933b94862f 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -9,7 +9,7 @@ Homepage: https://xcat.org/ Package: xcatsn Architecture: amd64 ppc64el Depends: ${perl:Depends}, goconserver (>=0.3.3-snap000000000000), xcat-server (>= 2.13-snap000000000000), xcat-client (>= 2.13-snap000000000000), libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, 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) +Recommends: bind9, net-tools, 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 From d7d96f27893a2d1f57c8c86cb285fd10d8de1e67 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 27 Sep 2022 11:49:31 -0400 Subject: [PATCH 112/188] Update repository sourcesi for Ubuntu20 testcases --- xCAT-test/autotest/testcase/go_xcat/focal-x86_64.sources.list | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 xCAT-test/autotest/testcase/go_xcat/focal-x86_64.sources.list diff --git a/xCAT-test/autotest/testcase/go_xcat/focal-x86_64.sources.list b/xCAT-test/autotest/testcase/go_xcat/focal-x86_64.sources.list new file mode 100644 index 0000000000..b355e6871e --- /dev/null +++ b/xCAT-test/autotest/testcase/go_xcat/focal-x86_64.sources.list @@ -0,0 +1,3 @@ +deb http://archive.ubuntu.com/ubuntu focal main restricted universe +deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe +deb http://archive.ubuntu.com/ubuntu focal-security main restricted universe From b588c2700507f0a47a4e25d51d04627c219bb96b Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 30 Sep 2022 14:17:39 +0200 Subject: [PATCH 113/188] Fix legacy PIDFile location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes error: /usr/lib/systemd/system/xcatd.service:8: PIDFile= references a path below legacy directory /var/run/, updating /var/run/xcatd.pid → /run/xcatd.pid; please update the unit file accordingly. --- xCAT-server/etc/init.d/xcatd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/etc/init.d/xcatd.service b/xCAT-server/etc/init.d/xcatd.service index 0ec230f0be..6ebc244b2f 100644 --- a/xCAT-server/etc/init.d/xcatd.service +++ b/xCAT-server/etc/init.d/xcatd.service @@ -5,7 +5,7 @@ After=network.target syslog.service [Service] EnvironmentFile=-/etc/sysconfig/xcat Type=forking -PIDFile=/var/run/xcatd.pid +PIDFile=/run/xcatd.pid ExecStart=/etc/init.d/xcatd start ExecStop=/etc/init.d/xcatd stop LimitNOFILE=16000 From 4c3404619ff952ace62f17a8b502efa555413e62 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 1 Nov 2021 10:33:28 +0100 Subject: [PATCH 114/188] Add ipmi_si module to be able to run bmcsetup manually --- xCAT-genesis-scripts/usr/bin/bmcsetup | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index b93a7663c5..515d578cff 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -110,6 +110,7 @@ fi # Add ipmi_devintf module to allow the ipmitool operation in-band modprobe ipmi_devintf +modprobe ipmi_si for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` From cbb39ea328b136d82e6872ce2407322806f499fa Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 4 Oct 2022 15:32:07 -0400 Subject: [PATCH 115/188] Fix Perl error in AAsn.pm --- xCAT-server/lib/xcat/plugins/AAsn.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 511b81853c..11744ca52b 100755 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -2,6 +2,12 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html #------------------------------------------------------- package xCAT_plugin::AAsn; + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use strict; use xCAT::Table; From 1d44787f17373ea9dd0782ad8a89fbd34382fc06 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Wed, 12 Oct 2022 16:02:35 +0200 Subject: [PATCH 116/188] Properly parse newer BIND versions Previous solution did not work for releases > 9.16.9 (ex. 9.16.10) Furthermore, EL9 adds -RH tag at the end (ex. 9.16.23-RH) which needs to be removed. --- xCAT-server/lib/xcat/plugins/ddns.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 712375e248..d1e6f1fff3 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -14,6 +14,7 @@ use xCAT::SvrUtils; use Socket; use Fcntl qw/:flock/; use Data::Dumper; +use version; # This is a rewrite of DNS management using nsupdate rather than # direct zone mangling @@ -1282,10 +1283,10 @@ sub update_namedconf { push @newnamed, "\t\t$_;\n"; } push @newnamed, "\t};\n"; - my $bind_version_cmd="/usr/sbin/named -v | cut -d' ' -f2"; + my $bind_version_cmd="/usr/sbin/named -v | cut -d' ' -f2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'"; my @bind_version =xCAT::Utils->runcmd($bind_version_cmd, 0); # Turn off DNSSEC if running with bind vers 9.16.6 or higher - if ((scalar @bind_version > 0) && ($bind_version[0] ge "9.16.6")) { + if ((scalar @bind_version > 0) && (version->parse($bind_version[0]) >= version->parse(9.16.6))) { push @newnamed, "\tdnssec-enable no;\n"; push @newnamed, "\tdnssec-validation no;\n"; } From 4278783a9e5b49f434816365e43f026b47b2d116 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 14 Oct 2022 14:31:19 -0400 Subject: [PATCH 117/188] Sign RH9 dependency RPMs with SHA256 --- builddep.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/builddep.sh b/builddep.sh index acb4a8fc22..c01ab89d02 100755 --- a/builddep.sh +++ b/builddep.sh @@ -239,9 +239,23 @@ if ! $GREP -q '%_gpg_name' $MACROS 2>/dev/null; then echo '%_gpg_name xCAT Automatic Signing Key' >> $MACROS fi -# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal. -echo "===> Signing RPMs..." -$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' +# Sign the rpms that are not already signed. The "standard input reopened" warnings are normal. +# First sign all non RH9 RPMS with DEFAULT algorithm, if running this script on RH7 or RH8, +# most likely it will be SHA1 +echo "===> Signing RPMs with DEFAULT algorithm..." +$XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm' ! -path './rh9/*'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' + +# Update $MACROS file so that RPMS will be signed with SHA256 algorithm +if ! $GREP -q '%_gpg_sign_cmd' $MACROS 2>/dev/null; then + echo '%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --batch --verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u "%{_gpg_name}" -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}' >> $MACROS +fi + +# Second sign all RH9 RPMS with SHA256 algorithm +echo "===> Signing RH9 RPMs with SHA265 algorithm..." +$XCATCOREDIR/build-utils/rpmsign.exp `find rh9 -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' + +# Remove SHA256 algorithm statement from $MACROS file, back to DEFAULT +sed -i '/__gpg_sign_cmd/d' $MACROS # Create the repodata dirs echo "===> Creating repodata directories..." From afaa1e24aec766e2e3b8c9f9b774e03f74105728 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 14 Oct 2022 14:46:53 -0400 Subject: [PATCH 118/188] Update comments --- builddep.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/builddep.sh b/builddep.sh index c01ab89d02..9ad4fa8645 100755 --- a/builddep.sh +++ b/builddep.sh @@ -240,8 +240,7 @@ if ! $GREP -q '%_gpg_name' $MACROS 2>/dev/null; then fi # Sign the rpms that are not already signed. The "standard input reopened" warnings are normal. -# First sign all non RH9 RPMS with DEFAULT algorithm, if running this script on RH7 or RH8, -# most likely it will be SHA1 +# First, sign all non RH9 RPMS with DEFAULT algorithm, if running this script on RH7, most likely it will be SHA1 echo "===> Signing RPMs with DEFAULT algorithm..." $XCATCOREDIR/build-utils/rpmsign.exp `find . -type f -name '*.rpm' ! -path './rh9/*'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' @@ -250,7 +249,7 @@ if ! $GREP -q '%_gpg_sign_cmd' $MACROS 2>/dev/null; then echo '%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --batch --verbose --no-armor --passphrase-fd 3 --no-secmem-warning -u "%{_gpg_name}" -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}' >> $MACROS fi -# Second sign all RH9 RPMS with SHA256 algorithm +# Second, sign all RH9 RPMS with SHA256 algorithm echo "===> Signing RH9 RPMs with SHA265 algorithm..." $XCATCOREDIR/build-utils/rpmsign.exp `find rh9 -type f -name '*.rpm'` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)' From 204bbe92f4df063657c331bfb1e2c5d9d537c1bf Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Oct 2022 15:11:00 -0400 Subject: [PATCH 119/188] Update conserver setting for testcase --- xCAT-test/autotest/testcase/installation/SN_setup_case | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 37d62ec2ba..de33689472 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -30,7 +30,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 setupntp=1 +cmd:chdef -t group -o service setupnfs=1 setupdhcp=1 setuptftp=1 setupnameserver=1 setupconserver=2 setupntp=1 check:rc==0 cmd:chdef -t group -o service nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN monserver=$$MN check:rc==0 From bc35fbb494f4fba405e9903a5445c364db61048f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 18 Oct 2022 16:30:21 -0400 Subject: [PATCH 120/188] Add testcase to verify xCAT public keys --- xCAT-test/autotest/testcase/go_xcat/case3 | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/xCAT-test/autotest/testcase/go_xcat/case3 b/xCAT-test/autotest/testcase/go_xcat/case3 index 7c1ea5a9ae..fcff836164 100644 --- a/xCAT-test/autotest/testcase/go_xcat/case3 +++ b/xCAT-test/autotest/testcase/go_xcat/case3 @@ -39,6 +39,33 @@ check:output=~Version cmd:xdsh $$CN "service xcatd status" check:rc==0 check:output=~running + +#Uninstall xCAT, then install again and verify public keys +cmd:xdsh $$CN "cd /; ./go-xcat completely uninstall" +check:rc==0 +check:output=~xCAT has been uninstalled + +#Remove --nogpgcheck (yum/dnf) --no-gpg-checks (zypper) and --allow-unauthenticated (apt-get) flags from go-xcat +# to install xCAT public key when installing packages +cmd:xdsh $$CN "sed -i 's/\-\-nogpgcheck//g' /go-xcat" +cmd:xdsh $$CN "sed -i 's/\-\-no\-gpg\-checks//g' /go-xcat" +cmd:xdsh $$CN "sed -i 's/\-\-allow\-unauthenticated//g' /go-xcat" + +#Install devel version of xCAT. If first attempt fails, try again +cmd:xdsh $$CN "cd /; ./go-xcat --xcat-version=devel -y install" +cmd:version=`xdsh $$CN /opt/xcat/bin/lsxcatd -v`; if [[ $version =~ "Version" ]]; then echo "xCAT installed successfully first time"; else echo "First attempt to install xCAT failed, attempting to install xCAT again"; xdsh $$CN "cd /; ./go-xcat --xcat-version=devel -y install"; fi + +cmd:xdsh $$CN "source /etc/profile.d/xcat.sh; lsxcatd -v" +check:output=~Version +cmd:xdsh $$CN "service xcatd status" +check:rc==0 +check:output=~running + +#Verify xCAT public key was installed +cmd:xdsh $$CN "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" +check:output=~xCAT Automatic Signing Key + +cmd:xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b" cmd:xdsh $$CN "service xcatd stop" end From 0ce91078a9e74e5a71399267490d92465ae56d73 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 20 Oct 2022 09:20:56 -0400 Subject: [PATCH 121/188] Affirmative reply to uninstall command --- xCAT-test/autotest/testcase/go_xcat/case3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/go_xcat/case3 b/xCAT-test/autotest/testcase/go_xcat/case3 index fcff836164..badf2b488d 100644 --- a/xCAT-test/autotest/testcase/go_xcat/case3 +++ b/xCAT-test/autotest/testcase/go_xcat/case3 @@ -41,7 +41,7 @@ check:rc==0 check:output=~running #Uninstall xCAT, then install again and verify public keys -cmd:xdsh $$CN "cd /; ./go-xcat completely uninstall" +cmd:xdsh $$CN "cd /; ./go-xcat -y completely uninstall" check:rc==0 check:output=~xCAT has been uninstalled From de70f3b1e2a8e791ef6995a1c53d5d5e10fc937b Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 25 Oct 2022 10:02:44 -0400 Subject: [PATCH 122/188] Use apt-key command on Ubunty system to verify signature key during regression test --- xCAT-test/autotest/testcase/go_xcat/case3 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/go_xcat/case3 b/xCAT-test/autotest/testcase/go_xcat/case3 index badf2b488d..705b24a33d 100644 --- a/xCAT-test/autotest/testcase/go_xcat/case3 +++ b/xCAT-test/autotest/testcase/go_xcat/case3 @@ -62,10 +62,12 @@ check:rc==0 check:output=~running #Verify xCAT public key was installed -cmd:xdsh $$CN "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'" +cmd:if xdsh $$CN "grep \"Ubuntu\" /etc/*release >/dev/null"; then xdsh $$CN "apt-key list"; else xdsh $$CN "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'"; fi check:output=~xCAT Automatic Signing Key -cmd:xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b" +#Remove public key on non-Ubuntu system. It was installed during go-xcat RPM installs +cmd:if xdsh $$CN "grep -v \"Ubuntu\" /etc/*release >/dev/null"; then xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b"; fi + cmd:xdsh $$CN "service xcatd stop" end From a6e08e4229ec821ba885114185b0f50478e6f285 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 25 Oct 2022 15:24:27 -0400 Subject: [PATCH 123/188] Free up disk space for regression test on SLES --- .../installation/reg_linux_diskless_installation_flat | 6 ++++++ 1 file changed, 6 insertions(+) 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 2c0a0252a2..94eb5c6464 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -139,6 +139,9 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 +#Move .iso out of the way to free up disk space +cmd:if [[ "$$OS" =~ "sle" ]]; then mv $$ISO /home; fi + 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 [[ -f /test.synclist ]] ;then mv -f /test.synclist /test.synclist.bak;fi; @@ -213,4 +216,7 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons -d $$CN; else makeconserverc cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist;else rm -rf /test.synclist;fi cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 + +#Move .iso back +cmd:if [[ "$$OS" =~ "sle" ]]; then mv /home/$$ISO /; fi end From 5ebb85a08014a39d78b424072109477766551385 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 26 Oct 2022 10:21:01 -0400 Subject: [PATCH 124/188] Better way to check OS in testcase --- xCAT-test/autotest/testcase/go_xcat/case3 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/go_xcat/case3 b/xCAT-test/autotest/testcase/go_xcat/case3 index 705b24a33d..01b58b915e 100644 --- a/xCAT-test/autotest/testcase/go_xcat/case3 +++ b/xCAT-test/autotest/testcase/go_xcat/case3 @@ -62,11 +62,11 @@ check:rc==0 check:output=~running #Verify xCAT public key was installed -cmd:if xdsh $$CN "grep \"Ubuntu\" /etc/*release >/dev/null"; then xdsh $$CN "apt-key list"; else xdsh $$CN "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'"; fi +cmd:if [[ "$$OS" =~ "ubuntu" ]]; then xdsh $$CN "apt-key list"; else xdsh $$CN "rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} --> %{summary}\n'"; fi check:output=~xCAT Automatic Signing Key #Remove public key on non-Ubuntu system. It was installed during go-xcat RPM installs -cmd:if xdsh $$CN "grep -v \"Ubuntu\" /etc/*release >/dev/null"; then xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b"; fi +cmd:if [[ "$$OS" !~ "ubuntu" ]]; then xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b"; fi cmd:xdsh $$CN "service xcatd stop" end From 03741fdd376274305f397c7c678232df4e49a52f Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 26 Oct 2022 11:02:50 -0400 Subject: [PATCH 125/188] Add more time for node to reboot --- .../testcase/installation/reg_linux_diskfull_installation_flat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 db489679da..199fcabaa9 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskfull_installation_flat @@ -79,7 +79,7 @@ cmd:xdsh $$CN "grep 'load host key' /var/log/xcat/xcat.log || echo 'No load host check:output=~No load hostkey warning # Check node can be rebooted from disk cmd:xdsh $$CN shutdown -r now -cmd:sleep 300 +cmd:sleep 360 cmd:xdsh $$CN uptime check:rc==0 check:output=~up From f4351a98a5abfc4f605b0765bd507e9091f9d33f Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Thu, 27 Oct 2022 11:59:21 -0400 Subject: [PATCH 126/188] Return year only for date for currentyear in makentp_extntpserver_value --- xCAT-test/autotest/testcase/makentp/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/makentp/cases0 b/xCAT-test/autotest/testcase/makentp/cases0 index cf5a27d643..78c96c5d51 100644 --- a/xCAT-test/autotest/testcase/makentp/cases0 +++ b/xCAT-test/autotest/testcase/makentp/cases0 @@ -46,7 +46,7 @@ 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 | awk '{print $6}' > /tmp/currentyear +cmd:date +"%Y" > /tmp/currentyear check:rc==0 cmd:date -s 20000101 check:rc==0 From fe41b7008b2d82caa3cfdc79fc8ea8bcedaf9651 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 27 Oct 2022 12:00:39 -0400 Subject: [PATCH 127/188] Use correct string compare operator for testcase --- xCAT-test/autotest/testcase/go_xcat/case3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/go_xcat/case3 b/xCAT-test/autotest/testcase/go_xcat/case3 index 01b58b915e..a62653d026 100644 --- a/xCAT-test/autotest/testcase/go_xcat/case3 +++ b/xCAT-test/autotest/testcase/go_xcat/case3 @@ -66,7 +66,7 @@ cmd:if [[ "$$OS" =~ "ubuntu" ]]; then xdsh $$CN "apt-key list"; else xdsh $$CN " check:output=~xCAT Automatic Signing Key #Remove public key on non-Ubuntu system. It was installed during go-xcat RPM installs -cmd:if [[ "$$OS" !~ "ubuntu" ]]; then xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b"; fi +cmd:if [[ "$$OS" != "ubuntu" ]]; then xdsh $$CN "rpm -e gpg-pubkey-ca548a47-5b2c830b"; fi cmd:xdsh $$CN "service xcatd stop" end From 71aeb71b8553882ab13bdd772dfdd332d66940d3 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:33:04 -0400 Subject: [PATCH 128/188] Spelling correction in chvm output --- xCAT-server/lib/xcat/plugins/kvm.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index b4d1a11787..ce4c665c58 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -2258,7 +2258,7 @@ sub chvm { } if ($cpucount or $memory) { if ($currstate eq 'on') { - if ($cpucount) { xCAT::SvrUtils::sendmsg([ 1, "Hot add of cpus not supported (VM must be powered down to successfuly change)" ], $callback, $node); } + if ($cpucount) { xCAT::SvrUtils::sendmsg([ 1, "Hot add of cpus not supported (VM must be powered down to successfully change)" ], $callback, $node); } if ($cpucount) { #$dom->set_vcpus($cpucount); this didn't work out as well as I hoped.. From f2cdc7cb94b94fa09d7ffe8a5157f9a5e10d1fcb Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 28 Oct 2022 13:56:32 -0400 Subject: [PATCH 129/188] Make sure initd files are installed --- xCAT-server/xCAT-server.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 0823f2a1fe..33709f89ed 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -41,7 +41,7 @@ BuildArch: noarch Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser %else BuildRequires: perl-generators -Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(LWP::Protocol::https) perl-XML-LibXML +Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(LWP::Protocol::https) perl-XML-LibXML (initscripts or insserv-compat) %endif Obsoletes: atftp-xcat %endif From f4fc0014da97cf12ca9c3587db3ea384fa9b6da0 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 31 Oct 2022 11:31:57 -0400 Subject: [PATCH 130/188] Free up disk space for regression test on SLES (2) --- .../installation/reg_linux_statelite_installation_flat | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat index 57a14bc679..99e3ddb8d8 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -24,6 +24,8 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 +#Move .iso out of the way to free up disk space +cmd:if [[ "$$OS" =~ "sle" ]]; then mv $$ISO /home; fi 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\|Rocky" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv;fi check:rc==0 @@ -132,4 +134,7 @@ check:rc==0 cmd:if [ -x /usr/bin/goconserver ]; then makegocons -d $$CN; else makeconservercf -d $$CN; fi 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 + +#Move .iso back +cmd:if [[ "$$OS" =~ "sle" ]]; then mv /home/$$ISO /; fi end From 55e40787687314717f0a11e34720e5b3ab31f2b8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 1 Nov 2022 15:13:17 -0400 Subject: [PATCH 131/188] Install initscripts during xCAT go-install --- xCAT-server/share/xcat/tools/go-xcat | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index c85c921dba..70da3308c3 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.50 +# Version 1.0.51 # # Copyright (C) 2016 - 2021 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -40,6 +40,8 @@ # - Provide correct versions of packages to be installed # 2021-07-27 Mark Gurevich # - Add support for Rocky Linux +# 2022-11-01 Mark Gurevich +# - Make sure initscripts installed on RH family of OSes # @@ -1709,6 +1711,7 @@ function install_packages_dnf() local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift dnf --nogpgcheck "${yes[@]}" install "$@" + dnf --nogpgcheck "${yes[@]}" install initscripts } function install_packages_yum() @@ -1717,6 +1720,7 @@ function install_packages_yum() local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift yum --nogpgcheck "${yes[@]}" install "$@" + yum --nogpgcheck "${yes[@]}" install initscripts } # Dirty workaround on SLES 11 SP4 From 32b072e35c1946482e2ee0741f1b043b982b4ecb Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 1 Nov 2022 15:17:34 -0400 Subject: [PATCH 132/188] Revert "Make sure initd files are installed with xCAT-server" --- xCAT-server/xCAT-server.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 33709f89ed..0823f2a1fe 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -41,7 +41,7 @@ BuildArch: noarch Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser %else BuildRequires: perl-generators -Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(LWP::Protocol::https) perl-XML-LibXML (initscripts or insserv-compat) +Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(LWP::Protocol::https) perl-XML-LibXML %endif Obsoletes: atftp-xcat %endif From 89d36b9b94e1a874fc38c57b82d82f7b94d0f248 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 7 Nov 2022 14:32:31 -0500 Subject: [PATCH 133/188] more_diskspace3 --- .../installation/reg_linux_diskless_installation_flat | 6 ++---- .../installation/reg_linux_statelite_installation_flat | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) 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 94eb5c6464..76e8ab2d6e 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -139,8 +139,8 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -#Move .iso out of the way to free up disk space -cmd:if [[ "$$OS" =~ "sle" ]]; then mv $$ISO /home; fi +#On SLES remove rh dependency dirs to free up disk space +cmd:if [[ "$$OS" =~ "sle" ]]; then rm -rf /xcat-dep/rh*; fi 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 @@ -217,6 +217,4 @@ cmd:if [[ -f /test.synclist.bak ]] ;then mv -f /test.synclist.bak /test.synclist cmd:chdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute synclists= check:rc==0 -#Move .iso back -cmd:if [[ "$$OS" =~ "sle" ]]; then mv /home/$$ISO /; fi 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 99e3ddb8d8..26e14e16d1 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_statelite_installation_flat @@ -24,8 +24,8 @@ check:rc==0 cmd:copycds $$ISO check:rc==0 -#Move .iso out of the way to free up disk space -cmd:if [[ "$$OS" =~ "sle" ]]; then mv $$ISO /home; fi +#On SLES remove rh dependency dirs to free up disk space +cmd:if [[ "$$OS" =~ "sle" ]]; then rm -rf /xcat-dep/rh*; fi 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\|Rocky" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv;fi check:rc==0 @@ -135,6 +135,4 @@ cmd:if [ -x /usr/bin/goconserver ]; then makegocons -d $$CN; else makeconserverc 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 -#Move .iso back -cmd:if [[ "$$OS" =~ "sle" ]]; then mv /home/$$ISO /; fi end From fc168cc9b81fcacff432d59ed07857fefb3ba7b1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 8 Nov 2022 14:46:00 -0500 Subject: [PATCH 134/188] Test lzma compression for genesis network boot --- xCAT-server/lib/xcat/plugins/mknb.pm | 2 +- .../autotest/bundle/rhels_ppcle_weekly.bundle | 1 + .../autotest/bundle/rhels_x86_weekly.bundle | 1 + xCAT-test/autotest/testcase/genesis/cases0 | 27 +++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 435cede47b..4fbd5869fc 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -104,7 +104,7 @@ sub process_request { $callback->({ error => "Need to specify architecture (x86, x86_64 or ppc64)" }, { errorcode => [1] }); return; } elsif ($arch eq "ppc64le" or $arch eq "ppc64el") { - $callback->({ data => "The arch:$arch is not supported at present, use \"ppc64\" instead" }); + $callback->({ data => "The arch:$arch is not supported, using \"ppc64\" instead" }); $arch = 'ppc64'; $request->{arg}->[0] = $arch; } diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index 55a98b8275..3334b784b0 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -23,6 +23,7 @@ get_xcat_postscripts_loginfo nodeset_cmdline nodeset_runimg nodeset_shell +nodeset_shell_lzma reg_linux_diskfull_installation_flat compare_postscripts cleanup_postscripts_diskfull diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 5cb54620a4..1ea44ff43c 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -23,6 +23,7 @@ get_xcat_postscripts_loginfo nodeset_cmdline nodeset_runimg nodeset_shell +nodeset_shell_lzma reg_linux_diskfull_installation_flat compare_postscripts cleanup_postscripts_diskfull diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index ed1b4ee59e..b38389827a 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -1,3 +1,30 @@ +start:nodeset_shell_lzma +os:rhels +label:others,genesis +description: verify could log in genesis shell lzma compression +cmd:yum install -y https://rpmfind.net/linux/centos/8-stream/PowerTools/__GETNODEATTR($$CN,arch)__/os/Packages/xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm +#Generate genesis network boot with lzma compression +cmd:mknb __GETNODEATTR($$CN,arch)__ +check:rc==0 +cmd:nodeset $$CN shell +check:rc==0 +cmd:ls -l /tftpboot/xcat/genesis.fs.*.lzma +check:output=~genesis +cmd:find /tftpboot -type f -name $$CN | xargs grep "lzma" +check:output=~genesis +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -g +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -s +check:rc==0 +cmd:perl /opt/xcat/share/xcat/tools/autotest/testcase/genesis/genesistest.pl -n $$CN -c +check:rc==0 +cmd:cat /tmp/genesistestlog/* +#Remove lzma compression RPM, cleanup and generate default gz genesis network boot +cmd:yum remove -y xz-lzma-compat +cmd:rm -f /tftpboot/xcat/genesis.fs.*.lzma +cmd:mknb __GETNODEATTR($$CN,arch)__ +end + start:nodeset_shell label:others,genesis description: verify could log in genesis shell From e942dd6f3724f2c69f62ef23bb46d8e039897ec2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 14 Nov 2022 16:00:33 -0500 Subject: [PATCH 135/188] Limit lzma testcase to run only on EL8 family of OSes --- xCAT-test/autotest/testcase/genesis/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index b38389827a..9d929016e6 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -1,5 +1,5 @@ start:nodeset_shell_lzma -os:rhels +os:rhels8 label:others,genesis description: verify could log in genesis shell lzma compression cmd:yum install -y https://rpmfind.net/linux/centos/8-stream/PowerTools/__GETNODEATTR($$CN,arch)__/os/Packages/xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm From 621b4bb48905ab3b56972fd90fec18211136e8a1 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Tue, 15 Nov 2022 13:29:08 -0500 Subject: [PATCH 136/188] Updated enableSSHbetweennodes documentation in Zone.pm --- perl-xCAT/xCAT/Zone.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Zone.pm b/perl-xCAT/xCAT/Zone.pm index babb42281a..620443a7ca 100644 --- a/perl-xCAT/xCAT/Zone.pm +++ b/perl-xCAT/xCAT/Zone.pm @@ -270,12 +270,12 @@ sub getmyzonename =head3 enableSSHbetweennodes Arguments: - zonename + nodename Returns: 1 if the sshbetweennodes attribute is yes/1 or undefined 0 if the sshbetweennodes attribute is no/0 Example: - xCAT::Zone->enableSSHbetweennodes($zonename); + xCAT::Zone->enableSSHbetweennodes($nodename); =cut #-------------------------------------------------------------------------------- From 5652b23845651164b37eabd8b3dfd118d02ee26e Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Tue, 15 Nov 2022 13:44:41 -0500 Subject: [PATCH 137/188] Fixed POD syntax error in rspconfig.1.pod --- .../guides/admin-guides/references/man1/rspconfig.1.rst | 4 +--- xCAT-client/pods/man1/rspconfig.1.pod | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst index 54a8f4a979..538e223ba9 100644 --- a/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rspconfig.1.rst @@ -777,9 +777,7 @@ EXAMPLES -4. - - To display the frame number for frame 9A00-10000001 +4. To display the frame number for frame 9A00-10000001 .. code-block:: perl diff --git a/xCAT-client/pods/man1/rspconfig.1.pod b/xCAT-client/pods/man1/rspconfig.1.pod index 67abfc7944..f452dc2cc8 100644 --- a/xCAT-client/pods/man1/rspconfig.1.pod +++ b/xCAT-client/pods/man1/rspconfig.1.pod @@ -572,7 +572,6 @@ Output is similar to: node4: BMC SNMP Destination 1: 9.114.47.227 =item 4. - To display the frame number for frame 9A00-10000001 rspconfig> 9A00-10000001 frame From 2b9f84b35b89ee7cba3f6bfcd99825fe20b0fec1 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Tue, 15 Nov 2022 13:47:47 -0500 Subject: [PATCH 138/188] Fixed minor documentation typo in xcattest.1.rst --- docs/source/guides/admin-guides/references/man1/xcattest.1.rst | 2 +- xCAT-test/pods/man1/xcattest.1.pod | 2 +- 2 files changed, 2 insertions(+), 2 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 a2762fa6f0..6e3470595f 100644 --- a/docs/source/guides/admin-guides/references/man1/xcattest.1.rst +++ b/docs/source/guides/admin-guides/references/man1/xcattest.1.rst @@ -193,7 +193,7 @@ EXAMPLES 4. - To add a new test case to test \ **chvm**\ . In this example, we assume that the \ **min_mem**\ should not be equal to 16 in the lpar profile of computenode. The case name is \ **chvm_customi**\ . It creates a test lpar named \ **testnode**\ first, then changes the \ **min_mem**\ of the lpar to 16 using \ **chvm**\ , then checks if \ **min_mem**\ have changed correctly. Finally, the \ **testnode**\ is removed. + To add a new test case to test \ **chvm**\ . In this example, we assume that the \ **min_mem**\ should not be equal to 16 in the lpar profile of computenode. The case name is \ **chvm_custom**\ . It creates a test lpar named \ **testnode**\ first, then changes the \ **min_mem**\ of the lpar to 16 using \ **chvm**\ , then checks if \ **min_mem**\ have changed correctly. Finally, the \ **testnode**\ is removed. .. code-block:: perl diff --git a/xCAT-test/pods/man1/xcattest.1.pod b/xCAT-test/pods/man1/xcattest.1.pod index d54afcd33d..535b01980b 100644 --- a/xCAT-test/pods/man1/xcattest.1.pod +++ b/xCAT-test/pods/man1/xcattest.1.pod @@ -123,7 +123,7 @@ To run specified test cases with I file: =item 4. -To add a new test case to test B. In this example, we assume that the B should not be equal to 16 in the lpar profile of computenode. The case name is B. It creates a test lpar named B first, then changes the B of the lpar to 16 using B, then checks if B have changed correctly. Finally, the B is removed. +To add a new test case to test B. In this example, we assume that the B should not be equal to 16 in the lpar profile of computenode. The case name is B. It creates a test lpar named B first, then changes the B of the lpar to 16 using B, then checks if B have changed correctly. Finally, the B is removed. add a new test case file in /opt/xcat/share/xcat/tools/autotest/chvm edit filename From b99133ad848332b703542b5f38d4bf794d317101 Mon Sep 17 00:00:00 2001 From: fangjzh <34927528+fangjzh@users.noreply.github.com> Date: Sun, 20 Nov 2022 22:19:58 +0800 Subject: [PATCH 139/188] Update diskinfo of Rocky Linux 8.7 Update diskinfo of Rocky Linux 8.7 --- perl-xCAT/xCAT/data/discinfo.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/perl-xCAT/xCAT/data/discinfo.pm b/perl-xCAT/xCAT/data/discinfo.pm index 00a5cfc50d..19ad579f16 100755 --- a/perl-xCAT/xCAT/data/discinfo.pm +++ b/perl-xCAT/xCAT/data/discinfo.pm @@ -14,6 +14,7 @@ require Exporter; use strict; our %distnames = ( + "1668116088.755845" => "rocky8.7", #x86_64 "1652648703.486923" => "rocky8.6", #x86_64 "1636882174.934804" => "rocky8.5", #x86_64 "1624205633.869423" => "rocky8.4", #x86_64 From 5ea831704d9a7537b7597af21aad0cd0d8cbe012 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 28 Nov 2022 15:10:28 -0500 Subject: [PATCH 140/188] Ignore lzma dependency on Oracle --- xCAT-test/autotest/testcase/genesis/cases0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-test/autotest/testcase/genesis/cases0 b/xCAT-test/autotest/testcase/genesis/cases0 index 9d929016e6..e2e7e7ca89 100644 --- a/xCAT-test/autotest/testcase/genesis/cases0 +++ b/xCAT-test/autotest/testcase/genesis/cases0 @@ -2,7 +2,7 @@ start:nodeset_shell_lzma os:rhels8 label:others,genesis description: verify could log in genesis shell lzma compression -cmd:yum install -y https://rpmfind.net/linux/centos/8-stream/PowerTools/__GETNODEATTR($$CN,arch)__/os/Packages/xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm +cmd:if [[ "__GETNODEATTR($$CN,os)__" =~ "rhel" ]]; then yum install -y https://rpmfind.net/linux/centos/8-stream/PowerTools/__GETNODEATTR($$CN,arch)__/os/Packages/xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm; elif rpm -q xz; then yum download https://rpmfind.net/linux/centos/8-stream/PowerTools/__GETNODEATTR($$CN,arch)__/os/Packages/xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm; rpm -ivh --nodeps xz-lzma-compat-5.2.4-3.el8.__GETNODEATTR($$CN,arch)__.rpm; fi #Generate genesis network boot with lzma compression cmd:mknb __GETNODEATTR($$CN,arch)__ check:rc==0 From 3ecf73ce6b360ee5d2859bea11ee34df8e9e5b74 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 29 Nov 2022 11:50:18 -0500 Subject: [PATCH 141/188] Fix 'quiet' spelling --- xCAT-server/lib/xcat/plugins/nodestat.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index bdea53303e..201b596736 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -136,7 +136,7 @@ sub preprocess_request # parse the options $::UPDATE = 0; - $::QUITE = 0; + $::QUIET = 0; $::MON = 0; $::POWER = 0; @@ -146,7 +146,7 @@ sub preprocess_request $Getopt::Long::ignorecase = 0; if (!GetOptions( 'm|usemon' => \$::MON, - 'q|quite' => \$::QUITE, #this is a internal flag used by monitoring + 'q|quiet' => \$::QUIET, #this is a internal flag used by monitoring 'u|updatedb' => \$::UPDATE, 'p|powerstat' => \$::POWER, 'h|help' => \$::HELP, @@ -174,7 +174,7 @@ sub preprocess_request } $req->{'update'}->[0] = $::UPDATE; - $req->{'quite'}->[0] = $::QUITE; + $req->{'quiet'}->[0] = $::QUIET; $req->{'mon'}->[0] = $::MON; $req->{'power'}->[0] = $::POWER; return [$req]; @@ -1123,11 +1123,11 @@ sub process_request { #print Dumper($request); my $update = $request->{'update'}->[0]; - my $quite = $request->{'quite'}->[0]; + my $quiet = $request->{'quiet'}->[0]; #show the output - if (!$quite) { + if (!$quiet) { foreach my $node1 (sort keys(%$status)) { my %rsp; $rsp{name} = [$node1]; From 2ca90e44648b93a5c82102d0aa311399fadb0419 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 1 Dec 2022 17:21:14 -0500 Subject: [PATCH 142/188] Split RHEL weekly bundles --- .../bundle/rhels8_ppcle_weekly.bundle | 39 +++++++++++++++++++ .../autotest/bundle/rhels8_x86_weekly.bundle | 38 ++++++++++++++++++ .../autotest/bundle/rhels_ppcle_weekly.bundle | 3 -- .../autotest/bundle/rhels_x86_weekly.bundle | 3 -- 4 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 xCAT-test/autotest/bundle/rhels8_ppcle_weekly.bundle create mode 100644 xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle diff --git a/xCAT-test/autotest/bundle/rhels8_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels8_ppcle_weekly.bundle new file mode 100644 index 0000000000..32b9104c31 --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels8_ppcle_weekly.bundle @@ -0,0 +1,39 @@ +#INCLUDE:rhels_ppcle_daily.bundle# +packimage_imagename +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_o_p_a_m +reg_linux_statelite_installation_hierarchy_by_nfs +reg_linux_statelite_installation_hierarchy_by_ramdisk +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_range_w +bmcdiscover_range_z +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +xcatprobe_work +confignetwork_static_installnic +get_xcat_postscripts_loginfo +nodeset_cmdline +nodeset_runimg +nodeset_shell +nodeset_shell_lzma +reg_linux_diskfull_installation_flat +reg_linux_diskfull_installation_flat_modules_and_groups_rh8 +compare_postscripts +cleanup_postscripts_diskfull +reg_linux_diskless_installation_flat +reg_linux_diskless_installation_flat_squashfs +reg_linux_diskless_installation_flat_modules_and_groups_rh8 +reg_linux_statelite_installation_flat +cleanup_postscripts_diskless +rmimage_diskless +rpower_reset +runcmdinstaller_command +linux_diskless_kdump diff --git a/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle new file mode 100644 index 0000000000..eaa9ad8920 --- /dev/null +++ b/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle @@ -0,0 +1,38 @@ +#INCLUDE:rhels_x86_daily.bundle# +packimage_imagename +packimage_m_cpio_c_gzip +packimage_m_cpio_c_xz +packimage_m_invalid_archive_method +packimage_m_invalid_compress_method +packimage_m_tar_c_gzip +packimage_m_tar_c_xz +packimage_o_p_a_m +reg_linux_statelite_installation_hierarchy_by_nfs +reg_linux_statelite_installation_hierarchy_by_ramdisk +bmcdiscover_h +bmcdiscover_nmap_range +bmcdiscover_v +bmcdiscover_range_w +bmcdiscover_range_z +bmcdiscover_help +bmcdiscover_q +bmcdiscover_version +xcatprobe_work +confignetwork_static_installnic +get_xcat_postscripts_loginfo +nodeset_cmdline +nodeset_runimg +nodeset_shell +nodeset_shell_lzma +reg_linux_diskfull_installation_flat +reg_linux_diskfull_installation_flat_modules_and_groups_rh8 +compare_postscripts +cleanup_postscripts_diskfull +reg_linux_diskless_installation_flat +reg_linux_diskless_installation_flat_squashfs +reg_linux_diskless_installation_flat_modules_and_groups_rh8 +reg_linux_statelite_installation_flat +cleanup_postscripts_diskless +rmimage_diskless +rpower_reset +runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index 3bfccc16b2..cf89e8abd3 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -23,16 +23,13 @@ get_xcat_postscripts_loginfo nodeset_cmdline nodeset_runimg nodeset_shell -nodeset_shell_lzma reg_linux_diskfull_installation_flat reg_linux_diskfull_installation_flat_groups_rh7 -reg_linux_diskfull_installation_flat_modules_and_groups_rh8 compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs reg_linux_diskless_installation_flat_groups_rh7 -reg_linux_diskless_installation_flat_modules_and_groups_rh8 reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 893b15648e..5f2d4b16e6 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -23,16 +23,13 @@ get_xcat_postscripts_loginfo nodeset_cmdline nodeset_runimg nodeset_shell -nodeset_shell_lzma reg_linux_diskfull_installation_flat reg_linux_diskfull_installation_flat_groups_rh7 -reg_linux_diskfull_installation_flat_modules_and_groups_rh8 compare_postscripts cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs reg_linux_diskless_installation_flat_groups_rh7 -reg_linux_diskless_installation_flat_modules_and_groups_rh8 reg_linux_statelite_installation_flat cleanup_postscripts_diskless rmimage_diskless From 45f55e08c17a68fc8688dcf3b783c25cc679e6e6 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Mon, 5 Dec 2022 01:04:46 -0500 Subject: [PATCH 143/188] Remove added osimage and node attributes at the end of linux_diskless_kdump --- xCAT-test/autotest/testcase/kdump/linux_diskless_kdump | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump index 9cc77f6a17..b374ec095f 100644 --- a/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump +++ b/xCAT-test/autotest/testcase/kdump/linux_diskless_kdump @@ -118,4 +118,12 @@ cmd:rm -rf /opt/xcat/share/xcat/tools/autotest/kdumpdir cmd:cat /tmp/node.stanza | chdef -z;rm -rf /tmp/node.stanza cmd:cat /tmp/osimage.stanza | chdef -z;rm -rf /tmp/osimage.stanza cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then mv $rootimgdir.regbak $rootimgdir -f;fi + +# Remove crashkernelsize and dump from the osimage definition and enablekdump from the node defintion +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute crashkernelsize= +check:rc==0 +cmd:chdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute dump= +check:rc==0 +cmd:chdef -t node $$CN -m postscripts=enablekdump +check:rc==0 end From d44c86fadfdfff1b3c024bce61148683424d89fe Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 5 Dec 2022 11:42:34 +0100 Subject: [PATCH 144/188] Remove deprecated blocksize argument Fixes the following error with perl-Crypt-CBC >= 3.0+ (default on EL9+) 'blocksize' is not a recognized argument at /usr/share/perl5/vendor_perl/Crypt/CBC.pm line 312. at /opt/xcat/lib/perl/xCAT/IPMI.pm line 724. --- xCAT-server/lib/perl/xCAT/IPMI.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/IPMI.pm b/xCAT-server/lib/perl/xCAT/IPMI.pm index 3fb50d582b..2164e8aee8 100644 --- a/xCAT-server/lib/perl/xCAT/IPMI.pm +++ b/xCAT-server/lib/perl/xCAT/IPMI.pm @@ -717,7 +717,7 @@ sub handle_ipmi_packet { my @payload = splice(@rsp, 12, $psize); if ($encrypted) { my $iv = pack("C*", splice @payload, 0, 16); - my $cipher = Crypt::CBC->new(-literal_key => 1, -key => $self->{aeskey}, -cipher => "Crypt::Rijndael", -header => "none", -iv => $iv, -keysize => 16, -blocksize => 16, -padding => \&cbc_pad); + my $cipher = Crypt::CBC->new(-literal_key => 1, -key => $self->{aeskey}, -cipher => "Crypt::Rijndael", -header => "none", -iv => $iv, -keysize => 16, -padding => \&cbc_pad); my $crypted = pack("C*", @payload); @payload = unpack("C*", $cipher->decrypt($crypted)); } From 8e6e151151cc81d2dc67d5165152e9accdd5399c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 7 Dec 2022 10:49:18 -0500 Subject: [PATCH 145/188] Installing xCAT on EL9 display message that EPEL and CRB repos are needed --- xCAT-server/share/xcat/tools/go-xcat | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index 70da3308c3..e830f57e03 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -42,6 +42,8 @@ # - Add support for Rocky Linux # 2022-11-01 Mark Gurevich # - Make sure initscripts installed on RH family of OSes +# 2022-12-06 Mark Gurevich +# - Check for EPEL and CRB repository on EL9 family of OSes # @@ -205,6 +207,8 @@ GO_XCAT_UNINSTALL_LIST=("${GO_XCAT_INSTALL_LIST[@]}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" export PATH +EL9_EPEL_TEST_RPM="perl-Crypt-CBC" +EL9_CRB_TEST_RPM="perl-IO-Tty" # # warn_if_bad Put out warning message(s) if $1 has bad RC. @@ -1708,6 +1712,7 @@ function update_repo() function install_packages_dnf() { type dnf >/dev/null 2>&1 || return 255 + el9_epel_and_crb_check dnf local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift dnf --nogpgcheck "${yes[@]}" install "$@" @@ -1717,6 +1722,7 @@ function install_packages_dnf() function install_packages_yum() { type yum >/dev/null 2>&1 || return 255 + el9_epel_and_crb_check yum local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift yum --nogpgcheck "${yes[@]}" install "$@" @@ -1732,6 +1738,55 @@ function github_issue_5503_workaround() return 0 } +# Check for EPEL and CRB repositories when installing on RH family of OSes +function el9_epel_and_crb_check() +{ + action="$@" # Passed parameter will only be 'yum' or 'dnf' + if [[ "${GO_XCAT_LINUX_DISTRO}" = "fedora" ]] + then + # For Fedora, version 35 is equivalent to EL9 + # But since xCAT currently does not support that version, just + # return and let 'yum install' fail if needed packages are not + # found + return 0 + else + [[ "${GO_XCAT_LINUX_VERSION}" =~ ^9(\.[0-9]) ]] || return 0 + fi + ${action} list available -q ${EL9_EPEL_TEST_RPM} + ret="$?" + case "${ret}" in + "1") + # Can not find EL9_EPEL_TEST_RPM + echo " +Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires EPEL repository to be enabled" + echo "Running '${action} install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm' will enable EPEL repository" + exit 1 + ;; + esac + ${action} list available -q ${EL9_CRB_TEST_RPM} + ret="$?" + case "${ret}" in + "1") + # Ccan not find EL9_CRB_TEST_RPM + echo " +Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires CRB repository to be enabled" + echo "Try adding the following entries to new or existing '.repo' file:" + echo " +[crb] +name=CentOS Stream $releasever - CRB +metalink=https://mirrors.centos.org/metalink?repo=centos-crb-$stream&arch=$basearch&protocol=https,http +gpgcheck=0 +repo_gpgcheck=0 +metadata_expire=6h +countme=1 +enabled=1 + " + exit 1 + ;; + esac + return 0 +} + function install_packages_zypper() { type zypper >/dev/null 2>&1 || return 255 From af7264f1babe78a5b4e1390bc97badceeb71d920 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 7 Dec 2022 11:12:25 -0500 Subject: [PATCH 146/188] Bump up go-xcat version number --- 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 e830f57e03..dd446c2e68 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.51 +# Version 1.0.52 # # Copyright (C) 2016 - 2021 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) From e60265ef90d854bdae9218fd98c53a74af131dcf Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Thu, 8 Dec 2022 18:20:12 +0100 Subject: [PATCH 147/188] Do not exclude ./usr/lib/locale/C* Missing C locale can cause issues with programs like tmux --- xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.exlist | 1 + xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.exlist | 1 + xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.exlist | 1 + xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.exlist | 1 + 10 files changed, 10 insertions(+) diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.exlist index ccad8b8c8e..8295677779 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.exlist index f717a5bcc1..01bbec99ce 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.exlist index 30b29ed632..2ed5893422 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/omf* ./usr/share/vim/site/doc* ./usr/share/vim/vim74/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.exlist index 38de240021..275bdd5913 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.exlist index 944d990e73..07436e39f8 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.ppc64le.exlist @@ -23,6 +23,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/omf* ./usr/share/vim/site/doc* ./usr/share/vim/vim74/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.exlist index def3241d33..c74b15c00d 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels8.x86_64.exlist @@ -23,6 +23,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.exlist index 944d990e73..07436e39f8 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.ppc64le.exlist @@ -23,6 +23,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/omf* ./usr/share/vim/site/doc* ./usr/share/vim/vim74/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.exlist b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.exlist index def3241d33..c74b15c00d 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels9.x86_64.exlist @@ -23,6 +23,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.exlist b/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.exlist index 38de240021..275bdd5913 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.exlist +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels7.ppc64le.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* diff --git a/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.exlist b/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.exlist index 38de240021..275bdd5913 100644 --- a/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.exlist +++ b/xCAT-server/share/xcat/netboot/rh/service.rhels7.x86_64.exlist @@ -25,6 +25,7 @@ +./usr/share/locale/locale.alias +./usr/lib/locale/locale-archive +./usr/lib/locale/en* ++./usr/lib/locale/C* ./usr/share/man* ./usr/share/omf* ./usr/share/vim/site/doc* From 108943ee74f98a2fb099f46cf746461cb5b45364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Obih=C3=B6rnchen?= Date: Fri, 9 Dec 2022 17:59:34 +0100 Subject: [PATCH 148/188] Load ipmi_powernv for ppc64 arch --- xCAT-genesis-scripts/usr/bin/bmcsetup | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index 515d578cff..84b9bac3ed 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -109,8 +109,12 @@ if ! ipmitool -V 2>/dev/null| grep "version"; then fi # Add ipmi_devintf module to allow the ipmitool operation in-band +if grep -q "^ppc64" <<< "$(uname -m)"; then + modprobe ipmi_powernv +else + modprobe ipmi_si +fi modprobe ipmi_devintf -modprobe ipmi_si for parm in `cat /proc/cmdline`; do key=`echo $parm|awk -F= '{print $1}'` From cb7290605428f9f5853f006b8fd328ae9ed42a64 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 10 Jan 2023 10:21:40 -0500 Subject: [PATCH 149/188] Testcase enhancements --- .../installation/reg_linux_diskless_installation_flat | 4 ++-- xCAT-test/autotest/testcase/pythonsupport/cases0 | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) 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 76e8ab2d6e..1d2ed7413e 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat @@ -20,7 +20,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true; do [ $a -eq 100 ] && { echo "After 100 iterations, makedhcp -q $$CN did not return any output"; makedhcp -q all; exit 1; }; output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;echo "[$a] Waiting for makedhcp -q $$CN to return output"; a=$[$a+1]; sleep 1;done +cmd:a=0;while true; do [ $a -eq 10 ] && { echo "After 10 iterations, makedhcp -q $$CN did not return any output"; makedhcp -q all; exit 1; }; [ $a -eq 5 ] && { echo "After 5 iterations, makedhcp -q $$CN did not return any output. Retrying makedhcp -a again"; makedhcp -a; }; output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;echo "[$a] Waiting for makedhcp -q $$CN to return output"; a=$[$a+1]; sleep 1;done check:rc==0 cmd:copycds $$ISO check:rc==0 @@ -134,7 +134,7 @@ cmd:makedhcp -n check:rc==0 cmd:makedhcp -a check:rc==0 -cmd:a=0;while true; do [ $a -eq 100 ] && { echo "After 100 iterations, makedhcp -q $$CN did not return any output"; makedhcp -q all; exit 1; }; output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;echo "[$a] Waiting for makedhcp -q $$CN to return output"; a=$[$a+1]; sleep 1;done +cmd:a=0;while true; do [ $a -eq 10 ] && { echo "After 10 iterations, makedhcp -q $$CN did not return any output"; makedhcp -q all; exit 1; }; [ $a -eq 5 ] && { echo "After 5 iterations, makedhcp -q $$CN did not return any output. Retrying makedhcp -a again"; makedhcp -a; }; output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;echo "[$a] Waiting for makedhcp -q $$CN to return output"; a=$[$a+1]; sleep 1;done check:rc==0 cmd:copycds $$ISO check:rc==0 diff --git a/xCAT-test/autotest/testcase/pythonsupport/cases0 b/xCAT-test/autotest/testcase/pythonsupport/cases0 index 9d820857cb..0e496120e7 100644 --- a/xCAT-test/autotest/testcase/pythonsupport/cases0 +++ b/xCAT-test/autotest/testcase/pythonsupport/cases0 @@ -33,6 +33,7 @@ check:rc==0 cmd:cat /etc/yum.repos.d/xcat-dep-python-local.repo check:rc==0 cmd:wget https://xcat.org/files/xcat/xcat-dep/2.x_Linux/beta/xCAT-openbmc-py-RH7-2.14.6-snap202204090016.noarch.rpm --no-check-certificate -O /tmp/xCAT-openbmc-py-RH7.noarch.rpm +check:rc==0 cmd:ls -l /tmp/xCAT-openbmc-py-RH7.noarch.rpm check:rc==0 cmd:yum install -y /tmp/xCAT-openbmc-py-RH7.noarch.rpm From 5b5b54c3c3128105bc86ebe7e92476cd86a5ec26 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 12 Jan 2023 16:08:31 -0500 Subject: [PATCH 150/188] Eliminate some duplicate output lines from xcatprobe osdeploy --- xCAT-probe/subcmds/osdeploy | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/xCAT-probe/subcmds/osdeploy b/xCAT-probe/subcmds/osdeploy index afe461baab..a34869a095 100755 --- a/xCAT-probe/subcmds/osdeploy +++ b/xCAT-probe/subcmds/osdeploy @@ -812,15 +812,28 @@ Start capturing every message during OS provision process.... my @hdls; my $starttime = time(); my @candidate_mn_hostname_in_log = $log_parse->obtain_candidate_mn_hostname_in_log(); + my $log_content_ref_last; - #read log realtimely, then handle each log + # Loop forever, reading each log file for (; ;) { if (@hdls = $select->can_read(0)) { foreach my $hdl (@hdls) { my $line = ""; chomp($line = <$hdl>); 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); + if ($log_content_ref->{label} == $::LOGLABEL_XCAT) { + # If reading computes or cluster log files, try to eliminate duplicated lines + unless (($log_content_ref_last->{time_record} eq $log_content_ref->{time_record}) && + ($log_content_ref_last->{sender} eq $log_content_ref->{sender}) && + ($log_content_ref_last->{msg} eq $log_content_ref->{msg})) { + dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); + } + # Save messages details for later duplicate detection + $log_content_ref_last = { %$log_content_ref }; + } + else { + dispatch_log_to_handler($log_content_ref, \@candidate_mn_hostname_in_log, \%node_state); + } } } From 1172e462bca6d5ef62b6457d46bd2b48916d0201 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 17 Jan 2023 10:49:12 -0500 Subject: [PATCH 151/188] Debug RHEL8.6 modules testcase --- xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle | 5 ----- .../reg_linux_diskless_installation_flat_modules_and_groups | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle index eaa9ad8920..d4249a502f 100644 --- a/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels8_x86_weekly.bundle @@ -31,8 +31,3 @@ cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs reg_linux_diskless_installation_flat_modules_and_groups_rh8 -reg_linux_statelite_installation_flat -cleanup_postscripts_diskless -rmimage_diskless -rpower_reset -runcmdinstaller_command diff --git a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups index 5821e409c1..01962e1494 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_flat_modules_and_groups @@ -34,6 +34,7 @@ check:output=~xml-common cmd:xdsh $$CN yum module list --installed check:output=~ruby check:output=~2.6 +end # Verify group and module can be removed cmd:cp /opt/xcat/share/xcat/netboot/rh/compute.rhels8.__GETNODEATTR($$CN,arch)__.pkglist /opt/xcat/share/xcat/netboot/rh/compute.pkglist.modules From 9fbd58bfc336c769b71338fcda7f974ba84b37a4 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 18 Jan 2023 11:00:59 -0500 Subject: [PATCH 152/188] Initial Alma8 support --- perl-xCAT/xCAT/Schema.pm | 4 ++-- perl-xCAT/xCAT/Utils.pm | 4 ++-- xCAT-server/lib/perl/xCAT/Postage.pm | 1 + xCAT-server/lib/perl/xCAT/SvrUtils.pm | 6 +++++ xCAT-server/lib/perl/xCAT/Template.pm | 2 +- xCAT-server/lib/xcat/plugins/anaconda.pm | 23 ++++++++++++++----- xCAT-server/lib/xcat/plugins/geninitrd.pm | 6 ++--- xCAT-server/lib/xcat/plugins/imgcapture.pm | 8 +++++++ xCAT-server/lib/xcat/plugins/imgport.pm | 1 + xCAT-server/lib/xcat/plugins/ontap.pm | 1 + xCAT-server/lib/xcat/plugins/route.pm | 4 ++-- .../xcat/install/alma/compute.alma8.pkglist | 1 + .../xcat/install/alma/compute.alma8.tmpl | 1 + .../xcat/install/alma/service.alma8.pkglist | 1 + .../xcat/install/alma/service.alma8.tmpl | 1 + .../service.alma8.x86_64.otherpkgs.pkglist | 1 + .../netboot/alma/compute.alma8.x86_64.exlist | 1 + .../netboot/alma/compute.alma8.x86_64.pkglist | 1 + .../alma/compute.alma8.x86_64.postinstall | 1 + xCAT-server/share/xcat/netboot/alma/dracut | 1 + .../share/xcat/netboot/alma/dracut_033 | 1 + .../share/xcat/netboot/alma/dracut_047 | 1 + xCAT-server/share/xcat/netboot/alma/genimage | 1 + xCAT-server/share/xcat/netboot/alma/geninitrd | 1 + .../share/xcat/netboot/alma/kvm.exlist | 1 + .../share/xcat/netboot/alma/kvm.pkglist | 1 + .../netboot/alma/service.alma8.x86_64.exlist | 1 + .../service.alma8.x86_64.otherpkgs.pkglist | 1 + .../netboot/alma/service.alma8.x86_64.pkglist | 1 + .../alma/service.alma8.x86_64.postinstall | 1 + .../share/xcat/netboot/alma/xen.exlist | 1 + .../share/xcat/netboot/alma/xen.pkglist | 1 + 32 files changed, 65 insertions(+), 16 deletions(-) create mode 120000 xCAT-server/share/xcat/install/alma/compute.alma8.pkglist create mode 120000 xCAT-server/share/xcat/install/alma/compute.alma8.tmpl create mode 120000 xCAT-server/share/xcat/install/alma/service.alma8.pkglist create mode 120000 xCAT-server/share/xcat/install/alma/service.alma8.tmpl create mode 120000 xCAT-server/share/xcat/install/alma/service.alma8.x86_64.otherpkgs.pkglist create mode 120000 xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.exlist create mode 120000 xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.pkglist create mode 120000 xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.postinstall create mode 120000 xCAT-server/share/xcat/netboot/alma/dracut create mode 120000 xCAT-server/share/xcat/netboot/alma/dracut_033 create mode 120000 xCAT-server/share/xcat/netboot/alma/dracut_047 create mode 120000 xCAT-server/share/xcat/netboot/alma/genimage create mode 120000 xCAT-server/share/xcat/netboot/alma/geninitrd create mode 120000 xCAT-server/share/xcat/netboot/alma/kvm.exlist create mode 120000 xCAT-server/share/xcat/netboot/alma/kvm.pkglist create mode 120000 xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.exlist create mode 120000 xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.otherpkgs.pkglist create mode 120000 xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.pkglist create mode 120000 xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.postinstall create mode 120000 xCAT-server/share/xcat/netboot/alma/xen.exlist create mode 120000 xCAT-server/share/xcat/netboot/alma/xen.pkglist diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 2385e9f7ce..9012eec171 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -756,7 +756,7 @@ passed as argument rather than by table value', table_desc => 'A few hardware and software characteristics of the nodes.', descriptions => { node => 'The node name or group name.', - os => 'The operating system deployed on this node. Valid values: AIX, rhels*,rhelc*, rhas*,centos*,rocky*,SL*, fedora*, sles* (where * is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile.', + os => 'The operating system deployed on this node. Valid values: AIX, rhels*,rhelc*, rhas*,centos*, alma*, rocky*,SL*, fedora*, sles* (where * is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile.', arch => 'The hardware architecture of this node. Valid values: x86_64, ppc64, x86, ia64.', profile => 'The string to use to locate a kickstart or autoyast template to use for OS deployment of this node. If the provmethod attribute is set to an osimage name, that takes precedence, and profile need not be defined. Otherwise, the os, profile, and arch are used to search for the files in /install/custom first, and then in /opt/xcat/share/xcat.', provmethod => 'The provisioning method for node deployment. The valid values are install, netboot, statelite or an os image name from the osimage table. If an image name is specified, the osimage definition stored in the osimage table and the linuximage table (for Linux) or nimimage table (for AIX) are used to locate the files for templates, pkglists, syncfiles, etc. On Linux, if install, netboot or statelite is specified, the os, profile, and arch are used to search for the files in /install/custom first, and then in /opt/xcat/share/xcat.', @@ -799,7 +799,7 @@ passed as argument rather than by table value', cfmdir => 'CFM directory name for PCM. Set to /install/osimages//cfmdir by PCM. ', profile => 'The node usage category. For example compute, service.', osname => 'Operating system name- AIX or Linux.', - osvers => 'The Linux operating system deployed on this node. Valid values: rhels*,rhelc*, rhas*,centos*,rocky*,SL*, fedora*, sles* (where * is the version #).', + osvers => 'The Linux operating system deployed on this node. Valid values: rhels*,rhelc*, rhas*,centos*,alma*, rocky*,SL*, fedora*, sles* (where * is the version #).', osarch => 'The hardware architecture of this node. Valid values: x86_64, ppc64, x86, ia64.', synclists => 'The fully qualified name of a file containing a list of files to synchronize on the nodes. Can be a comma separated list of multiple synclist files. The synclist generated by PCM named /install/osimages//synclist.cfm is reserved for use only by PCM and should not be edited by the admin.', postscripts => 'Comma separated list of scripts that should be run on this image after diskful installation or diskless boot. For installation of RedHat, CentOS, Fedora, the scripts will be run before the reboot. For installation of SLES, the scripts will be run after the reboot but before the init.d process. For diskless deployment, the scripts will be run at the init.d time, and xCAT will automatically add the list of scripts from the postbootscripts attribute to run after postscripts list. For installation of AIX, the scripts will run after the reboot and acts the same as the postbootscripts attribute. For AIX, use the postbootscripts attribute. See the site table runbootscripts attribute.', diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index c1ecf0d8be..aac6da437b 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -3724,7 +3724,7 @@ sub filter_nostatusupdate { #filter out the nodes which support the node provision status feedback my @nodesfiltered = (); if (exists $inref->{$::STATUS_INSTALLING}) { - map { if ($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|rocky|sles|ubuntu)/) { push @nodesfiltered, $_; } } @{ $inref->{$::STATUS_INSTALLING} }; + map { if ($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|alma|rocky|sles|ubuntu)/) { push @nodesfiltered, $_; } } @{ $inref->{$::STATUS_INSTALLING} }; delete $inref->{$::STATUS_INSTALLING}; if (@nodesfiltered) { @{ $inref->{$::STATUS_INSTALLING} } = @nodesfiltered; @@ -3733,7 +3733,7 @@ sub filter_nostatusupdate { @nodesfiltered = (); if (exists $inref->{$::STATUS_NETBOOTING}) { - map { if ($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|rocky|sles|ubuntu)/) { push @nodesfiltered, $_; } } @{ $inref->{$::STATUS_NETBOOTING} }; + map { if ($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|alma|rocky|sles|ubuntu)/) { push @nodesfiltered, $_; } } @{ $inref->{$::STATUS_NETBOOTING} }; delete $inref->{$::STATUS_NETBOOTING}; if (@nodesfiltered) { @{ $inref->{$::STATUS_NETBOOTING} } = @nodesfiltered; diff --git a/xCAT-server/lib/perl/xCAT/Postage.pm b/xCAT-server/lib/perl/xCAT/Postage.pm index e3ab9a8864..b7d44b9d3c 100644 --- a/xCAT-server/lib/perl/xCAT/Postage.pm +++ b/xCAT-server/lib/perl/xCAT/Postage.pm @@ -1222,6 +1222,7 @@ sub getImageitems_for_node { if ($os =~ /rh.*/) { $platform = "rh"; } elsif ($os =~ /centos.*/) { $platform = "centos"; } + elsif ($os =~ /alma.*/) { $platform = "alma"; } elsif ($os =~ /rocky.*/) { $platform = "rocky"; } elsif ($os =~ /fedora.*/) { $platform = "fedora"; } elsif ($os =~ /SL.*/) { $platform = "SL"; } diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 561706ef1c..40c17982ff 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -401,6 +401,7 @@ sub getsynclistfile() if ($os) { if ($os =~ /rh.*/) { $platform = "rh"; } elsif ($os =~ /centos.*/) { $platform = "centos"; } + elsif ($os =~ /alma.*/) { $platform = "alma"; } elsif ($os =~ /rocky.*/) { $platform = "rocky"; } elsif ($os =~ /fedora.*/) { $platform = "fedora"; } elsif ($os =~ /sles.*/) { $platform = "sles"; } @@ -432,6 +433,7 @@ sub getsynclistfile() if ($os) { if ($os =~ /rh.*/) { $platform = "rh"; } elsif ($os =~ /centos.*/) { $platform = "centos"; } + elsif ($os =~ /alma.*/) { $platform = "alma"; } elsif ($os =~ /rocky.*/) { $platform = "rocky"; } elsif ($os =~ /fedora.*/) { $platform = "fedora"; } elsif ($os =~ /sles.*/) { $platform = "sles"; } @@ -2173,6 +2175,10 @@ sub getplatform { { $platform = "centos"; } + elsif ($os =~ /alma.*/) + { + $platform = "alma"; + } elsif ($os =~ /rocky.*/) { $platform = "rocky"; diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 9eb971ff5b..27ae00094b 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -301,7 +301,7 @@ sub subvars { my $space10 = " " x 10; my $space12 = " " x 12; foreach my $pkgdir (@pkgdirs) { - if ($platform =~ /^(rh|SL|centos|ol|fedora|rocky)$/) { + if ($platform =~ /^(rh|SL|centos|alma|ol|fedora|rocky)$/) { 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. diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 5c0d0507ab..541cec729b 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -41,10 +41,10 @@ sub handled_commands { return { copycd => "anaconda", - mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)", - mkinstall => "nodetype:os=(pkvm.*)|(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", - mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", - mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)", + mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)", + mkinstall => "nodetype:os=(pkvm.*)|(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", + mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", + mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)", }; } @@ -145,7 +145,7 @@ sub process_request sub using_dracut { my $os = shift; - if ($os =~ /(rhels|rhel|centos|rocky|ol)(\d+)/) { + if ($os =~ /(rhels|rhel|centos|alma|rocky|ol)(\d+)/) { if ($2 >= 6) { return 1; } @@ -762,7 +762,7 @@ sub mknetboot } # turn off the selinux - if ($osver =~ m/(fedora12|fedora13|rhels7|rhels8|ol7|ol8|rocky8)/) { + if ($osver =~ m/(fedora12|fedora13|rhels7|rhels8|ol7|ol8|alma8|rocky8)/) { $kcmdline .= " selinux=0 "; } @@ -2013,6 +2013,7 @@ sub copycd } if ($distname and $distname !~ /^centos/ + and $distname !~ /^alma/ and $distname !~ /^rocky/ and $distname !~ /^fedora/ and $distname !~ /^SL/ @@ -2070,6 +2071,8 @@ sub copycd $distname = "centos-stream" . $1; } elsif ($desc and $desc =~ /Rocky Linux (.*)/) { $distname = "rocky" . $1; + } elsif ($desc and $desc =~ /AlmaLinux (.*)/) { + $distname = "alma" . $1; } unless ($dno) { @@ -2156,7 +2159,11 @@ sub copycd } elsif ($_ =~ /family\s*=\s*Rocky/i) { $distname = "rocky" . $desc; last; + } elsif ($_ =~ /family\s*=\s*Alma/i) { + $distname = "alma" . $desc; + last; } + } close($dinfo); } @@ -2407,6 +2414,10 @@ sub getplatform { { $platform = "centos"; } + elsif ($os =~ /alma.*/) + { + $platform = "alma"; + } elsif ($os =~ /rocky.*/) { $platform = "rocky"; diff --git a/xCAT-server/lib/xcat/plugins/geninitrd.pm b/xCAT-server/lib/xcat/plugins/geninitrd.pm index 5e1710fd07..157280ee70 100644 --- a/xCAT-server/lib/xcat/plugins/geninitrd.pm +++ b/xCAT-server/lib/xcat/plugins/geninitrd.pm @@ -190,7 +190,7 @@ sub geninitrd { mkpath $tftppath; } if ($arch =~ /x86/) { - if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)/) { + if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)/) { $kernelpath = "$tftppath/vmlinuz"; copy("$pkgdir/images/pxeboot/vmlinuz", $kernelpath); $initrdpath = "$tftppath/initrd.img"; @@ -205,7 +205,7 @@ sub geninitrd { return; } } elsif ($arch =~ /ppc/) { - if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)|(pkvm.*)/) { + if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)|(pkvm.*)/) { $kernelpath = "$tftppath/vmlinuz"; copy("$pkgdir/ppc/ppc64/vmlinuz", $kernelpath); if (-r "$pkgdir/ppc/ppc64/ramdisk.image.gz") { @@ -231,7 +231,7 @@ sub geninitrd { # call the insert_dd function in the anaconda or sles to hack the initrd that: # 1. Get the new kernel from update distro and copy it to /tftpboot # 2. Inject the drivers to initrd in /tftpboot base on the new kernel ver - if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)/) { + if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(alma.*)|(rocky.*)|(rh.*)|(fedora.*)|(SL.*)/) { require xCAT_plugin::anaconda; xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk); } elsif ($osvers =~ /(sles.*)|(suse.*)/) { diff --git a/xCAT-server/lib/xcat/plugins/imgcapture.pm b/xCAT-server/lib/xcat/plugins/imgcapture.pm index 6c11f596c5..2074bf3330 100755 --- a/xCAT-server/lib/xcat/plugins/imgcapture.pm +++ b/xCAT-server/lib/xcat/plugins/imgcapture.pm @@ -463,6 +463,8 @@ sub getplatform { $platform = "rh"; } elsif ($os =~ m/centos.*/) { $platform = "centos"; + } elsif ($os =~ m/alma.*/) { + $platform = "alma"; } elsif ($os =~ m/rocky.*/) { $platform = "rocky"; } elsif ($os =~ m/fedora.*/) { @@ -846,6 +848,12 @@ sub getOsVersion { $version = $lines[0]; $version =~ s/[^0-9]*([0-9.]+).*/$1/; $os = $os . $version; + } + elsif (grep (/Alma Linux/, @lines)) { + $os = "alma"; + $version = $lines[0]; + $version =~ s/[^0-9]*([0-9.]+).*/$1/; + $os = $os . $version; } elsif (grep (/Rocky/, @lines)) { $os = "rocky"; diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index ab0446ba9e..620d7cf492 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -1354,6 +1354,7 @@ sub change_profile { if ($os) { if ($os =~ /rh.*/) { $platform = "rh"; } elsif ($os =~ /centos.*/) { $platform = "centos"; } + elsif ($os =~ /alma.*/) { $platform = "alma"; } elsif ($os =~ /rocky.*/) { $platform = "rocky"; } elsif ($os =~ /fedora.*/) { $platform = "fedora"; } elsif ($os =~ /sles.*/) { $platform = "sles"; } diff --git a/xCAT-server/lib/xcat/plugins/ontap.pm b/xCAT-server/lib/xcat/plugins/ontap.pm index 1b2b1e67d3..3c4ad1e0b9 100644 --- a/xCAT-server/lib/xcat/plugins/ontap.pm +++ b/xCAT-server/lib/xcat/plugins/ontap.pm @@ -217,6 +217,7 @@ sub create_new_lun { my %osmap = ( 'rh.*' => 'linux', 'centos.*' => 'linux', + 'alma.*' => 'linux', 'rocky.*' => 'linux', 'sles.*' => 'linux', 'win2k8' => 'windows_2008', diff --git a/xCAT-server/lib/xcat/plugins/route.pm b/xCAT-server/lib/xcat/plugins/route.pm index 659e651e01..cf52825057 100644 --- a/xCAT-server/lib/xcat/plugins/route.pm +++ b/xCAT-server/lib/xcat/plugins/route.pm @@ -669,7 +669,7 @@ sub set_route { } elsif ($os =~ /ubuntu|debian/) { #ubuntu or Debian? addPersistentRoute_Debian($callback, $net, $mask, $gw_ip, $gw, $ifname); } - elsif ($os =~ /rh|fedora|centos|rocky/) { #RH, Ferdora, CentOS + elsif ($os =~ /rh|fedora|centos|alma|rocky/) { #RH, Ferdora, CentOS addPersistentRoute_RH($callback, $net, $mask, $gw_ip, $gw, $ifname); } } else { #AIX @@ -756,7 +756,7 @@ sub delete_route { } elsif ($os =~ /ubuntu/) { #ubuntu or Debian? deletePersistentRoute_Debian($callback, $net, $mask, $gw_ip, $gw, $ifname); } - elsif ($os =~ /rh|fedora|centos|rocky/) { #RH, Ferdora + elsif ($os =~ /rh|fedora|centos|alma|rocky/) { #RH, Ferdora deletePersistentRoute_RH($callback, $net, $mask, $gw_ip, $gw, $ifname); } } diff --git a/xCAT-server/share/xcat/install/alma/compute.alma8.pkglist b/xCAT-server/share/xcat/install/alma/compute.alma8.pkglist new file mode 120000 index 0000000000..ccb1fe4ef8 --- /dev/null +++ b/xCAT-server/share/xcat/install/alma/compute.alma8.pkglist @@ -0,0 +1 @@ +../rh/compute.rhels8.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/alma/compute.alma8.tmpl b/xCAT-server/share/xcat/install/alma/compute.alma8.tmpl new file mode 120000 index 0000000000..50866c82ac --- /dev/null +++ b/xCAT-server/share/xcat/install/alma/compute.alma8.tmpl @@ -0,0 +1 @@ +../rh/compute.rhels8.tmpl \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/alma/service.alma8.pkglist b/xCAT-server/share/xcat/install/alma/service.alma8.pkglist new file mode 120000 index 0000000000..818f670ec9 --- /dev/null +++ b/xCAT-server/share/xcat/install/alma/service.alma8.pkglist @@ -0,0 +1 @@ +../rh/service.rhels8.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/alma/service.alma8.tmpl b/xCAT-server/share/xcat/install/alma/service.alma8.tmpl new file mode 120000 index 0000000000..373e2f6ebe --- /dev/null +++ b/xCAT-server/share/xcat/install/alma/service.alma8.tmpl @@ -0,0 +1 @@ +../rh/service.rhels8.tmpl \ No newline at end of file diff --git a/xCAT-server/share/xcat/install/alma/service.alma8.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/install/alma/service.alma8.x86_64.otherpkgs.pkglist new file mode 120000 index 0000000000..03999f75fb --- /dev/null +++ b/xCAT-server/share/xcat/install/alma/service.alma8.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +../rh/service.rhels8.x86_64.otherpkgs.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.exlist b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.exlist new file mode 120000 index 0000000000..a6d9c0135e --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.exlist @@ -0,0 +1 @@ +../rh/compute.rhels8.x86_64.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.pkglist b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.pkglist new file mode 120000 index 0000000000..5ecd4c4d16 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.pkglist @@ -0,0 +1 @@ +../rh/compute.rhels8.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.postinstall b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.postinstall new file mode 120000 index 0000000000..3e16d254e1 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/compute.alma8.x86_64.postinstall @@ -0,0 +1 @@ +../rh/compute.rhels8.x86_64.postinstall \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/dracut b/xCAT-server/share/xcat/netboot/alma/dracut new file mode 120000 index 0000000000..11bde84457 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/dracut @@ -0,0 +1 @@ +../rh/dracut \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/dracut_033 b/xCAT-server/share/xcat/netboot/alma/dracut_033 new file mode 120000 index 0000000000..0e9de994af --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/dracut_033 @@ -0,0 +1 @@ +../rh/dracut_033 \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/dracut_047 b/xCAT-server/share/xcat/netboot/alma/dracut_047 new file mode 120000 index 0000000000..fe26fce058 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/dracut_047 @@ -0,0 +1 @@ +../rh/dracut_047 \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/genimage b/xCAT-server/share/xcat/netboot/alma/genimage new file mode 120000 index 0000000000..1c50b1848c --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/genimage @@ -0,0 +1 @@ +../rh/genimage \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/geninitrd b/xCAT-server/share/xcat/netboot/alma/geninitrd new file mode 120000 index 0000000000..2271c3f0f1 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/geninitrd @@ -0,0 +1 @@ +genimage \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/kvm.exlist b/xCAT-server/share/xcat/netboot/alma/kvm.exlist new file mode 120000 index 0000000000..c86878d027 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/kvm.exlist @@ -0,0 +1 @@ +../rh/kvm.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/kvm.pkglist b/xCAT-server/share/xcat/netboot/alma/kvm.pkglist new file mode 120000 index 0000000000..010315c63e --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/kvm.pkglist @@ -0,0 +1 @@ +../rh/kvm.rhels5.4.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.exlist b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.exlist new file mode 120000 index 0000000000..9d1e45244d --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.exlist @@ -0,0 +1 @@ +../rh/service.rhels8.x86_64.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.otherpkgs.pkglist b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.otherpkgs.pkglist new file mode 120000 index 0000000000..03999f75fb --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.otherpkgs.pkglist @@ -0,0 +1 @@ +../rh/service.rhels8.x86_64.otherpkgs.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.pkglist b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.pkglist new file mode 120000 index 0000000000..cba1edc0e5 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.pkglist @@ -0,0 +1 @@ +../rh/service.rhels8.x86_64.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.postinstall b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.postinstall new file mode 120000 index 0000000000..cd4cbff178 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/service.alma8.x86_64.postinstall @@ -0,0 +1 @@ +../rh/service.rhels8.x86_64.postinstall \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/xen.exlist b/xCAT-server/share/xcat/netboot/alma/xen.exlist new file mode 120000 index 0000000000..f968576cef --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/xen.exlist @@ -0,0 +1 @@ +../rh/xen.exlist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/alma/xen.pkglist b/xCAT-server/share/xcat/netboot/alma/xen.pkglist new file mode 120000 index 0000000000..b8f1959349 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/alma/xen.pkglist @@ -0,0 +1 @@ +../rh/xen.pkglist \ No newline at end of file From a886e8c480434385c11e6ddbc1d6acdfcf93d9ff Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 19 Jan 2023 13:11:41 -0500 Subject: [PATCH 153/188] Enable go-xcat to insall xCAT on Alma Linux --- xCAT-server/share/xcat/install/scripts/post.rhels8 | 2 +- xCAT-server/share/xcat/netboot/rh/genimage | 2 +- xCAT-server/share/xcat/tools/go-xcat | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xCAT-server/share/xcat/install/scripts/post.rhels8 b/xCAT-server/share/xcat/install/scripts/post.rhels8 index a45862796a..6ab305e87e 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rhels8 +++ b/xCAT-server/share/xcat/install/scripts/post.rhels8 @@ -22,7 +22,7 @@ done # List of internal repos to be disabled -internet_repo_file_list="oracle-linux-ol8.repo uek-ol8.repo Rocky-AppStream.repo Rocky-BaseOS.repo Rocky-Extras.repo CentOS-Base.repo" +internet_repo_file_list="oracle-linux-ol8.repo uek-ol8.repo Rocky-AppStream.repo Rocky-BaseOS.repo Rocky-Extras.repo CentOS-Base.repo almalinux-ha.repo almalinux-nfv.repo almalinux-powertools.repo almalinux.repo almalinux-resilientstorage.repo almalinux-rt.repo" for repo_file in $internet_repo_file_list do diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 8273ae87e6..a79194f235 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -786,7 +786,7 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut")) # List of internet repos to be disabled -my @internet_repo_file_list = ("oracle-linux-ol8.repo", "uek-ol8.repo", "Rocky-AppStream.repo", "Rocky-BaseOS.repo", "Rocky-Extras.repo", "CentOS-Base.repo"); +my @internet_repo_file_list = ("oracle-linux-ol8.repo", "uek-ol8.repo", "Rocky-AppStream.repo", "Rocky-BaseOS.repo", "Rocky-Extras.repo", "CentOS-Base.repo", "almalinux-ha.repo", "almalinux-nfv.repo", "almalinux-plus.repo", "almalinux-powertools.repo", "almalinux.repo", "almalinux-resilientstorage.repo", "almalinux-rt.repo"); foreach ( @internet_repo_file_list ) { if (-e "$rootimg_dir/etc/yum.repos.d/$_") { diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index dd446c2e68..099c4aab00 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.52 +# Version 1.0.53 # # Copyright (C) 2016 - 2021 International Business Machines # Eclipse Public License, Version 1.0 (EPL-1.0) @@ -44,6 +44,8 @@ # - Make sure initscripts installed on RH family of OSes # 2022-12-06 Mark Gurevich # - Check for EPEL and CRB repository on EL9 family of OSes +# 2023-01-19 Mark Gurevich +# - Add support for Alma Linux # @@ -1601,6 +1603,7 @@ function add_xcat_dep_repo_yum_or_zypper() "centos"*) distro="rh${distro#centos}" ;; "ol"*) distro="rh${distro#ol}" ;; "rocky"*) distro="rh${distro#rocky}" ;; + "alma"*) distro="rh${distro#almalinux}" ;; "fedora10"|"fedora11") distro="fedora9" ;; "fedora1"[678]) distro="rh6" ;; "fedora19"|"fedora2"?) distro="rh7" ;; @@ -2353,7 +2356,7 @@ Version: ${GO_XCAT_LINUX_VERSION} EOF case "${GO_XCAT_LINUX_DISTRO}" in -"centos"|"fedora"|"rhel"|"sles"|"ubuntu"|"ol"|"rocky") +"centos"|"fedora"|"rhel"|"sles"|"ubuntu"|"ol"|"rocky"|"almalinux") ;; *) warn_if_bad 1 "${GO_XCAT_LINUX_DISTRO}: unsupported Linux distro" From d83e15372c64f161d41996fdba0a9c2fb32df8e3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 24 Jan 2023 10:05:02 -0500 Subject: [PATCH 154/188] Update docs for password encryption --- .../manage_clusters/ppc64le/configure/password.rst | 7 ++++--- docs/source/guides/get-started/quick_start.rst | 6 +++--- perl-xCAT/xCAT/Schema.pm | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst index 91f2b0f8b9..672bdc75b9 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst @@ -1,13 +1,14 @@ Configure passwords =================== -#. Configure the system password for the ``root`` user on the compute nodes. +#. Configure the system password for the ``root`` user on the compute nodes. This password can be provided in encrypted or clear text form using the :doc:`chtab ` command. + + * Clear text: :: - * Set using the :doc:`chtab ` command: :: chtab key=system passwd.username=root passwd.password=abc123 - To encrypt the password using ``openssl``, use the following command: :: + * Encrypted using ``openssl``: :: chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` diff --git a/docs/source/guides/get-started/quick_start.rst b/docs/source/guides/get-started/quick_start.rst index d8b2b06da8..b85d5c9e4c 100644 --- a/docs/source/guides/get-started/quick_start.rst +++ b/docs/source/guides/get-started/quick_start.rst @@ -43,10 +43,10 @@ Prepare the Management Node ``xcatmn.mydomain.com`` 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 - go-xcat --yes install + /tmp/go-xcat --yes install source /etc/profile.d/xcat.sh -#. Configure the system password for the root user on the compute nodes: :: +#. Configure the system password for the ```root`` user on the compute nodes: :: chtab key=system passwd.username=root passwd.password=abc123 @@ -89,7 +89,7 @@ Stage 2 Provision a node and manage it with parallel shell copycds RHEL-7.6-20181010.0-Server-x86_64-dvd1.iso - After ``copycds``, the corresponding basic osimage will be generated automatically. And then you can list the new osimage name here. You can refer document to customize the package list or postscript for target compute nodes, but here just use the default one: :: + After ``copycds``, the corresponding basic osimage will be generated automatically. Later, package list or postscripts for target compute nodes can be customised. List generated osimages: :: lsdef -t osimage diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 9012eec171..9a46920d8e 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -884,7 +884,7 @@ passed as argument rather than by table value', descriptions => { 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. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported.', + password => 'The default password for this type of component. On Linux, a crypted form could be provided for the "system" component, which will be used during initial node provisioning. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported.', cryptmethod => 'Indicates the method to use 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 to encrypt plain-text passwords.', authdomain => 'The domain in which this entry has meaning, e.g. specifying different domain administrators per active directory domain', comments => 'Any user-written notes.', From 457da8b0738d793ffa969b9687fe363f755e6c5e Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Thu, 26 Jan 2023 21:16:55 -0500 Subject: [PATCH 155/188] Use xCAT::Utils:CheckVersion to compare BIND versions without using the version.pm --- perl-xCAT/xCAT/Utils.pm | 2 +- xCAT-server/lib/xcat/plugins/ddns.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index aac6da437b..bb3827a160 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -2201,7 +2201,7 @@ sub CheckVersion my $index = 0; my $max_index = ($len_a > $len_b) ? $len_a : $len_b; - for ($index = 0 ; $index <= $max_index ; $index++) + for ($index = 0 ; $index < $max_index ; $index++) { my $val_a = ($len_a < $index) ? 0 : $a[$index]; my $val_b = ($len_b < $index) ? 0 : $b[$index]; diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index d1e6f1fff3..693632c926 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -1286,7 +1286,7 @@ sub update_namedconf { my $bind_version_cmd="/usr/sbin/named -v | cut -d' ' -f2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'"; my @bind_version =xCAT::Utils->runcmd($bind_version_cmd, 0); # Turn off DNSSEC if running with bind vers 9.16.6 or higher - if ((scalar @bind_version > 0) && (version->parse($bind_version[0]) >= version->parse(9.16.6))) { + if ((scalar @bind_version > 0) && (xCAT::Utils::CheckVersion($bind_version[0], "9.16.6") >= 0)) { push @newnamed, "\tdnssec-enable no;\n"; push @newnamed, "\tdnssec-validation no;\n"; } From 786d271c5fc1a0998634904cd5f35249312aecb6 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Fri, 27 Jan 2023 10:26:19 -0500 Subject: [PATCH 156/188] remove use version --- xCAT-server/lib/xcat/plugins/ddns.pm | 1 - 1 file changed, 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 693632c926..ab0414d88c 100644 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -14,7 +14,6 @@ use xCAT::SvrUtils; use Socket; use Fcntl qw/:flock/; use Data::Dumper; -use version; # This is a rewrite of DNS management using nsupdate rather than # direct zone mangling From 92e12302b426f649ad337008022de546c2c01fa1 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 30 Jan 2023 11:49:52 -0500 Subject: [PATCH 157/188] Improve packimage time zone handling with no exlist --- xCAT-server/lib/xcat/plugins/packimage.pm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 3eb79ba23f..412f786fc8 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -329,6 +329,18 @@ sub process_request { xCAT::Utils->runcmd("cp /opt/xcat/share/xcat/netboot/rh/dracut_033/install.netboot $rootimg_dir/usr/lib/dracut/modules.d/97xcat/install", 0, 1); + # timedatectl requires /etc/localtime link to the zoneinfo in /usr/share/zoneinfo + if ($timezone[0]) { + unlink("$rootimg_dir/etc/localtime"); + symlink("../usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime"); + + if (not stat "$rootimg_dir/etc/localtime") { + $callback->({ warning => ["Unable to set timezone to \'$timezone[0]\', check this is a valid timezone"] }); + } + } else { + $callback->({ info => ["No timezone defined in site table, skipping timezone /etc/localtime configuration"] }); + } + my $xcat_packimg_tmpfile = "/tmp/xcat_packimg.$$"; my $excludestr = "find . -xdev "; my $includestr; @@ -344,11 +356,7 @@ sub process_request { } close($exlist); - # timedatectl requires /etc/localtime link to the zoneinfo in /usr/share/zoneinfo if ($timezone[0]) { - unlink("$rootimg_dir/etc/localtime"); - symlink("../usr/share/zoneinfo/$timezone[0]", "$rootimg_dir/etc/localtime"); - # Add the zoneinfo to the include list $excludetext .= "+./usr/share/zoneinfo/$timezone[0]\n"; @@ -361,11 +369,8 @@ sub process_request { $excludetext .= "+.$relativetzpath\n"; } - if (not stat "$rootimg_dir/etc/localtime") { - $callback->({ warning => ["Unable to set timezone to \'$timezone[0]\', check this is a valid timezone"] }); - } } else { - $callback->({ info => ["No timezone defined in site table, skipping timezone configuration"] }); + $callback->({ info => ["No timezone defined in site table, skipping timezone exlist configuration"] }); } #handle the #INLCUDE# tag recursively From 20ce89e153009b1f80bd2ed6fa394553ce82dfd3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 30 Jan 2023 14:55:29 -0500 Subject: [PATCH 158/188] Update docs and testcases to use sha512 --- .../manage_clusters/ppc64le/configure/password.rst | 2 +- xCAT-test/autotest/testcase/passwd/case0 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst index 672bdc75b9..5b907820e5 100644 --- a/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst +++ b/docs/source/guides/admin-guides/manage_clusters/ppc64le/configure/password.rst @@ -10,7 +10,7 @@ Configure passwords * Encrypted using ``openssl``: :: - chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` + chtab key=system passwd.username=root passwd.password=`openssl passwd -6 abc123` #. Configure the passwords for Management modules of the compute nodes. diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 42a862d69a..b72ba2efd1 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -228,7 +228,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 -cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` +cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -6 abc123` check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmpcryptedpasswd check:rc==0 @@ -254,7 +254,7 @@ cmd:gettab key=system passwd.cryptmethod > /tmp/tmpcryptmethod check:rc==0 cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 -cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -1 abc123` +cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -6 abc123` check:rc==0 cmd:gettab key=system passwd.password |grep '\$1\$' check:rc==0 From 1c0fc47c8ab824f44161743d2053703d0cb64ac5 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 31 Jan 2023 08:44:56 -0500 Subject: [PATCH 159/188] Install initscripts RPM during xCAT install(2) --- 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 099c4aab00..df96a0c1c2 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1718,8 +1718,8 @@ function install_packages_dnf() el9_epel_and_crb_check dnf local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift - dnf --nogpgcheck "${yes[@]}" install "$@" dnf --nogpgcheck "${yes[@]}" install initscripts + dnf --nogpgcheck "${yes[@]}" install "$@" } function install_packages_yum() @@ -1728,8 +1728,8 @@ function install_packages_yum() el9_epel_and_crb_check yum local -a yes=() [[ "$1" = "-y" ]] && yes=("-y") && shift - yum --nogpgcheck "${yes[@]}" install "$@" yum --nogpgcheck "${yes[@]}" install initscripts + yum --nogpgcheck "${yes[@]}" install "$@" } # Dirty workaround on SLES 11 SP4 @@ -1770,7 +1770,7 @@ Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires EPEL r ret="$?" case "${ret}" in "1") - # Ccan not find EL9_CRB_TEST_RPM + # Can not find EL9_CRB_TEST_RPM echo " Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires CRB repository to be enabled" echo "Try adding the following entries to new or existing '.repo' file:" From 37486f5bedd7d24b6ae61e864f68ddf6d46c4f3a Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 31 Jan 2023 13:58:31 -0500 Subject: [PATCH 160/188] Add Perl library path to xcat.sh --- xCAT-client/xCAT-client.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index f7d6b88a70..a2ecbf2bf0 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -318,6 +318,11 @@ PATH=\$XCATROOT/bin:\$XCATROOT/sbin:\$XCATROOT/share/xcat/tools:\$PATH MANPATH=\$XCATROOT/share/man:\$MANPATH export XCATROOT PATH MANPATH export PERL_BADLANG=0 +# If /usr/local/share/perl5 is not already in @INC, add it to PERL5LIB +perl -e "print \"@INC\"" | egrep "(^|\W)/usr/local/share/perl5($| )" > /dev/null +if [ \$? = 1 ]; then + export PERL5LIB=/usr/local/share/perl5:\$PERL5LIB +fi EOF # export XCATSSLVER for sles11. Others OS can work without this setting. @@ -337,6 +342,11 @@ else setenv MANPATH \${XCATROOT}/share/man:\${MANPATH} endif setenv PERL_BADLANG 0 +# If /usr/local/share/perl5 is not already in @INC, add it to PERL5LIB +perl -e "print \"@INC\"" | egrep "(^|\W)/usr/local/share/perl5($| )" > /dev/null +if [ \$? = 1 ]; then + setenv PERL5LIB /usr/local/share/perl5:\$PERL5LIB +fi EOF chmod 755 /etc/profile.d/xcat.* From d43cb1f134b9692b15dec5eb89ba984d05e43ceb Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Feb 2023 11:03:15 -0500 Subject: [PATCH 161/188] Fix password testcases for sha512 --- xCAT-test/autotest/testcase/passwd/case0 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index b72ba2efd1..9b781d02f2 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -235,8 +235,7 @@ check:rc==0 cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:if grep SUSE /etc/*release;then grep '\$1\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi -#cmd:grep '\$1\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd +cmd:if grep SUSE /etc/*release;then grep '\$6\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:diff /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd check:rc==0 @@ -256,7 +255,7 @@ cmd:gettab key=system passwd.password > /tmp/tmppassword check:rc==0 cmd:chtab key=system passwd.username=root passwd.password=`openssl passwd -6 abc123` check:rc==0 -cmd:gettab key=system passwd.password |grep '\$1\$' +cmd:gettab key=system passwd.password |grep '\$6\$' check:rc==0 #config CN to do diskless provision cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN @@ -286,7 +285,7 @@ cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-net check:rc==0 cmd:if [[ "__GETNODEATTR($$CN,arch)__" =~ "ppc64" ]]; then rnetboot $$CN;elif [[ "__GETNODEATTR($$CN,arch)__" =~ "x86_64" ]];then rpower $$CN boot; fi check:rc==0 -cmd:sleep 900 +cmd:sleep 300 cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done cmd:ping $$CN -c 3 check:rc==0 @@ -296,7 +295,7 @@ check:rc==0 check:output=~booted cmd:scp $$CN:/etc/shadow /tmp check:rc==0 -cmd:grep 'root:\$1\$' /tmp/shadow +cmd:grep 'root:\$6\$' /tmp/shadow 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 3cc4a39c84b2cfb4f08e0a3c1ccb2f6c4e179677 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Feb 2023 16:05:24 -0500 Subject: [PATCH 162/188] Add Perl library path to xcat.csh --- xCAT-client/xCAT-client.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index a2ecbf2bf0..8ed907edfa 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -345,7 +345,7 @@ setenv PERL_BADLANG 0 # If /usr/local/share/perl5 is not already in @INC, add it to PERL5LIB perl -e "print \"@INC\"" | egrep "(^|\W)/usr/local/share/perl5($| )" > /dev/null if [ \$? = 1 ]; then - setenv PERL5LIB /usr/local/share/perl5:\$PERL5LIB + setenv PERL5LIB /usr/local/share/perl5:\${PERL5LIB} fi EOF chmod 755 /etc/profile.d/xcat.* From 23052ccb9744c628c4dcd7ff52031d587dadc4a9 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 2 Feb 2023 13:53:59 -0500 Subject: [PATCH 163/188] Update github action to run on Ubuntu20 --- .github/workflows/xcat_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 781934c5e2..5c1361b8d7 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -3,7 +3,7 @@ on: pull_request jobs: xcat_pr_test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - run: sudo apt-get install -y fakeroot reprepro devscripts debhelper libcapture-tiny-perl libjson-perl libsoap-lite-perl libdbi-perl libcgi-pm-perl quilt openssh-server dpkg looptools genometools software-properties-common From ac75c245e6d5cad23aae1dc42de0db4ba81df616 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Fri, 3 Feb 2023 02:25:09 +0100 Subject: [PATCH 164/188] Fix EL9 chroot detection EL9 shows the following message: Running in chroot, ignoring command ... Previously this was: Running in chroot, ignoring request ... Truncate regex to detect both. --- xCAT/postscripts/xcatlib.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/xcatlib.sh b/xCAT/postscripts/xcatlib.sh index 5ea888fcba..c4c8b4beab 100755 --- a/xCAT/postscripts/xcatlib.sh +++ b/xCAT/postscripts/xcatlib.sh @@ -430,7 +430,7 @@ function startservice { local retmsg retmsg=`$cmd 2>&1` retval=$? - [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1 + [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1 return $retval } @@ -474,7 +474,7 @@ function stopservice { local retmsg retmsg=`$cmd 2>&1` retval=$? - [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1 + [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1 return $retval } @@ -522,7 +522,7 @@ function restartservice { #In the chrooted env, the system management commands(start/stop/restart) will be ignored and the return code is 0 #need to return the proper code in the chrooted scenario - [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring request.*" >/dev/null 2>&1) && retval=1 + [ "$retval" = "0" ] && (echo "$retmsg" | grep -i "Running in chroot,\s*ignoring .*" >/dev/null 2>&1) && retval=1 return $retval } From 89c81844af92eb30e7811ba620fd290aa5e23fe8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 3 Feb 2023 13:08:24 -0500 Subject: [PATCH 165/188] Modify testcases to run on AlmaLinux --- .../autotest/testcase/installation/SN_setup_case | 2 +- xCAT-test/autotest/testcase/restapi/cases0 | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index de33689472..51f45c09ed 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -24,7 +24,7 @@ check:rc==0 cmd:makedhcp -a check:rc==0 cmd:sleep 2 -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\|Rocky" >/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\|Rocky\|AlmaLinux" >/dev/null;then cat /var/lib/dhcpd/dhcpd.leases|grep $$SN;fi check:output=~$$SN cmd:chdef -t node $$SN groups=service,all check:rc==0 diff --git a/xCAT-test/autotest/testcase/restapi/cases0 b/xCAT-test/autotest/testcase/restapi/cases0 index 24cb18239c..8afc981a32 100644 --- a/xCAT-test/autotest/testcase/restapi/cases0 +++ b/xCAT-test/autotest/testcase/restapi/cases0 @@ -1,13 +1,13 @@ start:restapi_setup_on_MN_CN description: Set up the REST API on MN and CN label:restapi -#Install the mod_ssl package on Red Hat and Rocky -cmd:if cat /etc/*release | grep "Red Hat\|Rocky" >/dev/null; then yum install mod_ssl -y; rpm -qa | grep mod_ssl; fi +#Install the mod_ssl package on Red Hat, Rocky and AlmaLinux +cmd:if cat /etc/*release | grep "Red Hat\|Rocky\|AlmaLinux" >/dev/null; then yum install mod_ssl -y; rpm -qa | grep mod_ssl; fi check:rc==0 -cmd:if cat /etc/*release | grep "Red Hat\|Rocky" >/dev/null; then sed -i 's/^\(\s*\)SSLCertificateFile.*$/\1SSLCertificateFile \/etc\/xcat\/cert\/server-cred.pem/' /etc/httpd/conf.d/ssl.conf; fi -cmd:if cat /etc/*release | grep "Red Hat\|Rocky" >/dev/null; then sed -i 's/^\(\s*SSLCertificateKeyFile.*\)$/#\1/' /etc/httpd/conf.d/ssl.conf; fi +cmd:if cat /etc/*release | grep "Red Hat\|Rocky\|AlmaLinux" >/dev/null; then sed -i 's/^\(\s*\)SSLCertificateFile.*$/\1SSLCertificateFile \/etc\/xcat\/cert\/server-cred.pem/' /etc/httpd/conf.d/ssl.conf; fi +cmd:if cat /etc/*release | grep "Red Hat\|Rocky\|AlmaLinux" >/dev/null; then sed -i 's/^\(\s*SSLCertificateKeyFile.*\)$/#\1/' /etc/httpd/conf.d/ssl.conf; fi check:rc==0 -cmd:if cat /etc/*release | grep "Red Hat\|Rocky" >/dev/null; then service httpd restart; fi +cmd:if cat /etc/*release | grep "Red Hat\|Rocky\|AlmaLinux" >/dev/null; then service httpd restart; fi check:rc==0 #Configure the SLES environment cmd:if cat /etc/*release | grep "SLES" >/dev/null; then a2enmod ssl; a2enflag SSL; cp /etc/apache2/vhosts.d/vhost-ssl.template /etc/apache2/vhosts.d/vhost-ssl.conf; fi @@ -30,8 +30,8 @@ cmd:xdsh $$CN "rm /root/ca-cert.pem" check:rc==0 cmd:tabch -d key=xcat passwd check:rc==0 -#Remove the mod_ssl package on Red Hat and Rocky -cmd:if cat /etc/*release | grep "Red Hat\|Rocky" >/dev/null; then yum remove mod_ssl -y; service httpd restart; fi +#Remove the mod_ssl package on Red Hat, Rocky and AlmaLinux +cmd:if cat /etc/*release | grep "Red Hat\|Rocky\|AlmaLinux" >/dev/null; then yum remove mod_ssl -y; service httpd restart; fi check:rc==0 #Clean up the SLES environment cmd:if cat /etc/*release | grep "SLES" >/dev/null; then rm /etc/apache2/vhosts.d/vhost-ssl.conf; service apache2 restart; fi From 100c64b7ecb27511a6cee67fe665dcd8c5b833be Mon Sep 17 00:00:00 2001 From: Stephane Thiell Date: Fri, 3 Feb 2023 23:05:01 -0800 Subject: [PATCH 166/188] kvm: replace ac97 with ich6 for default audio support ac97 audio support has been removed from QEMU. For example in RHEL 9.1 (qemu-kvm-7.0.0), creating new VMs fail to start with the following error: 'AC97' is not a valid device model name. See: https://bugzilla.redhat.com/show_bug.cgi?id=1995819 --- xCAT-server/lib/xcat/plugins/kvm.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index ce4c665c58..08b43df073 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -970,7 +970,7 @@ sub build_xmldesc { # do nothing for ppc64le, do not support sound at this time ; } else { - $xtree{devices}->{sound}->{model} = 'ac97'; + $xtree{devices}->{sound}->{model} = 'ich6'; } $xtree{devices}->{console}->{type} = 'pty'; From 369683e139fbdda34a163fbfe2b014800cfb0a7e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 6 Feb 2023 14:23:16 -0500 Subject: [PATCH 167/188] Additional testcase changes for AlmaLinux --- xCAT-test/autotest/testcase/installation/SN_setup_case | 6 +++--- .../installation/reg_linux_diskless_installation_hierarchy | 4 ++-- xCAT-test/autotest/testcase/passwd/case0 | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-test/autotest/testcase/installation/SN_setup_case b/xCAT-test/autotest/testcase/installation/SN_setup_case index 51f45c09ed..68ceac5d64 100644 --- a/xCAT-test/autotest/testcase/installation/SN_setup_case +++ b/xCAT-test/autotest/testcase/installation/SN_setup_case @@ -46,13 +46,13 @@ check:rc==0 cmd:cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-core && createrepo . check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";path2="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then path="sles";path2="sles";elif [[ "__GETNODEATTR($$SN,os)__" =~ "ol" ]];then path="ol";path2="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "rocky" ]];then path="rocky";path2="rh";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path2$ver/__GETNODEATTR($$SN,arch)__ && createrepo .; +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";path2="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then path="sles";path2="sles";elif [[ "__GETNODEATTR($$SN,os)__" =~ "ol" ]];then path="ol";path2="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "rocky" ]];then path="rocky";path2="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "alma" ]];then path="alma";path2="rh";fi; ver="__GETNODEATTR($$SN,os)__"; tmp=${ver%%.*};ver=`echo "$tmp"|sed 's:[a-zA-Z]::g'`;cd /install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__/xcat/xcat-dep/$path2$ver/__GETNODEATTR($$SN,arch)__ && createrepo .; check:rc==0 cmd:chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkgdir=/install/post/otherpkgs/__GETNODEATTR($$SN,os)__/__GETNODEATTR($$SN,arch)__ check:rc==0 -cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then path="sles";elif [[ "__GETNODEATTR($$SN,os)__" =~ "ol" ]];then path="ol";elif [[ " __GETNODEATTR($$SN,os)__" =~ "rocky" ]];then path="rocky";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist; +cmd:if [[ "__GETNODEATTR($$SN,os)__" =~ "rh" ]]; then path="rh";elif [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then path="sles";elif [[ "__GETNODEATTR($$SN,os)__" =~ "ol" ]];then path="ol";elif [[ "__GETNODEATTR($$SN,os)__" =~ "rocky" ]];then path="rocky";elif [[ "__GETNODEATTR($$SN,os)__" =~ "alma" ]];then path="alma";fi; ver="__GETNODEATTR($$SN,os)__"; chdef -t osimage __GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-install-service otherpkglist=/opt/xcat/share/xcat/install/$path/service.${ver%%.*}.__GETNODEATTR($$SN,arch)__.otherpkgs.pkglist; check:rc==0 #add support python in sn @@ -100,7 +100,7 @@ check:output=~IMAGENAME=__GETNODEATTR($$SN,os)__-__GETNODEATTR($$SN,arch)__-inst cmd:if rpm -qa|grep xCAT-openbmc-py 2>&1; then xdsh $$SN "rpm -qa|grep xCAT-openbmc-py";else echo "There is no xCAT-openbmc-py installed in MN, skip check xCAT-openbmc-py installation in SN"; exit 0;fi check:rc==0 cmd:xdsh $$SN "cat /var/log/xcat/xcat.log" -cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif [[ "__GETNODEATTR($$SN,os)__" =~ "rh" || "__GETNODEATTR($$SN,os)__" =~ "ol" || "__GETNODEATTR($$SN,os)__" =~ "rocky" ]];then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi +cmd:if [[ "__GETNODEATTR($$SN,arch)__" =~ "x86_64" ]]; then if [[ "__GETNODEATTR($$SN,os)__" =~ "sle" ]];then xdsh $$SN "zypper -n install perl-Sys-Virt"; elif [[ "__GETNODEATTR($$SN,os)__" =~ "rh" || "__GETNODEATTR($$SN,os)__" =~ "ol" || "__GETNODEATTR($$SN,os)__" =~ "rocky" || "__GETNODEATTR($$SN,os)__" =~ "alma" ]];then xdsh $$SN "yum install -y perl-Sys-Virt";fi;fi check:rc==0 cmd:makentp -a 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 6d46a19211..195f6433f7 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -156,8 +156,8 @@ cmd:lsdef -t osimage -o __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netb cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute check:rc==0 -#Make sure squashfs-tools rpm is installed on RHEL, OL and Rocky -cmd:if [[ "$$OS" =~ "rhel" || "$$OS" =~ "ol" || "$$OS" =~ "rocky" ]]; then yum install -y squashfs-tools; fi +#Make sure squashfs-tools rpm is installed on RHEL, OL, Rocky and Alma +cmd:if [[ "$$OS" =~ "rhel" || "$$OS" =~ "ol" || "$$OS" =~ "rocky" || "$$OS" =~ "alma" ]]]; then yum install -y squashfs-tools; fi #Make sure squashfs-tools rpm is installed on Ubuntu cmd:if [[ "$$OS" =~ "ubuntu" ]]; then apt-get install -y squashfs-tools; fi diff --git a/xCAT-test/autotest/testcase/passwd/case0 b/xCAT-test/autotest/testcase/passwd/case0 index 9b781d02f2..9b5954d68a 100644 --- a/xCAT-test/autotest/testcase/passwd/case0 +++ b/xCAT-test/autotest/testcase/passwd/case0 @@ -235,7 +235,7 @@ check:rc==0 cmd:if grep Ubuntu /etc/*release;then if [ ! -e /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz ]; then copycds $$ISO;mkdir -p /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/;touch /install/__GETNODEATTR($$CN,os)__/__GETNODEATTR($$CN,arch)__/install/netboot/initrd.gz;fi;fi cmd:nodeset $$CN osimage=__GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute check:rc==0 -cmd:if grep SUSE /etc/*release;then grep '\$6\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then grep '\$6\$' /install/autoinst/$$CN | awk 'gsub(/^ *| *$/,"")'| awk -v head="" -v tail="" '{print substr($0, index($0,head)+length(head),index($0,tail)-index($0,head)-length(head))}' > /tmp/instcryptedpasswd; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $3}' > /tmp/instcryptedpasswd; elif grep Ubuntu /etc/*release;then grep '\$6\$' /install/autoinst/$$CN |awk -F " " '{print $4}' > /tmp/instcryptedpasswd;else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:diff /tmp/tmpcryptedpasswd /tmp/instcryptedpasswd check:rc==0 From a5d5ee03bedda4d17bedc0c679c433d484093b13 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 7 Feb 2023 14:54:35 -0500 Subject: [PATCH 168/188] Additional testcase and postscript changes for AlmaLinux --- .../autotest/testcase/confignetwork/cases0 | 186 +++++++++--------- .../reg_linux_diskless_installation_hierarchy | 2 +- xCAT/postscripts/ospkgs | 9 +- xCAT/postscripts/otherpkgs | 7 +- 4 files changed, 105 insertions(+), 99 deletions(-) diff --git a/xCAT-test/autotest/testcase/confignetwork/cases0 b/xCAT-test/autotest/testcase/confignetwork/cases0 index c766206315..7585a857ec 100644 --- a/xCAT-test/autotest/testcase/confignetwork/cases0 +++ b/xCAT-test/autotest/testcase/confignetwork/cases0 @@ -34,7 +34,7 @@ check:rc==0 check:output=~booted cmd:xdsh $$CN hostname check:output=~$$CN -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep __GETNODEATTR($$CN,ip)__ /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output=~BOOTPROTO=none|static @@ -84,7 +84,7 @@ check:rc==0 check:output=~booted cmd:xdsh $$CN hostname check:output=~$$CN -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output=~BOOTPROTO=none|static @@ -137,11 +137,11 @@ check:output=~64 bytes from $$CN cmd:lsdef -l $$CN | grep status check:rc==0 check:output=~booted -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$installnic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output=~BOOTPROTO=none|static -cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$secondarynic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$secondarynic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi +cmd:secondarynic=`xdsh $$CN ip addr |grep 100.1.0.100|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$secondarynic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-$secondarynic"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~100.1.0.100 check:output=~BOOTPROTO=none|static @@ -162,7 +162,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 @@ -173,16 +173,16 @@ check:rc==0 cmd:rmdef -t network -o confignetworks_test1 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$installnic*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$installnic*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output=~BOOTPROTO=none|static cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$SECONDNIC" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" end @@ -195,7 +195,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1496 check:rc==0 @@ -206,14 +206,14 @@ check:rc==0 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep -i MTU /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep mtu /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep MTU /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep -i MTU /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep mtu /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~MTU=1496|mtu 1496 cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/";else echo "Sorry,this is not supported os"; fi cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/" end @@ -226,7 +226,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:cp -f /etc/hosts /etc/hosts.bak cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC @@ -243,10 +243,10 @@ check:output=~aliases1-2 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:xdsh $$CN date -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 check:output=~BOOTPROTO=none|static -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 check:output=~BOOTPROTO=none|static cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 @@ -254,7 +254,7 @@ cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC";xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts";xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/";elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC";xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts";xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/";elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi @@ -273,7 +273,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:cp -f /etc/hosts /etc/hosts.bak cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC @@ -289,26 +289,26 @@ check:output=~$$CN-$$SECONDNIC-1 check:output=~$$CN-$$SECONDNIC-2 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~BOOTPROTO=none|static check:output=~CONNECTED_MODE=yes|CONNECTED_MODE yes -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $second1ip /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~CONNECTED_MODE=yes|CONNECTED_MODE yes check:output=~BOOTPROTO=none|static cmd:rmdef -t network -o confignetworks_test1 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -f /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$SECONDNIC" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$SECONDNIC" cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/" @@ -379,7 +379,7 @@ cmd:chtab node=$$CN nics.disable=yes check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 check:rc==0 @@ -401,7 +401,7 @@ cmd:chtab node=$$CN nics.disable=1 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output!~11.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 check:rc==0 @@ -447,7 +447,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 @@ -473,21 +473,21 @@ check:output=~$$CN-$$THIRDNIC-2 cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:xdsh $$CN date -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~11.1.0.100 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 12.1.0.100 /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:output=~12.1.0.100 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/sysconfig/network-scripts/ifcfg-*$$THIRDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/sysconfig/network-scripts/ifcfg-*$$THIRDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 13.1.0.200 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:output=~13.1.0.200 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$THIRDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$THIRDNIC*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 14.1.0.100 /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:output=~14.1.0.100 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 cmd:rmdef -t network -o 13_1_0_0-255_255_0_0 cmd:rmdef -t network -o 14_1_0_0-255_255_0_0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC /etc/network/interfaces.d/$$SECONDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC /etc/network/interfaces.d/$$THIRDNIC:1";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$SECONDNIC" @@ -496,7 +496,7 @@ cmd:xdsh $$CN "ip addr del 14.1.0.100/16 dev $$THIRDNIC" cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 cmd:mv -f /etc/hosts.bak /etc/hosts -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/" @@ -511,7 +511,7 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/; elif grep Ubuntu /etc/*release;then cp -f /etc/network/interfaces.d/* /tmp/backupnet/;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/; elif grep Ubuntu /etc/*release;then cp -f /etc/network/interfaces.d/* /tmp/backupnet/;else echo \"Sorry,this is not supported os\"; fi" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -524,7 +524,7 @@ cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=105.;var4=`echo $cnip |awk -F. check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=106.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test7 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "if grep SUSE /etc/*release;then grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then grep $second1ip /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "if grep SUSE /etc/*release;then grep $second1ip /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then grep $second1ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then grep $second1ip /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=105;var2=106;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second6ip=$var1$var3;second7ip=$var2$var3;chdef $$CN nicnetworks.$$SECONDNIC.6=confignetworks_test6 nicnetworks.$$SECONDNIC.7=confignetworks_test7 nictypes.$$SECONDNIC.6=vlan nictypes.$$SECONDNIC.7=vlan nicips.$$SECONDNIC.6=$second6ip nicips.$$SECONDNIC.7=$second7ip nicdevices.$$SECONDNIC.6=$$SECONDNIC nicdevices.$$SECONDNIC.7=$$SECONDNIC nictypes.$$SECONDNIC=ethernet check:rc==0 @@ -532,11 +532,11 @@ cmd:updatenode $$CN -P confignetwork check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=105;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second6ip=$var1$var3; echo $second6ip; xdsh $$CN "if grep SUSE /etc/*release;then grep $second6ip /etc/sysconfig/network/ifcfg-$$SECONDNIC.6;elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then grep $second6ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.6*; elif grep Ubuntu /etc/*release;then grep $second6ip /etc/network/interfaces.d/$$SECONDNIC.6;else echo \"Sorry,this is not supported os\"; fi" +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=105;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second6ip=$var1$var3; echo $second6ip; xdsh $$CN "if grep SUSE /etc/*release;then grep $second6ip /etc/sysconfig/network/ifcfg-$$SECONDNIC.6;elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then grep $second6ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.6*; elif grep Ubuntu /etc/*release;then grep $second6ip /etc/network/interfaces.d/$$SECONDNIC.6;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var2=106;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second7ip=$var2$var3; echo $second6ip; xdsh $$CN "if grep SUSE /etc/*release;then grep $second7ip /etc/sysconfig/network/ifcfg-$$SECONDNIC.7; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then grep $second7ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.7*; elif grep Ubuntu /etc/*release;then grep $second7ip /etc/network/interfaces.d/$$SECONDNIC.7;else echo \"Sorry,this is not supported os\"; fi" +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var2=106;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second7ip=$var2$var3; echo $second6ip; xdsh $$CN "if grep SUSE /etc/*release;then grep $second7ip /etc/sysconfig/network/ifcfg-$$SECONDNIC.7; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then grep $second7ip /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.7*; elif grep Ubuntu /etc/*release;then grep $second7ip /etc/network/interfaces.d/$$SECONDNIC.7;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC*; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC*; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=105;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second6ip=$var1$var3;xdsh $$CN "ip addr del $second6ip/8 dev $$SECONDNIC.6" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var2=106;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second7ip=$var2$var3;xdsh $$CN "ip addr del $second7ip/8 dev $$SECONDNIC.7" @@ -546,9 +546,9 @@ cmd:rmdef -t network -o confignetworks_test7 cmd:xdsh $$CN "ip link del dev $$SECONDNIC.6" cmd:xdsh $$CN "ip link del dev $$SECONDNIC.7" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$SECONDNIC" -cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network/ifcfg-$$SECONDNIC.7; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.6 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.7; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC.6 /etc/network/interfaces.d/$$SECONDNIC.7;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC.6 /etc/sysconfig/network/ifcfg-$$SECONDNIC.7; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.6 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC.7; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC.6 /etc/network/interfaces.d/$$SECONDNIC.7;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network/; elif grep -E \"Red Hat .* 8.*|CentOS .* 8.*\" /etc/*release; then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; nmcli con reload;elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; elif grep Ubuntu /etc/*release;then cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network/; elif grep -E \"Red Hat .* 8.*|CentOS .* 8.*\" /etc/*release; then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; nmcli con reload;elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; elif grep Ubuntu /etc/*release;then cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" check:rc==0 @@ -563,14 +563,14 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/; elif grep Ubuntu /etc/*release;then cp -f /etc/network/interfaces.d/* /tmp/backupnet/;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/; elif grep Ubuntu /etc/*release;then cp -f /etc/network/interfaces.d/* /tmp/backupnet/;else echo \"Sorry,this is not supported os\"; fi" cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then grep 11.1.0.100 /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then grep 11.1.0.100 /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then grep 11.1.0.100 /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" check:output=~11.1.0.100 cmd:chdef $$CN nicips.$$SECONDNIC= nictypes.$$SECONDNIC= nicnetworks.$$SECONDNIC= check:rc==0 @@ -589,11 +589,11 @@ cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 cmd:rmdef -t network -o 60_0_0_0-255_0_0_0 cmd:rmdef -t network -o 70_0_0_0-255_0_0_0 cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" -cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC; elif grep -E \"Red Hat|CentOS|Rocky|Alma\" /etc/*release;then rm -rf /etc/sysconfig/network-scripts/ifcfg-*$$SECONDNIC*; elif grep Ubuntu /etc/*release;then rm -rf /etc/network/interfaces.d/$$SECONDNIC;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network/; elif grep -E \"Red Hat .* 8.*|CentOS .* 8.*|Rocky .* 8.*\" /etc/*release; then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; nmcli con reload;elif grep -E \"Red Hat|CentOS\" /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; elif grep Ubuntu /etc/*release;then cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/;else echo \"Sorry,this is not supported os\"; fi" +cmd:xdsh $$CN "if grep SUSE /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network/; elif grep -E \"Red Hat .* 8.*|CentOS .* 8.*|Rocky .* 8.*|AlmaLinux .* 8.*\" /etc/*release; then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; nmcli con reload;elif grep -E \"Red Hat|CentOS\" /etc/*release;then cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/; elif grep Ubuntu /etc/*release;then cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/;else echo \"Sorry,this is not supported os\"; fi" check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" check:rc==0 @@ -608,8 +608,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -632,23 +632,23 @@ cmd:xdsh $$CN "ls /sys/class/net" check:output=~bond0 cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" check:output=~bond0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond0ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond0ip /etc/sysconfig/network/ifcfg-bond0"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $bond0ip /etc/sysconfig/network-scripts/ifcfg-*bond0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond0ip /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond0ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond0ip /etc/sysconfig/network/ifcfg-bond0"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $bond0ip /etc/sysconfig/network-scripts/ifcfg-*bond0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond0ip /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test1 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test3 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond0ip=$var1$var2;xdsh $$CN "ip addr del $bond0ip/16 dev bond0" cmd:xdsh $$CN "ip link del dev bond0" cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" @@ -664,8 +664,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -690,15 +690,15 @@ check:rc!=0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$SECONDNIC" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$THIRDNIC" cmd:rmdef -t network -o confignetworks_test1 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test3 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" check:rc==0 @@ -713,8 +713,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC mtu=1500 check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -735,9 +735,9 @@ cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=103;var3=`echo $cnip check:rc==0 cmd:updatenode $$CN -P confignetwork check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond2ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond2ip /etc/sysconfig/network/ifcfg-bond0.2"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $bond2ip /etc/sysconfig/network-scripts/ifcfg-*bond0.2*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond2ip /etc/network/interfaces.d/bond0.2";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond2ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond2ip /etc/sysconfig/network/ifcfg-bond0.2"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $bond2ip /etc/sysconfig/network-scripts/ifcfg-*bond0.2*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond2ip /etc/network/interfaces.d/bond0.2";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var2=103;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond3ip=$var2$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond3ip /etc/sysconfig/network/ifcfg-bond0.3"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $bond3ip /etc/sysconfig/network-scripts/ifcfg-*bond0.3*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond3ip /etc/network/interfaces.d/bond0.3";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var2=103;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;bond3ip=$var2$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $bond3ip /etc/sysconfig/network/ifcfg-bond0.3"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $bond3ip /etc/sysconfig/network-scripts/ifcfg-*bond0.3*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $bond3ip /etc/network/interfaces.d/bond0.3";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "ls /sys/class/net" check:output=~bond0 @@ -746,10 +746,10 @@ check:output=~bond0.3 cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" check:output=~bond0 cmd:rmdef -t network -o confignetworks_test1 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test3 cmd:rmdef -t network -o confignetworks_test4 @@ -761,11 +761,11 @@ cmd:xdsh $$CN "ip link del dev bond0" cmd:xdsh $$CN "ip link del dev bond0.2" cmd:xdsh $$CN "ip link del dev bond0.3" cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" @@ -781,8 +781,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -807,13 +807,13 @@ cmd:xdsh $$CN "ls /sys/class/net" check:output=~br0 cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" check:output=~bond0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=103;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br0ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $br0ip /etc/sysconfig/network/ifcfg-br0"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $br0ip /etc/sysconfig/network-scripts/ifcfg-*br0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br0ip /etc/network/interfaces.d/br0";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=103;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br0ip=$var1$var2;if grep SUSE /etc/*release;then xdsh $$CN "grep $br0ip /etc/sysconfig/network/ifcfg-br0"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $br0ip /etc/sysconfig/network-scripts/ifcfg-*br0"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br0ip /etc/network/interfaces.d/br0";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test1 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$SECONDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts/ifcfg-$$THIRDNIC"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=103;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br0ip=$var1$var2;xdsh $$CN "ip addr del $br0ip/16 dev br0" @@ -821,11 +821,11 @@ cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var2=`echo $cnip |sed -r ' cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;xdsh $$CN "ip addr del $second1ip/16 dev $$THIRDNIC" cmd:xdsh $$CN "ip link del dev br0" cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-br0"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/br0";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-br0"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/br0";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" cmd:chtab -d node=$$CN nics @@ -839,8 +839,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var3=100.;var4=`echo $cnip |awk -F. '{print $2}'`;var5=.0.0;secondnet=$var3$var4$var5;mkdef -t network -o confignetworks_test1 net=$secondnet mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;second1ip=$var1$var2;chdef $$CN nicips.$$SECONDNIC=$second1ip nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=confignetworks_test1 @@ -860,9 +860,9 @@ cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=103;var3=`echo $cnip check:rc==0 cmd:updatenode $$CN -P confignetwork -t 1800 check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br22ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $br22ip /etc/sysconfig/network/ifcfg-br22"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $br22ip /etc/sysconfig/network-scripts/ifcfg-*br22*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br22ip /etc/network/interfaces.d/br22";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br22ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $br22ip /etc/sysconfig/network/ifcfg-br22"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $br22ip /etc/sysconfig/network-scripts/ifcfg-*br22*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br22ip /etc/network/interfaces.d/br22";else echo "Sorry,this is not supported os"; fi check:rc==0 -cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=103;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br33ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $br33ip /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep $br33ip /etc/sysconfig/network-scripts/ifcfg-*br33*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br33ip /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi +cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=103;var3=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br33ip=$var1$var3;if grep SUSE /etc/*release;then xdsh $$CN "grep $br33ip /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep $br33ip /etc/sysconfig/network-scripts/ifcfg-*br33*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep $br33ip /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "ls /sys/class/net" check:output=~br22 @@ -873,7 +873,7 @@ cmd:xdsh $$CN "ip addr show bond0.3" cmd:xdsh $$CN "ip addr show br33" cmd:rmdef -t network -o confignetworks_test1 cmd:rmdef -t network -o confignetworks_test2 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:rmdef -t network -o confignetworks_test3 cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=102;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;br22ip=$var1$var2;xdsh $$CN "ip addr del $br22ip/16 dev br22" @@ -887,11 +887,11 @@ cmd:xdsh $$CN "ip link del dev bond0" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=100;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;secondip=$var1$var2;xdsh $$CN "ip addr del $secondip/16 dev $$SECONDNIC" cmd:cnip=__GETNODEATTR($$CN,ip)__;echo $cnip;var1=101;var2=`echo $cnip |sed -r 's/[^\.]{1,3}(\..*)/\1/'`;secondip=$var1$var2;xdsh $$CN "ip addr del $secondip/16 dev $$THIRDNIC" cmd:xdsh $$CN "echo -bond0 > /sys/class/net/bonding_masters" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" @@ -906,8 +906,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:mkdef -t network -o 11_1_0_0-255_255_0_0 net=11.1.0.0 mask=255.255.0.0 mgtifname=$$SECONDNIC check:rc==0 cmd:chdef $$CN nicips.$$SECONDNIC=11.1.0.100 nictypes.$$SECONDNIC=Ethernet nicnetworks.$$SECONDNIC=11_1_0_0-255_255_0_0 @@ -924,25 +924,25 @@ cmd:chdef $$CN nicdevices.br22=bond0.2 nicdevices.br33=bond0.3 nictypes.br22=bri check:rc==0 cmd:updatenode $$CN -P "confignetwork -s" check:rc==0 -cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$installnic*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi +cmd:installnic=`xdsh $$CN ip addr |grep __GETNODEATTR($$CN,ip)__|awk -F " " '{print $NF}'`; if grep SUSE /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network/ifcfg-$installnic"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cat /etc/sysconfig/network-scripts/ifcfg-*$installnic*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cat /etc/network/interfaces.d/*";else echo "Sorry,this is not supported os"; fi check:rc==0 check:output=~__GETNODEATTR($$CN,ip)__ check:output=~BOOTPROTO=none|static cmd:xdsh $$CN "cat /sys/class/net/bonding_masters" check:output=~bond0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/sysconfig/network/ifcfg-br22"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/sysconfig/network-scripts/ifcfg-*br22*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/network/interfaces.d/br22";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/sysconfig/network/ifcfg-br22"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/sysconfig/network-scripts/ifcfg-*br22*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 30.5.106.8 /etc/network/interfaces.d/br22";else echo "Sorry,this is not supported os"; fi check:output=~30.5.106.8 check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/sysconfig/network-scripts/ifcfg-*br33*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/sysconfig/network/ifcfg-br33"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/sysconfig/network-scripts/ifcfg-*br33*"; elif grep Ubuntu /etc/*release;then xdsh $$CN "grep 40.5.106.8 /etc/network/interfaces.d/br33";else echo "Sorry,this is not supported os"; fi check:output=~40.5.106.8 check:rc==0 cmd:xdsh $$CN "ls /sys/class/net" check:output=~br22 check:output=~br33 cmd:rmdef -t network -o 11_1_0_0-255_255_0_0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$SECONDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$SECONDNIC";else echo "Sorry,this is not supported os"; fi cmd:rmdef -t network -o 12_1_0_0-255_255_0_0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-$$THIRDNIC"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts"; elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/$$THIRDNIC";else echo "Sorry,this is not supported os"; fi cmd:rmdef -t network -o 30_5_0_0-255_255_0_0 cmd:xdsh $$CN "ip addr del 30.5.106.8/16 dev br22" cmd:xdsh $$CN "ip link del dev br22" @@ -954,7 +954,7 @@ cmd:xdsh $$CN "ip link del dev bond0.3" cmd:xdsh $$CN "ip link del dev bond0" cmd:xdsh $$CN "ip addr del 11.1.0.100/16 dev $$SECONDNIC" cmd:xdsh $$CN "ip addr del 12.1.0.100/16 dev $$THIRDNIC" -cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33";xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/";elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts";xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/";elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network/ifcfg-bond0 /etc/sysconfig/network/ifcfg-bond0.2 /etc/sysconfig/network/ifcfg-bond0.3 /etc/sysconfig/network/ifcfg-br22 /etc/sysconfig/network/ifcfg-br33";xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/";elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "rm -rf /etc/sysconfig/network-scripts";xdsh $$CN "cp -rf /tmp/backupnet/network-scripts /etc/sysconfig/";elif grep Ubuntu /etc/*release;then xdsh $$CN "rm -rf /etc/network/interfaces.d/bond0 /etc/network/interfaces.d/bond0.2 /etc/network/interfaces.d/bond0.3 /etc/network/interfaces.d/br22 /etc/network/interfaces.d/br33";xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "systemctl status NetworkManager >/dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi @@ -973,8 +973,8 @@ check:rc==0 cmd:xdsh $$CN "rm -rf /tmp/backupnet/" cmd:xdsh $$CN "mkdir -p /tmp/backupnet/" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi -cmd:if grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network-scripts/ifcfg-* /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/";else echo "Sorry,this is not supported os"; fi +cmd:if grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "if yum -q list bridge-utils ; then yum -y install bridge-utils; fi";fi cmd:mkdef -t network -o 30_5_0_0-255_255_0_0 net=30.5.0.0 mask=255.255.0.0 check:rc==0 cmd:mkdef -t network -o 40_5_0_0-255_255_0_0 net=40.5.0.0 mask=255.255.0.0 @@ -994,7 +994,7 @@ cmd:xdsh $$CN "ip link del dev bond0.3" cmd:xdsh $$CN "ip link del dev bond0" cmd:if [ -e /tmp/CN.stanza ]; then rmdef $$CN; cat /tmp/CN.stanza | mkdef -z; rm -rf /tmp/CN.stanza; fi check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/sysconfig/network-scripts/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /tmp/backupnet/* /etc/network/interfaces.d/;cp -f /tmp/interfaces /etc/network/";else echo "Sorry,this is not supported os"; fi cmd:xdsh $$CN "rm -rf /tmp/backupnet/ /tmp/interfaces" cmd:chtab -d node=$$CN nics end @@ -1006,7 +1006,7 @@ cmd:lsdef $$CN -z && lsdef -l $$CN -z >/tmp/CN.stanza check:rc==0 cmd:xdsh $$CN "mkdir -p /tmp/backupnet" check:rc==0 -cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi +cmd:if grep SUSE /etc/*release;then xdsh $$CN "cp -f /etc/sysconfig/network/ifcfg-* /tmp/backupnet/"; elif grep -E "Red Hat|CentOS|Rocky|Alma" /etc/*release;then xdsh $$CN "cp -rf /etc/sysconfig/network-scripts /tmp/backupnet/"; elif grep Ubuntu /etc/*release;then xdsh $$CN "cp -f /etc/network/interfaces.d/* /tmp/backupnet/;cp -f /etc/network/interfaces /tmp";else echo "Sorry,this is not supported os"; fi check:rc==0 cmd:xdsh $$CN "ps -A --format pid,comm | awk '/dhclient/ { print \$1 }' | xargs -r -n 1 kill" cmd:xdsh $$CN "ps -A --format pid,comm | awk '/dhclient/ { print \$1 }' | xargs -r -n 1 kill -KILL" @@ -1018,7 +1018,7 @@ cmd:xdsh $$CN date check:rc==0 # Clean up cmd:test -e /tmp/CN.stanza && rmdef $$CN && mkdef -z /dev/null 2>/dev/null && which nmcli >/dev/null 2>/dev/null && nmcli con reload" 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 195f6433f7..655c56158f 100644 --- a/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy +++ b/xCAT-test/autotest/testcase/installation/reg_linux_diskless_installation_hierarchy @@ -157,7 +157,7 @@ cmd:genimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-comput check:rc==0 #Make sure squashfs-tools rpm is installed on RHEL, OL, Rocky and Alma -cmd:if [[ "$$OS" =~ "rhel" || "$$OS" =~ "ol" || "$$OS" =~ "rocky" || "$$OS" =~ "alma" ]]]; then yum install -y squashfs-tools; fi +cmd:if [[ "$$OS" =~ "rhel" || "$$OS" =~ "ol" || "$$OS" =~ "rocky" || "$$OS" =~ "alma" ]]; then yum install -y squashfs-tools; fi #Make sure squashfs-tools rpm is installed on Ubuntu cmd:if [[ "$$OS" =~ "ubuntu" ]]; then apt-get install -y squashfs-tools; fi diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index f18c404f3d..79bc987ddb 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -261,7 +261,7 @@ do # (1)for rhels6, there is one repodata in the os base dir; so keep it here, and handle the other cases below # (2)for sles, we should specified the baseurl should be ./install/sles11/ppc64/1 # (3)for SL5, we should append the /SL - # (4)for rhels8, centos8, ol8 and rocky8 we should append /BaseOS and /AppStream to base directory + # (4)for rhels8, centos8, ol8, alma8 and rocky8 we should append /BaseOS and /AppStream to base directory # (5) for other os, we just keep it here. # For other pkg paths, we just keep it here. if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -276,8 +276,9 @@ do if ( ! pmatch "$OSVER" "rhels8*" && ! pmatch "$OSVER" "centos8*" && ! pmatch "$OSVER" "rocky8*" && + ! pmatch "$OSVER" "alma8*" && ! pmatch "$OSVER" "ol8*"); then - # For rhels8, centos8, ol8 and rocky8 do not put $ospkgdir by itself + # For rhels8, centos8, ol8, alma8 and rocky8 do not put $ospkgdir by itself array_set_element os_path $index $ospkgdir fi array_set_element os_path $index $ospkgdir @@ -310,6 +311,7 @@ do if ( pmatch "$OSVER" "rhel*" || pmatch "$OSVER" "centos*" || pmatch "$OSVER" "rocky*" || + pmatch "$OSVER" "alma*" || pmatch "$OSVER" "ol*"); then #default_pkgdir="$INSTALLDIR/$OSVER/$ARCH" if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -346,8 +348,9 @@ do elif ( pmatch "$OSVER" "rhels8*" || pmatch "$OSVER" "centos8*" || pmatch "$OSVER" "rocky8*" || + pmatch "$OSVER" "alma8*" || pmatch "$OSVER" "ol8*"); then - # for rhels8, centos8, ol8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ + # for rhels8, centos8, ol8, alma8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ for arg in "BaseOS" "AppStream" do ospkgdir_ok="$ospkgdir/$arg" diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 1cba3d1eaf..c8fdd3d5ff 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -340,7 +340,7 @@ fi # (1)for rhels6, there is one repodata in the os base dir; so keep it here, and handle the other cases below # (2)for sles, we should specified the baseurl should be ./install/sles11/ppc64/1 # (3)for SL5, we should append the /SL - # (4)for rhels8, centos8, ol8, and rocky8 we should append /BaseOS and /AppStream to base directory + # (4)for rhels8, centos8, ol8, alma8 and rocky8 we should append /BaseOS and /AppStream to base directory # (5) for other os, we just keep it here. # For other pkg paths, we just keep it here. if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -355,6 +355,7 @@ fi if ( ! pmatch "$OSVER" "rhels8*" && ! pmatch "$OSVER" "centos8*" && ! pmatch "$OSVER" "rocky8*" && + ! pmatch "$OSVER" "alma8*" && ! pmatch "$OSVER" "ol8*"); then # For rhels8, centos8, ol8, and rocky8 do not put $ospkgdir by itself array_set_element os_path $index $ospkgdir @@ -363,6 +364,7 @@ fi if ( pmatch "$OSVER" "rhel*" || pmatch "$OSVER" "centos*" || pmatch "$OSVER" "rocky*" || + pmatch "$OSVER" "alma*" || pmatch "$OSVER" "ol*"); then #default_pkgdir="$INSTALLDIR/$OSVER/$ARCH" if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -399,8 +401,9 @@ fi elif ( pmatch "$OSVER" "rhels8*" || pmatch "$OSVER" "centos8*" || pmatch "$OSVER" "rocky8*" || + pmatch "$OSVER" "alma8*" || pmatch "$OSVER" "ol8*"); then - # for rhels8, centos8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ + # for rhels8, centos8, ol8, alma8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ for arg in "BaseOS" "AppStream" do ospkgdir_ok="$ospkgdir/$arg" From 1a378b341c03208efcba6d79f25c5e7339f98734 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 8 Feb 2023 10:18:12 -0500 Subject: [PATCH 169/188] Fix mysql setup for RH family of OSes --- xCAT-client/bin/mysqlsetup | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 3d0cd6fcf6..083bb72cf8 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -952,7 +952,7 @@ sub mysqlstart else { if ($::MariaDB == 1) { # running MariaDB - if ( ($::linuxos =~ /rh.*/) || ($::linuxos =~ /sles15.*/) ) { + if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { $ret = xCAT::Utils->startservice("mariadb"); } else { # sles $ret = xCAT::Utils->startservice("mysql"); @@ -960,7 +960,7 @@ sub mysqlstart } else { # it is mysql - if ($::linuxos =~ /rh.*/) + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) { $ret = xCAT::Utils->startservice("mysqld"); } @@ -1063,7 +1063,7 @@ sub mysqlreboot { if ($::MariaDB == 1) { # MariaDB not MySQL - if ( ($::linuxos =~ /rh.*/) || ($::linuxos =~ /sles15.*/) ){ + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { $cmd = "chkconfig mariadb on"; } else { #sles $cmd = "chkconfig mysql on"; @@ -1073,7 +1073,7 @@ sub mysqlreboot } } else { # mysql - if ($::linuxos =~ /rh.*/) + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) { $cmd = "chkconfig mysqld on"; } @@ -1611,7 +1611,7 @@ sub setupODBC } # for aix and redhat - if (($::linuxos =~ /rh.*/) || ($::osname eq 'AIX')) + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) { $cmd = "rpm -qa | grep mysql-connector-odbc"; xCAT::Utils->runcmd($cmd, 0); @@ -1699,7 +1699,7 @@ sub setupODBC (my $connstring, my $adminid, my $passwd) = split(/\|/, $output[0]); (my $database, my $id, my $server) = split(/=/, $connstring); - if (($::linuxos =~ /rh.*/) || ($::osname eq 'AIX')) + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) { $odbcinstfile = "/etc/odbcinst.ini"; $odbcfile = "/etc/odbc.ini"; From 60c2dd4efeacc90fc65d2403b2342ca4eac0adc8 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Mon, 13 Feb 2023 09:23:19 -0500 Subject: [PATCH 170/188] More testcase changes for AlmaLinux --- .../reg_linux_statelite_installation_hierarchy_by_nfs | 4 ++-- .../reg_linux_statelite_installation_hierarchy_by_ramdisk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 602607f200..f44d14147d 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 @@ -41,7 +41,7 @@ cmd:xdsh $$SN 'cat /etc/exports|grep nodedata; if [ "$?" -ne "0" ]; then echo "/ check:rc==0 cmd:xdsh $$SN 'cd /etc; export exports;cd -' check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN 'service nfsserver restart'; elif cat /etc/*release |grep "Red Hat\|Rocky" >/dev/null;then xdsh $$SN 'if [ -f /usr/lib/systemd/system/nfs-server.service ]; then service nfs-server restart; else service nfs restart;fi'; fi +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN 'service nfsserver restart'; elif cat /etc/*release |grep "Red Hat\|Rocky\|Alma" >/dev/null;then xdsh $$SN 'if [ -f /usr/lib/systemd/system/nfs-server.service ]; then service nfs-server restart; else service nfs restart;fi'; fi check:rc==0 cmd:xdsh $$SN 'showmount -e' @@ -49,7 +49,7 @@ cmd:xdsh $$SN 'showmount -e' cmd:chtab node=$$CN statelite.statemnt="$$SN:/nodedata" 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\|Rocky" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv; fi +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\|Rocky\|Alma" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv; fi check:rc==0 cmd:tabdump litefile check:rc==0 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 c6a002ccab..4318f1e05d 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 @@ -41,13 +41,13 @@ cmd:xdsh $$SN 'cat /etc/exports|grep nodedata; if [ "$?" -ne "0" ]; then echo "/ check:rc==0 cmd:xdsh $$SN 'cd /etc; export exports;cd -' check:rc==0 -cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN 'service nfsserver restart'; elif cat /etc/*release |grep "Red Hat\|Rocky" >/dev/null;then xdsh $$SN 'if [ -f /usr/lib/systemd/system/nfs-server.service ]; then service nfs-server restart; else service nfs restart;fi'; fi +cmd:if cat /etc/*release |grep SUSE >/dev/null;then xdsh $$SN 'service nfsserver restart'; elif cat /etc/*release |grep "Red Hat\|Rocky\|Alma" >/dev/null;then xdsh $$SN 'if [ -f /usr/lib/systemd/system/nfs-server.service ]; then service nfs-server restart; else service nfs restart;fi'; fi check:rc==0 cmd:chtab node=$$CN statelite.statemnt="$$SN:/nodedata" 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\|Rocky" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv; fi +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\|Rocky\|Alma" >/dev/null; then tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/installation/litefile.csv; fi check:rc==0 cmd:tabdump litefile check:rc==0 From 570cda30b47e1df0123658935356033cbde1cf37 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 14 Feb 2023 13:17:17 -0500 Subject: [PATCH 171/188] mysqlsetup enhancements --- .../hierarchy/databases/mysql_remove.rst | 6 +- .../hierarchy/databases/postgres_remove.rst | 4 +- .../references/man1/mysqlsetup.1.rst | 18 +- .../references/man5/nodetype.5.rst | 2 +- .../references/man5/osimage.5.rst | 2 +- .../admin-guides/references/man5/passwd.5.rst | 2 +- .../admin-guides/references/man7/group.7.rst | 2 +- .../admin-guides/references/man7/node.7.rst | 2 +- .../references/man7/osimage.7.rst | 2 +- xCAT-client/bin/mysqlsetup | 88 +- xCAT-client/bin/mysqlsetup.mg | 1969 +++++++++++++++++ xCAT-client/bin/mysqlsetup.orig | 1964 ++++++++++++++++ xCAT-client/pods/man1/mysqlsetup.1.pod | 18 +- 13 files changed, 4001 insertions(+), 78 deletions(-) create mode 100755 xCAT-client/bin/mysqlsetup.mg create mode 100755 xCAT-client/bin/mysqlsetup.orig diff --git a/docs/source/advanced/hierarchy/databases/mysql_remove.rst b/docs/source/advanced/hierarchy/databases/mysql_remove.rst index e8c71c9513..1817e97fd8 100644 --- a/docs/source/advanced/hierarchy/databases/mysql_remove.rst +++ b/docs/source/advanced/hierarchy/databases/mysql_remove.rst @@ -12,10 +12,10 @@ If you no longer want to use MySQL/MariaDB to maintain ``xcatdb``, and like to s XCATBYPASS=1 restorexCATdb -p ~/xcat-dbback -* Change to PostgreSQL, following documentation: :doc:`/advanced/hierarchy/databases/postgres_install` +* To switch to PostgreSQL, follow: :doc:`/advanced/hierarchy/databases/postgres_install` -* Change back to default xCAT database, SQLite (**Note**: xCAT Hierarchy cluster will no longer work) +* To switch to default xCAT database, SQLite (**Note**: xCAT Hierarchy cluster will no longer work): #. Stop the ``xcatd`` daemon on the management node. :: @@ -33,7 +33,7 @@ If you no longer want to use MySQL/MariaDB to maintain ``xcatdb``, and like to s mysql> drop user xcatadm; - #. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to MySQL/MariaDB. (without this file, xCAT defaults to SQLite): :: + #. Move, or remove, the ``/etc/xcat/cfgloc`` file as it points xCAT to MySQL/MariaDB. (without this file, xCAT defaults to SQLite): :: rm /etc/xcat/cfgloc diff --git a/docs/source/advanced/hierarchy/databases/postgres_remove.rst b/docs/source/advanced/hierarchy/databases/postgres_remove.rst index ea91a7923a..908beb46cb 100644 --- a/docs/source/advanced/hierarchy/databases/postgres_remove.rst +++ b/docs/source/advanced/hierarchy/databases/postgres_remove.rst @@ -32,9 +32,9 @@ To remove ``xcatdb`` completely from the PostgreSQL database and restore xCAT da rm -rf * exit -#. Move, or remove, the ``/etc/xcat/cfglog`` file as it points xCAT to PostgreSQL. (without this file, xCAT defaults to SQLite): :: +#. Move, or remove, the ``/etc/xcat/cfgloc`` file as it points xCAT to PostgreSQL. (without this file, xCAT defaults to SQLite): :: - mv /etc/xcat/cfgloc /etc/xcat/cfglog.postgres + mv /etc/xcat/cfgloc /etc/xcat/cfgloc.postgres #. Restore the PostgreSQL database into SQLite: :: diff --git a/docs/source/guides/admin-guides/references/man1/mysqlsetup.1.rst b/docs/source/guides/admin-guides/references/man1/mysqlsetup.1.rst index cd6566407f..334fc4caf8 100644 --- a/docs/source/guides/admin-guides/references/man1/mysqlsetup.1.rst +++ b/docs/source/guides/admin-guides/references/man1/mysqlsetup.1.rst @@ -37,11 +37,9 @@ DESCRIPTION *********** -\ **mysqlsetup**\ - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in +\ **mysqlsetup**\ - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The \ **mysqlsetup**\ script is run on the Management Node as root after the MySQL or MariaDB packages have been installed. Before running the \ **-**\ **-init**\ option, the MySQL server should be stopped, if it is running. The xCAT daemon, \ **xcatd**\ , must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the \ **xcatd**\ daemon as well as the MySQL daemon. For more information, see https://xcat-docs.readthedocs.io/en/stable/advanced/hierarchy/databases/index.html#mysql-mariadb -\ **Setting_Up_MySQL_as_the_xCAT_DB**\ - -Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp. +Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables \ **XCATMYSQLADMIN_PW**\ and \ **XCATMYSQLROOT_PW**\ are set to the passwords for the xcatadmin id and root id in the database,respectively. Note below we refer to MySQL but it works the same for MariaDB. @@ -72,14 +70,14 @@ OPTIONS \ **-i|-**\ **-init**\ - The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. - On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init. + The \ **-**\ **-init**\ option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The \ **mysqlsetup**\ script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the \ **my.cnf**\ configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the \ **/etc/xcat/cfgloc**\ file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. + On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the \ **-f**\ and/or the \ **-o**\ option, to run after the <-**\ **-init>. \ **-u|-**\ **-update**\ - To run the update option, you must first have run the -i option and have xcat successfully running on the MySQL database. You can chose the -f and/or the -o option, to update. + To run the update option, you must first have run the \ **-i**\ option and have xcat successfully running on the MySQL database. You can chose the \ **-f**\ and/or the \ **-o**\ option, to update. @@ -91,17 +89,13 @@ OPTIONS \ **-o|-**\ **-odbc**\ - This option sets up the ODBC /etc/../odbcinst.ini, /etc/../odbc.ini and the .odbc.ini file in roots home directory will be created and initialized to run off the xcatdb MySQL database. - See "Add ODBC Support" in - Setting_Up_MySQL_as_the_xCAT_DB + This option sets up the ODBC \ **/etc/../odbcinst.ini**\ , \ **/etc/../odbc.ini**\ and the \ **.odbc.ini**\ file in roots home directory will be created and initialized to run off the xcatdb MySQL database. \ **-L|-**\ **-LL**\ Additional database configuration specifically for the LoadLeveler product. - See "Add ODBC Support" in - Setting_Up_MySQL_as_the_xCAT_DB diff --git a/docs/source/guides/admin-guides/references/man5/nodetype.5.rst b/docs/source/guides/admin-guides/references/man5/nodetype.5.rst index 7ccbf01989..3118325941 100644 --- a/docs/source/guides/admin-guides/references/man5/nodetype.5.rst +++ b/docs/source/guides/admin-guides/references/man5/nodetype.5.rst @@ -44,7 +44,7 @@ nodetype Attributes: \ **os**\ - The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. + The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*, alma\*, rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. diff --git a/docs/source/guides/admin-guides/references/man5/osimage.5.rst b/docs/source/guides/admin-guides/references/man5/osimage.5.rst index 6dd405fa3b..959007aa6b 100644 --- a/docs/source/guides/admin-guides/references/man5/osimage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/osimage.5.rst @@ -104,7 +104,7 @@ osimage Attributes: \ **osvers**\ - The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). + The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,alma\*, rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). 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 4123a9258d..174745f024 100644 --- a/docs/source/guides/admin-guides/references/man5/passwd.5.rst +++ b/docs/source/guides/admin-guides/references/man5/passwd.5.rst @@ -50,7 +50,7 @@ passwd Attributes: \ **password**\ - The default password for this type of component. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported. + The default password for this type of component. On Linux, a crypted form could be provided for the "system" component, which will be used during initial node provisioning. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported. 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 5c51532894..c8f339e5a1 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -733,7 +733,7 @@ group Attributes: \ **os**\ (nodetype.os) - The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. + The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*, alma\*, rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. 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 3fe63eb875..48ca38dc15 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -739,7 +739,7 @@ node Attributes: \ **os**\ (nodetype.os) - The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. + The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*, alma\*, rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). As a special case, if this is set to "boottarget", then it will use the initrd/kernel/parameters specified in the row in the boottarget table in which boottarget.bprofile equals nodetype.profile. 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 b3da0afc78..cf2767a567 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -249,7 +249,7 @@ osimage Attributes: \ **osvers**\ (osimage.osvers) - The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). + The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,alma\*, rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 083bb72cf8..b7794684c2 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -165,7 +165,7 @@ if ($::RUNCMD_RC == 0) { # check to see if mysql is installed # $cmd = "rpm -qa | grep -i perl-DBD-mysql"; -my $msg = "\nMySQL perl DBD "; +my $msg = "\nperl-DBD-mysql "; if ($::debianflag) { if ($::MariaDB) { $cmd = "dpkg -l | grep -i mariadb-server"; @@ -184,39 +184,41 @@ if ($::RUNCMD_RC != 0) exit(1); } -# check to see if MySQL is running +# check to see if MySQL or MariaDB is running $::mysqlrunning = 0; $::xcatrunningmysql = 0; -my $cmd = "ps -ef | grep mysqld"; -my @output = xCAT::Utils->runcmd($cmd, 0); -my $mysqlcheck = "mysql.sock"; # see if really running -if (grep(/$mysqlcheck/, @output)) -{ - if ($::INIT) - { - my $message = - "MySQL is running. Database initialization will not take place."; +my $cmd = "pidof mysqld"; +xCAT::Utils->runcmd($cmd, 0); +if ($::RUNCMD_RC == 0) { + $::mysqlrunning = 1; + if ($::INIT) { + my $message = "MySQL is already running. Database initialization will not take place."; xCAT::MsgUtils->message("I", "$message"); + my $ret = xCAT::Utils->stopservice("mysql"); + if ($ret != 0) { + xCAT::MsgUtils->message("E", " failed to stop MySQL."); + exit(1); + } else { + $::mysqlrunning = 0; # service was stopped + } } - $::mysqlrunning = 1; } -# Stop mysql in order to setup init xcat mysql -$cmd = "pidof mysqld"; -xCAT::Utils->runcmd($cmd, -1); -if ($::RUNCMD_RC == 0) -{ - if ($::INIT) - { - my $ret = xCAT::Utils->stopservice("mysql"); - if ($ret != 0) - { - xCAT::MsgUtils->message("E", " failed to stop mysql/mariadb."); +$cmd = "pidof mariadbd"; +xCAT::Utils->runcmd($cmd, 0); +if ($::RUNCMD_RC == 0) { + $::mysqlrunning = 1; + if ($::INIT) { + my $message = "MariaDB is already running. Database initialization will not take place."; + xCAT::MsgUtils->message("I", "$message"); + my $ret = xCAT::Utils->stopservice("mariadb"); + if ($ret != 0) { + xCAT::MsgUtils->message("E", " failed to stop MariaDB."); exit(1); - } - } else { - $::mysqlrunning = 1; + } else { + $::mysqlrunning = 0; # service was stopped + } } } @@ -976,26 +978,26 @@ sub mysqlstart exit(1); } - # make sure running - $cmd = "ps -ef | grep mysqld | grep -v grep"; - my $i; - for ($i = 0 ; $i < 12 ; $i++) - { - my @output = xCAT::Utils->runcmd($cmd, 0); - $mysqlcheck = "mysqld"; - - if (grep(/$mysqlcheck/, @output)) - { - sleep 10; # give a few extra seconds to be sure - return; - } - else - { - sleep 10; # wait for daemon + # make sure service has started. On some OSes, mariadb service starts mysql daemon + # on others, mariadb service starts mariadb daemon. Check a few times for one, + # then the other + my @db_service_name_list = ("mysqld", "mariadb"); + foreach my $db_service_name (@db_service_name_list) { + $cmd = "ps -ef | grep $db_service_name | grep -v grep"; + for (my $i = 0 ; $i < 6 ; $i++) { + my @output = xCAT::Utils->runcmd($cmd, 0); + my $mysqlcheck = $db_service_name; + + if (grep(/$mysqlcheck/, @output)) { + sleep 10; # give a few extra seconds to be sure + return; + } else { + sleep 10; # wait for daemon + } } } xCAT::MsgUtils->message("E", - " Could not start the mysql daemon, in time allocated (2 minutes)"); + " Could not start the mysql/mariadb daemon in time allocated (2 minutes)"); exit(1); } diff --git a/xCAT-client/bin/mysqlsetup.mg b/xCAT-client/bin/mysqlsetup.mg new file mode 100755 index 0000000000..27fa0af10a --- /dev/null +++ b/xCAT-client/bin/mysqlsetup.mg @@ -0,0 +1,1969 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# + +#----------------------------------------------------------------------------- + +=head1 mysqlsetup + + + + This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run + xCAT on MySQL/MariaDB. + Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password. + It will interact for the + password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW + env variables are set to the admin and mysql root password, resp. + Setups up AIX and Linux, but most work needs to be done on AIX. + See man mysqlsetup for more information and the xCAT2.SetupMySQL.pdf + documentation. + +=cut + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; +} + +# if AIX - make sure we include perl 5.8.2 in INC path. +# Needed to find perl dependencies shipped in deps tarball. +if ($^O =~ /^aix/i) { + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); +} + +use lib "$::XCATROOT/lib/perl"; +use DBI; +use xCAT::Utils; +use xCAT::NetworkUtils; +use Getopt::Long; +use xCAT::MsgUtils; +use xCAT::Table; +use Expect; +use Socket; +use strict; + +#----------------------------------------------------------------------------- +# Main + +$::progname = "mysqlsetup"; +my $args = join ' ', @ARGV; +$::command = "$0 $args"; +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; +$::installdir = "/usr/local/mysql"; # current release of xcat-mysql +$::debianflag = 0; + +#$::installdir="/opt/xcat/mysql"; # next release of xcat-mysql + +# parse the options +if ( + !GetOptions( + 'i|init' => \$::INIT, + 'u|update' => \$::UPDATE, + 'f|hostfile=s' => \$::HOSTFILE, + 'o|odbc' => \$::SETUPODBC, + 'L|LL' => \$::SETUPLL, + 'h|help' => \$::HELP, + 'v|version' => \$::VERSION, + 'V|verbose' => \$::VERBOSE, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +# display the version statement if -v or --version is specified +if ($::VERSION) +{ + my $version = xCAT::Utils->Version(); + xCAT::MsgUtils->message("I", $version); + exit 0; +} +if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPODBC)) && (!($::SETUPLL))) +{ + xCAT::MsgUtils->message("I", "Either -i or -u or -o flag must be chosen"); + &usage; + exit(1); +} + +# check to see if only odbc update, no passwords needed +my $odbconly = 0; +if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPLL)) && ($::SETUPODBC)) +{ + $odbconly = 1; + +} +if ((!($::HOSTFILE)) && ($::UPDATE) && ($::SETUPODBC)) +{ + $odbconly = 1; + +} +if (($::INIT) && ($::UPDATE)) +{ + my $warning = +" The -i and -u flags may not be input to the command. Use one or the other. \n "; + xCAT::MsgUtils->message("E", $warning); + exit 1; +} +if (($::UPDATE) && ((!($::HOSTFILE)) && (!($::SETUPODBC)))) +{ + my $warning = +" The -u flag requires the -o flag or the -f flag pointing to a file that contains the list of hosts that you would like to add to database access."; + xCAT::MsgUtils->message("E", $warning); + exit 1; +} +if (($::HOSTFILE) && (!(-e ($::HOSTFILE)))) +{ + my $warning = " The -f flag is pointing to a non-existing file."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + +} + +# +# Get OS +# +if (xCAT::Utils->isAIX()) +{ + $::osname = 'AIX'; +} +else +{ + $::osname = 'Linux'; +} + +if (-e "/etc/debian_version") { + $::debianflag = 1; +} + +# determine whether redhat or sles +$::linuxos = xCAT::Utils->osver(); + +# is this MariaDB or MySQL +$::MariaDB = 0; +$::db_service = "mysqld"; +my $cmd; +if ($::debianflag) { + $cmd = "dpkg -l | grep mariadb"; +} else { + $cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL +} +xCAT::Utils->runcmd($cmd, -1); +if ($::RUNCMD_RC == 0) { + $::MariaDB = 1; + if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { + $::db_service = "mariadbd"; + } +} + +# +# check to see if mysql is installed +# +$cmd = "rpm -qa | grep -i perl-DBD-mysql"; +my $msg = "\nMySQL perl DBD "; +if ($::debianflag) { + if ($::MariaDB) { + $cmd = "dpkg -l | grep -i mariadb-server"; + $msg = "\nmariadb-server "; + } else { + $cmd = "dpkg -l | grep mysql-server"; + $msg = "\nmysql-server "; + } +} +xCAT::Utils->runcmd($cmd, 0); +if ($::RUNCMD_RC != 0) +{ + my $message = +"\n$msg is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", " $cmd failed. $message"); + exit(1); +} + +# check to see if MySQL is running +$::mysqlrunning = 0; +$::xcatrunningmysql = 0; +my $cmd = "ps -ef | grep mysqld"; +my @output = xCAT::Utils->runcmd($cmd, 0); +my $mysqlcheck = "mysql.sock"; # see if really running +if (grep(/$mysqlcheck/, @output)) +{ + + if ($::INIT) + { + my $message = + "MySQL is running. Database initialization will not take place."; + xCAT::MsgUtils->message("I", "$message"); + } + $::mysqlrunning = 1; +} + +# Stop mysql in order to setup init xcat mysql +$cmd = "pidof $::db_service"; +xCAT::Utils->runcmd($cmd, -1); +if ($::RUNCMD_RC == 0) +{ + if ($::INIT) + { + my $ret = xCAT::Utils->stopservice("mysql"); + if ($ret != 0) + { + xCAT::MsgUtils->message("E", " failed to stop $::db_service."); + exit(1); + } + } else { + $::mysqlrunning = 1; + } +} + +if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql +{ # cfgloc exists + $cmd = "fgrep mysql /etc/xcat/cfgloc"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) + { + if ($::INIT) + { + my $message = +"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required."; + xCAT::MsgUtils->message("I", "$message"); + } + $::xcatrunningmysql = 1; + } +} + +# +# if AIX, Set memory unlimited. Linux defaults unlimited +# +if ($::osname eq 'AIX') +{ + &setulimits; +} + +# if not just odbc update and not already running mysql or mysqlsetup -u or -L +# Get root and admin passwords +# +if ((($odbconly == 0) && ($::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL) +{ # not just updating the odbc + if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password + { + my $pw = $ENV{'XCATMYSQLADMIN_PW'}; + if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + $::adminpassword = $ENV{'XCATMYSQLADMIN_PW'}; + + } + else # prompt for password + { + my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: "; + xCAT::MsgUtils->message('I', "$msg"); + `stty -echo`; + chop($::adminpassword = ); + `stty echo`; + + if ($::adminpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + } + if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password + { + my $pw = $ENV{'XCATMYSQLROOT_PW'}; + if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + $::rootpassword = $ENV{'XCATMYSQLROOT_PW'}; + + } + else # prompt for password + { + + my $msg = "Input the password for root in the MySQL database: "; + xCAT::MsgUtils->message('I', "$msg"); + `stty -echo`; + chop($::rootpassword = ); + `stty echo`; + + if ($::rootpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + } +} + +# initial setup request, if not already running mysql +my $hostfile_configured=0; +if (($::INIT) && ($::xcatrunningmysql == 0)) +{ + # MySQL not running, then initialize the database + if ($::mysqlrunning == 0) + { + # Add mysql user and group for AIX + # Correct directory permissions + # + &fixinstalldir; + + # + # Init mysql db and setup my.cnf + # + &initmysqldb; + + # + # Start MySQL server + # + &mysqlstart; + + # + # Setup MySQL to restart on reboot + # + &mysqlreboot; + + # + # set mysql root password in database + # + # + &setupmysqlroot; + } + + # Verify the mysql root password, if it is wrong, do nothing and die. + &verifymysqlroot; + + # + # Backup current database + # + my $homedir = xCAT::Utils->getHomeDir(); + $::backupdir = $homedir; + if ($::osname eq 'AIX') + { + $::backupdir .= "xcat-dbback"; + } + else + { + $::backupdir .= "/xcat-dbback"; + } + + &backupxcatdb; + + # shutdown the xcatd daemon while migrating + &shutdownxcatd; + + + # + # Get MN name from site.master in backed up database + # if that does not exist use resolved hostname + # double check site.master for resolution + my $sitefile = "$::backupdir/site.csv"; + my $cmd = "grep master $sitefile"; + my @output = xCAT::Utils->runcmd($cmd, -1); + my $hname; + # from site.master + if ($::RUNCMD_RC == 0 ) + { + (my $attr, my $master) = split(",", $output[0]); + (my $q, $hname) = split("\"", $master); + chomp $hname; + + } + + if( "$hname" eq ""){ + $hname = `hostname`; + chomp $hname; + } + + #my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname); + my $ipaddr = xCAT::NetworkUtils->getipaddr($hname); + if ($ipaddr) + { + $::MN = $ipaddr; + } + else + { + xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed."); + exit(1); + } + + # if xcat not already configured to run mysql, then add xcat info to the DB + if ($::xcatrunningmysql == 0) + { + + # + # Create xcatd database + # Create xcatadmin in the database + # Add Management Node to database access + # + &setupxcatdb; + + # + # create cfgloc file + # + &createcfgloc; + + if ($::HOSTFILE) + { + &addhosts; + $hostfile_configured=1 + } + + # + # Restore backed up database into MySQL + # + &restorexcatdb; + + if ($::osname eq 'AIX') + { + xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database.\nYou should log out and back in, so that the new ulimit settings will take affect."); + } else { + xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database."); + } + } + +} # end initialization + +if ($::SETUPODBC) +{ + + # + # set up the ODBC on the Management Node + # + + &setupODBC; + +} +if ($::SETUPLL) +{ + + # + # Add special Loadleveler setup + # + + &setupLL; + +} + + +# if input a list of hosts to add to the database, to give access to MySQL +if (($::HOSTFILE) && ($hostfile_configured == 0)) +{ + &addhosts; + +} +exit; + +##################################### +# subroutines +##################################### + +#----------------------------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#----------------------------------------------------------------------------- + +sub usage +{ + xCAT::MsgUtils->message( + 'I', +"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information." + ); + my $msg = +"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]"; + + xCAT::MsgUtils->message('I', "$msg"); +} + +#----------------------------------------------------------------------------- + +=head3 setulimits + + sets ulimits unlimited, needed to run MySQL + update /etc/security/limits with the info + +=cut + +#----------------------------------------------------------------------------- + +sub setulimits +{ + my $limitsfile = "/etc/security/limits"; + my $limitstmpfile = "/etc/security/limits.tmp"; + my $limitsbackup = "/etc/security/limits.backup"; + + # backup ulimits if not already backed up + if (!(-e ("$limitsbackup"))) + { + $cmd = "cp $limitsfile $limitsbackup"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # add ulimits for root to /etc/security/limits + unless (open(LIMITS, "<$limitsfile")) + { + xCAT::MsgUtils->message('E', "Error opening $limitsfile."); + exit(1); + } + unless (open(LIMITSTMP, ">$limitstmpfile")) + { + xCAT::MsgUtils->message('E', "Error opening $limitstmpfile."); + exit(1); + } + my $rootstanza = 0; + foreach my $line () + { + if ($rootstanza == 1) + { # dealing with root stanza, skip all entries + if (!($line =~ /:/)) + { # still in root stanza + next; # skip root stanza info + } + else + { # continue through the file + $rootstanza = 0; + } + } + print LIMITSTMP $line; + if ($line =~ /root:/) + { # at root stanza, add unlimits + print LIMITSTMP " fsize = -1\n"; + print LIMITSTMP " core= -1\n"; + print LIMITSTMP " cpu= -1\n"; + print LIMITSTMP " data= -1\n"; + print LIMITSTMP " rss= -1\n"; + print LIMITSTMP " stack= -1\n"; + print LIMITSTMP " nofiles= 102400\n"; + print LIMITSTMP "\n"; + $rootstanza = 1; + } + } + + close(LIMITS); + close(LIMITSTMP); + + # copy new limits to old + $cmd = "cp $limitstmpfile $limitsfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + +} + +#----------------------------------------------------------------------------- + +=head3 backupxcatdb + + Backup xCATdb + +=cut + +#----------------------------------------------------------------------------- + +sub backupxcatdb + +{ + + # If there is no backup or the /etc/xcat/cfgloc file does not point to + # mysql, then we backup the database + my $sitefile = "$::backupdir/site.csv"; + + if ((!(-e $sitefile)) || ($::xcatrunningmysql == 0)) + { + xCAT::MsgUtils->message( + "I", +"Backing up xCAT Database to $::backupdir.\nThis could take several minutes." + ); + if (!(-e $::backupdir)) + { # does not exist, make it + my $cmd = "mkdir -p $::backupdir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + else + { # remove contents + + my $cmd = "rm -f $::backupdir/*"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # back it up + my $cmd = "dumpxCATdb -p $::backupdir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + +} + +#----------------------------------------------------------------------------- + +=head3 shutdownxcatd + + shutdown the daemon + +=cut + +#----------------------------------------------------------------------------- + +sub shutdownxcatd + +{ + my $msg = "Shutting down the xcatd daemon during database migration."; + xCAT::MsgUtils->message('I', "$msg"); + my $xcmd; + if ($::osname eq 'AIX') + { + $xcmd = "stopsrc -s xcatd"; + system($xcmd); + + } + else + { + #$xcmd = "service xcatd stop"; + my $ret = xCAT::Utils->stopservice("xcatd"); + return $ret; + } + +} + +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- + +=head3 fixinstall + + If AIX, Fixes ownership and permssion on install + adds mysql user and group + +=cut + +#----------------------------------------------------------------------------- + +sub fixinstalldir +{ + + if ($::osname eq 'AIX') + { + + # + # mk mysql group and user + # + my $cmd = "lsgroup mysql"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + # mysql group does not exist, need to make it + $cmd = "mkgroup mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + $cmd = "lsuser mysql"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + # mysql user does not exist, need to make it + $cmd = "mkuser pgrp=mysql mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # + # correct installed directory permissions + # + xCAT::MsgUtils->message( + 'I', +"Fixing install directory permissions.\nThis may take a few minutes." + ); + my $mysqldir = $::installdir; + $mysqldir .= "\/*"; + $cmd = "chown -R mysql $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } +} + +#----------------------------------------------------------------------------- + +=head3 initmysqldb + + + Create the MySQL data directory and initialize the grant tables + Setup my.cnf + +=cut + +#----------------------------------------------------------------------------- +sub initmysqldb +{ + my $cmd; + + if (($::osname eq 'AIX') && (!(-e "/etc/my.cnf"))) + { + $cmd = "cp $::installdir/support-files/my-large.cnf /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } + + + # for AIX, insert datadir=/var/lib/mysql in the [mysqld] stanza + # of the /etc/my.cnf file,if it is not already there + if ($::osname eq 'AIX') + { + $cmd = "fgrep datadir /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + $cmd = +"awk '{gsub(\"\\\\[mysqld]\",\"\\[mysqld]\\ndatadir=/var/lib/mysql \"); print}' /etc/my.cnf > /etc/my.cnf.xcat"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "cp -p /etc/my.cnf.xcat /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # + # make data dir owned by mysql and root everything else + # + my $mysqldir = $::installdir; + $mysqldir .= "\/*"; + $cmd = "chown -R root $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + my $mysqldatadir = "$::installdir/data"; + $mysqldatadir .= "\/*"; + $cmd = "chown -R mysql $mysqldatadir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql $mysqldatadir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # make the database directory if it does not exist and + # make mysql the owner + if (!(-e ("/var/lib/mysql"))) + { + $cmd = "mkdir -p /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chown -R mysql /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } + } # end AIX only + + #bind-adress line in my.cnf should comment out + #on Ubuntu16.04, the bind-address line is in the mariadb.conf.d/50-server.cnf + #on SLE15, the bind-address line is in the /etc/my.cnf + my $bind_file; + if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") + { + $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; + } elsif (-e "/etc/mysql/my.cnf") + { + $bind_file = "/etc/mysql/my.cnf"; + } else { + $bind_file = "/etc/my.cnf"; + } + $cmd = "sed 's/^bind/#&/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); + exit(1); + } + + # Create the MySQL data directory and initialize the grant tables + # if not already setup + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + if ($::osname eq 'AIX') + { + $cmd = $cmd2; + $cmd .= +"$::installdir/scripts/mysql_install_db --user=mysql --basedir=$::installdir"; + } + else + { + my $sqlcmd = "/usr/bin/mysql_install_db"; + if (!(-x ($sqlcmd))) { + xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages"); + exit(1); + } + + $cmd = "$sqlcmd --user=mysql"; + # On rhels7.7, /usr/bin/mysql_install_db requires /usr/libexec/resolveip + # Link it to /usr/bin/resolveip for all OSes, just in case some future releases have the same requirement + my $resolveip="/usr/libexec/resolveip"; + if (!(-x ($resolveip))) { + my $linkcmd="ln -s /usr/bin/resolveip $resolveip"; + xCAT::Utils->runcmd($linkcmd, 0); + } + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + + exit(1); + } + +} + +#----------------------------------------------------------------------------- + +=head3 mysqlstart + + + Start the mysql server + +=cut + +#----------------------------------------------------------------------------- + +sub mysqlstart +{ + my $cmd; + my $ret = 0; + if ($::osname eq 'AIX') + { + my $hostname = `hostname`; + chomp $hostname; + + #$cmd = "$::installdir/bin/mysqld_safe --user=mysql &"; #doesnot return + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= +"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &"; + $ret = xCAT::Utils->runcmd($cmd, 0); + + + } + else + { + if ($::MariaDB == 1) { # running MariaDB + if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { + $ret = xCAT::Utils->startservice("mariadb"); + } else { # sles + $ret = xCAT::Utils->startservice("mysql"); + } + + } else { # it is mysql + + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) + { + $ret = xCAT::Utils->startservice("mysqld"); + } + else + { # sles + $ret = xCAT::Utils->startservice("mysql"); + } + } + } + if ($ret != 0) + { + xCAT::MsgUtils->message("E", " failed to start mysql/mariadb."); + exit(1); + } + + # make sure running + $cmd = "ps -ef | grep $::db_service | grep -v grep"; + for (my $i = 0 ; $i < 12 ; $i++) + { + my @output = xCAT::Utils->runcmd($cmd, 0); + $mysqlcheck = $::db_service; + + if (grep(/$mysqlcheck/, @output)) + { + sleep 10; # give a few extra seconds to be sure + return; + } + else + { + sleep 10; # wait for daemon + } + } + xCAT::MsgUtils->message("E", + " Could not start the $::db_service daemon, in time allocated (2 minutes)"); + exit(1); + +} + +#----------------------------------------------------------------------------- + +=head3 mysqlreboot + + + Setup for MySQL to start on reboot + +=cut + +#----------------------------------------------------------------------------- + +sub mysqlreboot +{ + my $cmd; + if ($::osname eq 'AIX') + { + $cmd = "fgrep mysql /etc/inittab"; + xCAT::Utils->runcmd($cmd, -1); + + # if not already in inittab + if ($::RUNCMD_RC != 0) + { + + # backup inittab + if (!(-e ("/etc/inittab.org"))) + { + $cmd = "cp -p /etc/inittab /etc/inittab.org"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", + " $cmd failed. Could not backup inittab."); + exit(1); + } + } + + $cmd = +"awk '{gsub(\"xcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>&1\",\"mysql:2:once:/usr/local/mysql/bin/mysqld_safe --user=mysql \\& \\nxcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>\\&1\"); print}' /etc/inittab > /etc/inittab.xcat"; + + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # put the new mysql entry in /etc/inittab + $cmd = "cp -p /etc/inittab.xcat /etc/inittab"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", + " $cmd failed. MySQL will not restart on reboot."); + } + } + } + else # linux + { + if ($::MariaDB == 1) { # MariaDB not MySQL + + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { + $cmd = "chkconfig mariadb on"; + } else { #sles + $cmd = "chkconfig mysql on"; + if ($::debianflag) { + $cmd = "update-rc.d mysql defaults"; + } + + } + } else { # mysql + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) + { + $cmd = "chkconfig mysqld on"; + } + else + { # sles + $cmd = "chkconfig mysql on"; + if ($::debianflag) { + $cmd = "update-rc.d mysql defaults"; + } + } + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", + " $cmd failed. MySQL will not restart on reboot."); + } + } + +} + +sub verifymysqlroot +{ + # Verify if mysql has an correct user input root password + if ($::osname eq 'AIX') + { + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= "$::installdir/bin/mysqladmin -u root -p$::rootpassword version"; + } + else + { + $cmd = "/usr/bin/mysqladmin -u root -p$::rootpassword version"; + } + + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC == 0) + { + # User has input an correct root passwd. That is fine. Do nothing and go head. + return + } + + # The password is wrong, warn the user and die. + xCAT::MsgUtils->message( + "E", + "Wrong MySQL root password." + ); + exit 1; +} + +#----------------------------------------------------------------------------- + +=head3 setupmysqlroot + + + Set mysql root password in the database + +=cut + +#----------------------------------------------------------------------------- + +sub setupmysqlroot + +{ + my $cmd; + + # set root password in database + if ($::osname eq 'AIX') + { + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= "$::installdir/bin/mysqladmin -u root password $::rootpassword"; + } + else + { + $cmd = "/usr/bin/mysqladmin -u root password $::rootpassword"; + } + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( + "I", +"Warning, mysqladmin -u root password command failed, trying to set root password in MySQL. If root id has been defined in MySQL, and has a password then this message can be ignored." + ); + + } + +} + +#----------------------------------------------------------------------------- + +=head3 setupxcatdb + + Creates the xcatdb in MySQL + Add xcatadmin to the database + Give Management Node database access + +=cut + +#----------------------------------------------------------------------------- + +sub setupxcatdb + +{ + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + $mysql = new Expect; + my $createuser = + "CREATE USER xcatadmin IDENTIFIED BY \'$::adminpassword\';\r"; + my $grantall = ""; + $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall .= "\'"; + $grantall .= "$::MN"; + $grantall .= "\'"; + $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; + + #GRAND user xcatadmin to localhost account + my $grantall_localhost = ""; + $grantall_localhost = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall_localhost .= "\'"; + $grantall_localhost .= "localhost"; + $grantall_localhost .= "\'"; + $grantall_localhost .= " IDENTIFIED BY \'$::adminpassword\';\r"; + + #GRAND root to host account + my $grantroot = ""; + $grantroot = "GRANT ALL on xcatdb.* TO root@"; + $grantroot .= "\'"; + $grantroot .= "$::MN"; + $grantroot .= "\'"; + $grantroot .= " IDENTIFIED BY \'$::rootpassword\';\r"; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the Create Database SQL command and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # turn on if debugging error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message("E", + "Unable to run $spawncmd to create database and add MN."); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("CREATE DATABASE xcatdb;ALTER DATABASE xcatdb DEFAULT CHARACTER SET latin1;\r"); + $mysql->clear_accum(); + $mysql->send("$createuser"); + $mysql->clear_accum(); + $mysql->send("$grantall"); + $mysql->clear_accum(); + $mysql->send("$grantall_localhost"); + $mysql->clear_accum(); + $mysql->send("$grantroot"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed creating database. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + +} + +#----------------------------------------------------------------------------- + +=head3 setupLL + + Adds special LoadLeveler setup in MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub setupLL + +{ + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + $mysql = new Expect; + my $setLLfunction = + "SET GLOBAL log_bin_trust_function_creators=1;\r"; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the log_bin_trust_function_creators command and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # log_stdout shows output, turn on if debugging error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message("E", + "Unable to run $spawncmd to add LL setup."); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("$setLLfunction"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed LoadLeveler setup. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + xCAT::MsgUtils->message("I", "LoadLeveler setup complete."); + +} + +#----------------------------------------------------------------------------- + +=head3 addhosts + + Will add all host ids that need access to the MySQL database. + User will input names, ipaddress or wild cards like 9.112.%.% + or %.ibm.com in a file after the -f flag. + +=cut + +#----------------------------------------------------------------------------- + +sub addhosts + +{ + my @hosts; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + + open(HOSTFILE, "<$::HOSTFILE") + or + xCAT::MsgUtils->message('S', "Cannot open $::HOSTFILE for node list. \n"); + foreach my $line () + { + chop $line; + push @hosts, $line; # add hosts + } + close HOSTFILE; + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + + foreach my $host (@hosts) + { + my $grantall = ""; + $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall .= "\'"; + $grantall .= "$host"; + $grantall .= "\'"; + $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; + $mysql = new Expect; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the GRANT ALL SQL command for each host and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # turn on to debug error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message( + "E", + "Unable to run $spawncmd to grant host access to the database." + ); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("$grantall"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed adding hosts. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + } +} + +#----------------------------------------------------------------------------- + +=head3 setupODBC + + Will setup the ODBC. Only needed if C, C++ applications are running + that need access to the MySQL database for example LoadLeveler. + +=cut + +#----------------------------------------------------------------------------- + +sub setupODBC + +{ + + # + # check to see if correct rpms are installed + # + # for all OS need unixODBC rpm + my $cmd = "rpm -qa | grep unixODBC"; + if ($::debianflag) { + $cmd = "dpkg -l | grep unixodbc"; + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"unixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", " $message"); + exit(1); + } + + # for aix and redhat + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) + { + $cmd = "rpm -qa | grep mysql-connector-odbc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"xcat-connector-odbc is not installed. It should be first obtained from the xcat dependency tarballs and installed before running this command. If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + elsif ($::debianflag) { + $cmd = "dpkg -l | grep libmyodbc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = "\nlibmyodbc is not installed."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + else # sles + { + $cmd = "rpm -qa | grep mysql-client"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"mysql-client is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + $cmd = "rpm -qa | grep libmysqlclient"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"libmysqlclient is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + $cmd = "rpm -qa | grep MyODBC-unixODBC"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"MyODBC-unixODBC is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } # end sles + my @rpmoutput; + my $odbcinstfile; + my $odbcfile; + my $message; + + # configure the ODBC, again SLES different than the rest + my $xcatconfig = "/etc/xcat/cfgloc"; + my $xcatconfigbackup = "/etc/xcat/cfgloc.mysql"; + if (!(-e ($xcatconfig)) && (!(-e ($xcatconfigbackup)))) + { + $message = +"The $xcatconfig and $xcatconfigbackup files are missing. You need to configure xCAT for MySQL before setting up the ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $cmd = "fgrep -i host $xcatconfig"; + my @output; + @output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then try backup + { + $cmd = "fgrep -i host $xcatconfigbackup"; + @output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then try backup + { + $message = +"Cannot find host info in the cfgloc or cfgloc.mysql file. Configuration of ODBC cannot continue."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + + # get host and password from cfgloc + (my $connstring, my $adminid, my $passwd) = split(/\|/, $output[0]); + (my $database, my $id, my $server) = split(/=/, $connstring); + + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) + { + $odbcinstfile = "/etc/odbcinst.ini"; + $odbcfile = "/etc/odbc.ini"; + $cmd = "rpm -ql mysql-connector-odbc | grep libmyodbc..so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + elsif ($::debianflag) { + $odbcinstfile = "/etc/odbcinst.ini"; + $odbcfile = "/etc/odbc.ini"; + $cmd = "dpkg -L libmyodbc | grep libmyodbc.so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + else + { #sles + $odbcinstfile = "/etc/unixODBC/odbcinst.ini "; + $odbcfile = "/etc/unixODBC/odbc.ini "; + $cmd = "rpm -ql rpm -ql MyODBC-unixODBC | grep libmyodbc..so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + if ($::RUNCMD_RC != 0) + { + my $message = "Cannot configure the ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + + # setup the odbcinst.ini file + my $sharedlib = $rpmoutput[0]; + $cmd = "fgrep -i MySQL $odbcinstfile "; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then driver entry not there + { + my $entry = + "[MySQL]\nDescription = ODBC for MySQL\nDriver = $sharedlib"; + $cmd = "echo \"$entry\" >> $odbcinstfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + else + { # entry already there + $message = "$odbcinstfile already configured, will not change."; + xCAT::MsgUtils->message("I", "$message"); + } + + # setup the DSN odbc.ini file + $cmd = "fgrep -i MySQL $odbcfile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then xcat entry not there + { + my $entry = +"[xCATDB]\nDriver = MySQL\nSERVER = $server\nPORT = 3306\nDATABASE = xcatdb"; + $cmd = "echo \"$entry\" >> $odbcfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup ODBC DNS file."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + } + else + { # entry already there + $message = "$odbcfile already configured, will not change."; + xCAT::MsgUtils->message("I", "$message"); + } + + # setup $roothome/.odbc.ini so root will not have to specify password + # when accessing through ODBC + + my $homedir = xCAT::Utils->getHomeDir(); + my $rootodbcfile = $homedir; + if ($::osname eq "AIX") + { + $rootodbcfile .= ".odbc.ini"; + } + else + { + $rootodbcfile .= "/.odbc.ini"; + } + + # setup the DSN odbc.ini file + $cmd = "fgrep -i XCATDB $rootodbcfile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then xcat entry not there + { + my $entry = +"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = $adminid\nPASSWORD = $passwd"; + $cmd = "echo \"$entry\" >> $rootodbcfile"; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup root ODBC file."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $::VERBOSE = $tmpv; + } + else + { # entry already there + $message = "$rootodbcfile already configured, will not change. Make sure the userid and password are correct for MySQL"; + xCAT::MsgUtils->message("I", "$message"); + } + + # allow readonly by root + chmod 0600, $rootodbcfile; + +} + +#----------------------------------------------------------------------------- + +=head3 createcfgloc + + Creates the cfgloc.mysql file which will be copied to cfgloc + to run xCAT on MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub createcfgloc + +{ + my $cfglocmysql = "/etc/xcat/cfgloc.mysql"; + my $cfglocmysqlbackup = "/etc/xcat/cfgloc.mysql.backup"; + my $cmd; + my $message; + if (-e ($cfglocmysql)) + { + $cmd = "mv $cfglocmysql $cfglocmysqlbackup"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "$cmd failed."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + } + my $mysqlentry = + "mysql:dbname=xcatdb;host=$::MN|xcatadmin|$::adminpassword"; + $cmd = "echo \"$mysqlentry\" > $cfglocmysql"; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "command failed. Could not setup cfgloc.mysql"; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $::VERBOSE = $tmpv; + + # allow readonly by root + chmod 0600, $cfglocmysql; + +} + + +#----------------------------------------------------------------------------- + +=head3 restorexcatdb + + Restores the database from ~/xcat-dbback and restarts the xcatd using + MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub restorexcatdb +{ + + # copy the mysql cfgloc file + my $cmd; + + # if they had an old cfgloc on another database, save it + if ((-e ("/etc/xcat/cfgloc")) && (!(-e ("/etc/xcat/cfgloc.olddb")))) + { + $cmd = "cp /etc/xcat/cfgloc /etc/xcat/cfgloc.olddb"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + } + } + + # put in place cfgloc for mysql + $cmd = "cp /etc/xcat/cfgloc.mysql /etc/xcat/cfgloc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # allow readonly by root + chmod 0600, "/etc/xcat/cfgloc"; + + # set the env variable for Table.pm for the new database + my $xcatcfg; + my $cfgl; + open($cfgl, "<", "/etc/xcat/cfgloc"); + $xcatcfg = <$cfgl>; + close($cfgl); + chomp($xcatcfg); + + # restore the database + xCAT::MsgUtils->message( + "I", +"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes." + ); + if (!(-d $::backupdir)) + { # does not exist, error + xCAT::MsgUtils->message("E", + " $::backupdir is missing. Cannot retore the database."); + exit(1); + } + + # restore it + my $cmd = "XCATBYPASS=y XCATCFG=\"$xcatcfg\" restorexCATdb -p $::backupdir"; + + # not display passwords in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # + # restart the daemon + # + my $xcmd; + if ($::osname eq 'AIX') + { + $xcmd = "$::XCATROOT/sbin/restartxcatd"; + system($xcmd); + } + else + { + #$xcmd = "service xcatd restart"; + my $ret = xCAT::Utils->restartservice("xcatd"); + return $ret; + } + +} + diff --git a/xCAT-client/bin/mysqlsetup.orig b/xCAT-client/bin/mysqlsetup.orig new file mode 100755 index 0000000000..19f9796beb --- /dev/null +++ b/xCAT-client/bin/mysqlsetup.orig @@ -0,0 +1,1964 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# + +#----------------------------------------------------------------------------- + +=head1 mysqlsetup + + + + This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run + xCAT on MySQL/MariaDB. + Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password. + It will interact for the + password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW + env variables are set to the admin and mysql root password, resp. + Setups up AIX and Linux, but most work needs to be done on AIX. + See man mysqlsetup for more information and the xCAT2.SetupMySQL.pdf + documentation. + +=cut + +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; + $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; +} + +# if AIX - make sure we include perl 5.8.2 in INC path. +# Needed to find perl dependencies shipped in deps tarball. +if ($^O =~ /^aix/i) { + unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); +} + +use lib "$::XCATROOT/lib/perl"; +use DBI; +use xCAT::Utils; +use xCAT::NetworkUtils; +use Getopt::Long; +use xCAT::MsgUtils; +use xCAT::Table; +use Expect; +use Socket; +use strict; + +#----------------------------------------------------------------------------- +# Main + +$::progname = "mysqlsetup"; +my $args = join ' ', @ARGV; +$::command = "$0 $args"; +Getopt::Long::Configure("bundling"); +$Getopt::Long::ignorecase = 0; +$::installdir = "/usr/local/mysql"; # current release of xcat-mysql +$::debianflag = 0; + +#$::installdir="/opt/xcat/mysql"; # next release of xcat-mysql + +# parse the options +if ( + !GetOptions( + 'i|init' => \$::INIT, + 'u|update' => \$::UPDATE, + 'f|hostfile=s' => \$::HOSTFILE, + 'o|odbc' => \$::SETUPODBC, + 'L|LL' => \$::SETUPLL, + 'h|help' => \$::HELP, + 'v|version' => \$::VERSION, + 'V|verbose' => \$::VERBOSE, + ) + ) +{ + &usage; + exit(1); +} + +# display the usage if -h or --help is specified +if ($::HELP) +{ + &usage; + exit(0); +} + +# display the version statement if -v or --version is specified +if ($::VERSION) +{ + my $version = xCAT::Utils->Version(); + xCAT::MsgUtils->message("I", $version); + exit 0; +} +if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPODBC)) && (!($::SETUPLL))) +{ + xCAT::MsgUtils->message("I", "Either -i or -u or -o flag must be chosen"); + &usage; + exit(1); +} + +# check to see if only odbc update, no passwords needed +my $odbconly = 0; +if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPLL)) && ($::SETUPODBC)) +{ + $odbconly = 1; + +} +if ((!($::HOSTFILE)) && ($::UPDATE) && ($::SETUPODBC)) +{ + $odbconly = 1; + +} +if (($::INIT) && ($::UPDATE)) +{ + my $warning = +" The -i and -u flags may not be input to the command. Use one or the other. \n "; + xCAT::MsgUtils->message("E", $warning); + exit 1; +} +if (($::UPDATE) && ((!($::HOSTFILE)) && (!($::SETUPODBC)))) +{ + my $warning = +" The -u flag requires the -o flag or the -f flag pointing to a file that contains the list of hosts that you would like to add to database access."; + xCAT::MsgUtils->message("E", $warning); + exit 1; +} +if (($::HOSTFILE) && (!(-e ($::HOSTFILE)))) +{ + my $warning = " The -f flag is pointing to a non-existing file."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + +} + +# +# Get OS +# +if (xCAT::Utils->isAIX()) +{ + $::osname = 'AIX'; +} +else +{ + $::osname = 'Linux'; +} + +if (-e "/etc/debian_version") { + $::debianflag = 1; +} + +# determine whether redhat or sles +$::linuxos = xCAT::Utils->osver(); + +# is this MariaDB or MySQL +$::MariaDB = 0; +my $cmd; +if ($::debianflag) { + $cmd = "dpkg -l | grep mariadb"; +} else { + $cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL +} +xCAT::Utils->runcmd($cmd, -1); +if ($::RUNCMD_RC == 0) { + $::MariaDB = 1; +} + +# +# check to see if mysql is installed +# +$cmd = "rpm -qa | grep -i perl-DBD-mysql"; +my $msg = "\nMySQL perl DBD "; +if ($::debianflag) { + if ($::MariaDB) { + $cmd = "dpkg -l | grep -i mariadb-server"; + $msg = "\nmariadb-server "; + } else { + $cmd = "dpkg -l | grep mysql-server"; + $msg = "\nmysql-server "; + } +} +xCAT::Utils->runcmd($cmd, 0); +if ($::RUNCMD_RC != 0) +{ + my $message = +"\n$msg is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", " $cmd failed. $message"); + exit(1); +} + +# check to see if MySQL is running +$::mysqlrunning = 0; +$::xcatrunningmysql = 0; +my $cmd = "ps -ef | grep mysqld"; +my @output = xCAT::Utils->runcmd($cmd, 0); +my $mysqlcheck = "mysql.sock"; # see if really running +if (grep(/$mysqlcheck/, @output)) +{ + if ($::INIT) + { + my $message = + "MySQL is running. Database initialization will not take place."; + xCAT::MsgUtils->message("I", "$message"); + } + $::mysqlrunning = 1; +} + +# Stop mysql in order to setup init xcat mysql +$cmd = "pidof mysqld"; +xCAT::Utils->runcmd($cmd, -1); +if ($::RUNCMD_RC == 0) +{ + if ($::INIT) + { + my $ret = xCAT::Utils->stopservice("mysql"); + if ($ret != 0) + { + xCAT::MsgUtils->message("E", " failed to stop mysql/mariadb."); + exit(1); + } + } else { + $::mysqlrunning = 1; + } +} + +if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql +{ # cfgloc exists + $cmd = "fgrep mysql /etc/xcat/cfgloc"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC == 0) + { + if ($::INIT) + { + my $message = +"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required."; + xCAT::MsgUtils->message("I", "$message"); + } + $::xcatrunningmysql = 1; + } +} + +# +# if AIX, Set memory unlimited. Linux defaults unlimited +# +if ($::osname eq 'AIX') +{ + &setulimits; +} + +# if not just odbc update and not already running mysql or mysqlsetup -u or -L +# Get root and admin passwords +# +if ((($odbconly == 0) && ($::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL) +{ # not just updating the odbc + if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password + { + my $pw = $ENV{'XCATMYSQLADMIN_PW'}; + if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + $::adminpassword = $ENV{'XCATMYSQLADMIN_PW'}; + + } + else # prompt for password + { + my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: "; + xCAT::MsgUtils->message('I', "$msg"); + `stty -echo`; + chop($::adminpassword = ); + `stty echo`; + + if ($::adminpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + } + if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password + { + my $pw = $ENV{'XCATMYSQLROOT_PW'}; + if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + $::rootpassword = $ENV{'XCATMYSQLROOT_PW'}; + + } + else # prompt for password + { + + my $msg = "Input the password for root in the MySQL database: "; + xCAT::MsgUtils->message('I', "$msg"); + `stty -echo`; + chop($::rootpassword = ); + `stty echo`; + + if ($::rootpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid + my $warning = +"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; + xCAT::MsgUtils->message("E", $warning); + exit 1; + } + + } +} + +# initial setup request, if not already running mysql +my $hostfile_configured=0; +if (($::INIT) && ($::xcatrunningmysql == 0)) +{ + # MySQL not running, then initialize the database + if ($::mysqlrunning == 0) + { + # Add mysql user and group for AIX + # Correct directory permissions + # + &fixinstalldir; + + # + # Init mysql db and setup my.cnf + # + &initmysqldb; + + # + # Start MySQL server + # + &mysqlstart; + + # + # Setup MySQL to restart on reboot + # + &mysqlreboot; + + # + # set mysql root password in database + # + # + &setupmysqlroot; + } + + # Verify the mysql root password, if it is wrong, do nothing and die. + &verifymysqlroot; + + # + # Backup current database + # + my $homedir = xCAT::Utils->getHomeDir(); + $::backupdir = $homedir; + if ($::osname eq 'AIX') + { + $::backupdir .= "xcat-dbback"; + } + else + { + $::backupdir .= "/xcat-dbback"; + } + + &backupxcatdb; + + # shutdown the xcatd daemon while migrating + &shutdownxcatd; + + + # + # Get MN name from site.master in backed up database + # if that does not exist use resolved hostname + # double check site.master for resolution + my $sitefile = "$::backupdir/site.csv"; + my $cmd = "grep master $sitefile"; + my @output = xCAT::Utils->runcmd($cmd, -1); + my $hname; + # from site.master + if ($::RUNCMD_RC == 0 ) + { + (my $attr, my $master) = split(",", $output[0]); + (my $q, $hname) = split("\"", $master); + chomp $hname; + + } + + if( "$hname" eq ""){ + $hname = `hostname`; + chomp $hname; + } + + #my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname); + my $ipaddr = xCAT::NetworkUtils->getipaddr($hname); + if ($ipaddr) + { + $::MN = $ipaddr; + } + else + { + xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed."); + exit(1); + } + + # if xcat not already configured to run mysql, then add xcat info to the DB + if ($::xcatrunningmysql == 0) + { + + # + # Create xcatd database + # Create xcatadmin in the database + # Add Management Node to database access + # + &setupxcatdb; + + # + # create cfgloc file + # + &createcfgloc; + + if ($::HOSTFILE) + { + &addhosts; + $hostfile_configured=1 + } + + # + # Restore backed up database into MySQL + # + &restorexcatdb; + + if ($::osname eq 'AIX') + { + xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database.\nYou should log out and back in, so that the new ulimit settings will take affect."); + } else { + xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database."); + } + } + +} # end initialization + +if ($::SETUPODBC) +{ + + # + # set up the ODBC on the Management Node + # + + &setupODBC; + +} +if ($::SETUPLL) +{ + + # + # Add special Loadleveler setup + # + + &setupLL; + +} + + +# if input a list of hosts to add to the database, to give access to MySQL +if (($::HOSTFILE) && ($hostfile_configured == 0)) +{ + &addhosts; + +} +exit; + +##################################### +# subroutines +##################################### + +#----------------------------------------------------------------------------- + +=head3 usage + + Displays message for -h option + +=cut + +#----------------------------------------------------------------------------- + +sub usage +{ + xCAT::MsgUtils->message( + 'I', +"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information." + ); + my $msg = +"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]"; + + xCAT::MsgUtils->message('I', "$msg"); +} + +#----------------------------------------------------------------------------- + +=head3 setulimits + + sets ulimits unlimited, needed to run MySQL + update /etc/security/limits with the info + +=cut + +#----------------------------------------------------------------------------- + +sub setulimits +{ + my $limitsfile = "/etc/security/limits"; + my $limitstmpfile = "/etc/security/limits.tmp"; + my $limitsbackup = "/etc/security/limits.backup"; + + # backup ulimits if not already backed up + if (!(-e ("$limitsbackup"))) + { + $cmd = "cp $limitsfile $limitsbackup"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # add ulimits for root to /etc/security/limits + unless (open(LIMITS, "<$limitsfile")) + { + xCAT::MsgUtils->message('E', "Error opening $limitsfile."); + exit(1); + } + unless (open(LIMITSTMP, ">$limitstmpfile")) + { + xCAT::MsgUtils->message('E', "Error opening $limitstmpfile."); + exit(1); + } + my $rootstanza = 0; + foreach my $line () + { + if ($rootstanza == 1) + { # dealing with root stanza, skip all entries + if (!($line =~ /:/)) + { # still in root stanza + next; # skip root stanza info + } + else + { # continue through the file + $rootstanza = 0; + } + } + print LIMITSTMP $line; + if ($line =~ /root:/) + { # at root stanza, add unlimits + print LIMITSTMP " fsize = -1\n"; + print LIMITSTMP " core= -1\n"; + print LIMITSTMP " cpu= -1\n"; + print LIMITSTMP " data= -1\n"; + print LIMITSTMP " rss= -1\n"; + print LIMITSTMP " stack= -1\n"; + print LIMITSTMP " nofiles= 102400\n"; + print LIMITSTMP "\n"; + $rootstanza = 1; + } + } + + close(LIMITS); + close(LIMITSTMP); + + # copy new limits to old + $cmd = "cp $limitstmpfile $limitsfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + +} + +#----------------------------------------------------------------------------- + +=head3 backupxcatdb + + Backup xCATdb + +=cut + +#----------------------------------------------------------------------------- + +sub backupxcatdb + +{ + + # If there is no backup or the /etc/xcat/cfgloc file does not point to + # mysql, then we backup the database + my $sitefile = "$::backupdir/site.csv"; + + if ((!(-e $sitefile)) || ($::xcatrunningmysql == 0)) + { + xCAT::MsgUtils->message( + "I", +"Backing up xCAT Database to $::backupdir.\nThis could take several minutes." + ); + if (!(-e $::backupdir)) + { # does not exist, make it + my $cmd = "mkdir -p $::backupdir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + else + { # remove contents + + my $cmd = "rm -f $::backupdir/*"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # back it up + my $cmd = "dumpxCATdb -p $::backupdir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + +} + +#----------------------------------------------------------------------------- + +=head3 shutdownxcatd + + shutdown the daemon + +=cut + +#----------------------------------------------------------------------------- + +sub shutdownxcatd + +{ + my $msg = "Shutting down the xcatd daemon during database migration."; + xCAT::MsgUtils->message('I', "$msg"); + my $xcmd; + if ($::osname eq 'AIX') + { + $xcmd = "stopsrc -s xcatd"; + system($xcmd); + + } + else + { + #$xcmd = "service xcatd stop"; + my $ret = xCAT::Utils->stopservice("xcatd"); + return $ret; + } + +} + +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- + +=head3 fixinstall + + If AIX, Fixes ownership and permssion on install + adds mysql user and group + +=cut + +#----------------------------------------------------------------------------- + +sub fixinstalldir +{ + + if ($::osname eq 'AIX') + { + + # + # mk mysql group and user + # + my $cmd = "lsgroup mysql"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + # mysql group does not exist, need to make it + $cmd = "mkgroup mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + $cmd = "lsuser mysql"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + # mysql user does not exist, need to make it + $cmd = "mkuser pgrp=mysql mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # + # correct installed directory permissions + # + xCAT::MsgUtils->message( + 'I', +"Fixing install directory permissions.\nThis may take a few minutes." + ); + my $mysqldir = $::installdir; + $mysqldir .= "\/*"; + $cmd = "chown -R mysql $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } +} + +#----------------------------------------------------------------------------- + +=head3 initmysqldb + + + Create the MySQL data directory and initialize the grant tables + Setup my.cnf + +=cut + +#----------------------------------------------------------------------------- +sub initmysqldb +{ + my $cmd; + + if (($::osname eq 'AIX') && (!(-e "/etc/my.cnf"))) + { + $cmd = "cp $::installdir/support-files/my-large.cnf /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } + + + # for AIX, insert datadir=/var/lib/mysql in the [mysqld] stanza + # of the /etc/my.cnf file,if it is not already there + if ($::osname eq 'AIX') + { + $cmd = "fgrep datadir /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { + + $cmd = +"awk '{gsub(\"\\\\[mysqld]\",\"\\[mysqld]\\ndatadir=/var/lib/mysql \"); print}' /etc/my.cnf > /etc/my.cnf.xcat"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "cp -p /etc/my.cnf.xcat /etc/my.cnf"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + } + + # + # make data dir owned by mysql and root everything else + # + my $mysqldir = $::installdir; + $mysqldir .= "\/*"; + $cmd = "chown -R root $mysqldir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + my $mysqldatadir = "$::installdir/data"; + $mysqldatadir .= "\/*"; + $cmd = "chown -R mysql $mysqldatadir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql $mysqldatadir"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # make the database directory if it does not exist and + # make mysql the owner + if (!(-e ("/var/lib/mysql"))) + { + $cmd = "mkdir -p /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chown -R mysql /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + $cmd = "chgrp -R mysql /var/lib/mysql"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + } + } # end AIX only + + #bind-adress line in my.cnf should comment out + #on Ubuntu16.04, the bind-address line is in the mariadb.conf.d/50-server.cnf + #on SLE15, the bind-address line is in the /etc/my.cnf + my $bind_file; + if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") + { + $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; + } elsif (-e "/etc/mysql/my.cnf") + { + $bind_file = "/etc/mysql/my.cnf"; + } else { + $bind_file = "/etc/my.cnf"; + } + $cmd = "sed 's/^bind/#&/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); + exit(1); + } + + # Create the MySQL data directory and initialize the grant tables + # if not already setup + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + if ($::osname eq 'AIX') + { + $cmd = $cmd2; + $cmd .= +"$::installdir/scripts/mysql_install_db --user=mysql --basedir=$::installdir"; + } + else + { + my $sqlcmd = "/usr/bin/mysql_install_db"; + if (!(-x ($sqlcmd))) { + xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages"); + exit(1); + } + + $cmd = "$sqlcmd --user=mysql"; + # On rhels7.7, /usr/bin/mysql_install_db requires /usr/libexec/resolveip + # Link it to /usr/bin/resolveip for all OSes, just in case some future releases have the same requirement + my $resolveip="/usr/libexec/resolveip"; + if (!(-x ($resolveip))) { + my $linkcmd="ln -s /usr/bin/resolveip $resolveip"; + xCAT::Utils->runcmd($linkcmd, 0); + } + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + + exit(1); + } + +} + +#----------------------------------------------------------------------------- + +=head3 mysqlstart + + + Start the mysql server + +=cut + +#----------------------------------------------------------------------------- + +sub mysqlstart +{ + my $cmd; + my $ret = 0; + if ($::osname eq 'AIX') + { + my $hostname = `hostname`; + chomp $hostname; + + #$cmd = "$::installdir/bin/mysqld_safe --user=mysql &"; #doesnot return + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= +"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &"; + $ret = xCAT::Utils->runcmd($cmd, 0); + + + } + else + { + if ($::MariaDB == 1) { # running MariaDB + if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { + $ret = xCAT::Utils->startservice("mariadb"); + } else { # sles + $ret = xCAT::Utils->startservice("mysql"); + } + + } else { # it is mysql + + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) + { + $ret = xCAT::Utils->startservice("mysqld"); + } + else + { # sles + $ret = xCAT::Utils->startservice("mysql"); + } + } + } + if ($ret != 0) + { + xCAT::MsgUtils->message("E", " failed to start mysql/mariadb."); + exit(1); + } + + # make sure running + $cmd = "ps -ef | grep mysql | grep -v grep"; + for (my $i = 0 ; $i < 12 ; $i++) + { + my @output = xCAT::Utils->runcmd($cmd, 0); + $mysqlcheck = "mysqld"; + + if (grep(/$mysqlcheck/, @output)) + { + sleep 10; # give a few extra seconds to be sure + return; + } + else + { + sleep 10; # wait for daemon + } + } + xCAT::MsgUtils->message("E", + " Could not start the mysql daemon, in time allocated (2 minutes)"); + exit(1); + +} + +#----------------------------------------------------------------------------- + +=head3 mysqlreboot + + + Setup for MySQL to start on reboot + +=cut + +#----------------------------------------------------------------------------- + +sub mysqlreboot +{ + my $cmd; + if ($::osname eq 'AIX') + { + $cmd = "fgrep mysql /etc/inittab"; + xCAT::Utils->runcmd($cmd, -1); + + # if not already in inittab + if ($::RUNCMD_RC != 0) + { + + # backup inittab + if (!(-e ("/etc/inittab.org"))) + { + $cmd = "cp -p /etc/inittab /etc/inittab.org"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", + " $cmd failed. Could not backup inittab."); + exit(1); + } + } + + $cmd = +"awk '{gsub(\"xcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>&1\",\"mysql:2:once:/usr/local/mysql/bin/mysqld_safe --user=mysql \\& \\nxcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>\\&1\"); print}' /etc/inittab > /etc/inittab.xcat"; + + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # put the new mysql entry in /etc/inittab + $cmd = "cp -p /etc/inittab.xcat /etc/inittab"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + + xCAT::MsgUtils->message("E", + " $cmd failed. MySQL will not restart on reboot."); + } + } + } + else # linux + { + if ($::MariaDB == 1) { # MariaDB not MySQL + + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { + $cmd = "chkconfig mariadb on"; + } else { #sles + $cmd = "chkconfig mysql on"; + if ($::debianflag) { + $cmd = "update-rc.d mysql defaults"; + } + + } + } else { # mysql + if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) + { + $cmd = "chkconfig mysqld on"; + } + else + { # sles + $cmd = "chkconfig mysql on"; + if ($::debianflag) { + $cmd = "update-rc.d mysql defaults"; + } + } + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", + " $cmd failed. MySQL will not restart on reboot."); + } + } + +} + +sub verifymysqlroot +{ + # Verify if mysql has an correct user input root password + if ($::osname eq 'AIX') + { + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= "$::installdir/bin/mysqladmin -u root -p$::rootpassword version"; + } + else + { + $cmd = "/usr/bin/mysqladmin -u root -p$::rootpassword version"; + } + + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC == 0) + { + # User has input an correct root passwd. That is fine. Do nothing and go head. + return + } + + # The password is wrong, warn the user and die. + xCAT::MsgUtils->message( + "E", + "Wrong MySQL root password." + ); + exit 1; +} + +#----------------------------------------------------------------------------- + +=head3 setupmysqlroot + + + Set mysql root password in the database + +=cut + +#----------------------------------------------------------------------------- + +sub setupmysqlroot + +{ + my $cmd; + + # set root password in database + if ($::osname eq 'AIX') + { + my $cmd2 = +"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; + $cmd = $cmd2; + $cmd .= "$::installdir/bin/mysqladmin -u root password $::rootpassword"; + } + else + { + $cmd = "/usr/bin/mysqladmin -u root password $::rootpassword"; + } + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message( + "I", +"Warning, mysqladmin -u root password command failed, trying to set root password in MySQL. If root id has been defined in MySQL, and has a password then this message can be ignored." + ); + + } + +} + +#----------------------------------------------------------------------------- + +=head3 setupxcatdb + + Creates the xcatdb in MySQL + Add xcatadmin to the database + Give Management Node database access + +=cut + +#----------------------------------------------------------------------------- + +sub setupxcatdb + +{ + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + $mysql = new Expect; + my $createuser = + "CREATE USER xcatadmin IDENTIFIED BY \'$::adminpassword\';\r"; + my $grantall = ""; + $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall .= "\'"; + $grantall .= "$::MN"; + $grantall .= "\'"; + $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; + + #GRAND user xcatadmin to localhost account + my $grantall_localhost = ""; + $grantall_localhost = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall_localhost .= "\'"; + $grantall_localhost .= "localhost"; + $grantall_localhost .= "\'"; + $grantall_localhost .= " IDENTIFIED BY \'$::adminpassword\';\r"; + + #GRAND root to host account + my $grantroot = ""; + $grantroot = "GRANT ALL on xcatdb.* TO root@"; + $grantroot .= "\'"; + $grantroot .= "$::MN"; + $grantroot .= "\'"; + $grantroot .= " IDENTIFIED BY \'$::rootpassword\';\r"; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the Create Database SQL command and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # turn on if debugging error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message("E", + "Unable to run $spawncmd to create database and add MN."); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("CREATE DATABASE xcatdb;ALTER DATABASE xcatdb DEFAULT CHARACTER SET latin1;\r"); + $mysql->clear_accum(); + $mysql->send("$createuser"); + $mysql->clear_accum(); + $mysql->send("$grantall"); + $mysql->clear_accum(); + $mysql->send("$grantall_localhost"); + $mysql->clear_accum(); + $mysql->send("$grantroot"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed creating database. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + +} + +#----------------------------------------------------------------------------- + +=head3 setupLL + + Adds special LoadLeveler setup in MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub setupLL + +{ + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + $mysql = new Expect; + my $setLLfunction = + "SET GLOBAL log_bin_trust_function_creators=1;\r"; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the log_bin_trust_function_creators command and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # log_stdout shows output, turn on if debugging error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message("E", + "Unable to run $spawncmd to add LL setup."); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("$setLLfunction"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed LoadLeveler setup. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + xCAT::MsgUtils->message("I", "LoadLeveler setup complete."); + +} + +#----------------------------------------------------------------------------- + +=head3 addhosts + + Will add all host ids that need access to the MySQL database. + User will input names, ipaddress or wild cards like 9.112.%.% + or %.ibm.com in a file after the -f flag. + +=cut + +#----------------------------------------------------------------------------- + +sub addhosts + +{ + my @hosts; + my $debug = 0; + + #if ($::VERBOSE) + #{ + # $debug = 1; + #} + + open(HOSTFILE, "<$::HOSTFILE") + or + xCAT::MsgUtils->message('S', "Cannot open $::HOSTFILE for node list. \n"); + foreach my $line () + { + chop $line; + push @hosts, $line; # add hosts + } + close HOSTFILE; + my $mysql; + my $timeout = 10; # sets Expect default timeout, 0 accepts immediately + my $pwd_sent = 0; + my $pwd_prompt = 'Enter password: '; + my $mysql_prompt; + if ($::MariaDB == 1) { # setup MariaDB + $mysql_prompt = 'MariaDB \[\(none\)\]> '; + } else { + $mysql_prompt = 'mysql> '; + } + my $expect_log = undef; + + foreach my $host (@hosts) + { + my $grantall = ""; + $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; + $grantall .= "\'"; + $grantall .= "$host"; + $grantall .= "\'"; + $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; + $mysql = new Expect; + + # + # -re $pwd_prompt + # Enter the password for root + # + # -re $mysql_prompt + # mysql> Enter the GRANT ALL SQL command for each host and exit + # + # + + # disable command echoing + #$mysql->slave->stty(qw(sane -echo)); + + # + # exp_internal(1) sets exp_internal debugging + # to STDERR. + # + #$mysql->exp_internal(1); + $mysql->exp_internal($debug); + + # + # log_stdout(0) prevent the program's output from being shown. + # turn on to debug error + #$mysql->log_stdout(1); + $mysql->log_stdout($debug); + my $spawncmd; + if ($::osname eq 'AIX') + { + $spawncmd = "$::installdir/bin/mysql -u root -p"; + } + else + { + $spawncmd = "/usr/bin/mysql -u root -p"; + } + unless ($mysql->spawn($spawncmd)) + { + xCAT::MsgUtils->message( + "E", + "Unable to run $spawncmd to grant host access to the database." + ); + return; + + } + + # + # setup SQL commands + # + + my @result = $mysql->expect( + $timeout, + [ + $pwd_prompt, + sub { + $mysql->send("$::rootpassword\r"); + $mysql->clear_accum(); + $mysql->exp_continue(); + } + ], + [ + $mysql_prompt, + sub { + + $mysql->send("$grantall"); + $mysql->clear_accum(); + $mysql->send("exit;\r"); + + } + ] + ); + ########################################## + # Expect error - report and quit + ########################################## + if (defined($result[1])) + { + my $errmsg = $result[1]; + $mysql->soft_close(); + xCAT::MsgUtils->message("E", + "Failed adding hosts. $errmsg"); + exit(1); + + } + $mysql->soft_close(); + } +} + +#----------------------------------------------------------------------------- + +=head3 setupODBC + + Will setup the ODBC. Only needed if C, C++ applications are running + that need access to the MySQL database for example LoadLeveler. + +=cut + +#----------------------------------------------------------------------------- + +sub setupODBC + +{ + + # + # check to see if correct rpms are installed + # + # for all OS need unixODBC rpm + my $cmd = "rpm -qa | grep unixODBC"; + if ($::debianflag) { + $cmd = "dpkg -l | grep unixodbc"; + } + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"unixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", " $message"); + exit(1); + } + + # for aix and redhat + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) + { + $cmd = "rpm -qa | grep mysql-connector-odbc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"xcat-connector-odbc is not installed. It should be first obtained from the xcat dependency tarballs and installed before running this command. If on Linux, install from the OS CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + elsif ($::debianflag) { + $cmd = "dpkg -l | grep libmyodbc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = "\nlibmyodbc is not installed."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + else # sles + { + $cmd = "rpm -qa | grep mysql-client"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"mysql-client is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + $cmd = "rpm -qa | grep libmysqlclient"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"libmysqlclient is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + $cmd = "rpm -qa | grep MyODBC-unixODBC"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + my $message = +"MyODBC-unixODBC is not installed. It should be first installed from the SLES CDs."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } # end sles + my @rpmoutput; + my $odbcinstfile; + my $odbcfile; + my $message; + + # configure the ODBC, again SLES different than the rest + my $xcatconfig = "/etc/xcat/cfgloc"; + my $xcatconfigbackup = "/etc/xcat/cfgloc.mysql"; + if (!(-e ($xcatconfig)) && (!(-e ($xcatconfigbackup)))) + { + $message = +"The $xcatconfig and $xcatconfigbackup files are missing. You need to configure xCAT for MySQL before setting up the ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $cmd = "fgrep -i host $xcatconfig"; + my @output; + @output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then try backup + { + $cmd = "fgrep -i host $xcatconfigbackup"; + @output = xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then try backup + { + $message = +"Cannot find host info in the cfgloc or cfgloc.mysql file. Configuration of ODBC cannot continue."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + + # get host and password from cfgloc + (my $connstring, my $adminid, my $passwd) = split(/\|/, $output[0]); + (my $database, my $id, my $server) = split(/=/, $connstring); + + if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) + { + $odbcinstfile = "/etc/odbcinst.ini"; + $odbcfile = "/etc/odbc.ini"; + $cmd = "rpm -ql mysql-connector-odbc | grep libmyodbc..so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + elsif ($::debianflag) { + $odbcinstfile = "/etc/odbcinst.ini"; + $odbcfile = "/etc/odbc.ini"; + $cmd = "dpkg -L libmyodbc | grep libmyodbc.so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + else + { #sles + $odbcinstfile = "/etc/unixODBC/odbcinst.ini "; + $odbcfile = "/etc/unixODBC/odbc.ini "; + $cmd = "rpm -ql rpm -ql MyODBC-unixODBC | grep libmyodbc..so"; + @rpmoutput = xCAT::Utils->runcmd($cmd, 0); + } + if ($::RUNCMD_RC != 0) + { + my $message = "Cannot configure the ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + + # setup the odbcinst.ini file + my $sharedlib = $rpmoutput[0]; + $cmd = "fgrep -i MySQL $odbcinstfile "; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then driver entry not there + { + my $entry = + "[MySQL]\nDescription = ODBC for MySQL\nDriver = $sharedlib"; + $cmd = "echo \"$entry\" >> $odbcinstfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup ODBC."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + } + } + else + { # entry already there + $message = "$odbcinstfile already configured, will not change."; + xCAT::MsgUtils->message("I", "$message"); + } + + # setup the DSN odbc.ini file + $cmd = "fgrep -i MySQL $odbcfile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then xcat entry not there + { + my $entry = +"[xCATDB]\nDriver = MySQL\nSERVER = $server\nPORT = 3306\nDATABASE = xcatdb"; + $cmd = "echo \"$entry\" >> $odbcfile"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup ODBC DNS file."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + } + else + { # entry already there + $message = "$odbcfile already configured, will not change."; + xCAT::MsgUtils->message("I", "$message"); + } + + # setup $roothome/.odbc.ini so root will not have to specify password + # when accessing through ODBC + + my $homedir = xCAT::Utils->getHomeDir(); + my $rootodbcfile = $homedir; + if ($::osname eq "AIX") + { + $rootodbcfile .= ".odbc.ini"; + } + else + { + $rootodbcfile .= "/.odbc.ini"; + } + + # setup the DSN odbc.ini file + $cmd = "fgrep -i XCATDB $rootodbcfile"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) # then xcat entry not there + { + my $entry = +"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = $adminid\nPASSWORD = $passwd"; + $cmd = "echo \"$entry\" >> $rootodbcfile"; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "Could not setup root ODBC file."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $::VERBOSE = $tmpv; + } + else + { # entry already there + $message = "$rootodbcfile already configured, will not change. Make sure the userid and password are correct for MySQL"; + xCAT::MsgUtils->message("I", "$message"); + } + + # allow readonly by root + chmod 0600, $rootodbcfile; + +} + +#----------------------------------------------------------------------------- + +=head3 createcfgloc + + Creates the cfgloc.mysql file which will be copied to cfgloc + to run xCAT on MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub createcfgloc + +{ + my $cfglocmysql = "/etc/xcat/cfgloc.mysql"; + my $cfglocmysqlbackup = "/etc/xcat/cfgloc.mysql.backup"; + my $cmd; + my $message; + if (-e ($cfglocmysql)) + { + $cmd = "mv $cfglocmysql $cfglocmysqlbackup"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "$cmd failed."; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + } + my $mysqlentry = + "mysql:dbname=xcatdb;host=$::MN|xcatadmin|$::adminpassword"; + $cmd = "echo \"$mysqlentry\" > $cfglocmysql"; + + # secure passwd in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + $message = "command failed. Could not setup cfgloc.mysql"; + xCAT::MsgUtils->message("E", "$message"); + exit(1); + + } + $::VERBOSE = $tmpv; + + # allow readonly by root + chmod 0600, $cfglocmysql; + +} + + +#----------------------------------------------------------------------------- + +=head3 restorexcatdb + + Restores the database from ~/xcat-dbback and restarts the xcatd using + MySQL + +=cut + +#----------------------------------------------------------------------------- + +sub restorexcatdb +{ + + # copy the mysql cfgloc file + my $cmd; + + # if they had an old cfgloc on another database, save it + if ((-e ("/etc/xcat/cfgloc")) && (!(-e ("/etc/xcat/cfgloc.olddb")))) + { + $cmd = "cp /etc/xcat/cfgloc /etc/xcat/cfgloc.olddb"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + } + } + + # put in place cfgloc for mysql + $cmd = "cp /etc/xcat/cfgloc.mysql /etc/xcat/cfgloc"; + xCAT::Utils->runcmd($cmd, 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # allow readonly by root + chmod 0600, "/etc/xcat/cfgloc"; + + # set the env variable for Table.pm for the new database + my $xcatcfg; + my $cfgl; + open($cfgl, "<", "/etc/xcat/cfgloc"); + $xcatcfg = <$cfgl>; + close($cfgl); + chomp($xcatcfg); + + # restore the database + xCAT::MsgUtils->message( + "I", +"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes." + ); + if (!(-d $::backupdir)) + { # does not exist, error + xCAT::MsgUtils->message("E", + " $::backupdir is missing. Cannot retore the database."); + exit(1); + } + + # restore it + my $cmd = "XCATBYPASS=y XCATCFG=\"$xcatcfg\" restorexCATdb -p $::backupdir"; + + # not display passwords in verbose mode + my $tmpv = $::VERBOSE; + $::VERBOSE = 0; + xCAT::Utils->runcmd($cmd, 0); + $::VERBOSE = $tmpv; + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message("E", " $cmd failed."); + exit(1); + } + + # + # restart the daemon + # + my $xcmd; + if ($::osname eq 'AIX') + { + $xcmd = "$::XCATROOT/sbin/restartxcatd"; + system($xcmd); + } + else + { + #$xcmd = "service xcatd restart"; + my $ret = xCAT::Utils->restartservice("xcatd"); + return $ret; + } + +} + diff --git a/xCAT-client/pods/man1/mysqlsetup.1.pod b/xCAT-client/pods/man1/mysqlsetup.1.pod index 021a972a95..b362c93ace 100644 --- a/xCAT-client/pods/man1/mysqlsetup.1.pod +++ b/xCAT-client/pods/man1/mysqlsetup.1.pod @@ -19,11 +19,9 @@ B {B<-L>|B<--LL>} [B<-V>|B<--verbose>] =head1 DESCRIPTION -B - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The mysqlsetup script is run on the Management Node as root after the MySQL code or MariaDB code has been installed. Before running the init option, the MySQL server should be stopped, if it is running. The xCAT daemon, xcatd, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the xcatd daemon as well as the MySQL daemon. For full information on all the steps that will be done, read the "Configure MySQL and Migrate xCAT Data to MySQL" sections in +B - Sets up the MySQL or MariaDB database (linux only for MariaDB) for xCAT to use. The B script is run on the Management Node as root after the MySQL or MariaDB packages have been installed. Before running the B<--init> option, the MySQL server should be stopped, if it is running. The xCAT daemon, B, must be running, do not stop it. No xCAT commands should be run during the init process, because we will be migrating the xCAT database to MySQL or MariaDB and restarting the B daemon as well as the MySQL daemon. For more information, see https://xcat-docs.readthedocs.io/en/stable/advanced/hierarchy/databases/index.html#mysql-mariadb -B - -Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables XCATMYSQLADMIN_PW and XCATMYSQLROOT_PW are set to the passwords for the xcatadmin id and root id in the database,resp. +Two passwords must be supplied for the setup, a password for the xcatadmin id and a password for the root id in the MySQL database. These will be prompted for interactively, unless the environment variables B and B are set to the passwords for the xcatadmin id and root id in the database,respectively. Note below we refer to MySQL but it works the same for MariaDB. @@ -45,12 +43,12 @@ Displays verbose messages. =item B<-i|--init> -The init option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The mysqlsetup script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the my.cnf configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the /etc/xcat/cfgloc file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. -On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the -f and/or the -o option, to run after the init. +The B<--init> option is used to setup a xCAT database on an installed MySQL or MariaDB server for xCAT to use. The B script will check for the installed MariaDB server rpm first and will use MariaDB if it is installed. This involves creating the xcatdb database, the xcatadmin id, allowing access to the xcatdb database by the Management Node. It customizes the B configuration file for xcat and starts the MySQL server. It also backs up the current xCAT database and restores it into the newly setup xcatdb MySQL database. It creates the B file to point the xcatd daemon to the MySQL database and restarts the xcatd daemon using the database. +On AIX, it additionally setup the mysql id and group and corrects the permissions in the MySQL install directories. For AIX, you should be using the MySQL rpms available from the xCAT website. For Linux, you should use the MySQL or MariaDB rpms shipped with the OS. You can chose the B<-f> and/or the B<-o> option, to run after the <--init>. =item B<-u|--update> -To run the update option, you must first have run the -i option and have xcat successfully running on the MySQL database. You can chose the -f and/or the -o option, to update. +To run the update option, you must first have run the B<-i> option and have xcat successfully running on the MySQL database. You can chose the B<-f> and/or the B<-o> option, to update. =item B<-f|--hostfile> @@ -58,15 +56,11 @@ This option runs during update, it will take all the host from the input file (p =item B<-o|--odbc> -This option sets up the ODBC /etc/../odbcinst.ini, /etc/../odbc.ini and the .odbc.ini file in roots home directory will be created and initialized to run off the xcatdb MySQL database. -See "Add ODBC Support" in -Setting_Up_MySQL_as_the_xCAT_DB +This option sets up the ODBC B, B and the B<.odbc.ini> file in roots home directory will be created and initialized to run off the xcatdb MySQL database. =item B<-L|--LL> Additional database configuration specifically for the LoadLeveler product. -See "Add ODBC Support" in -Setting_Up_MySQL_as_the_xCAT_DB =back From 540d4ca40a78a28f083d10e4727912b5648d23f2 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 14 Feb 2023 13:19:15 -0500 Subject: [PATCH 172/188] mysqlsetup enhancements --- xCAT-client/bin/mysqlsetup.mg | 1969 ------------------------------- xCAT-client/bin/mysqlsetup.orig | 1964 ------------------------------ 2 files changed, 3933 deletions(-) delete mode 100755 xCAT-client/bin/mysqlsetup.mg delete mode 100755 xCAT-client/bin/mysqlsetup.orig diff --git a/xCAT-client/bin/mysqlsetup.mg b/xCAT-client/bin/mysqlsetup.mg deleted file mode 100755 index 27fa0af10a..0000000000 --- a/xCAT-client/bin/mysqlsetup.mg +++ /dev/null @@ -1,1969 +0,0 @@ -#!/usr/bin/env perl -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -# - -#----------------------------------------------------------------------------- - -=head1 mysqlsetup - - - - This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run - xCAT on MySQL/MariaDB. - Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password. - It will interact for the - password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW - env variables are set to the admin and mysql root password, resp. - Setups up AIX and Linux, but most work needs to be done on AIX. - See man mysqlsetup for more information and the xCAT2.SetupMySQL.pdf - documentation. - -=cut - -BEGIN -{ - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; - $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; -} - -# if AIX - make sure we include perl 5.8.2 in INC path. -# Needed to find perl dependencies shipped in deps tarball. -if ($^O =~ /^aix/i) { - unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); -} - -use lib "$::XCATROOT/lib/perl"; -use DBI; -use xCAT::Utils; -use xCAT::NetworkUtils; -use Getopt::Long; -use xCAT::MsgUtils; -use xCAT::Table; -use Expect; -use Socket; -use strict; - -#----------------------------------------------------------------------------- -# Main - -$::progname = "mysqlsetup"; -my $args = join ' ', @ARGV; -$::command = "$0 $args"; -Getopt::Long::Configure("bundling"); -$Getopt::Long::ignorecase = 0; -$::installdir = "/usr/local/mysql"; # current release of xcat-mysql -$::debianflag = 0; - -#$::installdir="/opt/xcat/mysql"; # next release of xcat-mysql - -# parse the options -if ( - !GetOptions( - 'i|init' => \$::INIT, - 'u|update' => \$::UPDATE, - 'f|hostfile=s' => \$::HOSTFILE, - 'o|odbc' => \$::SETUPODBC, - 'L|LL' => \$::SETUPLL, - 'h|help' => \$::HELP, - 'v|version' => \$::VERSION, - 'V|verbose' => \$::VERBOSE, - ) - ) -{ - &usage; - exit(1); -} - -# display the usage if -h or --help is specified -if ($::HELP) -{ - &usage; - exit(0); -} - -# display the version statement if -v or --version is specified -if ($::VERSION) -{ - my $version = xCAT::Utils->Version(); - xCAT::MsgUtils->message("I", $version); - exit 0; -} -if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPODBC)) && (!($::SETUPLL))) -{ - xCAT::MsgUtils->message("I", "Either -i or -u or -o flag must be chosen"); - &usage; - exit(1); -} - -# check to see if only odbc update, no passwords needed -my $odbconly = 0; -if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPLL)) && ($::SETUPODBC)) -{ - $odbconly = 1; - -} -if ((!($::HOSTFILE)) && ($::UPDATE) && ($::SETUPODBC)) -{ - $odbconly = 1; - -} -if (($::INIT) && ($::UPDATE)) -{ - my $warning = -" The -i and -u flags may not be input to the command. Use one or the other. \n "; - xCAT::MsgUtils->message("E", $warning); - exit 1; -} -if (($::UPDATE) && ((!($::HOSTFILE)) && (!($::SETUPODBC)))) -{ - my $warning = -" The -u flag requires the -o flag or the -f flag pointing to a file that contains the list of hosts that you would like to add to database access."; - xCAT::MsgUtils->message("E", $warning); - exit 1; -} -if (($::HOSTFILE) && (!(-e ($::HOSTFILE)))) -{ - my $warning = " The -f flag is pointing to a non-existing file."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - -} - -# -# Get OS -# -if (xCAT::Utils->isAIX()) -{ - $::osname = 'AIX'; -} -else -{ - $::osname = 'Linux'; -} - -if (-e "/etc/debian_version") { - $::debianflag = 1; -} - -# determine whether redhat or sles -$::linuxos = xCAT::Utils->osver(); - -# is this MariaDB or MySQL -$::MariaDB = 0; -$::db_service = "mysqld"; -my $cmd; -if ($::debianflag) { - $cmd = "dpkg -l | grep mariadb"; -} else { - $cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL -} -xCAT::Utils->runcmd($cmd, -1); -if ($::RUNCMD_RC == 0) { - $::MariaDB = 1; - if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { - $::db_service = "mariadbd"; - } -} - -# -# check to see if mysql is installed -# -$cmd = "rpm -qa | grep -i perl-DBD-mysql"; -my $msg = "\nMySQL perl DBD "; -if ($::debianflag) { - if ($::MariaDB) { - $cmd = "dpkg -l | grep -i mariadb-server"; - $msg = "\nmariadb-server "; - } else { - $cmd = "dpkg -l | grep mysql-server"; - $msg = "\nmysql-server "; - } -} -xCAT::Utils->runcmd($cmd, 0); -if ($::RUNCMD_RC != 0) -{ - my $message = -"\n$msg is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", " $cmd failed. $message"); - exit(1); -} - -# check to see if MySQL is running -$::mysqlrunning = 0; -$::xcatrunningmysql = 0; -my $cmd = "ps -ef | grep mysqld"; -my @output = xCAT::Utils->runcmd($cmd, 0); -my $mysqlcheck = "mysql.sock"; # see if really running -if (grep(/$mysqlcheck/, @output)) -{ - - if ($::INIT) - { - my $message = - "MySQL is running. Database initialization will not take place."; - xCAT::MsgUtils->message("I", "$message"); - } - $::mysqlrunning = 1; -} - -# Stop mysql in order to setup init xcat mysql -$cmd = "pidof $::db_service"; -xCAT::Utils->runcmd($cmd, -1); -if ($::RUNCMD_RC == 0) -{ - if ($::INIT) - { - my $ret = xCAT::Utils->stopservice("mysql"); - if ($ret != 0) - { - xCAT::MsgUtils->message("E", " failed to stop $::db_service."); - exit(1); - } - } else { - $::mysqlrunning = 1; - } -} - -if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql -{ # cfgloc exists - $cmd = "fgrep mysql /etc/xcat/cfgloc"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC == 0) - { - if ($::INIT) - { - my $message = -"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required."; - xCAT::MsgUtils->message("I", "$message"); - } - $::xcatrunningmysql = 1; - } -} - -# -# if AIX, Set memory unlimited. Linux defaults unlimited -# -if ($::osname eq 'AIX') -{ - &setulimits; -} - -# if not just odbc update and not already running mysql or mysqlsetup -u or -L -# Get root and admin passwords -# -if ((($odbconly == 0) && ($::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL) -{ # not just updating the odbc - if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password - { - my $pw = $ENV{'XCATMYSQLADMIN_PW'}; - if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - $::adminpassword = $ENV{'XCATMYSQLADMIN_PW'}; - - } - else # prompt for password - { - my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: "; - xCAT::MsgUtils->message('I', "$msg"); - `stty -echo`; - chop($::adminpassword = ); - `stty echo`; - - if ($::adminpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - } - if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password - { - my $pw = $ENV{'XCATMYSQLROOT_PW'}; - if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - $::rootpassword = $ENV{'XCATMYSQLROOT_PW'}; - - } - else # prompt for password - { - - my $msg = "Input the password for root in the MySQL database: "; - xCAT::MsgUtils->message('I', "$msg"); - `stty -echo`; - chop($::rootpassword = ); - `stty echo`; - - if ($::rootpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - } -} - -# initial setup request, if not already running mysql -my $hostfile_configured=0; -if (($::INIT) && ($::xcatrunningmysql == 0)) -{ - # MySQL not running, then initialize the database - if ($::mysqlrunning == 0) - { - # Add mysql user and group for AIX - # Correct directory permissions - # - &fixinstalldir; - - # - # Init mysql db and setup my.cnf - # - &initmysqldb; - - # - # Start MySQL server - # - &mysqlstart; - - # - # Setup MySQL to restart on reboot - # - &mysqlreboot; - - # - # set mysql root password in database - # - # - &setupmysqlroot; - } - - # Verify the mysql root password, if it is wrong, do nothing and die. - &verifymysqlroot; - - # - # Backup current database - # - my $homedir = xCAT::Utils->getHomeDir(); - $::backupdir = $homedir; - if ($::osname eq 'AIX') - { - $::backupdir .= "xcat-dbback"; - } - else - { - $::backupdir .= "/xcat-dbback"; - } - - &backupxcatdb; - - # shutdown the xcatd daemon while migrating - &shutdownxcatd; - - - # - # Get MN name from site.master in backed up database - # if that does not exist use resolved hostname - # double check site.master for resolution - my $sitefile = "$::backupdir/site.csv"; - my $cmd = "grep master $sitefile"; - my @output = xCAT::Utils->runcmd($cmd, -1); - my $hname; - # from site.master - if ($::RUNCMD_RC == 0 ) - { - (my $attr, my $master) = split(",", $output[0]); - (my $q, $hname) = split("\"", $master); - chomp $hname; - - } - - if( "$hname" eq ""){ - $hname = `hostname`; - chomp $hname; - } - - #my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname); - my $ipaddr = xCAT::NetworkUtils->getipaddr($hname); - if ($ipaddr) - { - $::MN = $ipaddr; - } - else - { - xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed."); - exit(1); - } - - # if xcat not already configured to run mysql, then add xcat info to the DB - if ($::xcatrunningmysql == 0) - { - - # - # Create xcatd database - # Create xcatadmin in the database - # Add Management Node to database access - # - &setupxcatdb; - - # - # create cfgloc file - # - &createcfgloc; - - if ($::HOSTFILE) - { - &addhosts; - $hostfile_configured=1 - } - - # - # Restore backed up database into MySQL - # - &restorexcatdb; - - if ($::osname eq 'AIX') - { - xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database.\nYou should log out and back in, so that the new ulimit settings will take affect."); - } else { - xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database."); - } - } - -} # end initialization - -if ($::SETUPODBC) -{ - - # - # set up the ODBC on the Management Node - # - - &setupODBC; - -} -if ($::SETUPLL) -{ - - # - # Add special Loadleveler setup - # - - &setupLL; - -} - - -# if input a list of hosts to add to the database, to give access to MySQL -if (($::HOSTFILE) && ($hostfile_configured == 0)) -{ - &addhosts; - -} -exit; - -##################################### -# subroutines -##################################### - -#----------------------------------------------------------------------------- - -=head3 usage - - Displays message for -h option - -=cut - -#----------------------------------------------------------------------------- - -sub usage -{ - xCAT::MsgUtils->message( - 'I', -"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information." - ); - my $msg = -"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]"; - - xCAT::MsgUtils->message('I', "$msg"); -} - -#----------------------------------------------------------------------------- - -=head3 setulimits - - sets ulimits unlimited, needed to run MySQL - update /etc/security/limits with the info - -=cut - -#----------------------------------------------------------------------------- - -sub setulimits -{ - my $limitsfile = "/etc/security/limits"; - my $limitstmpfile = "/etc/security/limits.tmp"; - my $limitsbackup = "/etc/security/limits.backup"; - - # backup ulimits if not already backed up - if (!(-e ("$limitsbackup"))) - { - $cmd = "cp $limitsfile $limitsbackup"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # add ulimits for root to /etc/security/limits - unless (open(LIMITS, "<$limitsfile")) - { - xCAT::MsgUtils->message('E', "Error opening $limitsfile."); - exit(1); - } - unless (open(LIMITSTMP, ">$limitstmpfile")) - { - xCAT::MsgUtils->message('E', "Error opening $limitstmpfile."); - exit(1); - } - my $rootstanza = 0; - foreach my $line () - { - if ($rootstanza == 1) - { # dealing with root stanza, skip all entries - if (!($line =~ /:/)) - { # still in root stanza - next; # skip root stanza info - } - else - { # continue through the file - $rootstanza = 0; - } - } - print LIMITSTMP $line; - if ($line =~ /root:/) - { # at root stanza, add unlimits - print LIMITSTMP " fsize = -1\n"; - print LIMITSTMP " core= -1\n"; - print LIMITSTMP " cpu= -1\n"; - print LIMITSTMP " data= -1\n"; - print LIMITSTMP " rss= -1\n"; - print LIMITSTMP " stack= -1\n"; - print LIMITSTMP " nofiles= 102400\n"; - print LIMITSTMP "\n"; - $rootstanza = 1; - } - } - - close(LIMITS); - close(LIMITSTMP); - - # copy new limits to old - $cmd = "cp $limitstmpfile $limitsfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - -} - -#----------------------------------------------------------------------------- - -=head3 backupxcatdb - - Backup xCATdb - -=cut - -#----------------------------------------------------------------------------- - -sub backupxcatdb - -{ - - # If there is no backup or the /etc/xcat/cfgloc file does not point to - # mysql, then we backup the database - my $sitefile = "$::backupdir/site.csv"; - - if ((!(-e $sitefile)) || ($::xcatrunningmysql == 0)) - { - xCAT::MsgUtils->message( - "I", -"Backing up xCAT Database to $::backupdir.\nThis could take several minutes." - ); - if (!(-e $::backupdir)) - { # does not exist, make it - my $cmd = "mkdir -p $::backupdir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - else - { # remove contents - - my $cmd = "rm -f $::backupdir/*"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # back it up - my $cmd = "dumpxCATdb -p $::backupdir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - -} - -#----------------------------------------------------------------------------- - -=head3 shutdownxcatd - - shutdown the daemon - -=cut - -#----------------------------------------------------------------------------- - -sub shutdownxcatd - -{ - my $msg = "Shutting down the xcatd daemon during database migration."; - xCAT::MsgUtils->message('I', "$msg"); - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "stopsrc -s xcatd"; - system($xcmd); - - } - else - { - #$xcmd = "service xcatd stop"; - my $ret = xCAT::Utils->stopservice("xcatd"); - return $ret; - } - -} - -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- - -=head3 fixinstall - - If AIX, Fixes ownership and permssion on install - adds mysql user and group - -=cut - -#----------------------------------------------------------------------------- - -sub fixinstalldir -{ - - if ($::osname eq 'AIX') - { - - # - # mk mysql group and user - # - my $cmd = "lsgroup mysql"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - # mysql group does not exist, need to make it - $cmd = "mkgroup mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - $cmd = "lsuser mysql"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - # mysql user does not exist, need to make it - $cmd = "mkuser pgrp=mysql mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # - # correct installed directory permissions - # - xCAT::MsgUtils->message( - 'I', -"Fixing install directory permissions.\nThis may take a few minutes." - ); - my $mysqldir = $::installdir; - $mysqldir .= "\/*"; - $cmd = "chown -R mysql $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } -} - -#----------------------------------------------------------------------------- - -=head3 initmysqldb - - - Create the MySQL data directory and initialize the grant tables - Setup my.cnf - -=cut - -#----------------------------------------------------------------------------- -sub initmysqldb -{ - my $cmd; - - if (($::osname eq 'AIX') && (!(-e "/etc/my.cnf"))) - { - $cmd = "cp $::installdir/support-files/my-large.cnf /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } - - - # for AIX, insert datadir=/var/lib/mysql in the [mysqld] stanza - # of the /etc/my.cnf file,if it is not already there - if ($::osname eq 'AIX') - { - $cmd = "fgrep datadir /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - $cmd = -"awk '{gsub(\"\\\\[mysqld]\",\"\\[mysqld]\\ndatadir=/var/lib/mysql \"); print}' /etc/my.cnf > /etc/my.cnf.xcat"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "cp -p /etc/my.cnf.xcat /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # - # make data dir owned by mysql and root everything else - # - my $mysqldir = $::installdir; - $mysqldir .= "\/*"; - $cmd = "chown -R root $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - my $mysqldatadir = "$::installdir/data"; - $mysqldatadir .= "\/*"; - $cmd = "chown -R mysql $mysqldatadir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql $mysqldatadir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # make the database directory if it does not exist and - # make mysql the owner - if (!(-e ("/var/lib/mysql"))) - { - $cmd = "mkdir -p /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chown -R mysql /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } - } # end AIX only - - #bind-adress line in my.cnf should comment out - #on Ubuntu16.04, the bind-address line is in the mariadb.conf.d/50-server.cnf - #on SLE15, the bind-address line is in the /etc/my.cnf - my $bind_file; - if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") - { - $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; - } elsif (-e "/etc/mysql/my.cnf") - { - $bind_file = "/etc/mysql/my.cnf"; - } else { - $bind_file = "/etc/my.cnf"; - } - $cmd = "sed 's/^bind/#&/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); - exit(1); - } - - # Create the MySQL data directory and initialize the grant tables - # if not already setup - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - if ($::osname eq 'AIX') - { - $cmd = $cmd2; - $cmd .= -"$::installdir/scripts/mysql_install_db --user=mysql --basedir=$::installdir"; - } - else - { - my $sqlcmd = "/usr/bin/mysql_install_db"; - if (!(-x ($sqlcmd))) { - xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages"); - exit(1); - } - - $cmd = "$sqlcmd --user=mysql"; - # On rhels7.7, /usr/bin/mysql_install_db requires /usr/libexec/resolveip - # Link it to /usr/bin/resolveip for all OSes, just in case some future releases have the same requirement - my $resolveip="/usr/libexec/resolveip"; - if (!(-x ($resolveip))) { - my $linkcmd="ln -s /usr/bin/resolveip $resolveip"; - xCAT::Utils->runcmd($linkcmd, 0); - } - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - - exit(1); - } - -} - -#----------------------------------------------------------------------------- - -=head3 mysqlstart - - - Start the mysql server - -=cut - -#----------------------------------------------------------------------------- - -sub mysqlstart -{ - my $cmd; - my $ret = 0; - if ($::osname eq 'AIX') - { - my $hostname = `hostname`; - chomp $hostname; - - #$cmd = "$::installdir/bin/mysqld_safe --user=mysql &"; #doesnot return - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= -"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &"; - $ret = xCAT::Utils->runcmd($cmd, 0); - - - } - else - { - if ($::MariaDB == 1) { # running MariaDB - if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { - $ret = xCAT::Utils->startservice("mariadb"); - } else { # sles - $ret = xCAT::Utils->startservice("mysql"); - } - - } else { # it is mysql - - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) - { - $ret = xCAT::Utils->startservice("mysqld"); - } - else - { # sles - $ret = xCAT::Utils->startservice("mysql"); - } - } - } - if ($ret != 0) - { - xCAT::MsgUtils->message("E", " failed to start mysql/mariadb."); - exit(1); - } - - # make sure running - $cmd = "ps -ef | grep $::db_service | grep -v grep"; - for (my $i = 0 ; $i < 12 ; $i++) - { - my @output = xCAT::Utils->runcmd($cmd, 0); - $mysqlcheck = $::db_service; - - if (grep(/$mysqlcheck/, @output)) - { - sleep 10; # give a few extra seconds to be sure - return; - } - else - { - sleep 10; # wait for daemon - } - } - xCAT::MsgUtils->message("E", - " Could not start the $::db_service daemon, in time allocated (2 minutes)"); - exit(1); - -} - -#----------------------------------------------------------------------------- - -=head3 mysqlreboot - - - Setup for MySQL to start on reboot - -=cut - -#----------------------------------------------------------------------------- - -sub mysqlreboot -{ - my $cmd; - if ($::osname eq 'AIX') - { - $cmd = "fgrep mysql /etc/inittab"; - xCAT::Utils->runcmd($cmd, -1); - - # if not already in inittab - if ($::RUNCMD_RC != 0) - { - - # backup inittab - if (!(-e ("/etc/inittab.org"))) - { - $cmd = "cp -p /etc/inittab /etc/inittab.org"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", - " $cmd failed. Could not backup inittab."); - exit(1); - } - } - - $cmd = -"awk '{gsub(\"xcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>&1\",\"mysql:2:once:/usr/local/mysql/bin/mysqld_safe --user=mysql \\& \\nxcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>\\&1\"); print}' /etc/inittab > /etc/inittab.xcat"; - - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # put the new mysql entry in /etc/inittab - $cmd = "cp -p /etc/inittab.xcat /etc/inittab"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", - " $cmd failed. MySQL will not restart on reboot."); - } - } - } - else # linux - { - if ($::MariaDB == 1) { # MariaDB not MySQL - - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { - $cmd = "chkconfig mariadb on"; - } else { #sles - $cmd = "chkconfig mysql on"; - if ($::debianflag) { - $cmd = "update-rc.d mysql defaults"; - } - - } - } else { # mysql - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) - { - $cmd = "chkconfig mysqld on"; - } - else - { # sles - $cmd = "chkconfig mysql on"; - if ($::debianflag) { - $cmd = "update-rc.d mysql defaults"; - } - } - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", - " $cmd failed. MySQL will not restart on reboot."); - } - } - -} - -sub verifymysqlroot -{ - # Verify if mysql has an correct user input root password - if ($::osname eq 'AIX') - { - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= "$::installdir/bin/mysqladmin -u root -p$::rootpassword version"; - } - else - { - $cmd = "/usr/bin/mysqladmin -u root -p$::rootpassword version"; - } - - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC == 0) - { - # User has input an correct root passwd. That is fine. Do nothing and go head. - return - } - - # The password is wrong, warn the user and die. - xCAT::MsgUtils->message( - "E", - "Wrong MySQL root password." - ); - exit 1; -} - -#----------------------------------------------------------------------------- - -=head3 setupmysqlroot - - - Set mysql root password in the database - -=cut - -#----------------------------------------------------------------------------- - -sub setupmysqlroot - -{ - my $cmd; - - # set root password in database - if ($::osname eq 'AIX') - { - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= "$::installdir/bin/mysqladmin -u root password $::rootpassword"; - } - else - { - $cmd = "/usr/bin/mysqladmin -u root password $::rootpassword"; - } - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message( - "I", -"Warning, mysqladmin -u root password command failed, trying to set root password in MySQL. If root id has been defined in MySQL, and has a password then this message can be ignored." - ); - - } - -} - -#----------------------------------------------------------------------------- - -=head3 setupxcatdb - - Creates the xcatdb in MySQL - Add xcatadmin to the database - Give Management Node database access - -=cut - -#----------------------------------------------------------------------------- - -sub setupxcatdb - -{ - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - $mysql = new Expect; - my $createuser = - "CREATE USER xcatadmin IDENTIFIED BY \'$::adminpassword\';\r"; - my $grantall = ""; - $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall .= "\'"; - $grantall .= "$::MN"; - $grantall .= "\'"; - $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; - - #GRAND user xcatadmin to localhost account - my $grantall_localhost = ""; - $grantall_localhost = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall_localhost .= "\'"; - $grantall_localhost .= "localhost"; - $grantall_localhost .= "\'"; - $grantall_localhost .= " IDENTIFIED BY \'$::adminpassword\';\r"; - - #GRAND root to host account - my $grantroot = ""; - $grantroot = "GRANT ALL on xcatdb.* TO root@"; - $grantroot .= "\'"; - $grantroot .= "$::MN"; - $grantroot .= "\'"; - $grantroot .= " IDENTIFIED BY \'$::rootpassword\';\r"; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the Create Database SQL command and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # turn on if debugging error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message("E", - "Unable to run $spawncmd to create database and add MN."); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("CREATE DATABASE xcatdb;ALTER DATABASE xcatdb DEFAULT CHARACTER SET latin1;\r"); - $mysql->clear_accum(); - $mysql->send("$createuser"); - $mysql->clear_accum(); - $mysql->send("$grantall"); - $mysql->clear_accum(); - $mysql->send("$grantall_localhost"); - $mysql->clear_accum(); - $mysql->send("$grantroot"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed creating database. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - -} - -#----------------------------------------------------------------------------- - -=head3 setupLL - - Adds special LoadLeveler setup in MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub setupLL - -{ - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - $mysql = new Expect; - my $setLLfunction = - "SET GLOBAL log_bin_trust_function_creators=1;\r"; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the log_bin_trust_function_creators command and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # log_stdout shows output, turn on if debugging error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message("E", - "Unable to run $spawncmd to add LL setup."); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("$setLLfunction"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed LoadLeveler setup. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - xCAT::MsgUtils->message("I", "LoadLeveler setup complete."); - -} - -#----------------------------------------------------------------------------- - -=head3 addhosts - - Will add all host ids that need access to the MySQL database. - User will input names, ipaddress or wild cards like 9.112.%.% - or %.ibm.com in a file after the -f flag. - -=cut - -#----------------------------------------------------------------------------- - -sub addhosts - -{ - my @hosts; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - - open(HOSTFILE, "<$::HOSTFILE") - or - xCAT::MsgUtils->message('S', "Cannot open $::HOSTFILE for node list. \n"); - foreach my $line () - { - chop $line; - push @hosts, $line; # add hosts - } - close HOSTFILE; - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - - foreach my $host (@hosts) - { - my $grantall = ""; - $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall .= "\'"; - $grantall .= "$host"; - $grantall .= "\'"; - $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; - $mysql = new Expect; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the GRANT ALL SQL command for each host and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # turn on to debug error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message( - "E", - "Unable to run $spawncmd to grant host access to the database." - ); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("$grantall"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed adding hosts. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - } -} - -#----------------------------------------------------------------------------- - -=head3 setupODBC - - Will setup the ODBC. Only needed if C, C++ applications are running - that need access to the MySQL database for example LoadLeveler. - -=cut - -#----------------------------------------------------------------------------- - -sub setupODBC - -{ - - # - # check to see if correct rpms are installed - # - # for all OS need unixODBC rpm - my $cmd = "rpm -qa | grep unixODBC"; - if ($::debianflag) { - $cmd = "dpkg -l | grep unixodbc"; - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"unixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", " $message"); - exit(1); - } - - # for aix and redhat - if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) - { - $cmd = "rpm -qa | grep mysql-connector-odbc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"xcat-connector-odbc is not installed. It should be first obtained from the xcat dependency tarballs and installed before running this command. If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - elsif ($::debianflag) { - $cmd = "dpkg -l | grep libmyodbc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = "\nlibmyodbc is not installed."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - else # sles - { - $cmd = "rpm -qa | grep mysql-client"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"mysql-client is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - $cmd = "rpm -qa | grep libmysqlclient"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"libmysqlclient is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - $cmd = "rpm -qa | grep MyODBC-unixODBC"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"MyODBC-unixODBC is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } # end sles - my @rpmoutput; - my $odbcinstfile; - my $odbcfile; - my $message; - - # configure the ODBC, again SLES different than the rest - my $xcatconfig = "/etc/xcat/cfgloc"; - my $xcatconfigbackup = "/etc/xcat/cfgloc.mysql"; - if (!(-e ($xcatconfig)) && (!(-e ($xcatconfigbackup)))) - { - $message = -"The $xcatconfig and $xcatconfigbackup files are missing. You need to configure xCAT for MySQL before setting up the ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $cmd = "fgrep -i host $xcatconfig"; - my @output; - @output = xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then try backup - { - $cmd = "fgrep -i host $xcatconfigbackup"; - @output = xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then try backup - { - $message = -"Cannot find host info in the cfgloc or cfgloc.mysql file. Configuration of ODBC cannot continue."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - - # get host and password from cfgloc - (my $connstring, my $adminid, my $passwd) = split(/\|/, $output[0]); - (my $database, my $id, my $server) = split(/=/, $connstring); - - if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) - { - $odbcinstfile = "/etc/odbcinst.ini"; - $odbcfile = "/etc/odbc.ini"; - $cmd = "rpm -ql mysql-connector-odbc | grep libmyodbc..so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - elsif ($::debianflag) { - $odbcinstfile = "/etc/odbcinst.ini"; - $odbcfile = "/etc/odbc.ini"; - $cmd = "dpkg -L libmyodbc | grep libmyodbc.so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - else - { #sles - $odbcinstfile = "/etc/unixODBC/odbcinst.ini "; - $odbcfile = "/etc/unixODBC/odbc.ini "; - $cmd = "rpm -ql rpm -ql MyODBC-unixODBC | grep libmyodbc..so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - if ($::RUNCMD_RC != 0) - { - my $message = "Cannot configure the ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - - # setup the odbcinst.ini file - my $sharedlib = $rpmoutput[0]; - $cmd = "fgrep -i MySQL $odbcinstfile "; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then driver entry not there - { - my $entry = - "[MySQL]\nDescription = ODBC for MySQL\nDriver = $sharedlib"; - $cmd = "echo \"$entry\" >> $odbcinstfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - else - { # entry already there - $message = "$odbcinstfile already configured, will not change."; - xCAT::MsgUtils->message("I", "$message"); - } - - # setup the DSN odbc.ini file - $cmd = "fgrep -i MySQL $odbcfile"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then xcat entry not there - { - my $entry = -"[xCATDB]\nDriver = MySQL\nSERVER = $server\nPORT = 3306\nDATABASE = xcatdb"; - $cmd = "echo \"$entry\" >> $odbcfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup ODBC DNS file."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - } - else - { # entry already there - $message = "$odbcfile already configured, will not change."; - xCAT::MsgUtils->message("I", "$message"); - } - - # setup $roothome/.odbc.ini so root will not have to specify password - # when accessing through ODBC - - my $homedir = xCAT::Utils->getHomeDir(); - my $rootodbcfile = $homedir; - if ($::osname eq "AIX") - { - $rootodbcfile .= ".odbc.ini"; - } - else - { - $rootodbcfile .= "/.odbc.ini"; - } - - # setup the DSN odbc.ini file - $cmd = "fgrep -i XCATDB $rootodbcfile"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then xcat entry not there - { - my $entry = -"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = $adminid\nPASSWORD = $passwd"; - $cmd = "echo \"$entry\" >> $rootodbcfile"; - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup root ODBC file."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $::VERBOSE = $tmpv; - } - else - { # entry already there - $message = "$rootodbcfile already configured, will not change. Make sure the userid and password are correct for MySQL"; - xCAT::MsgUtils->message("I", "$message"); - } - - # allow readonly by root - chmod 0600, $rootodbcfile; - -} - -#----------------------------------------------------------------------------- - -=head3 createcfgloc - - Creates the cfgloc.mysql file which will be copied to cfgloc - to run xCAT on MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub createcfgloc - -{ - my $cfglocmysql = "/etc/xcat/cfgloc.mysql"; - my $cfglocmysqlbackup = "/etc/xcat/cfgloc.mysql.backup"; - my $cmd; - my $message; - if (-e ($cfglocmysql)) - { - $cmd = "mv $cfglocmysql $cfglocmysqlbackup"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "$cmd failed."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - } - my $mysqlentry = - "mysql:dbname=xcatdb;host=$::MN|xcatadmin|$::adminpassword"; - $cmd = "echo \"$mysqlentry\" > $cfglocmysql"; - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "command failed. Could not setup cfgloc.mysql"; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $::VERBOSE = $tmpv; - - # allow readonly by root - chmod 0600, $cfglocmysql; - -} - - -#----------------------------------------------------------------------------- - -=head3 restorexcatdb - - Restores the database from ~/xcat-dbback and restarts the xcatd using - MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub restorexcatdb -{ - - # copy the mysql cfgloc file - my $cmd; - - # if they had an old cfgloc on another database, save it - if ((-e ("/etc/xcat/cfgloc")) && (!(-e ("/etc/xcat/cfgloc.olddb")))) - { - $cmd = "cp /etc/xcat/cfgloc /etc/xcat/cfgloc.olddb"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - } - } - - # put in place cfgloc for mysql - $cmd = "cp /etc/xcat/cfgloc.mysql /etc/xcat/cfgloc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # allow readonly by root - chmod 0600, "/etc/xcat/cfgloc"; - - # set the env variable for Table.pm for the new database - my $xcatcfg; - my $cfgl; - open($cfgl, "<", "/etc/xcat/cfgloc"); - $xcatcfg = <$cfgl>; - close($cfgl); - chomp($xcatcfg); - - # restore the database - xCAT::MsgUtils->message( - "I", -"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes." - ); - if (!(-d $::backupdir)) - { # does not exist, error - xCAT::MsgUtils->message("E", - " $::backupdir is missing. Cannot retore the database."); - exit(1); - } - - # restore it - my $cmd = "XCATBYPASS=y XCATCFG=\"$xcatcfg\" restorexCATdb -p $::backupdir"; - - # not display passwords in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # - # restart the daemon - # - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "$::XCATROOT/sbin/restartxcatd"; - system($xcmd); - } - else - { - #$xcmd = "service xcatd restart"; - my $ret = xCAT::Utils->restartservice("xcatd"); - return $ret; - } - -} - diff --git a/xCAT-client/bin/mysqlsetup.orig b/xCAT-client/bin/mysqlsetup.orig deleted file mode 100755 index 19f9796beb..0000000000 --- a/xCAT-client/bin/mysqlsetup.orig +++ /dev/null @@ -1,1964 +0,0 @@ -#!/usr/bin/env perl -# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html -# - -#----------------------------------------------------------------------------- - -=head1 mysqlsetup - - - - This script automates the setup of the MySQL/MariaDB server and creates the xCAT database to run - xCAT on MySQL/MariaDB. - Note: it will setup an xcat database (xcatdb),a xcatadmin id , and a MySQL root password. - It will interact for the - password to assign, unless the XCATMYSQLADMIN_PW and the XCATMYSQLROOT_PW - env variables are set to the admin and mysql root password, resp. - Setups up AIX and Linux, but most work needs to be done on AIX. - See man mysqlsetup for more information and the xCAT2.SetupMySQL.pdf - documentation. - -=cut - -BEGIN -{ - $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; - $::XCATDIR = $ENV{'XCATDIR'} ? $ENV{'XCATDIR'} : '/etc/xcat'; -} - -# if AIX - make sure we include perl 5.8.2 in INC path. -# Needed to find perl dependencies shipped in deps tarball. -if ($^O =~ /^aix/i) { - unshift(@INC, qw(/usr/opt/perl5/lib/5.8.2/aix-thread-multi /usr/opt/perl5/lib/5.8.2 /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi /usr/opt/perl5/lib/site_perl/5.8.2)); -} - -use lib "$::XCATROOT/lib/perl"; -use DBI; -use xCAT::Utils; -use xCAT::NetworkUtils; -use Getopt::Long; -use xCAT::MsgUtils; -use xCAT::Table; -use Expect; -use Socket; -use strict; - -#----------------------------------------------------------------------------- -# Main - -$::progname = "mysqlsetup"; -my $args = join ' ', @ARGV; -$::command = "$0 $args"; -Getopt::Long::Configure("bundling"); -$Getopt::Long::ignorecase = 0; -$::installdir = "/usr/local/mysql"; # current release of xcat-mysql -$::debianflag = 0; - -#$::installdir="/opt/xcat/mysql"; # next release of xcat-mysql - -# parse the options -if ( - !GetOptions( - 'i|init' => \$::INIT, - 'u|update' => \$::UPDATE, - 'f|hostfile=s' => \$::HOSTFILE, - 'o|odbc' => \$::SETUPODBC, - 'L|LL' => \$::SETUPLL, - 'h|help' => \$::HELP, - 'v|version' => \$::VERSION, - 'V|verbose' => \$::VERBOSE, - ) - ) -{ - &usage; - exit(1); -} - -# display the usage if -h or --help is specified -if ($::HELP) -{ - &usage; - exit(0); -} - -# display the version statement if -v or --version is specified -if ($::VERSION) -{ - my $version = xCAT::Utils->Version(); - xCAT::MsgUtils->message("I", $version); - exit 0; -} -if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPODBC)) && (!($::SETUPLL))) -{ - xCAT::MsgUtils->message("I", "Either -i or -u or -o flag must be chosen"); - &usage; - exit(1); -} - -# check to see if only odbc update, no passwords needed -my $odbconly = 0; -if ((!($::INIT)) && (!($::UPDATE)) && (!($::SETUPLL)) && ($::SETUPODBC)) -{ - $odbconly = 1; - -} -if ((!($::HOSTFILE)) && ($::UPDATE) && ($::SETUPODBC)) -{ - $odbconly = 1; - -} -if (($::INIT) && ($::UPDATE)) -{ - my $warning = -" The -i and -u flags may not be input to the command. Use one or the other. \n "; - xCAT::MsgUtils->message("E", $warning); - exit 1; -} -if (($::UPDATE) && ((!($::HOSTFILE)) && (!($::SETUPODBC)))) -{ - my $warning = -" The -u flag requires the -o flag or the -f flag pointing to a file that contains the list of hosts that you would like to add to database access."; - xCAT::MsgUtils->message("E", $warning); - exit 1; -} -if (($::HOSTFILE) && (!(-e ($::HOSTFILE)))) -{ - my $warning = " The -f flag is pointing to a non-existing file."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - -} - -# -# Get OS -# -if (xCAT::Utils->isAIX()) -{ - $::osname = 'AIX'; -} -else -{ - $::osname = 'Linux'; -} - -if (-e "/etc/debian_version") { - $::debianflag = 1; -} - -# determine whether redhat or sles -$::linuxos = xCAT::Utils->osver(); - -# is this MariaDB or MySQL -$::MariaDB = 0; -my $cmd; -if ($::debianflag) { - $cmd = "dpkg -l | grep mariadb"; -} else { - $cmd = "rpm -qa | grep -i mariadb"; # check this is MariaDB not MySQL -} -xCAT::Utils->runcmd($cmd, -1); -if ($::RUNCMD_RC == 0) { - $::MariaDB = 1; -} - -# -# check to see if mysql is installed -# -$cmd = "rpm -qa | grep -i perl-DBD-mysql"; -my $msg = "\nMySQL perl DBD "; -if ($::debianflag) { - if ($::MariaDB) { - $cmd = "dpkg -l | grep -i mariadb-server"; - $msg = "\nmariadb-server "; - } else { - $cmd = "dpkg -l | grep mysql-server"; - $msg = "\nmysql-server "; - } -} -xCAT::Utils->runcmd($cmd, 0); -if ($::RUNCMD_RC != 0) -{ - my $message = -"\n$msg is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before running this command.\n If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", " $cmd failed. $message"); - exit(1); -} - -# check to see if MySQL is running -$::mysqlrunning = 0; -$::xcatrunningmysql = 0; -my $cmd = "ps -ef | grep mysqld"; -my @output = xCAT::Utils->runcmd($cmd, 0); -my $mysqlcheck = "mysql.sock"; # see if really running -if (grep(/$mysqlcheck/, @output)) -{ - if ($::INIT) - { - my $message = - "MySQL is running. Database initialization will not take place."; - xCAT::MsgUtils->message("I", "$message"); - } - $::mysqlrunning = 1; -} - -# Stop mysql in order to setup init xcat mysql -$cmd = "pidof mysqld"; -xCAT::Utils->runcmd($cmd, -1); -if ($::RUNCMD_RC == 0) -{ - if ($::INIT) - { - my $ret = xCAT::Utils->stopservice("mysql"); - if ($ret != 0) - { - xCAT::MsgUtils->message("E", " failed to stop mysql/mariadb."); - exit(1); - } - } else { - $::mysqlrunning = 1; - } -} - -if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql -{ # cfgloc exists - $cmd = "fgrep mysql /etc/xcat/cfgloc"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC == 0) - { - if ($::INIT) - { - my $message = -"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required."; - xCAT::MsgUtils->message("I", "$message"); - } - $::xcatrunningmysql = 1; - } -} - -# -# if AIX, Set memory unlimited. Linux defaults unlimited -# -if ($::osname eq 'AIX') -{ - &setulimits; -} - -# if not just odbc update and not already running mysql or mysqlsetup -u or -L -# Get root and admin passwords -# -if ((($odbconly == 0) && ($::xcatrunningmysql == 0)) || $::UPDATE || $::SETUPLL) -{ # not just updating the odbc - if ($ENV{'XCATMYSQLADMIN_PW'}) # input env sets the password - { - my $pw = $ENV{'XCATMYSQLADMIN_PW'}; - if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -" The password in the env variable XCATMYSQLADMIN_PW is not alpha-numeric."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - $::adminpassword = $ENV{'XCATMYSQLADMIN_PW'}; - - } - else # prompt for password - { - my $msg = "Input the alpha-numberic password for xcatadmin in the MySQL database: "; - xCAT::MsgUtils->message('I', "$msg"); - `stty -echo`; - chop($::adminpassword = ); - `stty echo`; - - if ($::adminpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - } - if ($ENV{'XCATMYSQLROOT_PW'}) # input env sets the password - { - my $pw = $ENV{'XCATMYSQLROOT_PW'}; - if ($pw =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -" The password in the env variable XCATMYSQLROOT_PW is not alpha-numeric."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - $::rootpassword = $ENV{'XCATMYSQLROOT_PW'}; - - } - else # prompt for password - { - - my $msg = "Input the password for root in the MySQL database: "; - xCAT::MsgUtils->message('I', "$msg"); - `stty -echo`; - chop($::rootpassword = ); - `stty echo`; - - if ($::rootpassword =~ m/[^a-zA-Z0-9]/) { # if not alpha-numerid - my $warning = -"The input password is not alpha-numeric. Rerun the command an input an alpha-numeric password."; - xCAT::MsgUtils->message("E", $warning); - exit 1; - } - - } -} - -# initial setup request, if not already running mysql -my $hostfile_configured=0; -if (($::INIT) && ($::xcatrunningmysql == 0)) -{ - # MySQL not running, then initialize the database - if ($::mysqlrunning == 0) - { - # Add mysql user and group for AIX - # Correct directory permissions - # - &fixinstalldir; - - # - # Init mysql db and setup my.cnf - # - &initmysqldb; - - # - # Start MySQL server - # - &mysqlstart; - - # - # Setup MySQL to restart on reboot - # - &mysqlreboot; - - # - # set mysql root password in database - # - # - &setupmysqlroot; - } - - # Verify the mysql root password, if it is wrong, do nothing and die. - &verifymysqlroot; - - # - # Backup current database - # - my $homedir = xCAT::Utils->getHomeDir(); - $::backupdir = $homedir; - if ($::osname eq 'AIX') - { - $::backupdir .= "xcat-dbback"; - } - else - { - $::backupdir .= "/xcat-dbback"; - } - - &backupxcatdb; - - # shutdown the xcatd daemon while migrating - &shutdownxcatd; - - - # - # Get MN name from site.master in backed up database - # if that does not exist use resolved hostname - # double check site.master for resolution - my $sitefile = "$::backupdir/site.csv"; - my $cmd = "grep master $sitefile"; - my @output = xCAT::Utils->runcmd($cmd, -1); - my $hname; - # from site.master - if ($::RUNCMD_RC == 0 ) - { - (my $attr, my $master) = split(",", $output[0]); - (my $q, $hname) = split("\"", $master); - chomp $hname; - - } - - if( "$hname" eq ""){ - $hname = `hostname`; - chomp $hname; - } - - #my ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($hname); - my $ipaddr = xCAT::NetworkUtils->getipaddr($hname); - if ($ipaddr) - { - $::MN = $ipaddr; - } - else - { - xCAT::MsgUtils->message("E", "Hostname resolution for $hname failed."); - exit(1); - } - - # if xcat not already configured to run mysql, then add xcat info to the DB - if ($::xcatrunningmysql == 0) - { - - # - # Create xcatd database - # Create xcatadmin in the database - # Add Management Node to database access - # - &setupxcatdb; - - # - # create cfgloc file - # - &createcfgloc; - - if ($::HOSTFILE) - { - &addhosts; - $hostfile_configured=1 - } - - # - # Restore backed up database into MySQL - # - &restorexcatdb; - - if ($::osname eq 'AIX') - { - xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database.\nYou should log out and back in, so that the new ulimit settings will take affect."); - } else { - xCAT::MsgUtils->message("I", "xCAT is now running on the MySQL database."); - } - } - -} # end initialization - -if ($::SETUPODBC) -{ - - # - # set up the ODBC on the Management Node - # - - &setupODBC; - -} -if ($::SETUPLL) -{ - - # - # Add special Loadleveler setup - # - - &setupLL; - -} - - -# if input a list of hosts to add to the database, to give access to MySQL -if (($::HOSTFILE) && ($hostfile_configured == 0)) -{ - &addhosts; - -} -exit; - -##################################### -# subroutines -##################################### - -#----------------------------------------------------------------------------- - -=head3 usage - - Displays message for -h option - -=cut - -#----------------------------------------------------------------------------- - -sub usage -{ - xCAT::MsgUtils->message( - 'I', -"Usage:\nmysqlsetup - Performs the setup of MySQL or MariaDB for xCAT to use as its database. See man mysqlsetup for more information." - ); - my $msg = -"mysqlsetup <-h|--help>\n <-v|--version>\n <-i|--init> [-f|hostfile] [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-u|--update> <-f|hostfile> [-o|--odbc] [-L|--LL] [-V|--verbose]\n <-o|--odbc> [-V|--verbose]\n <-L|--LL> [-V|--verbose]"; - - xCAT::MsgUtils->message('I', "$msg"); -} - -#----------------------------------------------------------------------------- - -=head3 setulimits - - sets ulimits unlimited, needed to run MySQL - update /etc/security/limits with the info - -=cut - -#----------------------------------------------------------------------------- - -sub setulimits -{ - my $limitsfile = "/etc/security/limits"; - my $limitstmpfile = "/etc/security/limits.tmp"; - my $limitsbackup = "/etc/security/limits.backup"; - - # backup ulimits if not already backed up - if (!(-e ("$limitsbackup"))) - { - $cmd = "cp $limitsfile $limitsbackup"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # add ulimits for root to /etc/security/limits - unless (open(LIMITS, "<$limitsfile")) - { - xCAT::MsgUtils->message('E', "Error opening $limitsfile."); - exit(1); - } - unless (open(LIMITSTMP, ">$limitstmpfile")) - { - xCAT::MsgUtils->message('E', "Error opening $limitstmpfile."); - exit(1); - } - my $rootstanza = 0; - foreach my $line () - { - if ($rootstanza == 1) - { # dealing with root stanza, skip all entries - if (!($line =~ /:/)) - { # still in root stanza - next; # skip root stanza info - } - else - { # continue through the file - $rootstanza = 0; - } - } - print LIMITSTMP $line; - if ($line =~ /root:/) - { # at root stanza, add unlimits - print LIMITSTMP " fsize = -1\n"; - print LIMITSTMP " core= -1\n"; - print LIMITSTMP " cpu= -1\n"; - print LIMITSTMP " data= -1\n"; - print LIMITSTMP " rss= -1\n"; - print LIMITSTMP " stack= -1\n"; - print LIMITSTMP " nofiles= 102400\n"; - print LIMITSTMP "\n"; - $rootstanza = 1; - } - } - - close(LIMITS); - close(LIMITSTMP); - - # copy new limits to old - $cmd = "cp $limitstmpfile $limitsfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - -} - -#----------------------------------------------------------------------------- - -=head3 backupxcatdb - - Backup xCATdb - -=cut - -#----------------------------------------------------------------------------- - -sub backupxcatdb - -{ - - # If there is no backup or the /etc/xcat/cfgloc file does not point to - # mysql, then we backup the database - my $sitefile = "$::backupdir/site.csv"; - - if ((!(-e $sitefile)) || ($::xcatrunningmysql == 0)) - { - xCAT::MsgUtils->message( - "I", -"Backing up xCAT Database to $::backupdir.\nThis could take several minutes." - ); - if (!(-e $::backupdir)) - { # does not exist, make it - my $cmd = "mkdir -p $::backupdir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - else - { # remove contents - - my $cmd = "rm -f $::backupdir/*"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # back it up - my $cmd = "dumpxCATdb -p $::backupdir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - -} - -#----------------------------------------------------------------------------- - -=head3 shutdownxcatd - - shutdown the daemon - -=cut - -#----------------------------------------------------------------------------- - -sub shutdownxcatd - -{ - my $msg = "Shutting down the xcatd daemon during database migration."; - xCAT::MsgUtils->message('I', "$msg"); - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "stopsrc -s xcatd"; - system($xcmd); - - } - else - { - #$xcmd = "service xcatd stop"; - my $ret = xCAT::Utils->stopservice("xcatd"); - return $ret; - } - -} - -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- - -=head3 fixinstall - - If AIX, Fixes ownership and permssion on install - adds mysql user and group - -=cut - -#----------------------------------------------------------------------------- - -sub fixinstalldir -{ - - if ($::osname eq 'AIX') - { - - # - # mk mysql group and user - # - my $cmd = "lsgroup mysql"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - # mysql group does not exist, need to make it - $cmd = "mkgroup mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - $cmd = "lsuser mysql"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - # mysql user does not exist, need to make it - $cmd = "mkuser pgrp=mysql mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # - # correct installed directory permissions - # - xCAT::MsgUtils->message( - 'I', -"Fixing install directory permissions.\nThis may take a few minutes." - ); - my $mysqldir = $::installdir; - $mysqldir .= "\/*"; - $cmd = "chown -R mysql $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } -} - -#----------------------------------------------------------------------------- - -=head3 initmysqldb - - - Create the MySQL data directory and initialize the grant tables - Setup my.cnf - -=cut - -#----------------------------------------------------------------------------- -sub initmysqldb -{ - my $cmd; - - if (($::osname eq 'AIX') && (!(-e "/etc/my.cnf"))) - { - $cmd = "cp $::installdir/support-files/my-large.cnf /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } - - - # for AIX, insert datadir=/var/lib/mysql in the [mysqld] stanza - # of the /etc/my.cnf file,if it is not already there - if ($::osname eq 'AIX') - { - $cmd = "fgrep datadir /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) - { - - $cmd = -"awk '{gsub(\"\\\\[mysqld]\",\"\\[mysqld]\\ndatadir=/var/lib/mysql \"); print}' /etc/my.cnf > /etc/my.cnf.xcat"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "cp -p /etc/my.cnf.xcat /etc/my.cnf"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - } - - # - # make data dir owned by mysql and root everything else - # - my $mysqldir = $::installdir; - $mysqldir .= "\/*"; - $cmd = "chown -R root $mysqldir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - my $mysqldatadir = "$::installdir/data"; - $mysqldatadir .= "\/*"; - $cmd = "chown -R mysql $mysqldatadir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql $mysqldatadir"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # make the database directory if it does not exist and - # make mysql the owner - if (!(-e ("/var/lib/mysql"))) - { - $cmd = "mkdir -p /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chown -R mysql /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - $cmd = "chgrp -R mysql /var/lib/mysql"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - } - } # end AIX only - - #bind-adress line in my.cnf should comment out - #on Ubuntu16.04, the bind-address line is in the mariadb.conf.d/50-server.cnf - #on SLE15, the bind-address line is in the /etc/my.cnf - my $bind_file; - if (-e "/etc/mysql/mariadb.conf.d/50-server.cnf") - { - $bind_file = "/etc/mysql/mariadb.conf.d/50-server.cnf"; - } elsif (-e "/etc/mysql/my.cnf") - { - $bind_file = "/etc/mysql/my.cnf"; - } else { - $bind_file = "/etc/my.cnf"; - } - $cmd = "sed 's/^bind/#&/' $bind_file > /tmp/my.cnf; mv -f /tmp/my.cnf $bind_file;chmod 644 $bind_file"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " comment the bind-address line in $bind_file failed: $cmd."); - exit(1); - } - - # Create the MySQL data directory and initialize the grant tables - # if not already setup - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - if ($::osname eq 'AIX') - { - $cmd = $cmd2; - $cmd .= -"$::installdir/scripts/mysql_install_db --user=mysql --basedir=$::installdir"; - } - else - { - my $sqlcmd = "/usr/bin/mysql_install_db"; - if (!(-x ($sqlcmd))) { - xCAT::MsgUtils->message("E", "$sqlcmd is not available, please install required mysql/mariadb packages"); - exit(1); - } - - $cmd = "$sqlcmd --user=mysql"; - # On rhels7.7, /usr/bin/mysql_install_db requires /usr/libexec/resolveip - # Link it to /usr/bin/resolveip for all OSes, just in case some future releases have the same requirement - my $resolveip="/usr/libexec/resolveip"; - if (!(-x ($resolveip))) { - my $linkcmd="ln -s /usr/bin/resolveip $resolveip"; - xCAT::Utils->runcmd($linkcmd, 0); - } - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - - exit(1); - } - -} - -#----------------------------------------------------------------------------- - -=head3 mysqlstart - - - Start the mysql server - -=cut - -#----------------------------------------------------------------------------- - -sub mysqlstart -{ - my $cmd; - my $ret = 0; - if ($::osname eq 'AIX') - { - my $hostname = `hostname`; - chomp $hostname; - - #$cmd = "$::installdir/bin/mysqld_safe --user=mysql &"; #doesnot return - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= -"$::installdir/bin/mysqld --user=mysql --basedir=$::installdir --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/$hostname.err --pid-file=/var/lib/mysql/$hostname.pid --socket=/tmp/mysql.sock --port=3306 &"; - $ret = xCAT::Utils->runcmd($cmd, 0); - - - } - else - { - if ($::MariaDB == 1) { # running MariaDB - if ( $::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { - $ret = xCAT::Utils->startservice("mariadb"); - } else { # sles - $ret = xCAT::Utils->startservice("mysql"); - } - - } else { # it is mysql - - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) - { - $ret = xCAT::Utils->startservice("mysqld"); - } - else - { # sles - $ret = xCAT::Utils->startservice("mysql"); - } - } - } - if ($ret != 0) - { - xCAT::MsgUtils->message("E", " failed to start mysql/mariadb."); - exit(1); - } - - # make sure running - $cmd = "ps -ef | grep mysql | grep -v grep"; - for (my $i = 0 ; $i < 12 ; $i++) - { - my @output = xCAT::Utils->runcmd($cmd, 0); - $mysqlcheck = "mysqld"; - - if (grep(/$mysqlcheck/, @output)) - { - sleep 10; # give a few extra seconds to be sure - return; - } - else - { - sleep 10; # wait for daemon - } - } - xCAT::MsgUtils->message("E", - " Could not start the mysql daemon, in time allocated (2 minutes)"); - exit(1); - -} - -#----------------------------------------------------------------------------- - -=head3 mysqlreboot - - - Setup for MySQL to start on reboot - -=cut - -#----------------------------------------------------------------------------- - -sub mysqlreboot -{ - my $cmd; - if ($::osname eq 'AIX') - { - $cmd = "fgrep mysql /etc/inittab"; - xCAT::Utils->runcmd($cmd, -1); - - # if not already in inittab - if ($::RUNCMD_RC != 0) - { - - # backup inittab - if (!(-e ("/etc/inittab.org"))) - { - $cmd = "cp -p /etc/inittab /etc/inittab.org"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", - " $cmd failed. Could not backup inittab."); - exit(1); - } - } - - $cmd = -"awk '{gsub(\"xcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>&1\",\"mysql:2:once:/usr/local/mysql/bin/mysqld_safe --user=mysql \\& \\nxcatd:2:once:/opt/xcat/sbin/restartxcatd > /dev/console 2>\\&1\"); print}' /etc/inittab > /etc/inittab.xcat"; - - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # put the new mysql entry in /etc/inittab - $cmd = "cp -p /etc/inittab.xcat /etc/inittab"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - - xCAT::MsgUtils->message("E", - " $cmd failed. MySQL will not restart on reboot."); - } - } - } - else # linux - { - if ($::MariaDB == 1) { # MariaDB not MySQL - - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*|sles15.*/) { - $cmd = "chkconfig mariadb on"; - } else { #sles - $cmd = "chkconfig mysql on"; - if ($::debianflag) { - $cmd = "update-rc.d mysql defaults"; - } - - } - } else { # mysql - if ($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) - { - $cmd = "chkconfig mysqld on"; - } - else - { # sles - $cmd = "chkconfig mysql on"; - if ($::debianflag) { - $cmd = "update-rc.d mysql defaults"; - } - } - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", - " $cmd failed. MySQL will not restart on reboot."); - } - } - -} - -sub verifymysqlroot -{ - # Verify if mysql has an correct user input root password - if ($::osname eq 'AIX') - { - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= "$::installdir/bin/mysqladmin -u root -p$::rootpassword version"; - } - else - { - $cmd = "/usr/bin/mysqladmin -u root -p$::rootpassword version"; - } - - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC == 0) - { - # User has input an correct root passwd. That is fine. Do nothing and go head. - return - } - - # The password is wrong, warn the user and die. - xCAT::MsgUtils->message( - "E", - "Wrong MySQL root password." - ); - exit 1; -} - -#----------------------------------------------------------------------------- - -=head3 setupmysqlroot - - - Set mysql root password in the database - -=cut - -#----------------------------------------------------------------------------- - -sub setupmysqlroot - -{ - my $cmd; - - # set root password in database - if ($::osname eq 'AIX') - { - my $cmd2 = -"ulimit -n unlimited; ulimit -m unlimited; ulimit -d unlimited;ulimit -f unlimited; ulimit -s unlimited;"; - $cmd = $cmd2; - $cmd .= "$::installdir/bin/mysqladmin -u root password $::rootpassword"; - } - else - { - $cmd = "/usr/bin/mysqladmin -u root password $::rootpassword"; - } - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message( - "I", -"Warning, mysqladmin -u root password command failed, trying to set root password in MySQL. If root id has been defined in MySQL, and has a password then this message can be ignored." - ); - - } - -} - -#----------------------------------------------------------------------------- - -=head3 setupxcatdb - - Creates the xcatdb in MySQL - Add xcatadmin to the database - Give Management Node database access - -=cut - -#----------------------------------------------------------------------------- - -sub setupxcatdb - -{ - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - $mysql = new Expect; - my $createuser = - "CREATE USER xcatadmin IDENTIFIED BY \'$::adminpassword\';\r"; - my $grantall = ""; - $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall .= "\'"; - $grantall .= "$::MN"; - $grantall .= "\'"; - $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; - - #GRAND user xcatadmin to localhost account - my $grantall_localhost = ""; - $grantall_localhost = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall_localhost .= "\'"; - $grantall_localhost .= "localhost"; - $grantall_localhost .= "\'"; - $grantall_localhost .= " IDENTIFIED BY \'$::adminpassword\';\r"; - - #GRAND root to host account - my $grantroot = ""; - $grantroot = "GRANT ALL on xcatdb.* TO root@"; - $grantroot .= "\'"; - $grantroot .= "$::MN"; - $grantroot .= "\'"; - $grantroot .= " IDENTIFIED BY \'$::rootpassword\';\r"; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the Create Database SQL command and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # turn on if debugging error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message("E", - "Unable to run $spawncmd to create database and add MN."); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("CREATE DATABASE xcatdb;ALTER DATABASE xcatdb DEFAULT CHARACTER SET latin1;\r"); - $mysql->clear_accum(); - $mysql->send("$createuser"); - $mysql->clear_accum(); - $mysql->send("$grantall"); - $mysql->clear_accum(); - $mysql->send("$grantall_localhost"); - $mysql->clear_accum(); - $mysql->send("$grantroot"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed creating database. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - -} - -#----------------------------------------------------------------------------- - -=head3 setupLL - - Adds special LoadLeveler setup in MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub setupLL - -{ - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - $mysql = new Expect; - my $setLLfunction = - "SET GLOBAL log_bin_trust_function_creators=1;\r"; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the log_bin_trust_function_creators command and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # log_stdout shows output, turn on if debugging error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message("E", - "Unable to run $spawncmd to add LL setup."); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("$setLLfunction"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed LoadLeveler setup. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - xCAT::MsgUtils->message("I", "LoadLeveler setup complete."); - -} - -#----------------------------------------------------------------------------- - -=head3 addhosts - - Will add all host ids that need access to the MySQL database. - User will input names, ipaddress or wild cards like 9.112.%.% - or %.ibm.com in a file after the -f flag. - -=cut - -#----------------------------------------------------------------------------- - -sub addhosts - -{ - my @hosts; - my $debug = 0; - - #if ($::VERBOSE) - #{ - # $debug = 1; - #} - - open(HOSTFILE, "<$::HOSTFILE") - or - xCAT::MsgUtils->message('S', "Cannot open $::HOSTFILE for node list. \n"); - foreach my $line () - { - chop $line; - push @hosts, $line; # add hosts - } - close HOSTFILE; - my $mysql; - my $timeout = 10; # sets Expect default timeout, 0 accepts immediately - my $pwd_sent = 0; - my $pwd_prompt = 'Enter password: '; - my $mysql_prompt; - if ($::MariaDB == 1) { # setup MariaDB - $mysql_prompt = 'MariaDB \[\(none\)\]> '; - } else { - $mysql_prompt = 'mysql> '; - } - my $expect_log = undef; - - foreach my $host (@hosts) - { - my $grantall = ""; - $grantall = "GRANT ALL on xcatdb.* TO xcatadmin@"; - $grantall .= "\'"; - $grantall .= "$host"; - $grantall .= "\'"; - $grantall .= " IDENTIFIED BY \'$::adminpassword\';\r"; - $mysql = new Expect; - - # - # -re $pwd_prompt - # Enter the password for root - # - # -re $mysql_prompt - # mysql> Enter the GRANT ALL SQL command for each host and exit - # - # - - # disable command echoing - #$mysql->slave->stty(qw(sane -echo)); - - # - # exp_internal(1) sets exp_internal debugging - # to STDERR. - # - #$mysql->exp_internal(1); - $mysql->exp_internal($debug); - - # - # log_stdout(0) prevent the program's output from being shown. - # turn on to debug error - #$mysql->log_stdout(1); - $mysql->log_stdout($debug); - my $spawncmd; - if ($::osname eq 'AIX') - { - $spawncmd = "$::installdir/bin/mysql -u root -p"; - } - else - { - $spawncmd = "/usr/bin/mysql -u root -p"; - } - unless ($mysql->spawn($spawncmd)) - { - xCAT::MsgUtils->message( - "E", - "Unable to run $spawncmd to grant host access to the database." - ); - return; - - } - - # - # setup SQL commands - # - - my @result = $mysql->expect( - $timeout, - [ - $pwd_prompt, - sub { - $mysql->send("$::rootpassword\r"); - $mysql->clear_accum(); - $mysql->exp_continue(); - } - ], - [ - $mysql_prompt, - sub { - - $mysql->send("$grantall"); - $mysql->clear_accum(); - $mysql->send("exit;\r"); - - } - ] - ); - ########################################## - # Expect error - report and quit - ########################################## - if (defined($result[1])) - { - my $errmsg = $result[1]; - $mysql->soft_close(); - xCAT::MsgUtils->message("E", - "Failed adding hosts. $errmsg"); - exit(1); - - } - $mysql->soft_close(); - } -} - -#----------------------------------------------------------------------------- - -=head3 setupODBC - - Will setup the ODBC. Only needed if C, C++ applications are running - that need access to the MySQL database for example LoadLeveler. - -=cut - -#----------------------------------------------------------------------------- - -sub setupODBC - -{ - - # - # check to see if correct rpms are installed - # - # for all OS need unixODBC rpm - my $cmd = "rpm -qa | grep unixODBC"; - if ($::debianflag) { - $cmd = "dpkg -l | grep unixodbc"; - } - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"unixODBC is not installed. If on AIX, it should be first obtained from the xcat dependency tarballs and installed before we can setup the ODBC. If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", " $message"); - exit(1); - } - - # for aix and redhat - if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) - { - $cmd = "rpm -qa | grep mysql-connector-odbc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"xcat-connector-odbc is not installed. It should be first obtained from the xcat dependency tarballs and installed before running this command. If on Linux, install from the OS CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - elsif ($::debianflag) { - $cmd = "dpkg -l | grep libmyodbc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = "\nlibmyodbc is not installed."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - else # sles - { - $cmd = "rpm -qa | grep mysql-client"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"mysql-client is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - $cmd = "rpm -qa | grep libmysqlclient"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"libmysqlclient is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - $cmd = "rpm -qa | grep MyODBC-unixODBC"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - my $message = -"MyODBC-unixODBC is not installed. It should be first installed from the SLES CDs."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } # end sles - my @rpmoutput; - my $odbcinstfile; - my $odbcfile; - my $message; - - # configure the ODBC, again SLES different than the rest - my $xcatconfig = "/etc/xcat/cfgloc"; - my $xcatconfigbackup = "/etc/xcat/cfgloc.mysql"; - if (!(-e ($xcatconfig)) && (!(-e ($xcatconfigbackup)))) - { - $message = -"The $xcatconfig and $xcatconfigbackup files are missing. You need to configure xCAT for MySQL before setting up the ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $cmd = "fgrep -i host $xcatconfig"; - my @output; - @output = xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then try backup - { - $cmd = "fgrep -i host $xcatconfigbackup"; - @output = xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then try backup - { - $message = -"Cannot find host info in the cfgloc or cfgloc.mysql file. Configuration of ODBC cannot continue."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - - # get host and password from cfgloc - (my $connstring, my $adminid, my $passwd) = split(/\|/, $output[0]); - (my $database, my $id, my $server) = split(/=/, $connstring); - - if (($::linuxos =~ /rh.*|ol.*|rocky.*|alma.*/) || ($::osname eq 'AIX')) - { - $odbcinstfile = "/etc/odbcinst.ini"; - $odbcfile = "/etc/odbc.ini"; - $cmd = "rpm -ql mysql-connector-odbc | grep libmyodbc..so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - elsif ($::debianflag) { - $odbcinstfile = "/etc/odbcinst.ini"; - $odbcfile = "/etc/odbc.ini"; - $cmd = "dpkg -L libmyodbc | grep libmyodbc.so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - else - { #sles - $odbcinstfile = "/etc/unixODBC/odbcinst.ini "; - $odbcfile = "/etc/unixODBC/odbc.ini "; - $cmd = "rpm -ql rpm -ql MyODBC-unixODBC | grep libmyodbc..so"; - @rpmoutput = xCAT::Utils->runcmd($cmd, 0); - } - if ($::RUNCMD_RC != 0) - { - my $message = "Cannot configure the ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - - # setup the odbcinst.ini file - my $sharedlib = $rpmoutput[0]; - $cmd = "fgrep -i MySQL $odbcinstfile "; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then driver entry not there - { - my $entry = - "[MySQL]\nDescription = ODBC for MySQL\nDriver = $sharedlib"; - $cmd = "echo \"$entry\" >> $odbcinstfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup ODBC."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - } - } - else - { # entry already there - $message = "$odbcinstfile already configured, will not change."; - xCAT::MsgUtils->message("I", "$message"); - } - - # setup the DSN odbc.ini file - $cmd = "fgrep -i MySQL $odbcfile"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then xcat entry not there - { - my $entry = -"[xCATDB]\nDriver = MySQL\nSERVER = $server\nPORT = 3306\nDATABASE = xcatdb"; - $cmd = "echo \"$entry\" >> $odbcfile"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup ODBC DNS file."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - } - else - { # entry already there - $message = "$odbcfile already configured, will not change."; - xCAT::MsgUtils->message("I", "$message"); - } - - # setup $roothome/.odbc.ini so root will not have to specify password - # when accessing through ODBC - - my $homedir = xCAT::Utils->getHomeDir(); - my $rootodbcfile = $homedir; - if ($::osname eq "AIX") - { - $rootodbcfile .= ".odbc.ini"; - } - else - { - $rootodbcfile .= "/.odbc.ini"; - } - - # setup the DSN odbc.ini file - $cmd = "fgrep -i XCATDB $rootodbcfile"; - xCAT::Utils->runcmd($cmd, -1); - if ($::RUNCMD_RC != 0) # then xcat entry not there - { - my $entry = -"[xCATDB]\nSERVER =$server\nDATABASE = xcatdb\nUSER = $adminid\nPASSWORD = $passwd"; - $cmd = "echo \"$entry\" >> $rootodbcfile"; - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "Could not setup root ODBC file."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $::VERBOSE = $tmpv; - } - else - { # entry already there - $message = "$rootodbcfile already configured, will not change. Make sure the userid and password are correct for MySQL"; - xCAT::MsgUtils->message("I", "$message"); - } - - # allow readonly by root - chmod 0600, $rootodbcfile; - -} - -#----------------------------------------------------------------------------- - -=head3 createcfgloc - - Creates the cfgloc.mysql file which will be copied to cfgloc - to run xCAT on MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub createcfgloc - -{ - my $cfglocmysql = "/etc/xcat/cfgloc.mysql"; - my $cfglocmysqlbackup = "/etc/xcat/cfgloc.mysql.backup"; - my $cmd; - my $message; - if (-e ($cfglocmysql)) - { - $cmd = "mv $cfglocmysql $cfglocmysqlbackup"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "$cmd failed."; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - } - my $mysqlentry = - "mysql:dbname=xcatdb;host=$::MN|xcatadmin|$::adminpassword"; - $cmd = "echo \"$mysqlentry\" > $cfglocmysql"; - - # secure passwd in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - $message = "command failed. Could not setup cfgloc.mysql"; - xCAT::MsgUtils->message("E", "$message"); - exit(1); - - } - $::VERBOSE = $tmpv; - - # allow readonly by root - chmod 0600, $cfglocmysql; - -} - - -#----------------------------------------------------------------------------- - -=head3 restorexcatdb - - Restores the database from ~/xcat-dbback and restarts the xcatd using - MySQL - -=cut - -#----------------------------------------------------------------------------- - -sub restorexcatdb -{ - - # copy the mysql cfgloc file - my $cmd; - - # if they had an old cfgloc on another database, save it - if ((-e ("/etc/xcat/cfgloc")) && (!(-e ("/etc/xcat/cfgloc.olddb")))) - { - $cmd = "cp /etc/xcat/cfgloc /etc/xcat/cfgloc.olddb"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - } - } - - # put in place cfgloc for mysql - $cmd = "cp /etc/xcat/cfgloc.mysql /etc/xcat/cfgloc"; - xCAT::Utils->runcmd($cmd, 0); - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # allow readonly by root - chmod 0600, "/etc/xcat/cfgloc"; - - # set the env variable for Table.pm for the new database - my $xcatcfg; - my $cfgl; - open($cfgl, "<", "/etc/xcat/cfgloc"); - $xcatcfg = <$cfgl>; - close($cfgl); - chomp($xcatcfg); - - # restore the database - xCAT::MsgUtils->message( - "I", -"Restoring the xCAT Database with $::backupdir to MySQL database.\nThis could take several minutes." - ); - if (!(-d $::backupdir)) - { # does not exist, error - xCAT::MsgUtils->message("E", - " $::backupdir is missing. Cannot retore the database."); - exit(1); - } - - # restore it - my $cmd = "XCATBYPASS=y XCATCFG=\"$xcatcfg\" restorexCATdb -p $::backupdir"; - - # not display passwords in verbose mode - my $tmpv = $::VERBOSE; - $::VERBOSE = 0; - xCAT::Utils->runcmd($cmd, 0); - $::VERBOSE = $tmpv; - if ($::RUNCMD_RC != 0) - { - xCAT::MsgUtils->message("E", " $cmd failed."); - exit(1); - } - - # - # restart the daemon - # - my $xcmd; - if ($::osname eq 'AIX') - { - $xcmd = "$::XCATROOT/sbin/restartxcatd"; - system($xcmd); - } - else - { - #$xcmd = "service xcatd restart"; - my $ret = xCAT::Utils->restartservice("xcatd"); - return $ret; - } - -} - From 6d4c948f447105845647fbedd21fa87e5085e8a3 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 15 Feb 2023 11:22:30 -0500 Subject: [PATCH 173/188] Syntax fixes --- xCAT-client/bin/mysqlsetup | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index b7794684c2..77176491e6 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -231,7 +231,7 @@ if (-e ("/etc/xcat/cfgloc")) # check to see if xcat is using mysql if ($::INIT) { my $message = -"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql as it's database. No xCAT setup is required."; +"The /etc/xcat/cfgloc file is already configured for MySQL and xCAT is using mysql or mariadb as it's database. No xCAT setup is required."; xCAT::MsgUtils->message("I", "$message"); } $::xcatrunningmysql = 1; @@ -438,6 +438,12 @@ if (($::INIT) && ($::xcatrunningmysql == 0)) } } # end initialization +else { + # MySQL not running, restart it + if ($::mysqlrunning == 0) { + &mysqlstart; + } +} if ($::SETUPODBC) { From 1add9d09f0ce17c8246bdfc6fc78fabb8f937862 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 15 Feb 2023 16:00:44 -0500 Subject: [PATCH 174/188] Fix syntax error in pgsqlsetup --- xCAT-client/bin/pgsqlsetup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/bin/pgsqlsetup b/xCAT-client/bin/pgsqlsetup index f6cd6c126a..f13ca21dca 100755 --- a/xCAT-client/bin/pgsqlsetup +++ b/xCAT-client/bin/pgsqlsetup @@ -318,7 +318,7 @@ if (($INIT) && ($xcatrunningpgsql == 0)) # if that does not exist use resolved hostname # double check site.master for resolution my $sitefile = "$::backupdir/site.csv"; - my $cmd = "grep \"master $sitefile"; + my $cmd = q{grep \"master } . $sitefile; my @output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC == 0) # entry in site table { From 6ec489daf18c9b07989bfcb709c2fcd2028d0d41 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Fri, 17 Feb 2023 11:46:46 -0500 Subject: [PATCH 175/188] Fixed comments in sudoer postscript for issue #7301 --- xCAT/postscripts/sudoer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/sudoer b/xCAT/postscripts/sudoer index 45f90b1bbf..f2f42e21d5 100755 --- a/xCAT/postscripts/sudoer +++ b/xCAT/postscripts/sudoer @@ -43,7 +43,7 @@ sleep 1 rm -rf $HOME/.ssh/authorized_keys #----------------- -# Retrieve DSA key +# Retrieve RSA key #----------------- KEY=`cat /xcatpost/hostkeys/ssh_host_rsa_key.pub` @@ -52,7 +52,7 @@ echo -e $KEY >> $HOME/.ssh/authorized_keys #----------------- -# Retrieve RSA key +# Retrieve DSA key #----------------- KEY=`cat /xcatpost/hostkeys/ssh_host_dsa_key.pub` From a2440a2acc4ac2c5dc04f138fca0012f537ed875 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 17 Feb 2023 12:20:14 -0500 Subject: [PATCH 176/188] Improve checking for running DB process --- xCAT-client/bin/mysqlsetup | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/xCAT-client/bin/mysqlsetup b/xCAT-client/bin/mysqlsetup index 77176491e6..3c13badace 100755 --- a/xCAT-client/bin/mysqlsetup +++ b/xCAT-client/bin/mysqlsetup @@ -984,26 +984,25 @@ sub mysqlstart exit(1); } - # make sure service has started. On some OSes, mariadb service starts mysql daemon + # Make sure service has started. On some OSes, mariadb service starts mysql daemon # on others, mariadb service starts mariadb daemon. Check a few times for one, # then the other - my @db_service_name_list = ("mysqld", "mariadb"); - foreach my $db_service_name (@db_service_name_list) { - $cmd = "ps -ef | grep $db_service_name | grep -v grep"; - for (my $i = 0 ; $i < 6 ; $i++) { - my @output = xCAT::Utils->runcmd($cmd, 0); - my $mysqlcheck = $db_service_name; - - if (grep(/$mysqlcheck/, @output)) { - sleep 10; # give a few extra seconds to be sure - return; - } else { - sleep 10; # wait for daemon - } + my $mariadb_process_name = "mariadbd"; + my $mysql_process_name = "mysqld"; + my $db_process_name_pattern = "\'".$mariadb_process_name."\|".$mysql_process_name."\'"; + for (my $i = 0 ; $i < 6 ; $i++) { + $cmd = "ps -ef | grep -E $db_process_name_pattern | grep -v grep"; + my @output = xCAT::Utils->runcmd($cmd, 0); + + if (grep(/$mariadb_process_name/, @output) || grep(/$mysql_process_name/, @output)) { + sleep 10; # give a few extra seconds to be sure + return; + } else { + sleep 10; # wait for daemon } } xCAT::MsgUtils->message("E", - " Could not start the mysql/mariadb daemon in time allocated (2 minutes)"); + " Could not start the mysql/mariadb daemon in time allocated (1 minute)"); exit(1); } From 0c288b36db461c0cc1cf170e88ed66f7c74a0550 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 21 Feb 2023 16:58:45 -0500 Subject: [PATCH 177/188] SLES15.4 genimage dracut rpm version --- xCAT-server/share/xcat/netboot/sles/genimage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 07c31f3af0..9daeed130c 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -666,7 +666,7 @@ if ((-d "$rootimg_dir/usr/share/dracut") or (-d "$rootimg_dir/usr/lib/dracut")) $dracutmode = 1; # get dracut version - $dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/{print \$3}' | awk -F. '{print \$1}'`; + $dracutver = `chroot $rootimg_dir rpm -qi dracut | awk '/Version/ {print \$3}' | awk -F[.+] '{print \$1}'`; chomp($dracutver); if ($dracutver =~ /^\d\d\d$/) { if ($dracutver >= "033") { From 2b07914311e1d01499d851be548221a2f19ff8f9 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:21:11 -0500 Subject: [PATCH 178/188] Update xcat_test.yml Add workflow_dispatch trigger to xcat_test workflow. --- .github/workflows/xcat_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index 5c1361b8d7..a1f8aa26a1 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -1,6 +1,7 @@ name: xcat_test on: pull_request + workflow_dispatch jobs: xcat_pr_test: runs-on: ubuntu-20.04 From 72316747433c4def9439dbcce79bc0191307a36d Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:26:50 -0500 Subject: [PATCH 179/188] Update xcat_test.yml Fixed yaml syntax error. --- .github/workflows/xcat_test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/xcat_test.yml b/.github/workflows/xcat_test.yml index a1f8aa26a1..4f432e5f6d 100644 --- a/.github/workflows/xcat_test.yml +++ b/.github/workflows/xcat_test.yml @@ -1,7 +1,5 @@ name: xcat_test -on: - pull_request - workflow_dispatch +on: [pull_request, workflow_dispatch] jobs: xcat_pr_test: runs-on: ubuntu-20.04 From 57cb219a99c19489b66363f45b65ed94021f0a16 Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:41:56 -0500 Subject: [PATCH 180/188] Removed execute permission from xcatpostinit.service --- xCAT/postscripts/xcatpostinit.service | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 xCAT/postscripts/xcatpostinit.service diff --git a/xCAT/postscripts/xcatpostinit.service b/xCAT/postscripts/xcatpostinit.service old mode 100755 new mode 100644 From 8bad3917fb80fb9129aabf5d9e99d8d09f5d229f Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:43:03 -0500 Subject: [PATCH 181/188] Added missing shebang to postscripts --- xCAT-genesis-scripts/usr/bin/bmcsetup | 1 + xCAT/postscripts/setupesx | 1 + 2 files changed, 2 insertions(+) diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index 84b9bac3ed..322c3bea1d 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -1,3 +1,4 @@ +#!/bin/sh # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html # Lenovo (c) 2016 # diff --git a/xCAT/postscripts/setupesx b/xCAT/postscripts/setupesx index 81b94f4d0b..6a8a49d2ab 100755 --- a/xCAT/postscripts/setupesx +++ b/xCAT/postscripts/setupesx @@ -1,3 +1,4 @@ +#!/bin/sh # esx setup # example on how to set up ESX. We setup ssh and also add a basic # VLAN configuration From e27638b2cddeed472b2a69445003ff844e65b94e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 28 Feb 2023 15:52:00 -0500 Subject: [PATCH 182/188] Fix RHEL9 yum repo paths for ospkgs and otherpkgs --- xCAT/postscripts/ospkgs | 26 +++++++++++++------------- xCAT/postscripts/otherpkgs | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/xCAT/postscripts/ospkgs b/xCAT/postscripts/ospkgs index 79bc987ddb..a824e7222d 100755 --- a/xCAT/postscripts/ospkgs +++ b/xCAT/postscripts/ospkgs @@ -261,7 +261,7 @@ do # (1)for rhels6, there is one repodata in the os base dir; so keep it here, and handle the other cases below # (2)for sles, we should specified the baseurl should be ./install/sles11/ppc64/1 # (3)for SL5, we should append the /SL - # (4)for rhels8, centos8, ol8, alma8 and rocky8 we should append /BaseOS and /AppStream to base directory + # (4)for rhels8/9, centos8/9, ol8/9, alma8/9 and rocky8/9 we should append /BaseOS and /AppStream to base directory # (5) for other os, we just keep it here. # For other pkg paths, we just keep it here. if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -273,12 +273,12 @@ do ospkgdir="$ospkgdir/SL" fi fi - if ( ! pmatch "$OSVER" "rhels8*" && - ! pmatch "$OSVER" "centos8*" && - ! pmatch "$OSVER" "rocky8*" && - ! pmatch "$OSVER" "alma8*" && - ! pmatch "$OSVER" "ol8*"); then - # For rhels8, centos8, ol8, alma8 and rocky8 do not put $ospkgdir by itself + if ( ! pmatch "$OSVER" "rhels[89]*" && + ! pmatch "$OSVER" "centos[89]*" && + ! pmatch "$OSVER" "rocky[89]*" && + ! pmatch "$OSVER" "alma[89]*" && + ! pmatch "$OSVER" "ol[89]*"); then + # For rhels8/9, centos8/9, ol8/9, alma8/9 and rocky8 do not put $ospkgdir by itself array_set_element os_path $index $ospkgdir fi array_set_element os_path $index $ospkgdir @@ -345,12 +345,12 @@ do array_set_element os_path $index $ospkgdir_ok done fi # x86_64 - elif ( pmatch "$OSVER" "rhels8*" || - pmatch "$OSVER" "centos8*" || - pmatch "$OSVER" "rocky8*" || - pmatch "$OSVER" "alma8*" || - pmatch "$OSVER" "ol8*"); then - # for rhels8, centos8, ol8, alma8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ + elif ( pmatch "$OSVER" "rhels[89]*" || + pmatch "$OSVER" "centos[89]*" || + pmatch "$OSVER" "rocky[89]*" || + pmatch "$OSVER" "alma[89]*" || + pmatch "$OSVER" "ol[89]*"); then + # for rhels8/9, centos8/9, ol8/9, alma8/9 and rocky8/9 the repodata is in ./BaseOS, ./AppStream, not in ./ for arg in "BaseOS" "AppStream" do ospkgdir_ok="$ospkgdir/$arg" diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index c8fdd3d5ff..301174e11f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -340,7 +340,7 @@ fi # (1)for rhels6, there is one repodata in the os base dir; so keep it here, and handle the other cases below # (2)for sles, we should specified the baseurl should be ./install/sles11/ppc64/1 # (3)for SL5, we should append the /SL - # (4)for rhels8, centos8, ol8, alma8 and rocky8 we should append /BaseOS and /AppStream to base directory + # (4)for rhels8/9, centos8/9, ol8/9, alma8/9 and rocky8/9 we should append /BaseOS and /AppStream to base directory # (5) for other os, we just keep it here. # For other pkg paths, we just keep it here. if [ $dir == $default_pkgdir ] || [ $dir == "$default_pkgdir/" ]; then @@ -352,12 +352,12 @@ fi ospkgdir="$ospkgdir/SL" fi fi - if ( ! pmatch "$OSVER" "rhels8*" && - ! pmatch "$OSVER" "centos8*" && - ! pmatch "$OSVER" "rocky8*" && - ! pmatch "$OSVER" "alma8*" && - ! pmatch "$OSVER" "ol8*"); then - # For rhels8, centos8, ol8, and rocky8 do not put $ospkgdir by itself + if ( ! pmatch "$OSVER" "rhels[89]*" && + ! pmatch "$OSVER" "centos[89]*" && + ! pmatch "$OSVER" "rocky[89]*" && + ! pmatch "$OSVER" "alma[89]*" && + ! pmatch "$OSVER" "ol[89]*"); then + # For rhels8/9, centos8/9, ol8/9, and rocky8/9 do not put $ospkgdir by itself array_set_element os_path $index $ospkgdir fi @@ -398,12 +398,12 @@ fi array_set_element os_path $index $ospkgdir_ok done fi # x86_64 - elif ( pmatch "$OSVER" "rhels8*" || - pmatch "$OSVER" "centos8*" || - pmatch "$OSVER" "rocky8*" || - pmatch "$OSVER" "alma8*" || - pmatch "$OSVER" "ol8*"); then - # for rhels8, centos8, ol8, alma8 and rocky8 the repodata is in ./BaseOS, ./AppStream, not in ./ + elif ( pmatch "$OSVER" "rhels[89]*" || + pmatch "$OSVER" "centos[89]*" || + pmatch "$OSVER" "rocky[89]*" || + pmatch "$OSVER" "alma[89]*" || + pmatch "$OSVER" "ol[89]*"); then + # for rhels8/9, centos8/9, ol8/9, alma8/9 and rocky8/9 the repodata is in ./BaseOS, ./AppStream, not in ./ for arg in "BaseOS" "AppStream" do ospkgdir_ok="$ospkgdir/$arg" From 1098e6943bc2b1b320e8acf6a9a551cbc473f155 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Mar 2023 10:25:20 -0500 Subject: [PATCH 183/188] Fix bind version comparison --- xCAT-server/sbin/makenamed.conf | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-server/sbin/makenamed.conf b/xCAT-server/sbin/makenamed.conf index d481bb76c2..9b984607c2 100755 --- a/xCAT-server/sbin/makenamed.conf +++ b/xCAT-server/sbin/makenamed.conf @@ -63,8 +63,19 @@ do echo " $i;" done >>$FILE echo " };" >>$FILE + +# Natural version compare against version of bind. +# If version 9.16.6 or higher, turn off DNSSEC BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2) -if [[ $BIND_VERSION > "9.16.5" ]]; then +CONTROL_BIND_VERSION="9.16.6" + +# "sort --version-sort" takes lines of version strings and sorts them. +# Output is lines of versions in sorted order, last line is highest version number +LAST_IN_COMPARE=`printf '%s\n' $BIND_VERSION $CONTROL_BIND_VERSION | sort --version-sort | tail -n1` + +if [ $BIND_VERSION = $LAST_IN_COMPARE ]; then + # current version of BIND was last in sorted order, + # therefor it is higher than CONTROL_BIND_VERSION echo " dnssec-enable no; dnssec-validation no;" >>$FILE fi From 60dfa47f379e228000ec38b2f7bc49ba2afcac3e Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Mar 2023 11:45:42 -0500 Subject: [PATCH 184/188] Strip out extra text from version string --- xCAT-server/sbin/makenamed.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/sbin/makenamed.conf b/xCAT-server/sbin/makenamed.conf index 9b984607c2..eaf197932c 100755 --- a/xCAT-server/sbin/makenamed.conf +++ b/xCAT-server/sbin/makenamed.conf @@ -66,7 +66,7 @@ echo " };" >>$FILE # Natural version compare against version of bind. # If version 9.16.6 or higher, turn off DNSSEC -BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2) +BIND_VERSION=$(/usr/sbin/named -v | cut -d" " -f2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' | head -n1) CONTROL_BIND_VERSION="9.16.6" # "sort --version-sort" takes lines of version strings and sorts them. From 459cbe64305e1da666913239b1d238e6b639a13c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Wed, 1 Mar 2023 16:31:47 -0500 Subject: [PATCH 185/188] Dummy pod files need content --- xCAT-client/xpod2man | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-client/xpod2man b/xCAT-client/xpod2man index 908804ba70..0096885a2a 100755 --- a/xCAT-client/xpod2man +++ b/xCAT-client/xpod2man @@ -98,7 +98,7 @@ sub createDummyPods { mkdir "$poddir/man7"; foreach my $d (@dummyPods) { if (!open(TMP, ">>$d")) { warn "Could not create dummy pod file $d ($!)\n"; } - else { close TMP; } + else { print TMP "=head1 NAME"; close TMP; } } return @dummyPods; From 4c46607c8c222a05af9548b3e8b89b396ad1ee64 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 2 Mar 2023 14:04:29 -0500 Subject: [PATCH 186/188] Adding 2.16.5 release information --- docs/source/overview/_files/2.16.x.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/overview/_files/2.16.x.csv b/docs/source/overview/_files/2.16.x.csv index 1bf645c7c1..caf0d24b60 100644 --- a/docs/source/overview/_files/2.16.x.csv +++ b/docs/source/overview/_files/2.16.x.csv @@ -1,4 +1,5 @@ Version,Release Date,New OS Supported,Release Notes +2.16.5,2023-03-08,"RHEL 8.6",`2.16.5 Release Notes `_ 2.16.4,2022-06-20,"RHEL 8.5,SLES15.3",`2.16.4 Release Notes `_ 2.16.3,2021-11-17,"RHEL 8.4",`2.16.3 Release Notes `_ 2.16.2,2021-05-25,"RHEL 8.3",`2.16.2 Release Notes `_ From b35fc1b0e78643facca0f4ab8df52eddfbefb44c Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 2 Mar 2023 14:12:43 -0500 Subject: [PATCH 187/188] go-xcat should not use available option --- xCAT-server/share/xcat/tools/go-xcat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/go-xcat b/xCAT-server/share/xcat/tools/go-xcat index df96a0c1c2..8f88447fbe 100755 --- a/xCAT-server/share/xcat/tools/go-xcat +++ b/xCAT-server/share/xcat/tools/go-xcat @@ -1755,7 +1755,7 @@ function el9_epel_and_crb_check() else [[ "${GO_XCAT_LINUX_VERSION}" =~ ^9(\.[0-9]) ]] || return 0 fi - ${action} list available -q ${EL9_EPEL_TEST_RPM} + ${action} list -q ${EL9_EPEL_TEST_RPM} ret="$?" case "${ret}" in "1") @@ -1766,7 +1766,7 @@ Installation on ${GO_XCAT_LINUX_DISTRO} ${GO_XCAT_LINUX_VERSION} requires EPEL r exit 1 ;; esac - ${action} list available -q ${EL9_CRB_TEST_RPM} + ${action} list -q ${EL9_CRB_TEST_RPM} ret="$?" case "${ret}" in "1") From 56ec84d29476813b64309d8ee8f9649a2c2d59ee Mon Sep 17 00:00:00 2001 From: besawn <38794505+besawn@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:05:07 -0500 Subject: [PATCH 188/188] Fixed typo in readthedocs SSL config page --- docs/source/advanced/security/ssl_config.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/source/advanced/security/ssl_config.rst b/docs/source/advanced/security/ssl_config.rst index 28ff05036d..fe640e06c3 100644 --- a/docs/source/advanced/security/ssl_config.rst +++ b/docs/source/advanced/security/ssl_config.rst @@ -1,17 +1,16 @@ OpenSSL Configuration ===================== -xCAT does not ship OpenSSL RPMS nor does it statically link to any OpenSSL libraries. Communication between the xCAT client and daemon utilizes OpenSSL and the administrator can configure SSL_version and SSL_cipher that should be used by xCAT daemons. +xCAT does not ship OpenSSL RPMS nor does it statically link to any OpenSSL libraries. Communication between the xCAT client and daemon utilizes OpenSSL and the administrator can configure the SSL_version and SSL_cipher that should be used by xCAT daemons. -The configuration is stored in the xCAT site table using the ``site.xcatsslversion`` and ``site.xcatsslciphers`` variables. +The configuration is stored in the xCAT site table using the ``site.xcatsslversion`` and ``site.xcatsslciphers`` attributes. Configuration ------------- -``site.xcatsslversion`` is the ``SSL_version`` option ``xcatd`` used and passed to ``IO::Socket::SSL->start_SSL()``. By default, this value is set to empty. In this case, ``xcatd`` will use ``SSLv23:!SSLv2:!SSLv3:!TLSv1`` internally. For more detail, see https://metacpan.org/pod/IO::Socket::SSL -By default, xCAT ships with an empty value for ``site.xcatsslversion``. In this case, ``xcatd`` will use ``SSLv23:!SSLv2:!SSLv3:!TLSv1`` internally. +``site.xcatsslversion`` is the ``SSL_version`` option used by ``xcatd`` and passed to ``IO::Socket::SSL->start_SSL()``. See https://metacpan.org/pod/IO::Socket::SSL for more information. By default, xCAT ships with an empty value for ``site.xcatsslversion``. In this case, ``xcatd`` will use ``SSLv23:!SSLv2:!SSLv3:!TLSv1`` internally. -Here is an example of change ``site.xcatsslversoin`` to a different value. Say, TLS 1.2 is preferred. :: +Here is an example of changing ``site.xcatsslversion`` to a different value, ``TLSv1_2``, for example. :: chtab key=xcatsslversion site.value=TLSv1_2 @@ -23,8 +22,7 @@ After making any changes to these configuration values, ``xcatd`` must be restar service restart xcatd - -If any mistakes have been made and communication is lost to xCAT, use ``XCATBYPASS`` to fix/remove the bad configuration: :: +If any mistakes have been made and communication is lost to xCAT, use ``XCATBYPASS`` to fix the bad configuration: :: XCATBYPASS=1 tabedit site