From f52c2aa7df8a958a67a2d7aee6e77b09b823ab1d Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Tue, 23 Aug 2022 16:31:56 -0400 Subject: [PATCH] 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 7380332a9..1968f5b7f 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 55a98b827..5226c43d6 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 5cb54620a..7e8f489df 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 000000000..13c886ef5 --- /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 000000000..246267db2 --- /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 83451061c..f18c404f3 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