From 50f5c9040d25641cf4d39768e71a3cdf7dfeebee Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Thu, 12 Aug 2021 15:19:50 -0400 Subject: [PATCH] Add cleanupdiskfullxcatpost attribute to site table --- .../references/man5/nodetype.5.rst | 2 +- .../references/man5/osimage.5.rst | 2 +- .../admin-guides/references/man5/site.5.rst | 4 ++ .../admin-guides/references/man7/group.7.rst | 2 +- .../admin-guides/references/man7/node.7.rst | 2 +- .../references/man7/osimage.7.rst | 2 +- perl-xCAT/xCAT/Schema.pm | 3 ++ xCAT-server/sbin/xcatconfig | 1 + .../autotest/bundle/rhels_ppcle_weekly.bundle | 2 + .../autotest/bundle/rhels_x86_weekly.bundle | 2 + .../autotest/bundle/sles_ppcle_weekly.bundle | 2 + .../autotest/bundle/sles_x86_weekly.bundle | 2 + .../autotest/bundle/ubuntu_ppcle_daily.bundle | 2 + .../autotest/bundle/ubuntu_x86_daily.bundle | 2 + .../testcase/installation/compare_postscripts | 45 +++++++++++++++++++ xCAT/postscripts/xcatinstallpost | 13 ++++++ 16 files changed, 83 insertions(+), 5 deletions(-) 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 7d75e070c..7ccbf0198 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\*,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\*,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 2c74f3a31..6dd405fa3 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\*,SL\*, fedora\*, sles\* (where \* is the version #). + The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). diff --git a/docs/source/guides/admin-guides/references/man5/site.5.rst b/docs/source/guides/admin-guides/references/man5/site.5.rst index 538e4399c..0e37ed404 100644 --- a/docs/source/guides/admin-guides/references/man5/site.5.rst +++ b/docs/source/guides/admin-guides/references/man5/site.5.rst @@ -261,6 +261,10 @@ site Attributes: directory on the stateless and statelite nodes after the postscripts are run. Default is no. + cleanupdiskfullxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost + directory on the diskfull nodes after the + postscripts are run with no errors. Default is no. + db2installloc: The location which the service nodes should mount for the db2 code to install. Format is hostname:/path. If hostname is omitted, it defaults to the management node. Default is /mntdb2. 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 72c006ac8..f0e76c803 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -721,7 +721,7 @@ group Attributes: \ **os**\ (nodetype.os) - The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*,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\*,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 5bece505e..081b09e30 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -727,7 +727,7 @@ node Attributes: \ **os**\ (nodetype.os) - The operating system deployed on this node. Valid values: AIX, rhels\*,rhelc\*, rhas\*,centos\*,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\*,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 ee93d48b0..b3da0afc7 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\*,SL\*, fedora\*, sles\* (where \* is the version #). + The Linux operating system deployed on this node. Valid values: rhels\*,rhelc\*, rhas\*,centos\*,rocky\*,SL\*, fedora\*, sles\* (where \* is the version #). diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 4332e673e..5c623e970 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -1156,6 +1156,9 @@ passed as argument rather than by table value', " cleanupxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n" . " directory on the stateless and statelite nodes after the\n" . " postscripts are run. Default is no.\n\n" . +" cleanupdiskfullxcatpost: (yes/1 or no/0). Set to 'yes' or '1' to clean up the /xcatpost\n" . +" directory on the diskfull nodes after the\n" . +" postscripts are run with no errors. Default is no.\n\n" . " db2installloc: The location which the service nodes should mount for\n" . " the db2 code to install. Format is hostname:/path. If hostname is\n" . " omitted, it defaults to the management node. Default is /mntdb2.\n\n" . diff --git a/xCAT-server/sbin/xcatconfig b/xCAT-server/sbin/xcatconfig index 5f8b1c5de..f1b1c2a71 100755 --- a/xCAT-server/sbin/xcatconfig +++ b/xCAT-server/sbin/xcatconfig @@ -1204,6 +1204,7 @@ sub initDB $chtabcmds .= "$::XCATROOT/sbin/chtab key=dnshandler site.value=ddns;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=vsftp site.value=n;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupxcatpost site.value=no;"; + $chtabcmds .= "$::XCATROOT/sbin/chtab key=cleanupdiskfullxcatpost site.value=no;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=dhcplease site.value=43200;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=auditnosyslog site.value=0;"; $chtabcmds .= "$::XCATROOT/sbin/chtab key=xcatsslversion site.value=;"; diff --git a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle index 0fc86d278..55a98b827 100644 --- a/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_ppcle_weekly.bundle @@ -25,9 +25,11 @@ nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat compare_postscripts +cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs reg_linux_statelite_installation_flat +cleanup_postscripts_diskless rmimage_diskless rpower_reset runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle index 6b39cbd14..5cb54620a 100644 --- a/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/rhels_x86_weekly.bundle @@ -25,9 +25,11 @@ nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat compare_postscripts +cleanup_postscripts_diskfull reg_linux_diskless_installation_flat reg_linux_diskless_installation_flat_squashfs reg_linux_statelite_installation_flat +cleanup_postscripts_diskless rmimage_diskless rpower_reset runcmdinstaller_command diff --git a/xCAT-test/autotest/bundle/sles_ppcle_weekly.bundle b/xCAT-test/autotest/bundle/sles_ppcle_weekly.bundle index ddfa86713..49d95ba23 100644 --- a/xCAT-test/autotest/bundle/sles_ppcle_weekly.bundle +++ b/xCAT-test/autotest/bundle/sles_ppcle_weekly.bundle @@ -16,6 +16,8 @@ nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat compare_postscripts +cleanup_postscripts_diskfull reg_linux_diskless_installation_flat +cleanup_postscripts_diskless reg_linux_diskless_installation_flat_squashfs reg_linux_statelite_installation_flat diff --git a/xCAT-test/autotest/bundle/sles_x86_weekly.bundle b/xCAT-test/autotest/bundle/sles_x86_weekly.bundle index a523a0746..750c1da31 100644 --- a/xCAT-test/autotest/bundle/sles_x86_weekly.bundle +++ b/xCAT-test/autotest/bundle/sles_x86_weekly.bundle @@ -16,6 +16,8 @@ nodeset_runimg nodeset_shell reg_linux_diskfull_installation_flat compare_postscripts +cleanup_postscripts_diskfull reg_linux_diskless_installation_flat +cleanup_postscripts_diskless reg_linux_diskless_installation_flat_squashfs reg_linux_statelite_installation_flat diff --git a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle index 92a9daad8..ee3ef5dc0 100644 --- a/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_ppcle_daily.bundle @@ -1,8 +1,10 @@ reg_linux_diskless_installation_flat +cleanup_postscripts_diskless reg_linux_diskless_installation_flat_squashfs reg_linux_diskfull_installation_flat makentp_extntpserver_value compare_postscripts +cleanup_postscripts_diskfull assign_certain_command_permission bmcdiscover_help bmcdiscover_q diff --git a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle index 712a82052..154c66025 100644 --- a/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle +++ b/xCAT-test/autotest/bundle/ubuntu_x86_daily.bundle @@ -1,8 +1,10 @@ reg_linux_diskless_installation_flat +cleanup_postscripts_diskless reg_linux_diskless_installation_flat_squashfs reg_linux_diskfull_installation_flat makentp_extntpserver_value compare_postscripts +cleanup_postscripts_diskfull assign_certain_command_permission bmcdiscover_help bmcdiscover_q diff --git a/xCAT-test/autotest/testcase/installation/compare_postscripts b/xCAT-test/autotest/testcase/installation/compare_postscripts index 049024101..8b4fdc732 100644 --- a/xCAT-test/autotest/testcase/installation/compare_postscripts +++ b/xCAT-test/autotest/testcase/installation/compare_postscripts @@ -13,4 +13,49 @@ cmd:cat /tmp/diff.list check:rc==0 cmd:rm -fr /tmp/mn; rm -fr /tmp/cn; rm /tmp/mn.tar; rm /tmp/diff.list + +end + +start:cleanup_postscripts_diskfull +os:Linux +label:provision +description: Verify postscripts cleaned up after diskfull installation +cmd:chdef -t site clustersite cleanupdiskfullxcatpost="yes" +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-install-compute 1 +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 +cmd:xdsh $$CN ls /xcatpost | wc -l +check:rc==0 +check:output==1 +cmd:chdef -t site clustersite cleanupdiskfullxcatpost="no" +end + +start:cleanup_postscripts_diskless +os:Linux +label:provision +description: Verify postscripts cleaned up after diskless installation +cmd:chdef -t site clustersite cleanupxcatpost="yes" +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/commoncmd/retry_install.sh $$CN __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute 1 +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 +cmd:xdsh $$CN ls /xcatpost | wc -l +check:rc==0 +check:output==0 +cmd:chdef -t site clustersite cleanupxcatpost="no" end diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 50e71ae00..367bdc8d0 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -13,6 +13,7 @@ if [ -f /xcatpost/mypostscript.post ]; then OSVER=`grep '^OSVER=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` NODE=`grep '^NODE=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` IMAGE=`grep '^PROVMETHOD=' /xcatpost/mypostscript.post |cut -d= -f2|sed s/\'//g` + CLEANUPDISKFULLXCATPOST=`grep CLEANUPDISKFULLXCATPOST= /xcatpost/mypostscript |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z` fi @@ -139,6 +140,18 @@ fi " >> /xcatpost/mypostscript.post fi +# If "cleanupdiskfullxcatpost" install was requested, remove all /xcapost +# files (except updateflag.awk ) if postscripts ran without an error +if [[ "$CLEANUPDISKFULLXCATPOST" =~ ^(1|yes|y)$ ]]; then +echo " +if [ \"\$return_value\" -eq \"0\" ]; then + cd / + find /xcatpost/ -type f -not -name 'updateflag.awk' -delete + find /xcatpost/ -type d -empty -delete + msgutil_r \$MASTER_IP \"info\" \"cleanup of /xcatpost completed.(\$NODE)\" \"/var/log/xcat/xcat.log\" \"\$log_label\" +fi +" >> /xcatpost/mypostscript.post +fi chmod +x /xcatpost/mypostscript.post if [ -x /xcatpost/mypostscript.post ];then